weatherbot is a simple app that lets us use our TJBot as an ambient weather device.
It gives us an at-a-glance weather forecast using it's head LED and the position of it's arm. We're using DarkSky's API to get a weather forecast.
If the chance of rain is 50% or higher, the LED on weatherbot's head will light up.
So a glance at weatherbot means we know to take an umbrella with us if we're going out.
The arm will rotate to show a predicted temperature.
Rotating to the left means cold, with the arm horizontal and all the way to the front meaning 0 degrees C or colder.
Rotating to the right means hot, with the arm horizontal and all the way to the back meaning 30 degrees C or hotter.
And the arm pointing straight up is half-way between the two: 15 degrees C.
So a glance at weatherbot means we know if we should take a coat.
The script sets the arm and LED once.
We're using cron
to run the script every 5 minutes, so the weatherbot keeps up to date with the latest forecast.
Sure.
But the config is scattered through the code, sorry. You'll need to sort yourself out with a DarkSky API key and put it in an environment variable. You'll also need to modify the script to specify the location you want forecasts for.
Yes. The TJBot was built by my kids and this is their first project.
Faith came up with the idea and Grace wrote bot.js with a few suggestions and additional commenting from me. The idea was to let them use the bot to build something they could understand and make themselves, without me interfering too much.
For our next project, we might try something a little more advanced! :-)
-- Dale ( @dalelane )