This is a follow-on article from my blog Home Control 2015 which concerns itself with IOT around the home - you might want to read that first.
Many articles on DIY home control tend to scratch the surface and you don’t find out about reliability issues until you’ve wasted many hours building stuff just to discover that the authors never really got into real world subjects like “what happens if the router power-cyles”.
I’ve been working on this stuff for some time now along with my friend Aidan and having installed boards around the place I’m now getting into the “nitty gritty” of reliability.
So for example, take my system here at Bedrock (so called because it is actually a real cave in the mountains of Andalusia). I have a Pergola – which has a 12v power system and an ESP8266-based relay board to turn the lights on and off. I also have flood lights around the place and an internal light which are controlled by another board. Finally I have a watering system which fires off twice a day for a few minutes.
My system as you’ll know from the main home control article is based on a Raspberry Pi2 running MQTT and Node-Red talking to ESP-8266 “Hackitt & Bodgitt” boards and of course my own software.
I have a little uninterruptable on the Pi2 and that has tests for WIFI failing and tests for MQTT failing and almost no matter what happens, the system stays up.
After 12 days of perfect operation while I was over in Boston with Espressif, last night the WIFI went off. I had no idea what it was so I power-cycled the router. Still nothing. We sat around for a while and the WIFI came back up – clearly some issue with the service provider.
I noted that it had just turned to DUSK and yet no lights.
And then it twigged. My Node-Red node I wrote called scheduler, sends MQTT messages out at dusk and other times to control the lighting… but of course if the WIFI is not connecting at the time, the opportunity is missed.
Now you could use a number of tricks, the various modes of MQTT include a mode to always get the message through. However I can see issues with that and so last night I did an update to my scheduler.
Instead of sending out commands to turn lights on and off at specific times – like dusk and dawn – I’ve added a checkbox to send the instructions out every minute as to the state that is expected. This is entirely optional, controlled by a tickbox. But this way, if a message for whatever reason is missed – it will be sent regularly and the recipient units can then be assured of catching up.
Time will tell if this improves reliability – my gut feeling tells me it will. The scheduler is available on BitBucket and obviously requires Node-Red. It is probably the most comprehensive timing mechanism available for Node-Red – I would welcome being proven wrong here.