Events: State node only if output changes

In the Events: State node you can toggle it to ignore of the state hasn’t changed.

But I’m trying to figure out a way to ignore it if the result (true / false) has not changed. For instance, if I’m checking if a number value is above or below a threshold (luminance in a room for example). If the value changes but are still within the same threshold (output is still true or false), it’s still running.

Is there any way to prevent this?

What you can do in this scenario is tell the event state to output either on/off depending on the value.

$number($entity().state) > 1000 ? "on" : "off"

Now msg.payload will be either on/off, adding a filter node after the event state will only send when the message changes.

image

1 Like

Use a trigger: state node with two conditions:

  1. Current State: <= X
  2. Previous State: > X

This setup will trigger the flow only when the entity state crosses below the threshold X from a higher value.

Thanks for your help! This seems to work just as I want. :slight_smile: