Node-red error message

Hi,

I am trying to return to homeassistant a date,
here is the nodered flow :

[
    {
        "id": "625950af552cf8f3",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "91ada0aaf9b139d5",
        "type": "api-call-service",
        "z": "625950af552cf8f3",
        "name": "",
        "server": "11a90641.be375a",
        "version": 5,
        "debugenabled": false,
        "domain": "input_datetime",
        "service": "set_datetime",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "input_datetime.sba_echeance_date"
        ],
        "data": "{ \"date\" : \"{{ Date.parse(msg.sba_echeance)}}\"}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 340,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "0ff847984b24abda",
        "type": "inject",
        "z": "625950af552cf8f3",
        "name": "le 2022-05-19",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "sba_echeance",
                "v": "2022-05-25",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 110,
        "y": 120,
        "wires": [
            [
                "91ada0aaf9b139d5",
                "46e23037060b2e5f"
            ]
        ]
    },
    {
        "id": "4398e38709e3b3fa",
        "type": "comment",
        "z": "625950af552cf8f3",
        "name": "envoi date",
        "info": "",
        "x": 80,
        "y": 80,
        "wires": []
    },
    {
        "id": "46e23037060b2e5f",
        "type": "debug",
        "z": "625950af552cf8f3",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 290,
        "y": 160,
        "wires": []
    },
    {
        "id": "11a90641.be375a",
        "type": "server",
        "name": "Home Assistant",
        "version": 2,
        "addon": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": false,
        "cacheJson": false,
        "heartbeat": false,
        "heartbeatInterval": 30
    }
]```

**Here is the response :**

28/03/2022, 20:04:50node: 46e23037060b2e5fmsg : Object

object

_msgid: "1fda3381d1c8021f"

payload: 1648490690536

sba_echeance: "2022-05-25"

28/03/2022, 20:04:50node: 91ada0aaf9b139d5msg : string[76]

"Call-service error. Could not parse date for dictionary value @ data['date']"



Regards,
Bernard

This looks like a question that needs Home Assistant knowledge. Few, if any, here use HA, so you might be better asking in an HA forum.

I will get a try on HA forum.
Thanks.

The date input just requires the string no need to use Date.parse().
so

{ "date" : "{{msg.sba_echeance}}"}

should be all you need.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.