Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger Node need a >= and <= comparison #81

Open
Skaronator opened this issue Jun 6, 2018 · 5 comments
Open

Trigger Node need a >= and <= comparison #81

Skaronator opened this issue Jun 6, 2018 · 5 comments

Comments

@Skaronator
Copy link

Skaronator commented Jun 6, 2018

Is your feature request related to a problem? Please describe.
I've a trigger node with these conditions:

image

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.

@x99percent
Copy link

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.

@Skaronator
Copy link
Author

@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.

@x99percent
Copy link

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.

@Skaronator
Copy link
Author

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:

image

@x99percent
Copy link

x99percent commented Aug 24, 2018

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"}]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants