Needless to say air quality might remain above 65 for long periods of time, so I am trying to pause rule AQI>65 for 2 hours after it is triggered, so that at most I receive one notification every 2 hours. I created rule AQI>65 PAUSE to try to accomplish this:
This works correctly IF air quality remains > 65 for 2 hours or less at a time. But after 2 hours, I start getting notifications every few minutes, presumably because rule AQI>65 PAUSE is getting repeatedly triggered over and over again and after 2 hours there are repeated "resume" actions being triggered.
At the end of my day, I don't really care how I do it, but I only want the rule AQI>65 to be able to send a maximum of 1 notification every 2 hours.
Any advice on the simplest way to accomplish that?
You may want to look at doing this with the built-in Notifications App. That app has options for how often to repeat the notification when a condition remains. It seems like it might work for your application . . .
Thanks for the suggestion. I looked into that but the "aqi" value from my PurpleAir is a "custom attribute" that I have access to from Rule Machine, but the built-in Notifications app does not have a "custom attributes" option so I cannot choose the "aqi" value as the trigger for a notification, as far as I can see.
You can expand with local variables to enhance some information.
If this is a value that updates frequently, this rule will execute frequently -- a Required expression might help limit some of that.
Might consider setting a date/time variable for 2 hours in the future each time you send a notification, and not send another until the current date/time is > than the variable.
The purpleair AQI value gets updated every 5 minutes I believe (might even be every 1 or 2 minutes).
I see in your example it is listed as "temperature." That actually gives me an idea. Do you know if it's possible to change PurpleAir's custom attribute "aqi" so that Hubitat sees it as a temperature? If I could just make hubitat see it as a "temperature" rather than as a custom attribute, then I could try using the built-in "Notifications" app...
yes i would use a virtual switch and have your notify rule have a required expression switch must be off.
have a rule that sets the switch on when aqi >65 and stays that way for a time ie 2 hours.
then have another or the same rule turn it off when it goes below 65 ..
you may want a stays that way also for a time so you dont get ping ponging when it jumps around over and under 65 repeatedly in a short time.
I was afraid it might have the same problem when AQI is greater than 65 for several hours straight, but we had bad air quality last night and this solution actually appears to have worked:
Thanks again for the helpful input. I'm still planning to test out some of the suggestions in this thread at some point just to get a better understanding of how all of this operates. I especially liked the virtual switch idea.