Why can't I run this LUA code ?
-
I have created a Global Reaction with this LUA code for my Vera to run.
However when I run the Reaction nothing happens. I can't see anything in the log file either about this rules ID number.
If I run the same LUA code on Vera in the test window it works OK.
OR any other suggestions how I can set this up in a global Reaction (Scene) in MSR ?
Instead I could use the VeraScenes.lua file in the Vera startup library, but I am wondering why I can't just paste the LUA code directly in to the MSR rule.
Thanks
local status = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", 419) --Status of Safe to Arm virtual switch if status == "0" then --Safe to Arm luup.inet.wget("http://SOME-HTTP-REQUEST") luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","SetHouseMode", {Mode = 2}, 0) --Set House Mode to Away luup.inet.wget('SOME-HTTP-REQUEST' ,5); else --Not Safe to Arm luup.inet.wget("SOME-HTTP-REQUEST") luup.inet.wget('SOME-HTTP-REQUEST' ,5); end
-
Have you looked at the contents of your LuaUPnP log file?
-
Have you looked at the contents of your LuaUPnP log file?
No I will try again and check it.
-
Have you looked at the contents of your LuaUPnP log file?
@toggledbits said in Why can't I run this LUA code ?:
Have you looked at the contents of your LuaUPnP log file?
I am not seeing anything at all in the Vera LuaUPnP log after running the Global Reaction with the above lua code.
No job is started.
However if I change the lua code to just a one liner to do a TTS announcement for example, then that does work OK and I see it happening in the Vera log also.
-
Are you running firmware 7.32 in the 5350 range? If not, what firmware are you running?
-
Are you running firmware 7.32 in the 5350 range? If not, what firmware are you running?
Production Vera Plus is firmware version 1.7.5186 (7.31)
-
I have created a Global Reaction with this LUA code for my Vera to run.
However when I run the Reaction nothing happens. I can't see anything in the log file either about this rules ID number.
If I run the same LUA code on Vera in the test window it works OK.
OR any other suggestions how I can set this up in a global Reaction (Scene) in MSR ?
Instead I could use the VeraScenes.lua file in the Vera startup library, but I am wondering why I can't just paste the LUA code directly in to the MSR rule.
Thanks
local status = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", 419) --Status of Safe to Arm virtual switch if status == "0" then --Safe to Arm luup.inet.wget("http://SOME-HTTP-REQUEST") luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","SetHouseMode", {Mode = 2}, 0) --Set House Mode to Away luup.inet.wget('SOME-HTTP-REQUEST' ,5); else --Not Safe to Arm luup.inet.wget("SOME-HTTP-REQUEST") luup.inet.wget('SOME-HTTP-REQUEST' ,5); end
-
@cw-kid I don't know much Lua, but what determines when you do or don't include a semicolon at the end of a statement? Seems irregular to my eye.
Both of these work OK on the Vera unit itself.
luup.inet.wget("SOME-HTTP-REQUEST") luup.inet.wget('SOME-HTTP-REQUEST' ,5);
The one with the semi colon has a time out set.
I have tried making both HTTP requests one or the other / the same, but that's not the problem.
The problem is the LUA code is just not run on the Vera at all when initiated from the MSR rules Set Reaction.
-
T toggledbits locked this topic on