NodeRed - stuck on the runing state

Hi,

I have simple automation made in NodeRed.

The main assumption is to check the temperature on the Aqara sensor and then if the temperature is less or equal 20, set 23 degrees on the smart valve. If the temperature is higher than 20, valve has to be set to 20 degrees.

Unfortunately the automation is stuck on the first step, on the running status. If the automation will go forward, the temperatures are assigned wrongly - I mean HA is setting the 20 degrees instead of 23.

There is the json from the nodered:

kod nodered - Pastebin.com

Is anybody able to help me?

I think that this just that you have your service calls the wrong way around from the switch node output. Also, your service call is setting temperature to 26 when I believe you said you want 23.

Room temperature <= 20 → exit from top output → service call to set target temperature to 23
Room temperature >20 → exit from lower output → service call to set target temp to 20

Also:
I don’t think you need to specify all three of the area and the device and the entityID in the service call. Just one should do, ideally the entity.

Lastly:
This could be simplified - as the target temperature can be calculated and sent to the call service node directly. This removes the need for duplicate call services nodes, and indeed the switch node.

Here I’m doing the temperature setting in the event: state node using JSONata. This sets the msg.payload with the data object that you would otherwise set in the call service node.

I have set the event: state node so that the state type is number - the string gets turned into a number (I assume your temperature is a number).
If temperature (the entity.state) <= 20 then set data: target temperature to 23, otherwise to 20

{"data": {"temperature": $entity().state <= 20 ? 23 : 20}}

I would also set the event state change node to ignore current state unknown and unavailable, and personally also to output on connect.

I can’t test this out fully, but perhaps the following might work for you?
The ‘server config node’ has been removed - you just have to edit the node to reset this.

[
    {
        "id": "63e54f2b788a2bd5",
        "type": "server-state-changed",
        "z": "383f140bd7a133e3",
        "name": "Sprawdź temperaturę sypialnia",
        "server": "84a75071b624414a",
        "version": 5,
        "outputs": 1,
        "exposeAsEntityConfig": "",
        "entityId": "sensor.sypialnia_temperature",
        "entityIdType": "exact",
        "outputInitially": true,
        "stateType": "num",
        "ifState": "",
        "ifStateType": "num",
        "ifStateOperator": "is",
        "outputOnlyOnStateChange": true,
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": true,
        "ignoreCurrentStateUnavailable": true,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "{\"data\": {\"temperature\": $entity().state <= 20 ? 23 : 20}}",
                "valueType": "jsonata"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 450,
        "y": 1100,
        "wires": [
            [
                "a7cce39f851feade"
            ]
        ]
    },
    {
        "id": "a7cce39f851feade",
        "type": "api-call-service",
        "z": "383f140bd7a133e3",
        "name": "Ustaw 23",
        "server": "84a75071b624414a",
        "version": 5,
        "debugenabled": true,
        "domain": "climate",
        "service": "set_temperature",
        "areaId": [
            "sypialnia"
        ],
        "deviceId": [
            "8f7634ce4cc077d864f4ef19fb4815c1"
        ],
        "entityId": [
            "climate.glowica_sypialnia"
        ],
        "data": "",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 720,
        "y": 1100,
        "wires": [
            []
        ]
    }
]