Building a WeatherBot
code
• February 22, 2017
We live in Upstate New York so there’s snow and it’s kind of pain for J to plow the driveway if our cars are in the way. I built a little Slack bot that runs three times a day (7 am, 1 pm, and 7 pm). And if there will be more than one inch of snow in the next 12 hours then WeatherBot will ping our Slack:
How it works
- Using the Dark Sky API, I run through the hourly data for the next 12 hours.
- During each hour, if the forecast shows precipitation which is snow, and the snow will accumulate, then start adding up the accumulation.
- If there’s more than 1 inch of snow during the next 12 hours, then post to Slack.
How it runs
WeatherBot uses three AWS resources:
- S3 - I deploy and host the code here.
- CloudFormation - I created a CloudFormation template that defines the variables and the functions that Lambda will need to run my code.
- Lambda - Lambda handles running my code at the days and times I’ve defined. (The CloudFormation template does me a solid by configuring Lambda for me.)
And now we get to sit back and wait for and then park our cars good.