Hi,
I an trying to send an SMS when motion is detected from different sensors, but i want this to happen only when a virtual switch “I am at Home” is false.
I know how to add LUUP conditions, but in reality the SMS is sent upon the occurence of triggers, and not on the execution of the scene.
I tried the following code:
[font=courier]local iamhere = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”, “Status”, 48)
if (iamhere == “1”) then
luup.log("Motion Detected when AT HOME ")
return false
else
luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1”, “RunScene”, {SceneNum = “32”}, 0)
luup.log("Motion Detected at EMPTY HOUSE ")
end[/font]
but the SMS is sent whatever is the switch status…as expected.
Then, i made code to change the status of a virtual switch on the occurrence of motion, thinking to be able to send an SMS when the virtual switch state changes. However, it seems that a virtual switch never generate a trigger to such a scene, so no SMS again!
Any suggestions? I know of alternatives that are possible under UI5, but because of the many EZmotion sensors i own i need to do it under UI4…