It’s unusual that I ever think of a use case where my technical skills can help my everyday life. But it’s now seed planting time, I have a lack of sunny windowsills and it’s still too cold to risk putting my seedlings in the greenhouse at night.

So I decided to write a quick solution that would alert me if the minimum nightly temperature dropped below a certain level.

As always, this is done in AWS, mainly because I’m more comfortable there, and Azure is also honking!

Here’s the simple design that will run each evening and trigger an email if the minimum temperature falls below the supplied criteria. This is all built using AWS free tier and will be deployed using Terraform.

diagram

The scheduler runs from February through to May at 8pm each night and sends an email if the minimum temperature falls below 12 degrees Celsius.

Firstly, I signed up with https://www.weatherapi.com and use their excellent API service to request weather forecasts. One generated API key later, i was ready to go!

I decided to write the Lambda function in Go, mainly because I’m new to the language and might as well improve my knowledge. I could have written this in Python in 20 mins, but where would the fun in that be. Some things took some time to get my head into to begin with, mainly the error handling and the clunky json conversions.

But I do like Go. it’s nice and clean, its performance is excellent and the invocation times are impressive. Not that invocation times were an issue with this project…

Anyways its simplistic, but it works great and will help keep my chilli crop in good health.