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:

WeatherBot Slack Post

How it works

  1. Using the Dark Sky API, I run through the hourly data for the next 12 hours.
  2. During each hour, if there’s precipitation and it’s snow, and there is accumulation then start adding up the accumulation.
  3. 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:

  1. S3 - I deploy and host the code here.
  2. Cloudformation - I created a Cloudformation template that defines the variables and the functions that Lambda will need to run my code.
  3. Lambda - Lambda is responsible for running my code at the days and times I’ve defined. (The Cloudformation template does me a solid by configuring Lambda for me.)

Browse the code!

And now we get to sit back and wait for :snowflake: and then park our cars good.

Unconventional use cases for Jekyll WeatherBot goes outside