node-red-contrib-home-assistant-websocket icon indicating copy to clipboard operation
node-red-contrib-home-assistant-websocket copied to clipboard

call_service node output properties

Open dgthomson opened this issue 1 year ago • 1 comments

Describe the bug

The sent data call_service node output properties aren't respected and are omitted from msg.

To Reproduce

Simple flow enclosed which is an inject node, a call-service node and a debug node.

The call-service node is set as follows:

domain switch service turn_on entity [entity] Output properties msg.payload sent data msg.test moocow

Expected behavior

I expect to get a complete msg payload like...

{ "_msgid": "9c65388168b28e40", "payload": "[sent data]", "test": "moocow" }

Instead I get...

{ "_msgid": "9c65388168b28e40", "test": "moocow" }

Screenshots

No response

Example Flow

[
    {
        "id": "d694245e3ea6a055",
        "type": "inject",
        "z": "b32fac405d124132",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 248,
        "y": 616,
        "wires": [
            [
                "2ae53bc5ac3c1f14"
            ]
        ]
    },
    {
        "id": "2ae53bc5ac3c1f14",
        "type": "api-call-service",
        "z": "b32fac405d124132",
        "name": "",
        "server": "272cfc8b.74dfb4",
        "version": 5,
        "debugenabled": false,
        "domain": "switch",
        "service": "turn_off",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "switch.door_alert_arm"
        ],
        "data": "",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "data"
            },
            {
                "property": "test",
                "propertyType": "msg",
                "value": "moocow",
                "valueType": "str"
            }
        ],
        "queue": "none",
        "x": 416,
        "y": 616,
        "wires": [
            [
                "027e5b6aca67ec22"
            ]
        ]
    },
    {
        "id": "027e5b6aca67ec22",
        "type": "debug",
        "z": "b32fac405d124132",
        "name": "debug 11",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 592,
        "y": 616,
        "wires": []
    }
]

Environment Information

Confirmed in 2 NodeRED environments connecting to the same Home Assistant

Version: 0.64.0

Home Assistant version: 2024.4.4 Companion version: 3.1.5

Node-RED version: 3.1.9 Docker: yes Add-on: no

Node.js version: v16.20.2 arm linux OS: Linux 5.10.103-v7+ arm

Version: 0.64.0

Home Assistant version: 2024.4.4 Companion version: 3.1.5

Node-RED version: 3.1.9 Docker: yes Add-on: no

Node.js version: v16.20.2 arm64 linux OS: Linux 6.5.0-1020-oracle arm64

Additional context

No response

dgthomson avatar Apr 28 '24 12:04 dgthomson

Looks like it has been broken for a while or never worked as intended.

Instead of outputting sent data it outputs the data field.

zachowj avatar Apr 28 '24 13:04 zachowj

Had this issue today and found the solution.

You can get the results of a service call as output by adding an output property and setting it to results, or the sent data by setting an output property to sent data. Property

The result will then be found in whatever variable you chose like this: Output

Schonke avatar Jul 20 '24 22:07 Schonke

fixed 30b15a7a22ae69a7df6c2db8d71b3d74ded24354

zachowj avatar Aug 11 '24 08:08 zachowj