I have a virtual switch defined against which I have an PLEG action defined for when it is switched on. The action should execute some Lua as follows;
local shieldcondition = “”
local AL_resultCode, AL_resultString, AL_job, AL_returnArguments = luup.call_action(“urn:micasaverde‐com:serviceId:AlarmPartition2”, “RequestArmMode”, {State=“Alarm”, PINCode=“xxxx”}, 14)
if AL_resultCode ~0 then
shieldcondition = " the house shield cannot be lowered at this moment, please check the perimeter for problems "
else
shieldcondition = " the house shield has been lowered, the perimeter is now disarmed and safe to cross."
end
local greeting = “”
local time = os.date(‘It is %H:%M.’)
local hour = tonumber(os.date(‘%H’))
if hour < 12 then
greeting = “Good morning”
elseif hour < 17 then
greeting = “Good afternoon”
elseif hour < 21 then
greeting = “Good evening”
else
greeting = “Good night”
end
luup.call_action(“urn:micasaverde‐com:serviceId:Sonos1”, “Say”, {Text=greeting … " , " … time … shieldcondition, Language=“en”, GroupZones=“ALL”, Volume=20, SameVolumeForAll=“true”}, 112)
return true
For some reason I’m getting an error message “Invalid Lua Action: cShieldOn” when its triggered and I cannot see why? Anyone got any pointers as to what I’m doing wrong? I’ve tried taking all the code out, leaving just the first variable declaration and the return true lines and I get the same error message. It’s gotta be something really stupidly silly but I cannot for the life of me see it.