Remember light switches state

Moderator: leecollings

Post Reply
Slinkos
Posts: 81
Joined: Thursday 10 December 2015 0:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Netherlands
Contact:

Remember light switches state

Post 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?
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: Remember light switches state

Post 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".
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Remember light switches state

Post by Egregius »

Or do something with the lastupdate time.
If lastupdate > time() - 1800 ...
Slinkos
Posts: 81
Joined: Thursday 10 December 2015 0:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Netherlands
Contact:

Re: Remember light switches state

Post by Slinkos »

Thanks for you reply's, still struggling with how to script this..
User avatar
Westcott
Posts: 423
Joined: Tuesday 09 December 2014 17:04
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: Remember light switches state

Post 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
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest