Page 1 of 1
turn ON when power is back again
Posted: Wednesday 30 September 2020 14:35
by abdolhamednik
hello everyone
how to tell a switch to turn on by script, exactly after electricity power came
can u plz help me?
Re: turn ON when power is back again
Posted: Wednesday 30 September 2020 15:37
by waaren
abdolhamednik wrote: Wednesday 30 September 2020 14:35
how to tell a switch to turn on by script, exactly after electricity power came
dzVents can launge an eventscript triggered by a domoticz start but without additional conditions it would also switch when domoticz was restarted without a power outage. (manual system reboot or domoticz stop/start or -restart)
So you would need to build a checkfile when you intentionally reboot your system, or stop or restart domoticz.
If the checkfile is not present, the logic in dzVents will then recognize that the start was because of an external reason (eg power outage) perform the necessary actions and remove the checkfile
Re: turn ON when power is back again
Posted: Sunday 04 October 2020 12:51
by abdolhamednik
could u plz suggest an easier way?
thanks
Re: turn ON when power is back again
Posted: Sunday 04 October 2020 12:59
by waaren
abdolhamednik wrote:could u plz suggest an easier way?
If I knew an easier way, I would have suggested it already.
Re: turn ON when power is back again
Posted: Tuesday 06 October 2020 12:32
by erem
this article will get you started.
https://unix.stackexchange.com/question ... -of-reboot
like waaren said, you need to distinguish between intentional power down and power loss
so, use this to write a signal file (touch ~/normalpowerdown) and test for that file on boot..
the absence if the file ~/normalpowerdown tells you if the last power down was abnormal
btw ~ is shorthand for the home dir of the logged on user.