Disconnected nodes issue

I have a few nodes that do the following:
Read the temp from the Solis inverter, then compare this temp with a preset temperature and if it’s too hot turn on a switch (fan) and then it’s cooled… turn off the fan.

I also have a “tolerance” input… to give me a variable temperature tolerance so the fan doesn’t go on and back off again.
eg: if it’s 40C then don’t turn on fan until it reaches 41C and then turn off when at 39C.

This works ewll when Node-Red behaves… but recently I’m seeing the nodes show “disconnected” in NR.
But in HA the sensors are fine…

Any ideas what’s going on… is NR losing connection to HA ?
Target Temp and Temp tolerance are “helpers” in HA.

Screenshot of it NOT working:

Here’s the code:

[
    {
        "id": "d193075c3ba4cccf",
        "type": "server-state-changed",
        "z": "e00a823001e5e9f9",
        "name": "Target Temp",
        "server": "e3697f1929e4c1bf",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "input_number.temperature_target",
        "entityidfiltertype": "exact",
        "outputinitially": true,
        "state_type": "num",
        "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": 110,
        "y": 160,
        "wires": [
            [
                "556b7e25434f8d4f"
            ]
        ]
    },
    {
        "id": "60fe48034f9b2e83",
        "type": "server-state-changed",
        "z": "e00a823001e5e9f9",
        "name": "Temp Tolerance",
        "server": "e3697f1929e4c1bf",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "input_number.temperature_tolerance",
        "entityidfiltertype": "exact",
        "outputinitially": true,
        "state_type": "num",
        "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": 120,
        "y": 240,
        "wires": [
            [
                "556b7e25434f8d4f"
            ]
        ]
    },
    {
        "id": "556b7e25434f8d4f",
        "type": "join",
        "z": "e00a823001e5e9f9",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": true,
        "timeout": "",
        "count": "3",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 370,
        "y": 240,
        "wires": [
            [
                "110be969afc910cd"
            ]
        ]
    },
    {
        "id": "c453f97017829253",
        "type": "api-call-service",
        "z": "e00a823001e5e9f9",
        "name": "",
        "server": "e3697f1929e4c1bf",
        "version": 5,
        "debugenabled": false,
        "domain": "switch",
        "service": "turn_on",
        "areaId": [],
        "deviceId": [
            "0e3827579840bed5a93e24b9505e88d7"
        ],
        "entityId": [
            "switch.solar_fan_socket_socket_1"
        ],
        "data": "",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 880,
        "y": 160,
        "wires": [
            [
                "f67201bd53744e76"
            ]
        ]
    },
    {
        "id": "712cf00532ebc528",
        "type": "api-call-service",
        "z": "e00a823001e5e9f9",
        "name": "",
        "server": "e3697f1929e4c1bf",
        "version": 5,
        "debugenabled": false,
        "domain": "switch",
        "service": "turn_off",
        "areaId": [],
        "deviceId": [
            "0e3827579840bed5a93e24b9505e88d7"
        ],
        "entityId": [
            "switch.solar_fan_socket_socket_1"
        ],
        "data": "",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 880,
        "y": 320,
        "wires": [
            [
                "f67201bd53744e76"
            ]
        ]
    },
    {
        "id": "f67201bd53744e76",
        "type": "debug",
        "z": "e00a823001e5e9f9",
        "name": "debug 1",
        "active": true,
        "tosidebar": true,
        "console": true,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 950,
        "y": 500,
        "wires": []
    },
    {
        "id": "110be969afc910cd",
        "type": "function",
        "z": "e00a823001e5e9f9",
        "name": "function 1",
        "func": "if (msg.payload[\"sensor.solis_inverter_temperature\"] > (msg.payload[\"input_number.temperature_target\"] + msg.payload[\"input_number.temperature_tolerance\"])){\n    return [msg, null];\n}\nelse if (msg.payload[\"sensor.solis_inverter_temperature\"] < (msg.payload[\"input_number.temperature_target\"] - msg.payload[\"input_number.temperature_tolerance\"])) {\n    return [null, msg];\n}",
        "outputs": 2,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 520,
        "y": 240,
        "wires": [
            [
                "7a2b909d93c2c705"
            ],
            [
                "88b19814b1c8035b"
            ]
        ]
    },
    {
        "id": "7a2b909d93c2c705",
        "type": "api-current-state",
        "z": "e00a823001e5e9f9",
        "name": "Switch State",
        "server": "e3697f1929e4c1bf",
        "version": 3,
        "outputs": 2,
        "halt_if": "off",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "switch.solar_fan_socket_socket_1",
        "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": 670,
        "y": 200,
        "wires": [
            [
                "c453f97017829253"
            ],
            []
        ]
    },
    {
        "id": "88b19814b1c8035b",
        "type": "api-current-state",
        "z": "e00a823001e5e9f9",
        "name": "Switch State",
        "server": "e3697f1929e4c1bf",
        "version": 3,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "switch.solar_fan_socket_socket_1",
        "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": 670,
        "y": 280,
        "wires": [
            [
                "712cf00532ebc528"
            ],
            []
        ]
    },
    {
        "id": "3c2a25f34f18e577",
        "type": "server-state-changed",
        "z": "e00a823001e5e9f9",
        "name": "Solis Internal Temperature",
        "server": "e3697f1929e4c1bf",
        "version": 4,
        "exposeToHomeAssistant": true,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "sensor.solis_inverter_temperature",
        "entityidfiltertype": "exact",
        "outputinitially": true,
        "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": 150,
        "y": 320,
        "wires": [
            [
                "556b7e25434f8d4f",
                "f67201bd53744e76"
            ]
        ]
    },
    {
        "id": "e3697f1929e4c1bf",
        "type": "server",
        "name": "Home Assistant",
        "version": 5,
        "addon": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": true,
        "heartbeatInterval": "30",
        "areaSelector": "friendlyName",
        "deviceSelector": "friendlyName",
        "entitySelector": "friendlyName",
        "statusSeparator": ": ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "default",
        "statusTimeFormat": "h:m",
        "enableGlobalContextStore": true
    }
]`Preformatted text`

I found that restarting the flows resolves the issue for a little while… then disconnected again.

Any update on this, I am having the same issues. Most sensors show disconnected, then re connect randomly.

I think it’s HA not Node red… but no fix as yet

Did you get anywhere with this? I have had the same issue for a year now. It occurs around once a week. In the NodeRed gui the trigger nodes show “disconnected” and every few seconds change to “running” for less then a second, then flick back to disconnected.

I am running NodeRed within HA, but had the same issue when NodeRed was a separate docker from HA.

A restart of NodeRed resolves the problem for a few days.