Take a peek please? rule review

I get an occassional error as show in this image:

The device related is an Aqara Temp/humidity sensor that seems to operating just grand.
What of the following rule is wrong?:

As I understand it, this error means that you have multiple instances of the rule running in parallel and interfering with each other. You will want to avoid this by either:

  1. Change the Delay 0:15:00 by a Wait for 0:15:00
    Or
  2. Setup a local boolean variable that is turned on when the rule starts and off when it stops. It would need to either be part of your if condition or part of your Required Expression.

I'd also check the events for the sensor to see how often it reports.

@Sebastien - I've often wondered this, is there a trigger that fires only when something like temperature or humidity crosses a boundary, rather than just that it reports and the value is below a threshold?

I’m quite sure that it triggers with every event change when it meets the trigger condition. As I understand it, it would have no way to know that it has already triggered…

I was thinking more so whether you could have a trigger that detects that the previous value was higher than the threshold and the newly reported figure was below. If the next report is also below, the old and new figures would both be below and not satisfy that condition.

I have no context other than the above discussion - but to prevent interference, could/should the first step (perhaps inside the IF) be to "cancel delayed actions"? That way if a prior execution is still running when a new event triggers, it terminates it and starts fresh?

1 Like

Yes, that would be a great option! (Using Wait does essentially the same thing, but with one command instead of 2. :slight_smile: )

1 Like

Predicate condition / required expression?

2 Likes

Sorry to sidetrack the conversation there slightly @jshimota, I expect @Sebastien is on the right track to solving your issue.

1 Like

Million ways to skin a cat, but I have used Private Boolean in a separate rule to do stuff like this before.

All the logic for temperatures are in a separate rule. If above X.X degrees set PB true. If below Y.Y degrees, set PB false. That gives you a range so your heat isn't going on/off/on/off every time the sensor has a minor adjustment.

I then use the PB value to trigger the second rule (turn on thermostat, fan, etc)

4 Likes

I do exactly this for all my rules that are dependent on temp, heat, light and humidity.
It stops rule continually triggering.
The only rules that trigger are the ones that set the hub PB for light, heat etc.

1 Like

Thanks. I added the Cancel as the first line inside the if then. Seems to have solved the problem. Also my hub went from 14% load to 9%. likely a corelation there!

2 Likes

Hmm - I've a new problem now - it doesn't turn off!
The temp is currently a 74.3

Do I need some end command to restart the wait on the trigger?

Hmm... I'm not sure why it would never turn off - seems unlikely that it would get 9 degrees above threshold within the 15min delay...

But re-reading, the "cancel" may not be what was originally intended, as now it should run continuously as soon as it reports below 65.3, until 15 minutes after the last report below the threshold. A private boolean variable, as described above, might be the way to go. You could incorporate this into the same rule, e.g.

Initialize it to false
Add to required expression: variable == false
Set to true as first action
Set to false as last action