Page 1 of 1

Power failure and output state after power-up

Posted: Sunday 08 April 2018 10:39
by mackowiakp
I use RPi in my holiday house in the forest. The problems are frequent commercial power failure even for 2 days. I use small UPS for RPi and it shutdown itself after 1 hour. But lokk at the scenario. I setup one relay (connected vio GPIO pin) to be turn on at 19 PM and turn off at 6 AM. But the power failure occurs on 5 AM and electricity came back at 8 AM. So after boot of RPi, such relay is set to last know state, that is turn on. But in this time should be turn off.
Is any possibility to set relays state set to the state that should be at this time, not in the last known state? I mean to write boot-up script querying database about states of relays it shuld be in this time?