Hi and hello to all of you,
i have a question about the behaviour of pimatic after a “hard” system crash caused by a power failure and how to manage it.
As i figured out, pimatic starts after a power loss of my raspberry pi, with the same state of buttons and switches as the last stored status in the database. By default these values are stored by the “diskSyncInterval” every 4h i think.
So with this i run into a problem. I have an off grid solar powered fridge supplied by batteries - controlled and managed by pimatic So i have e.g. a rule to check the voltage and the daily generated power.
If the fridge is running (controlled by a pimatic GPO-switch witch dependencies of voltage and generated power) and the power cuts off caused by the solar controller detecting under-voltage (bad batterie) and cutting everything out also my raspberry with the relais and pimatic gets cut off very ungraceful
Lets do a short run through:
Good sunny day --> enough generated power --> high battery voltage --> turn switch/fridge on --> voltage drops in normal ranges but bufferd by the sun and beer gets cold --> pimatic stores stats to database --> fridge is still on --> battery collaps in the night --> everything is cut off --> without the fridge running the volatge/battery gets better --> system gets power back --> pimatic starts with last known stats --> fridge is turned on --> system crashes …
As i figured out, i can manage it with a rule and the condition “when pimatic is starting switch everything off” …
But i need to restart the raspberry 4 times by cron a day as a prevention of connection loss caused by bad celluar network and bad UMTS/LTE USB Sticks.
So i need a way to check if the shutdown was planned or graceful by cron and “system reboot” or if it happens by a power failure. In case of the failure all sould be switched off - in case of a normal shutdown we can continue as before.
Yes, it is a very special topic! I am appreciating every kind of tips or help! If you need further information just text me here - there are a lot of rules for controlling and managing the system!