I’m in the process of migrating my webCoRE pistons, and I have quite a few that use the concept of “has not changed in X min/hours”. For example, I want to trigger a “default” cooling or heating set point on my thermostats but only if the set point has not changed in 4 hours. Any thoughts on how to do this in the rules engine? Or is this a needed feature?
I believe this could be accomplished through Variables and potentially combining two rules.
You would start by setting up a variable that you’ll later use as a State Stays trigger in your second rule. So we could use a True/False variable for example named $ThermostatTracker
In the first rule, you would setup your trigger based on the Thermostat’s setpoint changing. In the flow, you could set a variable to false and then back to true.
Then in the second rule, you could either add the variables as a trigger for $ThermostatTracker stays ‘true’ for XX minutes. Or within another rule as a condition – also using the state stays comparison.
–
So the way this works is the first rule will ‘reset’ the variable each time the setpoint changes and the variable kind of acts like a timer for our usage. Then the second rule is triggered (or conditionally run) anytime the timer stays unchanged for our desired period of time which we can use
–
That being said, it still seems like a reasonable feature request that would simplify this process, so I’m fine if you want to leave the feature request open!
Thanks for the response, this validates exactly what I did while I was waiting for your feedback and I think it’ll work fine, I’m not sure it will extend the time if say 2 hours into my 4 hour window the setpoint is changed, but that’s kind of an edge case anyway. I think I’ll only get 4 hours from the first change regardless of the most recent time the setpoint was changed, and then it will reset back to my “default”.
The approach I mentioned above should cover that. The key part is to set the variable back to false and then true again each time the setpoint changes. That effectively resets the state stays timer.