generate a MIOS SMS upon motion AND an external condition under UI4


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:

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
luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1”, “RunScene”, {SceneNum = “32”}, 0)
luup.log("Motion Detected at EMPTY HOUSE ")

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…

You should be able to add a notification to the Virtual Switch that you toggle based on motion. You will have to turn it off then on to get a notification sent.

If you have an Android Phone you might move to Vera Alerts you have a lot more options.

the idea is a good one…but i am using the stateDevice, and it doesn’t seem to work… :-[

I would also recommend that you use Vera Alerts or some other notification apps like prowl. Then you can send notifications from scenes (in lua code) which allows you to send much more specific notifications in specific moments.

I personally do not use any vera build in notifications at all.