Noobie question - control all lights in an area via Pleg

Hi,

I’m new with Pleg and it’s an amazing platform.
I want to control all the lights in a define area in one virtual switch - turn on/off 5 lights in the Living Room.

For the practice I tried to work it out with two lights. I created virtual switch and made this pleg config:

inputs:
LrLeftOff - Whenever the Left Lr is turned off
LrLeftOn - Whenever the Left Lr is turned on
LrOff1 - Whenever the Lr is turned off
LrOn1 - Whenever the Lr is turned on
LrRightOff - Whenever the Right Lv is turned off
LrRightOn - Whenever the Right Lv is turned on

Conditions:
LrOff - LrOff1 and (LrRightOn or LrLeftOn)
LrOn - LrOn1 and (LrRightOff and LrLeftOff)

Actions:
LrOff - Immediate - 2 (turn off Right and Left)
LrOn - Immediate - 2 (turn on Right and Left)

In this position, when I turn the virtual switch on/off, the right and left lights are turning on/off (like they should), but I can’t keep the individual right or left light on when the Living room virtual switch is off.

I think that I need to config this action to be only when the virtual switch is manually changed, and not to be active at any time, because right now if its on “off” it turns the lights off whenever I try to turn one of them on. But I don’t know how to config it that way.

Thank you in advance,
Ori.

Have you thought about something like below. It’s not using the Virtual Switch plugin but it has many more options for control.

[url=http://forum.micasaverde.com/index.php/topic,32865.msg240044.html#msg240044]http://forum.micasaverde.com/index.php/topic,32865.msg240044.html#msg240044[/url]

You do not need two of every input Trigger!

Input Triggers:
LRVirtual when the Virtual Switch is On
LRLight1 when LR Light 1 is on
LRLight2
LRLight3
LRLight4
LRLight5

Conditions:
AnyOn LRLight1 or LRLight2 or LRLight3 or LRLight4 or LRLight5
AllOff !AnyOn
TurnAllOn AllOff and LRVirtual and (AllOff; LRVirtual)
TurnAllOff AnyOn and !LRVirtual and (AnyOn; !LRVirtual)

The addition of the sequence expression allows you to control the individual lights manually or with the Virtual Switch, preference is given to the individual switches.

Thank you very much for your answer, it helped me a-lot!
Your solution works great, except for when one light is on, and I turn on the virtual switch, it doesn’t turn all the lights on.

Thanks again for your amazing and useful pleg.

As I said … single lights have precedence.

You can remove the " AllOff and" from the TurnAllOn condition