Can anyone spot what could be wrong with this rule....
What I’m noticing is that occasionally I activate my off Downstairs Alexa routine which fires a rule to turn off all devices ...
What I’m noticing is that occasionally lights turn back on again afterwards, as if there were a delayed motion trigger event fired by this rule..
So I walk out of the area where the motion sensor is, and shout to Alexa, turn off everything ... everything turns off then occasionally back on again as if the motion event was triggered only after I moved out of the area.. causing lights to turn back on again ...
I'd be curious what type of motion detector you have. I have some Iris V2 motion detectors that take about 30-40 seconds to reset. This may be seen as movement in your routine. May need a second routine to kill this one by Alexa. (just a guess)
Your rule actions will run any time "Living Room Motion Sensor" or "Konnected - living room" change to active or inactive. Your IF will restrict what actually happens a bit: everything is contained inside it, so it must also be night mode, "Auto Reduce Lights" must be on, and either one or both sensors must be "active." I strongly suspect that last thing is what's getting you: if one sensor becomes inactive but the other is still active, then "any active" evaluates to True and it's possible (if the remaining conditions are met) that the rest of your actions will still run. One sensor being active and staying active while the other sensor becomes inactive will cause your trigger to fire (that's part of what your trigger is) and this part of the IF to be true since the entire IF is re-evaluated any time either sensor changes (even if the other sensor's state did not change). You can use logging to help determine if this is the case.
Assuming it is the case, here's what I think would help: create two separate triggers, one for each sensor, and use "becomes active" instead of "changed." You're not doing anything when they become inactive, so you don't need "changed," and separating the triggers will ensure that a trigger with "any" won't fire when either happen to be active and one changes (which is what combining them into one does--it doesn't check for a state change but just re-evaluates that truth value every time anything changes).
I think this is it ! The sensors are actually physically close to one another. I recently bought the Konnected alarm interface and added this PIR sensor in the mix but it’s positioned just above the other (hue) motion sensor. I was going to retire the hue motion sensor untill I realised it’s handy for temperature monitoring and lighting levels so just kept them both in place, figuring one is wired so if the battery runs out on the hue motion sensor (admittedly not a common occurrence!) the wired one would still be there ...
My guess is this one is the problem. I have a Ring motion detector and it takes about a minute to reset. I would try taking this one out of your routine (you said they are mounted close so probably doesn't add to routine) and see if it works the way you want.
By the way, I believe Bert's analysis, as usual, is exactly right.
Or you could add a line to your Alexa routine in HE to pause THIS rule for the sensor timeout, cancel timed actions for THIS rule, and then resume THIS rule after the timeout expires (which you'd have to determine).
That way, you get the benefit of both motions sensors working.
I know it seems counter-intuitive, but the likely problem here is actually one motion sensor going inactive while the other remains active--see my breakdown of the truth values and flow of actions above. ZMC is one solution to this problem, though if you only care about "active" events, filtering out those into separate triggers is another. For example, these triggers look the same but are actually different:
Trigger: Sensor A, Sensor B any active
Triggers: Sensor A active OR sensor B active
With the first, the trigger will fire if both sensors are active then one changes to inactive, even though neither changed to active as you might suspect is needed. In the latter (actually two separate triggers), only either sensor becoming active will match one of the triggers. Neither is inherently better than the other, but since your actions run any time a trigger is matched, it depends on what logic you're using there, and the former didn't work with the conditionals in the original rule in some circumstances.