Set switch OFF if all lights get shut off

I have a room with a GE / Jasco in-wall switch. It controls 3 GE / Jasco in-wall outlets with floor lamps plugged into the switched outlet. I also have to of the Aeon Labs remotes so that we can control the lights in this room independently.

RIght now:

Switch ON = All lights on

Remote, turn each light off (one at a time):
All lights off, switch still on

TO turn the lights on from the switch, I need to:

  1. Turn switch off
  2. Turn switch back on

Is there a way to program a scene such that when the last light gets switched off, the switch gets set to off?

You can do that with PLEG.

[quote=“scottr, post:1, topic:197562”]I have a room with a GE / Jasco in-wall switch. It controls 3 GE / Jasco in-wall outlets with floor lamps plugged into the switched outlet. I also have to of the Aeon Labs remotes so that we can control the lights in this room independently.

RIght now:

Switch ON = All lights on

Remote, turn each light off (one at a time):
All lights off, switch still on

TO turn the lights on from the switch, I need to:

  1. Turn switch off
  2. Turn switch back on

Is there a way to program a scene such that when the last light gets switched off, the switch gets set to off?[/quote]

should be pretty easy to do in luup. Create a scene that fires whenever any of the lamps gets turned off and then get the status of each lamp via a luup.variable_get and if they are all off set the switch to off. assuming your lamp devices are 20,21,22 and your switch is device 40

[code]-- this gets the status of the lamps, 1 is on 0 is off
local lamp1 = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”, “Status”, 20)
local lamp2 = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”, “Status”, 21)
local lamp3 = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”, “Status”, 22)

– this checks if they are all off and turns the switch off
if (lamp1 == “0”) and (lamp2 == “0”) and (lamp3 == “0”) then
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, {newTargetValue = “1”}, 40)
end[/code]

If the Switch supports power metering you can set there scene with the condition that if power readings drop to 0, then the switch it’s turned off and then on

In PLEG

Inputs:
SwitchPower Bound to the Switch Power setting.
SwitchOn Bound to when the Switch Indicates it’s On

Condition:
PowerZero SwitchPower == 0
Reset PowerZero and SwitchOn and (SwitchOn; PowerZero)

Actions for Reset … turn switch off, then on.

This is much more tricky in LUA … without the sequence expression … you could trip and infinite loop.