I have a scene that I intend to use simply to activate one of two other scenes, based on the current level of a dimmer. Basically, to let me use one scene remote to toggle between two levels. I’m not seeing any response. Can anyone offer a pointer?
When I usually code (not in LUA…), I do a lot of console.log() or var_dump() or similar to help debug a problem. What’s the easiest way within LUUP for a scene to see (visually) the current value of a variable?
My code:
[tt]
local ecON = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”,“Status”, 53)
local ecLevel = luup.variable_get(“urn:upnp-org:serviceId:Dimming1”,“LoadLevelStatus”, 53)
if (ecON == “1”) then
if ( ecLevel > 40 ) then
luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1”, “RunScene”, {SceneNum = “45”}, 0)
else
luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1”, “RunScene”, {SceneNum = “46”}, 0)
end
end
[/tt]
(note: my understanding is that I need the “on” variable as the level will maintain the last level used, even if turned off)