Page 1 of 2

Timeres not activated after power outage

Posted: Mon Jan 12, 2015 5:45 am
by heggholmen
Hi,
After a power outage and a server reboot, Timers was not activated causing lights to be off. Is there any way to have the system check of a time should be "ON" / "OFF" and perform actions based on that? Now my lights seems to me "OFF" untill the time is activated again (in my example 15:00CET, and now it's 06:45 CET)

Re: Timeres not activated after power outage

Posted: Mon Jan 12, 2015 8:44 am
by Nasty76
Use UPS for you computer. That state remember is nice feature imo but I think that cause too many write to SD card and kill card early.

Re: Timeres not activated after power outage

Posted: Mon Jan 12, 2015 10:27 am
by stefangsbb
I am not sure exactly what happened in your situation, but the NetHome timers are purely event based, meaning that when an on or off time is passed it performs the switch action. If the NetHome server was not running when a time was passed and started later, it will not do anything about that. The reason is that the on and off actions are very general, they can perform any kind of action and NetHome does not really know if the on action was performed or not and therefore cannot safely perform it "again" at another time.

Also, when NetHome starts up it does not know of the state of the lamps. So if some of the lamps were on and you restart the server, they will appear as off in NetHome, since it does not save "transient" states like if a lamp is on or off. I have been playing with the idea that it should save that too and then try to determine how long time ago it was shut down to determine the likelihood that the lights are still in the same state, but it becomes a bit messy... If that kind of thing is really important we should probably use Philips Hue (or Z-Wave) or some other device protocol that can actually report back the state of the lights.

Re: Timeres not activated after power outage

Posted: Mon Jan 12, 2015 7:34 pm
by heggholmen
@Nasty76: UPS is properbly something i will consider:)

@stefangsbb: Thanks for the detailed desctiption. A solution could be just "execute timers" at startup. I'll make sure the system doesn't stop working, than everyting is solved:)

Re: Timeres not activated after power outage

Posted: Mon Jan 12, 2015 8:43 pm
by Nasty76
Yeah I was think something MySQL to keep record on /off data but that crash same time as nethome if power cut come :D.
I think if use cellphone power bank and power that via usb hub so that load battery when power is on and give raspberry power when power is off . but not sure if that work like that need test that when I buy powerbank.

Re: Timeres not activated after power outage

Posted: Mon Jan 12, 2015 9:07 pm
by krambriw
but not sure if that work like that need test that when I buy powerbank
I think some powerbanks works desired way, i.e. can be charged and supply power @ the same time but some does not. I have a cheap crappy one from Biltema that can NOT supply power while charging...

Regarding what shall happen after power outage when system is restarting ( I call it 'state recovery') I did my solutions for EventGhost that my plugins are checking what state it shall have 'right now' by checking for first time setting backwards and forward related to current time. In this way it is figured out what state it shall have. It has worked very well for many years now.

Re: Timeres not activated after power outage

Posted: Mon Jan 12, 2015 9:28 pm
by Nasty76
hhhmmm I get crazy idea if we have powerbank what we can use , loading and powering up is possible then some little circuit to input power and raspi look when that pin is high =3.3v and if that drop that mean power loss in main power and we can shut down raspberry nice and right way , need only run shutdown -h now command :D poor man real ups ::P

Re: Timeres not activated after power outage

Posted: Tue Jan 20, 2015 6:36 pm
by lassiko
I have an issue that kind relates to this.

After reboot, some of my HomeItems goes to Enabled state. E.g. i have few "NexaLCRemapButton" that should be in Disabled state all the time as i dont use those. Can i configure these so, that in every reboot these are in Disabled state automatically?

Sorry if this is already explained earlier.

Re: Timeres not activated after power outage

Posted: Tue Jan 20, 2015 7:24 pm
by Nasty76
I think that is default mode that enable but maybe you make some perl script which run crontab at boot and adjust items disabled , that need use some delay and wait when nethome is again up.
if you need I can make some script which make job, but maybe Stefan edit that control item so we can set default action that enable / disable section :D
I think that perl script is dirty way and edit nethome item is Good way :D

Re: Timeres not activated after power outage

Posted: Tue Jan 20, 2015 9:36 pm
by stefangsbb
Oops - that is a bug... It should really save and restore the disabled state. I will fix that.