Halt-If not halting?

I recently installed the new Community Hass.io Add-on’s Node-RED (I uninstalled Notoriousbdg’s version) and I tried creating a simple flow. Upon a state change for a particular entity, I want the flow to stop if the new state is off.

Per the node help, the Halt If State is

If the new_state === this setting then skip sending

I put ‘off’ into the “Halt If State” field:

Here are the exact details for the node:

[
    {
        "id": "1d10ce02.a157a2",
        "type": "server-state-changed",
        "z": "a89b4521.620c18",
        "name": "I Arrive",
        "server": "165d1d5a.120493",
        "entityidfilter": "binary_sensor.is_david_home",
        "entityidfiltertype": "exact",
        "haltifstate": "off",
        "x": 116,
        "y": 426,
        "wires": [
            [
                "1a1323f1.ab970c",
                "7484f380.21858c"
            ]
        ]
    },
    {
        "id": "165d1d5a.120493",
        "type": "server",
        "z": "",
        "name": "Home Assistant",
        "url": "http://hassio/homeassistant",
        "pass": "MYPASS"
    }
]

I then published a test state_changed event via Home Assistant’s dev event window:

{
   "entity_id": "binary_sensor.is_david_home",
   "old_state": "on",
   "new_state": "off"
}

The flow did not stop at the event changed node and continued to the debug node (here is the output):

{
   "topic": "binary_sensor.is_david_home",
   "data": {
      "entity_id": "binary_sensor.is_david_home",
      "old_state": "on",
      "new_state": "off"
   },
   "_msgid": "fdb95de4.edc75"
}

Am I misunderstanding this “Halt If State” field? Shouldn’t the flow have stopped at the event_changed node? Any insight would be greatly appreciated.

Thanks,
–David

what does a debug node say?
Try not using EXACT and using SUBSTRING

This is what the debug node output. I tried with substring as well and I didn’t see any change.

I figured out what was wrong. The data that comes into node-red from state change event that was triggered from the “dev event” window is not the same as an actual state change event. The most likely culprit is the fact that the payload field does not get populated:

Data that comes into Node-RED from a Dev event window triggered state-changed event:

{
   "topic": "binary_sensor.is_david_home",
   "data": {
      "entity_id": "binary_sensor.is_david_home",
      "old_state": "on",
      "new_state": "off"
   },
   "_msgid": "fdb95de4.edc75"
}

Data that comes into Node-RED from an actual state-changed event:

{
   "topic":"binary_sensor.health_check",
   "payload":"off",
   "data":{
      "entity_id":"binary_sensor.health_check",
      "old_state":{
         "entity_id":"binary_sensor.health_check",
         "state":"on",
         "attributes":{
            "round_trip_time_avg":"5.012",
            "round_trip_time_max":"5.776",
            "round_trip_time_mdev":"",
            "round_trip_time_min":"4.249",
            "friendly_name":"Health Check",
            "device_class":"connectivity"
         },
         "last_changed":"2018-06-04T21:45:04.064945+00:00",
         "last_updated":"2018-06-04T21:46:06.068216+00:00"
      },
      "new_state":{
         "entity_id":"binary_sensor.health_check",
         "state":"off",
         "attributes":{
            "friendly_name":"Health Check",
            "device_class":"connectivity"
         },
         "last_changed":"2018-06-04T21:46:38.006270+00:00",
         "last_updated":"2018-06-04T21:46:38.006270+00:00"
      }
   },
   "_msgid":"de6f4959.cd4b08"
}