Restore all device levels


#1

Trying to design a piston that turns all the lights off in my house for a christmas light show. But every light is at a different setting depending on the time of day and weather conditions. I’ve poked around, but there doesn’t appear to be any easy way to take a snapshot of all the devices state and then turn them off, and restore to that.

Otherwise, it looks like it’s saving the current device level for each device. Not sure if that’s practical.

Thanks


#2

If you just turn them off, do they not return to their previous value when you turn them on?


#3

Wow, you may be right. I may have really overthunk this one!

I guess the only issue would be if a light is not on when I run the piston. If I “turn on” everything and something was off before, it will come on.


#4

You might save “on” devices with something like this:

device all Devices=[your list]
device onDevices

if allDevices switch is on then
   save matching devices to onDevices
  with onDevices
     turn off
  end with
end if

When you want to turn on:

with onDevices
   turn on
end with

This later logic will need to be in the same piston or you will need to use a global variable.