Page 1 of 1
Remember light switches state
Posted: Saturday 19 March 2016 21:22
by Slinkos
Hi all, I was thinking a new scenario for my Domoticz. When I am under the shower for example, there is no need for all the lights to be on downstairs. So what I want is that when I'm under the shower the lights go off downstairs. Now that's easy to do, BUT when I come back downstairs (and I have motion detectors that will see that) I want all the lights that were on, to go on again. So the script must remember the state of my switches before turning them off, so that the exact same switches can go on again.
Is that possible, and how would I achieve that?
Re: Remember light switches state
Posted: Saturday 19 March 2016 22:11
by simonrg
Quite possible to do, may be tedious to get just right.
Create a virtual "Having Shower" switch which you turn on when having a shower, this switch triggers a Script.
The script checks the state of each of your downstairs lights and stores them in a Domoticz uservariable.
On going downstairs, when the motion detectors spot you, a different script is triggered which checks to see if "Having Shower" is on, if so it reads the Domoticz uservariable, sets the lights accordingingly and then switches off "Having Shower".
Re: Remember light switches state
Posted: Saturday 19 March 2016 22:44
by Egregius
Or do something with the lastupdate time.
If lastupdate > time() - 1800 ...
Re: Remember light switches state
Posted: Monday 21 March 2016 11:49
by Slinkos
Thanks for you reply's, still struggling with how to script this..
Re: Remember light switches state
Posted: Monday 21 March 2016 13:37
by Westcott
One way would be to store a list of the saved states in a user variable, or a Text device.
Or you could use
http://www.domoticz.com/forum/viewtopic ... 23&t=11151