Automation: why does it not work? (Ignores no motion condition)

XYZ Room Motion Sensor:
: Motion Sensor: No Motion
For 20 Minutes
XYZ Room Door
: Contact Sensor Open

Send notification to members: “Door Open 20min, No one inside!”

I’m toying with this for a garage and other rooms that are meant to alert if the door is open and no one is apparently in there.

I’m finding that it ignores the motion sensor and seems to just send it after 20 minutes, regardless of if there’s further motion in the room.

Any ideas why? Or how to remedy?

I wish I knew.

I tend to stay clear of the options in many conditions because it isn’t clear how they are meant to work.

I would expect to see the notification if the door is opened and there hadn’t been any motion for at least 20 minutes. I am pretty sure that happens.

I’d possibly expect a notification if the door is open and motion is detected after at least 20 minutes of no motion.

I don’t think I can reconcile that with your description.

I have had similar situations, and one would expect that these simple conditions would work as our brain thinks. I believe the challenge with ST Rule automations is the inability to debug a specific automation (live logging very device specific).

Most of these automations work on state changes. The “No motion for 20 minutes” will trigger a timer, after state changes from motion to no motion and a countdown timer will start for 20 minutes. Ideally then it should check the condition if the door is open or not and then take an action. It will not work in a situation when the door is opened but you do not enter the room for 30 minutes, as the state change of motion to no motion never happened, and the sensor was already in the state of no motion. (I know I have stopped making sense now).

I have used to manage these kind of automations as it treats trigger and check conditions as separate (I struggled with the concept initially).


That is one interpretation, where a change of state to no motion is a trigger and a timer starts from then. Maybe it can do that, though how it does it with the existing Rules API escapes me, but …

Imagine you have a room that you know has been empty for the last hour or so, and a button. If you create a simple automation that says ‘if there is no motion in the empty room for twenty minutes and the button is pressed send a notification’ and then immediately press the button you will get a notification. It seems to be looking back in the history from the button press event.

I haven’t really scan through SmartThings documentation, but through usage, it feels in general, Automations are stateless. An Example, when my Awair Element sends an update with multiple attribute values, my Automation with 3 “If Conditionals with OR” will actually fire off three times (I ends up getting 3 notifications from thsi single automation).

I’d imaging the simplest way to code “No Motion for 20 minutes” would be like what you said - automation would (1) track last motion timestamp, (2) when a check is needed, compare now() with that timestamp. This implementation would mean “No motion for 20 minutes” can only be “a support Conditional check” and not the triggering condition.

This is my guess, so if anyone can link to developer document that explains this would be great (I did a general search on developer site for “no motion” and nothing came back).

1 Like

I’ve not thought it thru, and it is definitely not elegant, but I wonder if a virtual switch could help in this case. I know the delay of turning on something works. I think this would require several automations though.

Just tested this. It will certainly start a timer with no motion as a trigger.