Node-Red cannot change helper in HA

Hello,

I made this Flow for testing (inject payload “3”, function-node convert to number, action-node should write it to HA-helper)

[
    {
        "id": "14a65c9e1077d2d8",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "777b263b71e0b421",
        "type": "debug",
        "z": "14a65c9e1077d2d8",
        "name": "Show Total Sum",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 380,
        "y": 80,
        "wires": []
    },
    {
        "id": "1b12bbf864ea7f1d",
        "type": "api-call-service",
        "z": "14a65c9e1077d2d8",
        "name": "heute",
        "server": "48453e273e9641c6",
        "version": 7,
        "debugenabled": false,
        "action": "number.set_value",
        "floorId": [],
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "counter.brum"
        ],
        "labelId": [],
        "data": "{   \"value\": $number(payload) }",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "blockInputOverrides": true,
        "domain": "number",
        "service": "set_value",
        "x": 350,
        "y": 120,
        "wires": [
            []
        ]
    },
    {
        "id": "e230544389dcf758",
        "type": "inject",
        "z": "14a65c9e1077d2d8",
        "name": "test",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "3",
        "payloadType": "num",
        "x": 150,
        "y": 200,
        "wires": [
            [
                "36412e946cd82735"
            ]
        ]
    },
    {
        "id": "36412e946cd82735",
        "type": "function",
        "z": "14a65c9e1077d2d8",
        "name": "function 1",
        "func": "msg.payload = Number(msg.payload);  // Stelle sicher, dass es eine Zahl ist\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 300,
        "y": 200,
        "wires": [
            [
                "777b263b71e0b421",
                "1b12bbf864ea7f1d"
            ]
        ]
    },
    {
        "id": "48453e273e9641c6",
        "type": "server",
        "name": "Home Assistant",
        "version": 5,
        "addon": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": 30,
        "areaSelector": "friendlyName",
        "deviceSelector": "friendlyName",
        "entitySelector": "friendlyName",
        "statusSeparator": ": ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "default",
        "statusTimeFormat": "h:m",
        "enableGlobalContextStore": true
    }
]


normally, Node-Red should write “3” in HA-helper “counter.brum”, but this does not happen.
Does anybody know what I can do to fix this?

Thanks.

Change the action from number.set_value to counter.set_value. You don’t need the function. The jsonata you have in the action node will cast the value to a number.