Treating a Group of Lights/Switches/Dimmers as One


#1

After trying a bunch of changes in device type handlers, struggling with GE add-on switch functionality, etc. I finally just wrote a piston that treats a group of dimmers as one entity. These lights will always be set the same, but ANY of the lights in the set can be used as the ‘master.’. There’s a timeout of 15 seconds so inadvertent bumps to an adjacent switch don’t cause issues… that can be pared down or eliminated easily if you prefer.

Hope someone finds this useful. I’d rather be able to do this through Groups in the device type handler as they are instantaneous, but this patches the hole for now.


Sync A Group Of Dimmer Switches
#2

Nice implementation. I may snag this


#3

@michicago
This is really close to one of the iterations that I tried. A few suggestions:

  1. instead of using $date, you might user $currentEventDate. If there’s a delay in execution, that will give you the time that the trigger event occurred rather than a later timestamp of when the code is executing.

  2. line 29 - 31 seem like they’d prevent you from using the same switch to issue 2 different commands without going to another switch in between those commands. My approach was something like:

    if
    $currentEventDevice is the same as {CurrentMaster}
    or
    $currentEventDate is after {MasterExpires}

This allows you to issue several commands on the same device in quick succession

What you did in lines 40 and 42 is an interesting approach. I might try incorporating that into mine.

There were a few other questions about webCore in general that this raises. I’ve asked them here: Sync A Group Of Dimmer Switches


#4

I don’t use $date, I use $now. I’d have to do some testing to see if $currentEventDate is a suitable replacement, but understand what you’re saying (if $currentEventDate is not affected by delayed piston executions).

No, the only things line 29-31 prevent is the setting of a new master switch. They do not block commands from reaching the target device. I can set 72 sequential commands with one switch, and the moment the level and switch on the ‘current master’ remain idle for 2 seconds, the other devices are set to match it.


#5

Hey, Thank you for this Piston! Quick any easy to use. :+1:


#6

Great Piston. I was searching for something similar