Turning off smart plug if there's no motion detected for X minutes

Hi people.

Pretty strange question, but anyway.

The goal is to turn off smartplug if there’s no motion detected for X minutes.

I’m using “new” ST app (not classic one).

New automation rule:

If the smart plug is on
AND
no motion is detected for X minutes
THEN
it’s needed to turn off the smart plug, but it’s impossible to choose this device during this step.

Seems like it’s impossible to set the state of a device depending on its condition.

Is it possible to get it working?

Or maybe I’m just on the wrong way?

Thanks.

Correct, in the new app (STSC) you can’t have the same device in both “IF” and “THEN”. One quick workaround would be to create a virtual switch with a Smart Lights rule that mirrors the plug status, and substitute that as your “IF”.

Thanks! Virtual Lights switch helped :slight_smile:

Why do you need the on condition? Just do IF no motion for X minutes THEN turn off plug. Or use smart lighting so the rule runs local.

Yes, it looks absolutely logic to use only no motion for X minutes in IF. And yes it works fine. Until you want to get some notifications along with turning off the smart plug.

For example, if you set up such automation rule:

IF
there’s no motion for X minutes
THEN
turn off the smart plug
AND
send notification “the smart plug is off”

you’ll get your smart plug turned off and then infinite notifications, because, yes, no motion detected for X minutes.

That is the way it worked for me.

Ah, yes, that is true.