With the below rule the intent is that if the bedroom is above 74 deg., there is motion, and the mode is not away to turn on the fan. Then turn the fan off 15 min after the last motion. Does anyone see a problem? The rule isn't turning the fan on as expected.
With this rule the only time the temperature will be evaluated will be when the sensor sends an active command.
Also there is nothing to stop the fan from turning off after fifteen min after the first active statement (there is nothing that cancels the delayed actions). Below is how I would write this if it were my rule
Trigger: Temp > 74 OR Motion Active
IF Mode away and Motion Active and Temp > 74
Cancel Delayed Actions
Turn On Fan
Wait for event Motion Inactive
Turn Off Fan > Delay 15 min Cancelable
This will evaluate when at every motion active and temperature change.
I only need the rule to be evaluated with motion.
How should I set motion so that it resets the delay for fan off?
I know how to write the rule so that if there is action in the room the fan will turn on and turn off 15 minutes after motion stops
trigger: motion active
If mode is NOT away
Motion is active
temp is > 74
cancel delayed actions
turn on fan
motion is inactive
then turn off fan delayed 15 minutes
If you only want it to trigger on a motion event then the following will work.
Trigger: Motion Active Action: If Mode Not Away and Temp > 74 Cancel Delayed Actions Turn Fan On Wait for Event Motion Inactive Turn Off Fan > Delay 15 (Cancelable) End If
The only issue here will be if you have been in the room for a while being active and then temperature then gets above 74. unless the sensor sends an active event the fan will not turn on.
However there might be a better way
Trigger: Motion Active Action: Cancel Delayed Actions Wait for condition Temp > 74 and Motion Active IF Mode NOT Away Turn Fan On END IF Wait for Event Motion Inactive Turn Off Fan > Delay 15 (Cancelable)
This Rule should be able to account for constant activity and a rising temperature.