I’m trying my best to stop whining about and/or ;D
But Lua is kicking my butt.
I’ve read the wiki and a pile of threads here and then cut and pasted snippets that seem to make sense to me but it just isn’t working. here’s what I have:
local getupearly= luup.variable_get("urn:upnp-org:serviceId:SwitchPower1","Status",25)
if (getupearly== "1")
then
luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","RunScene",{ SceneNum="17" }, 0)
luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="0" },25)
else
return false
end
I have a state device (#25) for getupearly. I have a scene with a timer for 3:30 am as the trigger and then in the luup code I have the above. My thought (Hope) would be it will run my scene 17 which turns the heat up in the morning for me and then flip the getupearly flag back to zero so the next morning it just comes on at the normal time.
But when i run it it doesn’t work.
when i try in the develop tab luup test box
luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1”,“RunScene”,{ SceneNum=“17” }, 0)
if says “code failed” but actually does run scene 17
when I try
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”,“SetTarget”,{ newTargetValue=“0” },25)
it says “code failed” and does NOT flip the flag from on to off.
I cut and pasted straight from the wiki and only changed my device/scene numbers and the wiki had netargetvalue=“1” but i made it 0
I’m guessing that Device#25 “isn’t real”, so probably doesn’t have an implementation. Technically, when you [tt]call_action(…)[/tt], it’s making a method call against that object behind the scenes. If that object doesn’t actually have the Method, then it’ll report a Failure.
Something similar happens if you try to press “[tt]Arm[/tt]” Buttons on Virtual Motion sensor buttons (having seen this with my Alarm code)
Anyhow, you might try a slightly different tack for this part (the bit that sets the Flag variable)
thanks for replying- but I’m a complete dumbass- laughing.
I figured it out. I fought it like 30 minutes last night and like an hour tonight and just didn’t see it. But I looked at it once last time and I realized I had the wrong device number.
fixed it and it works- I got confused and saw the "parent’ number and thought that was it.
It’s actually a ‘virtual’ x-10 device so it’s ‘real’ as far as vera is concerned. So that command above i was using does work.
[quote=“guessed, post:2, topic:166815”]I’m guessing that Device#25 “isn’t real”, so probably doesn’t have an implementation. Technically, when you [tt]call_action(…)[/tt], it’s making a method call against that object behind the scenes. If that object doesn’t actually have the Method, then it’ll report a Failure.
Something similar happens if you try to press “[tt]Arm[/tt]” Buttons on Virtual Motion sensor buttons (having seen this with my Alarm code)
Anyhow, you might try a slightly different tack for this part (the bit that sets the Flag variable)