UI7 works differently than UI5?

Last night I took the big step of upgrading, since I need to expand and want the new Fibaro dimmers. One of my scenes worked perfectly in UI5 but don’t work anymore after the upgrade.

It’s a scene that turns off a specific light after the motion sensor reports “no motion”. At first sight it looked like UI7 could handle that without lua. It doens’t work.

I created a new scene and used the same code I used previously. No success. Any ideas with that?

"local dID = 159 – Device ID of your Z-Wave Switch
local allow = false – false runs scene if switch is on, true blocks it
local status = luup.variable_get(“urn:upnp-org:serviceId:MotionSensor1”,“Status”,dID)
return ((status == “0”) == allow)

I believe you are querying the wrong value on the device. It should be something like

local status = luup.variable_get(“urn:micasaverde-com:serviceId:SecuritySensor1”,“Tripped”,dID)

In this case a zero means untripped aka no motin

I want this scene triggered by a “no motion”. It worked fine on UI5 and after the update that very code doesn’t work.

Actually you didn’t specify what type of motion sensor you had, I had assumed it was a Fibaro.

The code snippet I gave you will do what you are looking for, a Tripped == 0 means it is untripped. (No motion)

It is possible that the behavior of the device is slightly different for the “status” variable on the latest firmware, I am not 100% sure if status variable tracks th tripped variable or only the armed tripped variable, or is only reporting the Armed status. using the Tripped or ArmedTripped in you LUA is just more specific and there for more likely going to not change behavior over time. Some of the armed tripped behavior did change in UI7 with how notifications work.

[quote=“Kryckmeister, post:1, topic:189926”]Last night I took the big step of upgrading, since I need to expand and want the new Fibaro dimmers. One of my scenes worked perfectly in UI5 but don’t work anymore after the upgrade.

It’s a scene that turns off a specific light after the motion sensor reports “no motion”. At first sight it looked like UI7 could handle that without lua. It doens’t work.

I created a new scene and used the same code I used previously. No success. Any ideas with that?

"local dID = 159 – Device ID of your Z-Wave Switch
local allow = false – false runs scene if switch is on, true blocks it
local status = luup.variable_get(“urn:upnp-org:serviceId:MotionSensor1”,“Status”,dID)
return ((status == “0”) == allow)[/quote]

This code would not work as intended… even under UI5… It will ALWAYS allow the scene to run…

The serviceId and variable used in the variable_get function are wrong… (should be “urn:schemas-micasaverde-com:device:MotionSensor:1” and “Tripped”)…

Since the serviceID and variable do not exist, variable_get will return nil… so you status variable will be set to nil…

The return variable will then evaluate to true… (status == “0”) translates to (nil == “0”) which evaluates to false… (false == allow) translates to (false == false) which evaluates to true, and the code returns true, allowing the scene to execute…

Just like UI5, a UI7 scene CAN use a motion sensor as a trigger when it stops detecting motion… without using lua code.

The trick is selecting the correct trigger… There are two possibilities… 1) When device is armed and stops detecting motion, and 2) When device is armed or disarmed and stops detecting motion…

The first gotcha here is the “armed” and “disarmed”… If you select option 1, the armed/disarmed state of the sensor will affect when the scene is triggered… and the armed/disarmed state can be changed by the home mode…

Normally, with UI7 defaults, all the motion sensors are disarmed when im “home” mode (which is also the UI7 default mode)… So if you select “is armed and stops detecting motion”, the scene will never trigger.

If you ALWAYS want the scene to trigger, you should select the “is armed or disarmed”…

The second gotcha is the motion sensors “untrip timeout”… The amount of time that the sensor waits after being tripped before reporting that it is no longer tripped… It is different for each brand and model of sensor… Most can have this delay customized by setting a parameter in it’s configuration… Make sure that you know what the default is, so that you know how long to wait after tripping the sensor before assuming that it doesn’t work…

The third gotcha is that some Z-Wave sensors are “broken” in UI7 … Not broken as in the sensor is malfunctioning… broken as in UI7 does not interpret the report from the sensor that it has untripped… and therefore the sensor will never untrip… and the scene will never run…

The specific scene did, in UI5 what was intended. Another scene turned the lights on, and that very scene turned it off when no motion was detected. I use the Aeon 4-in-1.

I have tried with the no motion “is armed or disarmed”, which I never saw available in UI5. But nothing. The sensors does however report the status correctly. I don’t see that compatibility issue should be the problem.

Two scenes, one with Lua, the other without - none of them does the job.