Call service node for climate set_hvac not working at times

I have a flow that uses a call-service node to set {"hvac_mode":"off"} or {"hvac_mode":"cool"} depending on the situation (the device is running ESPHome) and at times it’s not working. I have a debug node attached and according to it, it is getting called as well as the input Boolean on the output of the node, however the device itself shows no change. . Screen Shot 2022-09-07 at 5.51.01 PM

No errors in the logs, and more interestingly there is nothing in the HA logbook for that device, as if HA itself is not receiving the command from Node Red. Like I said it doesn’t happen all the time and I’m unsure how to debug this. FWIW this flow has been running for well over a year, and I don’t remember having this issue last summer (it’s an aircon so it’s not used during the winter). Only changes are software updates. I had this issue with v12 and I just updated to v13 with no change. Any help would be appreciated.

You should export your code when asking for assistance. I’m guessing that the output properties of the current state are set to entity and entity state. Delete data and change payload to timestamp. See if that helps.

image

Didn’t know if it would be ok to upload the entire JSON but here it is:

[
  {
    "id": "84f180cb.a8a24",
    "type": "tab",
    "label": "Living Room A/C Control ",
    "disabled": false,
    "info": ""
  },
  {
    "id": "41816963.dea82",
    "type": "server-state-changed",
    "z": "84f180cb.a8a24",
    "name": "",
    "server": "a898e79c.9c2fe8",
    "version": 4,
    "exposeToHomeAssistant": false,
    "haConfig": [
      {
        "property": "name",
        "value": ""
      },
      {
        "property": "icon",
        "value": ""
      }
    ],
    "entityidfilter": "input_number.living_room_a_c_setpoint",
    "entityidfiltertype": "exact",
    "outputinitially": false,
    "state_type": "str",
    "haltifstate": "",
    "halt_if_type": "str",
    "halt_if_compare": "is",
    "outputs": 1,
    "output_only_on_state_change": true,
    "for": 0,
    "forType": "num",
    "forUnits": "minutes",
    "ignorePrevStateNull": false,
    "ignorePrevStateUnknown": false,
    "ignorePrevStateUnavailable": false,
    "ignoreCurrentStateUnknown": false,
    "ignoreCurrentStateUnavailable": false,
    "outputProperties": [
      {
        "property": "payload",
        "propertyType": "msg",
        "value": "",
        "valueType": "entityState"
      },
      {
        "property": "data",
        "propertyType": "msg",
        "value": "",
        "valueType": "eventData"
      },
      {
        "property": "topic",
        "propertyType": "msg",
        "value": "",
        "valueType": "triggerId"
      }
    ],
    "x": 240,
    "y": 140,
    "wires": [
      [
        "82783178.fd7fc8",
        "5ec3bd04.1118ac",
        "ab2ada74.127cd8"
      ]
    ]
  },
  {
    "id": "25dd84c9.b1367c",
    "type": "server-state-changed",
    "z": "84f180cb.a8a24",
    "name": "",
    "server": "a898e79c.9c2fe8",
    "version": 4,
    "exposeToHomeAssistant": false,
    "haConfig": [
      {
        "property": "name",
        "value": ""
      },
      {
        "property": "icon",
        "value": ""
      }
    ],
    "entityidfilter": "climate.living_room_mini_split_2",
    "entityidfiltertype": "exact",
    "outputinitially": false,
    "state_type": "str",
    "haltifstate": "",
    "halt_if_type": "str",
    "halt_if_compare": "is",
    "outputs": 1,
    "output_only_on_state_change": false,
    "for": 0,
    "forType": "num",
    "forUnits": "minutes",
    "ignorePrevStateNull": false,
    "ignorePrevStateUnknown": false,
    "ignorePrevStateUnavailable": false,
    "ignoreCurrentStateUnknown": false,
    "ignoreCurrentStateUnavailable": false,
    "outputProperties": [
      {
        "property": "payload",
        "propertyType": "msg",
        "value": "",
        "valueType": "entityState"
      },
      {
        "property": "data",
        "propertyType": "msg",
        "value": "",
        "valueType": "eventData"
      },
      {
        "property": "topic",
        "propertyType": "msg",
        "value": "",
        "valueType": "triggerId"
      }
    ],
    "x": 200,
    "y": 60,
    "wires": [
      [
        "812cbbb8.a34448",
        "164790595b741e24"
      ]
    ]
  },
  {
    "id": "82783178.fd7fc8",
    "type": "api-call-service",
    "z": "84f180cb.a8a24",
    "name": "Update Temp on Mini Split",
    "server": "a898e79c.9c2fe8",
    "version": 5,
    "debugenabled": false,
    "domain": "climate",
    "service": "set_temperature",
    "areaId": [],
    "deviceId": [],
    "entityId": [
      "climate.living_room_mini_split_2"
    ],
    "data": "{\"temperature\": \"{{payload}}\"}",
    "dataType": "json",
    "mergeContext": "",
    "mustacheAltTags": false,
    "outputProperties": [
      {
        "property": "payload",
        "propertyType": "msg",
        "value": "",
        "valueType": "str"
      },
      {
        "property": "value",
        "propertyType": "msg",
        "value": "",
        "valueType": "str"
      }
    ],
    "queue": "none",
    "x": 660,
    "y": 140,
    "wires": [
      []
    ]
  },
  {
    "id": "812cbbb8.a34448",
    "type": "api-call-service",
    "z": "84f180cb.a8a24",
    "name": "",
    "server": "a898e79c.9c2fe8",
    "version": 5,
    "debugenabled": false,
    "domain": "input_number",
    "service": "set_value",
    "areaId": [],
    "deviceId": [],
    "entityId": [
      "input_number.living_room_a_c_setpoint"
    ],
    "data": "{\"value\":{{data.new_state.attributes.temperature}}}",
    "dataType": "json",
    "mergeContext": "",
    "mustacheAltTags": false,
    "outputProperties": [],
    "queue": "none",
    "x": 670,
    "y": 60,
    "wires": [
      []
    ]
  },
  {
    "id": "77fbdc52.17007c",
    "type": "server-state-changed",
    "z": "84f180cb.a8a24",
    "name": "",
    "server": "a898e79c.9c2fe8",
    "version": 4,
    "exposeToHomeAssistant": false,
    "haConfig": [
      {
        "property": "name",
        "value": ""
      },
      {
        "property": "icon",
        "value": ""
      }
    ],
    "entityidfilter": "sensor.lumi_lumi_weather_5857b302_temperature",
    "entityidfiltertype": "exact",
    "outputinitially": false,
    "state_type": "num",
    "haltifstate": "",
    "halt_if_type": "str",
    "halt_if_compare": "is",
    "outputs": 1,
    "output_only_on_state_change": false,
    "for": 0,
    "forType": "num",
    "forUnits": "minutes",
    "ignorePrevStateNull": false,
    "ignorePrevStateUnknown": false,
    "ignorePrevStateUnavailable": false,
    "ignoreCurrentStateUnknown": false,
    "ignoreCurrentStateUnavailable": false,
    "outputProperties": [],
    "x": 320,
    "y": 200,
    "wires": [
      [
        "2bb07252.ea1a6e",
        "dbde6c2e.6e4768",
        "ab2ada74.127cd8",
        "5ec3bd04.1118ac"
      ]
    ]
  },
  {
    "id": "2bb07252.ea1a6e",
    "type": "debug",
    "z": "84f180cb.a8a24",
    "name": "",
    "active": false,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "false",
    "statusVal": "",
    "statusType": "auto",
    "x": 710,
    "y": 280,
    "wires": []
  },
  {
    "id": "dbde6c2e.6e4768",
    "type": "debug",
    "z": "84f180cb.a8a24",
    "name": "",
    "active": false,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "data",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 700,
    "y": 340,
    "wires": []
  },
  {
    "id": "38db4861.a938f8",
    "type": "api-current-state",
    "z": "84f180cb.a8a24",
    "name": "",
    "server": "a898e79c.9c2fe8",
    "version": 3,
    "outputs": 2,
    "halt_if": "cool",
    "halt_if_type": "str",
    "halt_if_compare": "is",
    "entity_id": "climate.living_room_mini_split_2",
    "state_type": "str",
    "blockInputOverrides": false,
    "outputProperties": [
      {
        "property": "payload",
        "propertyType": "msg",
        "value": "",
        "valueType": "entityState"
      },
      {
        "property": "data",
        "propertyType": "msg",
        "value": "",
        "valueType": "entity"
      }
    ],
    "for": 0,
    "forType": "num",
    "forUnits": "minutes",
    "override_topic": false,
    "state_location": "payload",
    "override_payload": "msg",
    "entity_location": "data",
    "override_data": "msg",
    "x": 900,
    "y": 540,
    "wires": [
      [
        "3130f9b2.b7d8e6"
      ],
      []
    ]
  },
  {
    "id": "322418a5.6dbe28",
    "type": "debug",
    "z": "84f180cb.a8a24",
    "name": "Overcooling swtich results",
    "active": true,
    "tosidebar": true,
    "console": true,
    "tostatus": false,
    "complete": "payload",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 800,
    "y": 660,
    "wires": []
  },
  {
    "id": "94957e7c.42cc48",
    "type": "api-call-service",
    "z": "84f180cb.a8a24",
    "name": "Turn Mini-Split Off",
    "server": "a898e79c.9c2fe8",
    "version": 5,
    "debugenabled": false,
    "domain": "climate",
    "service": "set_hvac_mode",
    "areaId": [],
    "deviceId": [],
    "entityId": [
      "climate.living_room_mini_split_2"
    ],
    "data": "{\"hvac_mode\":\"off\"}",
    "dataType": "json",
    "mergeContext": "",
    "mustacheAltTags": false,
    "outputProperties": [
      {
        "property": "payload",
        "propertyType": "msg",
        "value": "Turned Minisplit off",
        "valueType": "str"
      }
    ],
    "queue": "none",
    "x": 950,
    "y": 400,
    "wires": [
      [
        "352dd5bd.e1bc7a",
        "15f5e912.0a5217"
      ]
    ]
  },
  {
    "id": "352dd5bd.e1bc7a",
    "type": "debug",
    "z": "84f180cb.a8a24",
    "name": "",
    "active": true,
    "tosidebar": true,
    "console": true,
    "tostatus": false,
    "complete": "payload",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 1140,
    "y": 460,
    "wires": []
  },
  {
    "id": "df05f8b6.c5b2c8",
    "type": "join",
    "z": "84f180cb.a8a24",
    "name": "",
    "mode": "custom",
    "build": "object",
    "property": "payload",
    "propertyType": "msg",
    "key": "data.entity_id",
    "joiner": "\\n",
    "joinerType": "str",
    "accumulate": false,
    "timeout": "",
    "count": "2",
    "reduceRight": false,
    "reduceExp": "",
    "reduceInit": "",
    "reduceInitType": "",
    "reduceFixup": "",
    "x": 610,
    "y": 440,
    "wires": [
      [
        "b4514451.ad2f6",
        "ad21c98b.e20a98",
        "96a06ed7.d423e"
      ]
    ]
  },
  {
    "id": "5ec3bd04.1118ac",
    "type": "api-current-state",
    "z": "84f180cb.a8a24",
    "name": "",
    "server": "a898e79c.9c2fe8",
    "version": 3,
    "outputs": 1,
    "halt_if": "",
    "halt_if_type": "str",
    "halt_if_compare": "is",
    "entity_id": "input_number.living_room_a_c_setpoint",
    "state_type": "num",
    "blockInputOverrides": false,
    "outputProperties": [
      {
        "property": "payload",
        "propertyType": "msg",
        "value": "",
        "valueType": "entityState"
      },
      {
        "property": "data",
        "propertyType": "msg",
        "value": "",
        "valueType": "entity"
      }
    ],
    "for": 0,
    "forType": "num",
    "forUnits": "minutes",
    "override_topic": false,
    "state_location": "payload",
    "override_payload": "msg",
    "entity_location": "data",
    "override_data": "msg",
    "x": 320,
    "y": 420,
    "wires": [
      [
        "df05f8b6.c5b2c8"
      ]
    ]
  },
  {
    "id": "b4514451.ad2f6",
    "type": "debug",
    "z": "84f180cb.a8a24",
    "name": "",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "true",
    "targetType": "full",
    "statusVal": "",
    "statusType": "auto",
    "x": 230,
    "y": 780,
    "wires": []
  },
  {
    "id": "ad21c98b.e20a98",
    "type": "function",
    "z": "84f180cb.a8a24",
    "name": "Overcooling Check",
    "func": "//var currentSensorTemperature = msg.payload[0];\n//var currentSetpoint = msg.payload[1];\n\nvar  currentSetpoint = msg.payload[\"input_number.living_room_a_c_setpoint\"];\nvar  currentSensorTemperature = msg.payload[\"sensor.lumi_lumi_weather_5857b302_temperature\"];\n\nif (currentSensorTemperature <= (currentSetpoint - 1.5)){\n    console.log(\"Overcooling detected\");\n  return msg;  \n}\n\n",
    "outputs": 1,
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 530,
    "y": 660,
    "wires": [
      [
        "322418a5.6dbe28",
        "38db4861.a938f8"
      ]
    ]
  },
  {
    "id": "96a06ed7.d423e",
    "type": "api-current-state",
    "z": "84f180cb.a8a24",
    "name": "Living Room A/C Standby?",
    "server": "a898e79c.9c2fe8",
    "version": 3,
    "outputs": 2,
    "halt_if": "true",
    "halt_if_type": "bool",
    "halt_if_compare": "is",
    "entity_id": "input_boolean.living_room_a_c_standby",
    "state_type": "habool",
    "blockInputOverrides": false,
    "outputProperties": [],
    "for": 0,
    "forType": "num",
    "forUnits": "minutes",
    "override_topic": false,
    "state_location": "payload",
    "override_payload": "msg",
    "entity_location": "data",
    "override_data": "msg",
    "x": 460,
    "y": 860,
    "wires": [
      [
        "7fbbe24.4f1ea1c",
        "d0ab12b2.e067d"
      ],
      []
    ]
  },
  {
    "id": "7fbbe24.4f1ea1c",
    "type": "function",
    "z": "84f180cb.a8a24",
    "name": "Ready to call for cooling?",
    "func": "var  currentSetpoint = msg.payload[\"input_number.living_room_a_c_setpoint\"];\nvar  currentSensorTemperature = msg.payload[\"sensor.lumi_lumi_weather_5857b302_temperature\"];\n\nif (currentSensorTemperature >= (currentSetpoint) + 1.0){\n    \n  return msg;  \n}\n\n",
    "outputs": 1,
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 810,
    "y": 780,
    "wires": [
      [
        "4dd754d1.015394",
        "2cd9c756.6c41b"
      ]
    ]
  },
  {
    "id": "d0ab12b2.e067d",
    "type": "debug",
    "z": "84f180cb.a8a24",
    "name": "",
    "active": false,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "true",
    "targetType": "full",
    "statusVal": "",
    "statusType": "auto",
    "x": 710,
    "y": 880,
    "wires": []
  },
  {
    "id": "3eaa15f9.751e42",
    "type": "api-call-service",
    "z": "84f180cb.a8a24",
    "name": "Set Mini Split to Cool",
    "server": "a898e79c.9c2fe8",
    "version": 5,
    "debugenabled": false,
    "domain": "climate",
    "service": "set_hvac_mode",
    "areaId": [],
    "deviceId": [],
    "entityId": [
      "climate.living_room_mini_split_2"
    ],
    "data": "{\"hvac_mode\":\"cool\"}",
    "dataType": "json",
    "mergeContext": "",
    "mustacheAltTags": false,
    "outputProperties": [
      {
        "property": "payload",
        "propertyType": "msg",
        "value": "Turned Minisplit to cool",
        "valueType": "str"
      }
    ],
    "queue": "none",
    "x": 1160,
    "y": 600,
    "wires": [
      [
        "8913c736.00e048",
        "298fead6.9a8afe"
      ]
    ]
  },
  {
    "id": "15f5e912.0a5217",
    "type": "api-call-service",
    "z": "84f180cb.a8a24",
    "name": "Turn Standby mode on",
    "server": "a898e79c.9c2fe8",
    "version": 5,
    "debugenabled": false,
    "domain": "input_boolean",
    "service": "turn_on",
    "areaId": [],
    "deviceId": [],
    "entityId": [
      "input_boolean.living_room_a_c_standby"
    ],
    "data": "",
    "dataType": "jsonata",
    "mergeContext": "",
    "mustacheAltTags": false,
    "outputProperties": [],
    "queue": "none",
    "x": 1140,
    "y": 320,
    "wires": [
      []
    ]
  },
  {
    "id": "8913c736.00e048",
    "type": "api-call-service",
    "z": "84f180cb.a8a24",
    "name": "Turn Standby mode off",
    "server": "a898e79c.9c2fe8",
    "version": 5,
    "debugenabled": false,
    "domain": "input_boolean",
    "service": "turn_off",
    "areaId": [],
    "deviceId": [],
    "entityId": [
      "input_boolean.living_room_a_c_standby"
    ],
    "data": "",
    "dataType": "jsonata",
    "mergeContext": "",
    "mustacheAltTags": false,
    "outputProperties": [],
    "queue": "none",
    "x": 1200,
    "y": 780,
    "wires": [
      []
    ]
  },
  {
    "id": "298fead6.9a8afe",
    "type": "debug",
    "z": "84f180cb.a8a24",
    "name": "",
    "active": false,
    "tosidebar": true,
    "console": true,
    "tostatus": false,
    "complete": "payload",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 1400,
    "y": 680,
    "wires": []
  },
  {
    "id": "4dd754d1.015394",
    "type": "debug",
    "z": "84f180cb.a8a24",
    "name": "Function node result",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "true",
    "targetType": "full",
    "statusVal": "",
    "statusType": "auto",
    "x": 1040,
    "y": 860,
    "wires": []
  },
  {
    "id": "ab2ada74.127cd8",
    "type": "api-current-state",
    "z": "84f180cb.a8a24",
    "name": "",
    "server": "a898e79c.9c2fe8",
    "version": 3,
    "outputs": 1,
    "halt_if": "",
    "halt_if_type": "str",
    "halt_if_compare": "is",
    "entity_id": "sensor.lumi_lumi_weather_5857b302_temperature",
    "state_type": "num",
    "blockInputOverrides": false,
    "outputProperties": [
      {
        "property": "payload",
        "propertyType": "msg",
        "value": "",
        "valueType": "entityState"
      },
      {
        "property": "data",
        "propertyType": "msg",
        "value": "",
        "valueType": "entity"
      }
    ],
    "for": 0,
    "forType": "num",
    "forUnits": "minutes",
    "override_topic": false,
    "state_location": "payload",
    "override_payload": "msg",
    "entity_location": "data",
    "override_data": "msg",
    "x": 350,
    "y": 340,
    "wires": [
      [
        "df05f8b6.c5b2c8"
      ]
    ]
  },
  {
    "id": "3130f9b2.b7d8e6",
    "type": "api-current-state",
    "z": "84f180cb.a8a24",
    "name": "Automation Enabled?",
    "server": "a898e79c.9c2fe8",
    "version": 3,
    "outputs": 2,
    "halt_if": "true",
    "halt_if_type": "bool",
    "halt_if_compare": "is",
    "entity_id": "input_boolean.living_room_a_c_automation",
    "state_type": "habool",
    "blockInputOverrides": false,
    "outputProperties": [],
    "for": 0,
    "forType": "num",
    "forUnits": "minutes",
    "override_topic": false,
    "state_location": "payload",
    "override_payload": "msg",
    "entity_location": "data",
    "override_data": "msg",
    "x": 880,
    "y": 460,
    "wires": [
      [
        "94957e7c.42cc48"
      ],
      []
    ]
  },
  {
    "id": "2cd9c756.6c41b",
    "type": "api-current-state",
    "z": "84f180cb.a8a24",
    "name": "Automation Enabled?",
    "server": "a898e79c.9c2fe8",
    "version": 3,
    "outputs": 2,
    "halt_if": "true",
    "halt_if_type": "bool",
    "halt_if_compare": "is",
    "entity_id": "input_boolean.living_room_a_c_automation",
    "state_type": "habool",
    "blockInputOverrides": false,
    "outputProperties": [],
    "for": 0,
    "forType": "num",
    "forUnits": "minutes",
    "override_topic": false,
    "state_location": "payload",
    "override_payload": "msg",
    "entity_location": "data",
    "override_data": "msg",
    "x": 1000,
    "y": 700,
    "wires": [
      [
        "3eaa15f9.751e42"
      ],
      []
    ]
  },
  {
    "id": "164790595b741e24",
    "type": "debug",
    "z": "84f180cb.a8a24",
    "name": "",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "true",
    "targetType": "full",
    "statusVal": "",
    "statusType": "auto",
    "x": 450,
    "y": 80,
    "wires": []
  },
  {
    "id": "a898e79c.9c2fe8",
    "type": "server",
    "name": "Home Assistant",
    "version": 2,
    "addon": true,
    "rejectUnauthorizedCerts": true,
    "ha_boolean": "y|yes|true|on|home|open",
    "connectionDelay": true,
    "cacheJson": true,
    "heartbeat": false,
    "heartbeatInterval": 30
  }
]





















JSON Pretty Print - Privacy Policy

What I’m confused about is that call service node (id:94957e7c.42cc48) to turn off the a/c doesn’t rely on any data from previous nodes/payloads, except for the output that I use as the debug message, and according to that it’s clearly getting called.

What I also noticed is that it depends on the trigger than is used to start the flow. If input_number.living_room_a_c_setpoint (id: 41816963.dea82) is the trigger that’s when there’s an issue. But if the trigger is sensor.lumi_lumi_weather_5857b302_temperature (id:77fbdc52.17007c) then it generally seems to work fine.

If I change the input_number.living_room_a_c_setpoint manually in HA, the flow fires, including the toggle boolean node that is on the output of the troublesome call-service node. The boolean flips as intended, the debug says the turn AC off call-service node was run, but the device itself doesn’t turn off.

The call service node settings, even if not expecting a variable, can be overridden by the incoming message. Adjust the output options on the problematic trigger.

I think I see your problem now that I have the flow loaded, you’re sending a number as a string.

image

JSON shows the red error window if you leave out the quotes. Use j;expression with

{"temperature": payload }