I am currently trying to teach myself some basic Luup code. I have several things working but I’m struggling a bit with appliance modules. From what I can find in the Luup manuals, getting the status of an Appliance Module (HA02) should go something like this;
local lul_tmp = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”,“Status”,7)
if( lul_tmp==“1” ) then
return false
end
The device number I’m trying to access is 7
I get a message in the Luup test window saying “bad device” and I can’t seem to get around it.
Did you get the device number from where it says Device #7 (see Capture1.png) or from the altid (see Capture2.png)? The correct device number is the one from Capture1.png (Device #7).
[quote=“MarkC, post:6, topic:168492”]Yep, worked now, thanks. I thought that field had to be populated (*).
Thanks again.[/quote]
Yeah, that one got me too when I first started with Vera!
Just cause it’s clearly noted: “* Required fields” doesn’t mean it’s required. As a matter of fact actually including the device ID in “* Required fields” box usually causes the test to fail ???
The more you use it the more you’ll see there’s lots and lots of bugs/misinformation in the control panel…
If a device number is present, then the Lua code is run with that device’s Lua interface. Otherwise, it is run with the same interface as the code from Scenes. However, there seems to be a bug when a device number other than 0 is present. I asked Aaron about this and he’ll decide if we keep that field or not.
Honestly, I don’t know what are the advantages of running the code with a device’s specific interface, but I will try to find out.
Best Home Automation shopping experience. Shop at Ezlo!