@bravenel, Not sure that this is possible, but it would be nice if there was a new trigger type for when a device’s attribute transitions from a specific value to another. (If this exists already, I missed it…)
Device Voltage becomes <= 25v
In this situation, the rule would only trigger when the voltage crosses the trigger. When it goes from > 25v to a value that is <=25v, it triggers. But it would not trigger again as it gets lower than 25v, until it goes above the 25v threshold and comes down to again become <= 25v.
This would also allow a combination like:
Device Voltage becomes <= 25v or
Device Voltage becomes >=25v
That example would allow it to trigger in either direction, when the threshold is crossed.
I have rules setup on my solar panels that could use this. Right now, I have it going in one direction by combining a required expression of >25v with a trigger of <=25v.
Can this just be a
required expression with a
The require can be the
<= or >=
Do you do the same thing when it deviates from the 25, but
<= 25 and
>=25 is basically any change away from 25, so why not
which is what you stated your requirement needs to be
but again, that equivalent to
ahh, you only want it when it crosses the threshold, I missed this in there. For now, you could keep track of which direction it went as a local variable, and break out of the rule till it goes the other way
Yup. There are indeed a few ways to do this outside of using a trigger. Making it a trigger option would make it simpler to use, I think.
I agree it would be nice to have something that handles the complexity in setting this up, but could you not use a variable and wait of some kind?
Required Expression: Variable lowV = False
Trigger: Voltage drops below 25
Set lowV to True (stopping the rule from firing again)
Do anything else you want here...
Wait for Voltage to be >= 25
Set lowV variable to True
Like I said, would be nice if it could be done for us.... And I can't say for certain my approach will even work...
I'm not sure this is something that should be a type of trigger, although I will think about it. Here is the logic that implements:
This is using the generic application of Private Boolean being used to prevent a rule from being triggered more than once, coupled with the temperature requirement -- both in the Required Expression. Note that the Wait for Event keeps the rule waiting for the temperature to rise above 25 before re-enabling itself by setting PB true. It can't be triggered again until the temp has risen above 25.
I think it is worth pointing out that for RM to do this as a native trigger, it would have to implement essentially the same logic. It has to keep track of having been triggered once (what PB does above), and keep track of the temperature rising above the threshold (what the Wait for Event does). That's a lot of keeping track of things that the rule itself is perfectly capable of keeping track of.
Thanks @bravenel ! I agree - it would replace a lot of rule logic - I have a similar rule, though I use the >= trigger rather than changed. It eliminates the need for the private boolean and the wait for event in that rule.
Probably not worth it if it makes RM too much more heavy. I really appreciate your looking into it.