Need help with home assistant call service

I'm setting up a flow that will put our phones in do not disturb mode under certain conditions.

I've got this flow that works fine:

[
    {
        "id": "4b8921974ed0e3a5",
        "type": "api-call-service",
        "z": "04a973f84921075e",
        "name": "angie priority 0nly",
        "server": "605a747493ca4dcf",
        "version": 3,
        "debugenabled": false,
        "service_domain": "notify",
        "service": "mobile_app_nokia_g10",
        "entityId": "",
        "data": "{\t   \"message\":\"command_dnd\",\t   \"title\":\"priority_only\"\t}",
        "dataType": "jsonata",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1550,
        "y": 300,
        "wires": [
            []
        ]
    },
    {
        "id": "dd247ea53d74ca25",
        "type": "api-call-service",
        "z": "04a973f84921075e",
        "name": "angie off",
        "server": "605a747493ca4dcf",
        "version": 3,
        "debugenabled": false,
        "service_domain": "notify",
        "service": "mobile_app_nokia_g10",
        "entityId": "",
        "data": "{\t   \"message\":\"command_dnd\",\t   \"title\":\"off\"\t}",
        "dataType": "jsonata",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1520,
        "y": 380,
        "wires": [
            []
        ]
    },
    {
        "id": "6559b7cb4ff92bb4",
        "type": "inject",
        "z": "04a973f84921075e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 1360,
        "y": 300,
        "wires": [
            [
                "4b8921974ed0e3a5"
            ]
        ]
    },
    {
        "id": "2538fd7f194e0579",
        "type": "inject",
        "z": "04a973f84921075e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 1360,
        "y": 380,
        "wires": [
            [
                "dd247ea53d74ca25"
            ]
        ]
    },
    {
        "id": "605a747493ca4dcf",
        "type": "server",
        "name": "Home Assistant",
        "version": 2,
        "addon": false,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": true,
        "heartbeatInterval": "30"
    }
]

What I want to achieve is having just one call service node with several inputs, all of which will have a different data field, I can't figure out how to do this though.

Any help is greatly appreciated.

As you are using JSONata in the HA nodes you could do something like

{
   "message":"command_dnd",
   "title": $$.payload
}

then if you feed in msg.payload set to a string "priority_only" or any other command. You could do similar with the message string to.

I do not use HA so this my best guess.

1 Like

spot-on, just what I needed.

Thanks

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