Wait for Condition & Multiple Instance Triggering

I have this rule that I've created to automate my portable Air Conditioner. It works pretty well, but my stick point is that every time the temperature sensor reports, it kicks off the rule, even if the rule is already running and waiting for the temperature to drop as stated in the "wait" below. What is the most simple, correct way to prevent this happening? Thanks in advance!!

Do you only want to trigger on the first report > 69? If so, an easy fix would be to select "Use required expression" and create a required expression of <= 69. Then, your trigger will capture only this specific transition--under the threshold to over, the first time only (until it goes below again). Note that any time a rule triggers, it will cancel all waits, but delays at not affected, so as-is you're likely to have unexpected results in some cases, perhaps fewer with this modification. You may wish to use "Wait for event: elapsed time" instead or make the delays cancelable and add a Cancel Delayed Actions.

If that's not what you want, it may be helpful to me plain what you want the rule to do (in plain language, not thinking about Rule Machine or how you might implement it). Good luck!

1 Like

@bertabcd1234 Thank you so much for the input.

  • (Trigger) AC Thermometer detects that the temperature is above 69
  • AC Unit Toggles off, then on
    *Wait 2 Seconds
    *AC IFTTT switch is toggled off, then on
    *Furnace blower switch turns on
    *(Trigger) AC Thermometer detects that the temperature is less than 67
    *AC Unit and AC IFTTT both turn off
    *After 5 minutes, the blower fan turns off as well.

To answer your question, yes I only want the rule to trigger the first time that the high temp is detected, until the temperature falls below the threshold and the switches all turn off. At which point I would obviously like the rule to be trigger-able again.
Are you suggesting that I use a private boolean state in the required expression?
I have also swapped out the delays with wait for event: elapsed time. Let me know if that part looks correct. Thanks for letting me pick your brain!

No, my suggestion was:

By which (I realize this was vague) I meant "thermostat temperature <= 69," i.e., anything below what would be captured by your trigger. Then your rule will trigger only on thus specific transition, a reading below to a reading above. Subsequent reports of readings above will not trigger until it goes below this threshold again. If that's the only problem you're trying to solve, it should work.

The non-rule-esque description was still too rule-esque for me to guess is this is all you really want (don't think of terms like "trigger" and consider carefully exactly when you want this to happen), but it seeks like it. :slight_smile:

Okay I see what you're getting at. Here's what I put into the rule- I believe I'm missing something though, as this way it won't allow the rule to fire the first time either. Thanks for bearing with me!

At the time that screenshot was taken, you can see the required expression evaluated to false. You'll need a reading below that value in order for the expression to become true, then it will trigger the next time it goes above.

If that's not what you want (maybe you don't care how many times the rule triggers as long as you got to the end of the actions first?), then your idea of using private Boolean or some other method of resrdicitmg re-entrant execution would work instead.

Excellent. So once the RQ evaluates to true, the rule will progress past the Required Expression, and wait on the trigger event, even if it evaluates back to false in the meantime?

I'm not exactly sure how to interpret the question, but if this helps: the trigger event only counts (i.e., actually triggers the rule) if the required expression is true at the moment of triggering (and before any state changes the trigger itself might cause have taken effect, which is why having this required expression with this trigger will capture just this specific state change, a reading <= 69 to a reading > 69).