I am having ZERO luck getting even the most basic LUA/LUUP (what’s the difference?) code to work in a scene, and just can’t figure out what I might be doing wrong?! Ultimately, I’m trying to build a scene that will toggle a switch on if it is off, and off if it is on. Basically creating a push on/push off switch, but I’m starting very basic, and have just built a scene that should simply turn the device on, and even that isn’t working! I feel like I must be missing something so basic, and so fundamental to vera that as soon as I understand, all of this will just fall into place…
SO… Simply, here’s my line of code:
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, {newTargetValue = “1”}, 29)
From everything I have read, this should simply turn on device 29.
My device 29 is an Aeon heavy duty outdoor switch (Amazon.com) which itself has been working fine for 4 years, and responds properly to scenes where I select the device and on/off status in the normal mode, and I can even control it via Alexa, so the device or it’s registration to Vera isn’t it’s problem…
Using this web query:
http://192.168.1.185:3480/data_request?id=status&output_format=xml&DeviceNum=29
I can see the device and status in the web browser. What I believe is the pertainent information in the response is:
[Device_Num_29 PendingJobs=“0” status=“-1”]
[states]
[state id=“630” service=“urn:upnp-org:serviceId:SwitchPower1” variable=“Target” value=“0”/] [state id=“631” service=“urn:upnp-org:serviceId:SwitchPower1” variable=“Status” value=“0”/]
(replaced greater than/less than with [] brackets because this editor didn’t seem to like them!)
I can turn the device on and off in Vera, and see the target and status variables change to “1” so I KNOW I am on the right device…
I have the scene configured (for testing) for only manual trigger, and it’s basically empty, except the Luup code I posted above in the “Also, execute the following Luup code:” section:
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, {newTargetValue = “1”}, 29)
I also tried this in case “Target” was actually supposed to be the parameter being set
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, {Target = “1”}, 29)
Nothing I do seems to have any effect.
What could I be doing wrong, and is there a better way to troubleshoot this? Is there a LUA "interpreter’ or other interactive window where I can just type in commands and maybe get some context relelvant error messages back?
Thanks in advance… I’ve owned “Vera” for 6 years, and feel like I’ve barely scratched the surface because this LUA is SO frustrating to me…
-Steve