Hacking my Smart Heating with AWS

Logging from radiator valves to Amazon Web Services, via NodeMCU, Lambda functions, S3 and Athena.

Danny Boland
Oct 1, 2018 · 5 min read

Having just installed a smart central heating system, I realised how much data is now generated about my home. I knew I wouldn’t be happy until there were at least a few charts showing what’s going on.

I went for the Drayton Wiser system — think Nest but with wirelessly controlled valves on the radiators as well as a central hub by the boiler. Each room has its own heating schedule and can call for the boiler individually. The system works really well but that didn’t stop me from immediately trying to take control of it.

I wanted to log all the sensor readings to the cloud for later analysis and didn’t want to commit to running a desktop PC or any servers continuously. Given that this will be running all the time, the cost needed to be virtually zero. First though, I needed to be able to send commands to the hub and have a microcontroller act as a middle-man with my services in AWS.

Hacking the Hub

The Wiser system has an app with the usual Alexa etc. integrations, as well as small but growing support for IFTTT. I wanted to log as much as possible, including room temperatures and boiler states, so needed to dig a bit deeper into the internal platform.

When the system is first setup, the hub creates a wireless access point that the user connects to with their phone, in order to connect the app. A secret token is exchanged during this process, which is then used to authenticate all further requests to the Wiser hub. A bit of packet sniffing later and it turns out it’s really easy to grab this secret for our own purposes. During the setup process, while connected to the Wiser AP, I could simply point a browser to the URL:
The secret then appears in the browser!

When everything is up and running, the hub can be queried to give a JSON blob that summarises the state of the system. I used Postman to try out some example GET requests. The endpoint is: https://hubip/data/domain/
In order for the request to work, the header has to contain the secret token value under the key SECRET.

A subset of the JSON response is shown here, the full output is pretty comprehensive! Of particular interest were the HeatingRelayState and CalculatedTemperature fields. For optimising my heating setup, it also made sense to capture the target for each room from CurrentSetPoint, as well as the PercentageDemandbeing asked of the boiler. In practice, my plan was to grab everything and store it in S3.

I’d previously picked up some NodeMCUs and not yet had a project to use them for. I set one up to poll the Wiser hub every minute and pass the JSON blob to an AWS Lambda function (serverless code that runs in response to an event).

From Radiator to the Cloud

In case you’re not familiar, the NodeMCU is a cheap wifi-enabled microcontroller that’s compatible with Arduino libraries. It’s a great option for this kind of project — low power, small and with (relatively) easy to use SSL libraries. I wanted to do as little as possible on the microcontroller and so the C code used just connects to the Wiser hub, stores the JSON response and then immediately POSTs it to an AWS API endpoint wrapping a Lambda function.

The Lambda function code is also very simple, though I wrote it in Go just for the learning exercise. It takes the JSON submitted and stores it directly as a file in S3. It places the file in a year/month/day folder structure to neatly partition the data for querying later with AWS Athena (a SQL engine that treats data in S3 like a database).

The above approach is serverless and cheap enough for me to leave running indefinitely without having to weigh up the cost.

Keeping tabs on the heat and humidity at home after a lot of cooking and laundry. Wiser stores the temperature value x10 to save having floating points.

Visualise & Analyse

I left the logging running overnight. The next morning I noticed condensation on my windows. Already something to investigate using the new data source!

I used AWS Glue to crawl my JSON in S3 and create a table for it. I then wrote an Athena query that pulls out metrics per room like temperature and humidity in a format that can be imported into openTSDB — a time series database. Once there, the data could be plotted in Grafana at varying granularities.

As can be seen in the graph earlier, the humidity and temperature had spiked in the evening. This was around the time I set a big pot of Bolognese sauce simmering. Maybe I should turn up the extractor fan in future. I also noticed that the majority of the heating demand on my boiler was coming from the lounge, despite it being empty most of the day.

The cold (and usually empty) lounge places the greatest demand on the boiler. This kind of view is useful for optimising heating schedules.


I plan to do a lot with this data. First, I’d like to train a model to infer the actual temperature from the measurement at the valve, taking radiator output and external temperature as features. Another project would be to use the heating schedule and humidistat readings to warn when condensation might occur overnight. Stay tuned for future posts on these.

The code for the various parts of this project is available in a git repo. Let me know your thoughts on what else this type of data might be used for. Not to forget that we can also control the heating too!


Data Science, day-to-day.

Danny Boland

Written by

Writing about Data Science applied to day-to-day life.



Data Science, day-to-day.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade