Super Simple - Turn off ceiling fan if no movement

Hi Folks - I am trying in RM5.0 to create a very simple rule for my daughters room. If there is no movement for 15 minutes, turn the ceiling fan off. Also - at night, don't run. Here is what I have - and it doesn't seem to be working.

I think you want the trigger to be that the motion sensor moves to an inactive state, not just that it has changed state.

I tried that initially, but same behaviour - when motion was triggered, it wouldn't reset the timer.

Ah, yes, good point.

Leave the trigger as changed, and introduce a cancel action and conditional action:

Cancel delayed actions from this rule
IF Motion inactive
Turn off the fan with the 15 minute delay
END-IF

I think this is what I would do. You would need to add your predicate

2 Likes

Here is a rule I have setup to trigger based off of motion.

It has a little bit more complexity because i also adjust speed based on room temp.

Thanks @terminal3 - I set this up with the two wait statements, and it is doing exactly what I want it to do!

Appreciate it.

matt

2 Likes

Hi @terminal3 - i seem to be missing one piece. When motion occurs within that "wait for event -> elapsed time" I want it to basically reset the time, but it isn't. Maybe because of my predicate condition - I think if that predicate is false -> then the actions to reset the motion doesn't work, but the "OFF" does?

image

app:2922021-09-19 08:51:55.835 pm infoAction: Off: Annikas Room (Fan)
app:2922021-09-19 08:51:55.769 pm infoAnnika's Room - Turn off Fan with no movement: elapsed time
dev:2942021-09-19 08:40:46.518 pm infoAnnika's Room Sensor motion is inactive
dev:2942021-09-19 08:38:24.315 pm infoAnnika's Room Sensor motion is active
dev:2942021-09-19 08:35:31.521 pm infoAnnika's Room Sensor motion is inactive
dev:2942021-09-19 08:32:13.020 pm infoAnnika's Room Sensor motion is active
dev:2942021-09-19 08:32:09.525 pm infoAnnika's Room Sensor motion is inactive
dev:2942021-09-19 08:27:38.212 pm infoAnnika's Room Sensor motion is active
dev:2942021-09-19 08:27:29.575 pm infoAnnika's Room Sensor motion is inactive
dev:2942021-09-19 08:17:22.001 pm infoAnnika's Room Sensor motion is active
dev:2942021-09-19 08:17:19.212 pm infoAnnika's Room Sensor motion is inactive
dev:2942021-09-19 08:15:45.938 pm infoAnnika's Room Sensor motion is active
dev:2942021-09-19 08:15:34.531 pm infoAnnika's Room Sensor motion is inactive
dev:2942021-09-19 08:14:33.454 pm infoAnnika's Room Sensor motion is active
dev:2942021-09-19 08:14:22.213 pm infoAnnika's Room Sensor motion is inactive
dev:2942021-09-19 08:12:00.790 pm infoAnnika's Room Sensor motion is active
dev:2942021-09-19 08:10:09.534 pm infoAnnika's Room Sensor motion is inactive
dev:2942021-09-19 08:09:08.712 pm infoAnnika's Room Sensor motion is active
dev:2942021-09-19 08:07:59.218 pm infoAnnika's Room Sensor motion is inactive
dev:2942021-09-19 08:06:58.837 pm infoAnnika's Room Sensor motion is active
dev:2942021-09-19 08:01:46.544 pm infoAnnika's Room Sensor motion is inactive
dev:2942021-09-19 08:00:45.310 pm infoAnnika's Room Sensor motion is active
app:2922021-09-19 08:00:00.791 pm infoAnnika's Room - Turn off Fan with no movement: Predicate Conditions now false
app:2922021-09-19 08:00:00.720 pm infoAnnika's Room - Turn off Fan with no movement: Predicate Conditions now false
dev:2942021-09-19 07:56:43.354 pm infoAnnika's Room Sensor UV index is 0
dev:2942021-09-19 07:56:43.117 pm infoAnnika's Room Sensor illuminance is 31 Lux
dev:2942021-09-19 07:56:39.121 pm infoAnnika's Room Sensor battery level is 100%
dev:2942021-09-19 07:56:37.406 pm infoAnnika's Room Sensor humidity is 57%
dev:2942021-09-19 07:56:36.610 pm infoAnnika's Room Sensor temperature is 77.6°F
app:2922021-09-19 07:51:55.596 pm infoWait over: Annika's Room Sensor motion inactive
app:2922021-09-19 07:51:55.591 pm infoAnnika's Room - Turn off Fan with no movement: Annika's Room Sensor motion inactive
dev:2942021-09-19 07:51:55.543 pm infoAnnika's Room Sensor motion is inactive
app:2922021-09-19 07:50:42.502 pm infoAction: Wait for event: Annika's Room Sensor inactive
app:2922021-09-19 07:50:42.436 pm infoAnnika's Room - Turn off Fan with no movement Triggered
app:2922021-09-19 07:50:42.427 pm infoAnnika's Room - Turn off Fan with no movement: Annika's Room Sensor motion active
dev:2942021-09-19 07:50:42.364 pm infoAnnika's Room Sensor motion is active

I believe you are correct that whilst ever the predicate condition is false, the trigger events will never fire, and therefore neither will the actions.

One solution to this and your issue with the fan turning off could be:

Add a "Cancel delayed actions from this rule" as the first action

  • This should avoid any subsequent turning off, although I'm sure I've asked this before and they are cancelled by default... I'll have to track down the post where I asked Bruce this question...

Setup a second rule to Cancel delayed actions from this rule at 8pm

  • There must be a better solution to this, some kind of repeat, etc...

The only question I have, however, is exactly what you want to happen when motion is triggered just before 8pm, like you show in the logs, but then motion continues to come and go after 8pm. Are you saying you want the fan to continue to stay on (that would seem reasonable)? In that case you may want to reconsider the predicate or the setup of the rule, may two rules, one to start the process of turning on the fan during the time period you want, and a second to keep it on regardless of the time of day.

Just before the predicate condition started the rule was triggered at 7:50Pm. So the fan will stay on until 8:50 and turn off. After 8:00 the predicate will no longer allow the rule to trigger. It does not cancel the wait apparently.

So basically you want the fan to stay on after 8:00PM? If so then one way to stop it would be to put a IF time between 8:00 and 9:00 THEN exit rule after the wait for event.

That way if it triggered just prior to 8:00 it will exit the rule and not turn off the fan.

1 Like

This will really come down to the desired behaviour, but if the only addition for this is the condition, then the fan will never turn off in this case, as the rule will not retrigger and enter the 1 hour wait. That was why I included the second rule. But like I said, depends on the intended behaviour....

Since my daughter often forgets to turn off her ceiling fan - desired behavior is during the day (7am-10pm) to turn off the fan if there is no movement in the room for an hour. When she is sleeping (generally 10pm-7am) - don't turn the fan off.

Ok, that makes sense, then @terminal3 's suggestion should do what you need.

Thanks - that did the trick!

Matt

1 Like