I want to create a rule that monitors two temperature sensors in my attic. If either sensor rises above 120, 130, 140 and 150 degrees F, I want to get a notification at each threshold.
What's the best / most efficient way to create this rule?
This is what I came up with do far. Suggestions to improve?
What you made wont do what you are asking for, and all those elseif statements are redundant, since the first one is the lowest temp it will trigger first for all the cases, and the message output is the same.
So do you want it to specifically trigger at those thresholds you pointed out, or do you want it to just trigger for anything above 120?
Do you want it to trigger hourly, or any time the temp hits the target?
ah good points.
I didn't want to use temp as a trigger as that didn't work properly last time I tried to do it with my pool pump. So I thought "grab current temp once every hour" and then if it's above 120 send msg, if it's above 130 send msg and so on.
I want it to trigger at 120 (temp now above 120) and then if it rises above 130 trigger again, send 2nd notification (temp now above 130), at 140 snd 3rd notification(temp now above 140).
You would want to set your trigger to be the 120 mark then.
I think the best way to do it would be with a global variable, lets call it alertLevel
Trigger = Temp > 120 (I think this will trigger for any temp change above 120)
(You could also do a conditional trigger where it only triggers if over > 120 and the actual trigger is every increase, then it wont trigger at all for temp decreases.
For your actions, you start with the higher temp and work down.
- If TEMP > 150 and alertLevel < 4 THEN
- send alert
- set alertLevel = 4
- elseif TEMP > 140 and alertLevel < 3 THEN
- send alert
- setAlertLevel = 3
- else if ..... etc
THEN you need a separate rule that triggers if both temps drop below 120, and the actions would just reset alertLevel to 0. To prevent bouncing you may want to actually have it drop below 110 before resetting it.
I think that should trigger each alert only once per heat rise event, and then once it drops below your set level in the second rule it would be reset.
You may want to build in some sort of loop also if one of those temp levels is critical that you do something about it. I find a single alert can be missed but if it keeps repeating you are sure to notice it before too long.

