I tried doing this with Basic rules app, by “on motion, wait for temp above 74, then turn on fan”… but what really happens is… temp is 72, motion is seen… and the rule lurks in the background for two hours until temp is above 74, then with no new motion, the fan “seemingly randomly” turns on.
You can't do this with Basic Rule, as it has no conditional actions. You can do it with Rule Machine. The trigger is motion active, then a conditional action to test the temperature, just like in the title of your post.
(I live in Arizona -- that's why the temperature in the garage is 92.68 -- for real! But I dare not turn on the exhaust fan until the outside temperature is lower than the inside temperature -- otherwise it sucks in hotter air than it exhausts!)
Thank you. Yeah this seems to be the best way currently.
I wish the Motion Lighting app could be generalized to include fans (and thus temperature values, not just lux). Otherwise if I use Rule Machine, setting an auto-off is wonky... The Motion LIghting app will reset the off timer with every new motion event it receives. But I can't see a way to do this with Rule Machine.
You could do it this way:
Trigger Event: Motion Active
Actions:
IF(Temperature > 74) THEN
On: Fan
Wait for Event: Motion inactive
Wait for Elapsed Time x:xx (if you want some extra time before turning off)
Off: Fan
ELSE
Off: Fan
END-IF
Those Wait for Events are cancelled by the rule being triggered. So the fan won't turn off until x minutes after motion stops and stays inactive. In effect, the timer starts over on each new motion active event.