Light status and variables


#1

At this stage I haven’t tried to create a piston but wanted someone to help me with the right logic so my brain will be steered at the right path.
I currently have a working piston that flashed a few lights when our ring doorbell is pressed. this works well. what i want is to be able to turn lights off after that weren’t already on, and for the ones that were on to reset them to the previous state or set to a particular colour if easier.

Do I need to define variables for each bulb? My current logic is to have a variable for each light that is set to true when light is on, then it sets to off after a couple of minutes when light goes off. This way once the doorbell routine has run it should be able to turn off those that weren’t on as the variable will be false.

Is this the right way to approach this? Or has someone already got a nice implementation already?


#2

There is a Capture/Restore capability within WebCoRE that you might want to try. Here’s my example which turns on/brightens our (3) outside front lights and (1) inside light when either of us return home or if someone rings the doorbell (when it’s dark) and then returns the lights to their original settings (on/off & level) . Take a look starting at line 44 specifically for the Capture/Restore logic:

Be aware that capture/restore can run into issues with not restoring things properly if there is ‘too much’ to restore. Some have had issues with trying to turn on or set levels of numerous lights and also trying to set colors or saturation parameters. The version I posted above seems to be very reliable but I’m only setting levels and/or turning on/off a total of four lights.


#3

I’ve only had luck capturing ‘level’ and ‘switch’ to the local store.

If I add anything else, it doesn’t always work right.