Temp Alert Delay

I have some temp sensors in my fridge and freezer. I have a rule to alert when the fridge is at 45*, but when the door is opened for a little bit it will start sending alerts. I want to change the rule to be something like…if it has been 20 min since the first alert and it is still above 45* send alert but if it the temp dropped below 45* within that 20 min cancel the alert or start the time over. I would like to apply the same logic to the low end of the alert as well.

Here is my attempt to write it out:

If temp of fridge >= 45*
And
Time = 20 min
And
If temp of fridge < 45* cancel alert
Else
Send alert

This is what I have so far:

image

You should be able to make the delay cancel-able. (Sorry, I'm not at home to mock up a rule.) Something like this:

IF (temp >  44) THEN
  Delay 0:20:00 (cancelable)
  Notify "High temp alert"
ELSE
  Cancel Delayed Actions
END-IF

How exactly do I do this in RM? I have been looking around but dont quite understand how to configure the rule how I want it.

Can anyone offer any help on this? I tried searching but did not find exactly what I am trying to do. If this has been discussed in another thread point me in the right direction.

Please see the docs and rule machine tutorials from Bruce. But as @lairdknox outlines your rule should be setup like this:

3 Likes

Just be sure to make the “Delay 0:20:00” cancellable.

Knew I forgot something. Screenshot above corrected.

1 Like

Thanks for your help. I was able to create the rule and test it out and it is working the way I was wanting.

1 Like

So I ended up creating this rule but I am still getting high temp alerts which if I understand it correctly means the rule is not working or the temp is really above 45* for 20 min. When I go to that device events page I see events but the temp is not listed as part of the of event so I cant tell if it really is above 45* for 20 min, see screenshot below. So, does anyone see anything wrong with my rule or how can I see the temp? I am using hubduino on a ESP8266.

Here is a pic of the events page.

Change the trigger to use temperature "changed' instead of discrete values. The way it is currently written, if temp goes above 45, but then drops to say 30 for the next 20 minutes, you will still get a notification.

Also, the rule is trying to be two rules in one, and the two discrete IF/ELSE statements are going to conflict with one another. Consider writing two rules, or using an IF/THEN/ELSE-IF/ENDIF type of logic.

Right now, the two ELSE statements will cancel each other's IF statement delays, once you change the trigger to 'changed'.