On/Off function with aeon Panic switch

I’ve fussed with this switch for hours to finally get it working. I can trigger a scene to turn off 2 lights. Being luua illiterate, is there any way I can program the switch to turn the lights on, if their off, and off, if they’re on only using the one button panic switch.

Thanks in advance

You could put the following into your scene’s Luup and remove the existing actions. Replace 150 with the device ID of your light switch.

local dID = 150 local status = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1","Status",dID) if status == "0" then luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{newTargetValue="1"},dID) else luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{newTargetValue="0"},dID) end

It works beautifully…Thank you very much. I have 2 lights that will always be turned on together, I assume if I added the same code again, below the first one in Luua, changing the device id to the # of the second switch…both would be operated ?

You saved me, the wife was giving me 5 more Minutes of what she calls “dinkin around”…

I’m glad to hear I saved you from the wrath of the wife. Never a pretty site. ;D

Yes you can just duplicate the code with a different dID for a second switch. Note, though, that you could get the lights out of sequence (one on, the other off) if something changed the state of only one light. To avoid this, you could test one of the lights and fire the actions for both on the state of that. E.g:

local dID = 150 local dID2 = 151 local status = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1","Status",dID) if status == "0" then luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{newTargetValue="1"},dID) luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{newTargetValue="1"},dID2) else luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{newTargetValue="0"},dID) luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{newTargetValue="0"},dID2) end

Second code is much better…didn’t even think of the out of sync possibility. This one takes care of that. again, thanks very much. I was actually setting it up for the wife to be able to turn on lights for those middle night trips to the bathroom. Now she’s walking around with the clicker trying it from all sorts of distances. I just told her to “quit dinkin around” and lets go shopping before the snow hits. I think we have created a Monster :slight_smile:

This would be a good time to tell her what great things you could achieve with a few dollars for new hardware. ;D I’m happy to hear it’s working for you.