For the last few years I have been capturing indoor temperature data from the Honeywell Evohome system that controls our heating. I’ve used it to create various dashboards which have taught me a great deal about how quickly different areas of the house heat up and cool down. Here’s an example of a dashboard widget which shows the indoor temperature for each of our heating zones:


I used to use Domoticz to get outdoor temperature from the DarkSky weather API, but this stopped working a few years back, so I thought I’d see how difficult it would be to write my own solution which pulled temperature data from an API and sent it to my InfluxDB.

Tech Stack

I’m really enjoying Kotlin and Micronaut at the moment and thought some of Micronaut’s features might work well with something like this. In particular I wanted to utilise Micronaut’s declarative HTTP client, to interact with the weather API. I also wanted to see how easy it would be to compile the application to a native image, using GraalVM, to see what sort of memory overhead could be achieved.

So how did I get on?

I had a few disagreements with Micronaut along the way, particularly when it came to setting up the scheduled task executor programmatically, which is somewhat more complicated than using a fixed schedule expression. But generally speaking writing the application itself was fairly straight forward, and I can now visualise the outdoor temperature in my Dashboards:


I didn’t manage to deliver on my hope of building the application as a GraalVM native image though, as my choice to use the official Kotlin influxdb-client seemed to make it impossible to perform the necessary static linking. This might be something I can overcome in a subsequent release though, so I might have another crack at it at some point in the future.

Weather API

When looking at the various weather APIs available I settled on meteomatics, who provide a free weather API. The API is perpetually free for private use, albeit with rate limits in place. For my purposes I have found that I can get enough data out of it without hitting the rate limits.

Postcodes API

I wanted to be able to configure the app simply by providing a UK postcode. I discovered postcodes.io, which is a free, open source API which, given a UK postcode, will return the corresponding latitude and longitude co-ordinates, which were the inputs I needed to provide the weather API with.

Introducing influxdb-weather-ingestor

I have published my utility as a Docker image, named influxdb-weather-ingestor, on DockerHub. The image can be found here. Hopefully the README provides the necessary instructions to get yourself up and running.

Source code can be found in the eddgrant/influxdb-weather-ingestor repository.

Feedback

Please leaving a reaction or comment below to let me know if you have found this useful or interesting. I’d love to know if anyone gets the app up and running themselves or if you’ve implemented something similar yourself.

Cheers!

Edd

Support:

If you’ve found my writing helpful and would like to show your support, I’d be truly grateful for your contribution.