Category Archives:

The Weather

I had a chat with my pal Jonathan today about the weather – and more specifically getting it into Node-Red.  If you are building your home control with Node-Red at the centre then it is always nice to have information about the local weather to send off to your various displays (such as the one described earlier today) and is a dead easy way to get it!

Go to and sign up – that will give you an API number. No, really it is that easy and as long as you don’t use it 1,000 times a day, it is free. Simples.

Here’s what you do: setup

Using an HTTP node (the yellow one) and fill it in as below substituting XXXXXXX for your API key – and the long/lat coordinates for your own (I got mine off the Google Maps command line when pointing at my village). If you’re not in the UK then you’ll have to try something else. US is probably a good start for our friends in the USA. setup

In the function (orange) you need this..

var weather = JSON.parse(msg.payload);

And that is that. NOW you need to know what is available in your new json object and remember – don’t use that timestamp inject (it is irrelevant what it is injecting – it’s just a trigger) more than 999 times a day Smile

So if you look at the output from the incoming XML it is MASSIVE – but put into a JSON online viewer like once converted it starts to look more reasonable. json

For example if we expand currently – we get…


And how do we access that? Simples – having called the object “weather” we get the temperature as weather.currently.temperature

and so on. In HOURLY we see timestamps and things like chances of precipitation… a little clever loop and… remember in an earlier blog we looked at showing graphs of history in Imperihome? It would not be beyond the bounds of reason to feed this lot into said graphs!!!

Well, even without digging any further, hopefully there are a few items of interest for you.  weather.currently.summary is good as are weather.hourly.summary and weather.daily.summary.

If you want to check the weather you could look at this – but with your coordinates. .,-0.0295

And on the subject of weather but otherwise unrelated – this looks like a fun site…

Oh, nearly forgot – and you’ll be needing some fancy icons..

Have fun. And if you know of something BETTER – leave a link in the comments.