I am running version 1.0.988 and am having some issues with the luup code.
First, let me be clear that I am trying to write conditionals. I am working in the SCENES tab so basically it’s SCENE>New Scene>LUUP CODE.
The device I want to control is a wall wart nondimmable light or light appliance switch.
Under the ADVANCED tab for the DEVICE it is listed as:
urn:schemas-upnp-org:device:BinaryLight:1
From the examples I enter a line like this:
lu_CallAction(“urn:upnp-org:serviceId:SwitchPower1”,“SetTarget”,{ newTargetValue=“0” },20)
After I UPDATE>SAVE and then press the GO button for the scene, I get the following error in the log:
01 03/16/10 23:45:29.621 LuaInterface::CallFunction-3 Scene 30 failed [string “function scene_30()…”]:4: attempt to call global ‘lu_CallAction’ (a nil value) <0x2c0c>
I have tried the same thing using: luup.call_action
I don’t get an error but I get no response.
Now I can write the conditional:
local lul_tmp = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”,“Status”,20)
if( lul_tmp==“1” ) then
luup.call_action(“urn:upnp-org:serviceId:Dimming1”,“SetLoadLevelTarget”,{ newLoadlevelTarget=“99” },19)
end
and it works if I manually tell it to GO.
First, which is the correct way to call these statements (luup.call_action or lu_CallAction)?
Second, is there any way for Vera to poll this scene automatically and not have to manually execute it?