Need rule to adjust temp but only if still motion after 5 min

So I have an area that is heated with a mini-split system for which I have built a IR transmitter using and ESP8266 and talking to it from Hubitat via NodeRed. That all works fine.

Now I need a rule such that if the motion detector is true, wait 5 minutes and if still true then adjust the temp upward. I am just using basic rules and it looks like I can wait 5 easily enough but then there doesn't appear to be a way to do the "if still active" query.

Can I do this in basic rules or do I need to go to full on rule-machine?
Thanks

I can think of a few ways you might try solving this. If I'm understanding your situation, it sounds like you might need a rule required expression to not fire if the temperature was already adjusted upwards. Is there a period of non-activity where you want to adjust it downwards?

For what you described so far, it sounds like adding an if-then statement after your delay would work (don't forget to add the end-if). The logic I would use is if the sensor is no longer active, then exit the rule.

It's also possible to enhance your delay logic to use a "wait for event" instead. This would allow for stopping if the motion sensor sends a non-active event at any time during the delay. If the "wait for event" rule that gets that non-active event it will interrupt the 5 minute wait, and then the if statement following it would exit the rule immediately.

One trick you probably need to account for though is that the rule can fire off multiple times. Because you have delays in the rule, you might want something to prevent it from running again should the motion sensor fire another active event while the rule is already running and waiting in the delay action. For this case, you might do this through a hub variable (e.g. Room1TempEvaluationRunning as true/false). You can then use a required rule condition (Room1TempEvaluationRunning = false) to prevent more triggers -- just make sure you set to true when you start the rule, and false on all exit paths.

Thanks for the quick response. Thinking about what you said it sounds like I can't use basic rules.

What I want to do it avoid turning the heat up if the workshop is only occupied for a few minutes while I grab a tool, but if I am in the area for more than just few minutes then I am probably there for hours and it is worth turning the heat up. Once there is no motion in the area for about an hour, turn the heat back down.

Here is what I have so far but I don't think it is right.

image

I can set the hardware to only report every 5 minutes or even more or less, which might be of some benefit.

Download the Hubitat app