This is about resetting your RaspberryPi, which is much more then simply rebooting it.
Intro (can be skipped):
My main RPi sometimes hangs. Not simply pimatic but really the entire RPi. Probably due to too many RF433 signals overflowing the arduino/homeduino combi (which I’m now gradually replacing by ESPs). I also have a BananaPi network file server also running pimatic as backup which checks every 15 minutes my main pimatic RPI and takes over the central heating control when the main RPi hangs. I have an ESP(imatic) with relay coupled to my central heating. Both my pimatic RPi and backup pimatic BananaPi can easily control the esp/relay combi connected to my central heating and I can even do that from a terminal either on my phone or laptop or OpenElec(Kodi) RPi streamer with an API call from the outside (I have encrypted tunnels to my home network)
How
Anyway: The fact that my pimatic RPi sometimes completely hangs (even not pingable) is an annoyance. Some time ago I did read this article about how to reset your RPi to make it reboot no matter its current state.
And then it came to mind that I can also use an ESP with relay (to separate circuits) to reset my pimatic RPi.
I can simply flip-flop the relay on my ESP via the webgui or some shell/python scripted API call from my phone or backup BananaPi, and reset my pimatic RPi.
(I have been thinking to power my Nodemcu from the 5V-GND pins of the RPi on to the 5V-GND pins on the ESP, or maybe RPi USB to ESP development board USB, which means no extra power source necessary. But in this case, when resetting the RPi, the ESP will be resetted as well and I’m afraid my ESP relay state will stay high, which will continue resetting (looping) my RPi).
I have the above now in place for about a week and I’m currently thinking of the following: My backup BanaPi, which checks every 15 minutes my main RPi, can also:
- switch off my heating via the central heating coupled ESP/relay combi. (Just to be sure).
- send this flip-flop command to reboot my pimatic.
But what if the pimatic doesn’t reset correctly because it has a corrupted SD-card or so? I have not solved that one yet without getting into a complicated rule set.