zachowj / hass-node-red

Companion Component for node-red-contrib-home-assistant-websocket to help integrate Node-RED with Home Assistant Core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calls to RED.util.evaluateJSONataExpression must include a callback.

Jizar07 opened this issue · comments

Describe the bug

TTS from Google say and notification from Alexa is no longer working

[error] [api-call-service:Google Notification] Calls to RED.util.evaluateJSONataExpression must include a callback. [error] [api-call-service:TTS] Calls to RED.util.evaluateJSONataExpression must include a callback.

To Reproduce

create any flow that has tts

Expected behavior

for google minis or echos device to tts

Screenshots

image

Example Flow

[
    {
        "id": "a682878db590c68b",
        "type": "inject",
        "z": "1861f8b587c855bd",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 600,
        "y": 880,
        "wires": [
            [
                "3a90be4bfeef89a4"
            ]
        ]
    },
    {
        "id": "c6bb0562ba448a3b",
        "type": "debug",
        "z": "1861f8b587c855bd",
        "name": "debug 16",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1140,
        "y": 880,
        "wires": []
    },
    {
        "id": "3a90be4bfeef89a4",
        "type": "api-current-state",
        "z": "1861f8b587c855bd",
        "name": "Daily Usage",
        "server": "f4db5f8a.2b88a",
        "version": 3,
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "num",
        "halt_if_compare": "is",
        "entity_id": "sensor.daily_usage",
        "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": 770,
        "y": 880,
        "wires": [
            [
                "b7235277c729978d"
            ]
        ]
    },
    {
        "id": "b7235277c729978d",
        "type": "function",
        "z": "1861f8b587c855bd",
        "name": "function 5",
        "func": "const today = new Date();\nconst month = today.getMonth();\nconst day = today.getDate();\n\nlet totalUsage = context.global.get(\"totalUsage\") || 0; // get stored usage or initialize\n\n// Reset on 10th of each month\nif (day === 10) {\n  totalUsage = 0;\n}\n\n// Get daily usage from msg.payload (replace with your actual usage node)\nconst dailyUsage = msg.payload;\ntotalUsage += dailyUsage;\n\ncontext.global.set(\"totalUsage\", totalUsage);  // store total usage\n\nconst cost = totalUsage * 0.13;  // multiply by cost per kWh\n\nmsg.payload = {\n  \"totalUsage\": totalUsage,\n  \"cost\": cost.toFixed(2)  // format cost to 2 decimal places\n};\n\nreturn msg;\n",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 960,
        "y": 880,
        "wires": [
            [
                "c6bb0562ba448a3b",
                "134c08f129ffe0fe"
            ]
        ]
    },
    {
        "id": "134c08f129ffe0fe",
        "type": "api-call-service",
        "z": "1861f8b587c855bd",
        "name": "Google Notification",
        "server": "f4db5f8a.2b88a",
        "version": 5,
        "debugenabled": false,
        "domain": "tts",
        "service": "cloud_say",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "media_player.google_mini"
        ],
        "data": "{\t    \"message:\" : \"Your Montly usage is \" & payload.totalUsage & \" \" & Kilowatthour & \", thats around  $\" & payload.cost & \" of energy so far!\"\t}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "str"
            }
        ],
        "queue": "none",
        "x": 1170,
        "y": 920,
        "wires": [
            []
        ]
    },
    {
        "id": "f4db5f8a.2b88a",
        "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": "at: ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "h23",
        "statusTimeFormat": "h:m",
        "enableGlobalContextStore": true
    }
]

Environment Information

not working

Additional context

No response

Guessing your Home Assistant nodes is an older version. Check the palette manager in Node-RED.

Thank you... That fixed the problem!!!