(WeMo + Pi + ThingSpeak + Python) The coding dishes are done dude.

I managed to get a little time to put this together.  It checks ThingSpeak for the latest entry and if that’s more than 1 hour ago, then there’s a problem so it cycles the WeMo. This script has a lot of fiddling about with dates and times because despite there being a standard for date and time, everyone seems to be interpreting that differently.  So I have to break apart most dates, do calculations and put them back together.

I also want to track how many times in a day the power needs to be cycled.  Because the script is called from a cron job, the variables that need to persist have to be stored in a file.  I’m ok with that, that’s what files are for.

So, without ado here’s the script, IP addresses redacted and stuff.

This relies on the Miranda library and driver.  They can be found from the links in previous posts.