[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…