node-red-contrib-home-assistant
node-red-contrib-home-assistant copied to clipboard
Trigger Node need a >= and <= comparison
Is your feature request related to a problem? Please describe. I've a trigger node with these conditions:
This node is NOT triggered when the input/state looks like this:
-
-4.99
-
-5.00
<- because this is not less than -5.00 (it is less than or equal to) -
-5.01
This node is triggered when the input/state looks like this:
-
-4.99
-
-5.01
Describe the solution you'd like Add >= (greater equal) and <= (less equal) option to choose from.
Additional context
Using IS is not a option. This state sometimes skip -5.00
and sometimes not.
Are there other conditions or can you provide more context to what you're trying to accomplish? It seems odd to want to trigger on ANY value.
@x99percent This trigger node is connected to the sun.sun
value in Home Assistant. It should trigger once the value is below -5.00
degrees. The issue is that the sun.sun
sensor doesn't go from -4.98
to -4.99
to -5.00
, it just "jumps" instead since it is only updated every x second.
That's why the trigger node is not triggered when it jumps from -4.99
to -5.01
.
There are ways to do what you're talking about, but trying to catch exactly -5.00 is not the way to do it. Check for < -4.99 and use a delay node to limit the message rate to 1 per 23hrs.
Other than that, you might want to consider using node-red-contrib-time-range-switch.
True, exactly is the wrong word. Trigger once would fit better. I'd like to avoid using a additional node hence this PR.
My current workaround till this issue is fixed:
Using a delay node (built into Node-RED) will get you that single trigger behavior.
[{"id":"997750e5.328f","type":"trigger-state","z":"c5dbadc8.392e8","name":"","server":"fce9a161.4cb4b","entityid":"sun.sun","debugenabled":false,"constraints":[{"id":"feci6yolmwl","targetType":"this_entity","targetValue":"","propertyType":"property","propertyValue":"new_state.attributes.elevation","comparatorType":"less_than","comparatorValueDatatype":"num","comparatorValue":"-4.99"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"x":320,"y":860,"wires":[["9119dbff.0bdc78"],[]]},{"id":"9119dbff.0bdc78","type":"delay","z":"c5dbadc8.392e8","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"20","rateUnits":"hour","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":540,"y":860,"wires":[["48737504.d7ba2c"]]},{"id":"fce9a161.4cb4b","type":"server","z":"","name":"Home Assistant","url":"http://HA.IP.GOES.HERE:8123","pass":"PASSWORD"}]