Node Red Call Service Node: media_player.join Problem

I’m having trouble configuring a Node Red Call Service Node that will join four Sonos speakers together. I believe I’ve configured the HA “Call Service Node” correctly - followed the example included within the node. Each time the node is triggered an error is received. My data field, based on the sample, reads as follows;

{"group_members":"- media_player.kitchen_sonos\n- media_player.breakfast_sonos\n- Media_player.livingroom_sonos\n- media_player.workshop_sonos\n"}

This format didn’t look right to me so I tried;

{
    "group_members": [
        "- media_player.kitchen_sonos\n",
        "- media_player.breakfast_sonos\n",
        "- Media_player.livingroom_sonos\n",
        "- media_player.workshop_sonos\n"
    ]
}

and;

{
    "group_members": [
        "- media_player.kitchen_sonos",
        "- media_player.breakfast_sonos",
        "- Media_player.livingroom_sonos",
        "- media_player.workshop_sonos"
    ]
}

No matter what I try, the following error appears;

HomeAssistantError: Entity ID - media_player.kitchen_sonos

  • media_player.breakfast_sonos
  • Media_player.livingroom_sonos
  • media_player.workshop_sonos
    is an invalid entity ID @ data[‘group_members’][0]

I looked at how a “call service” node is configured in an HA script. What I noticed is an Entity is identified. I tried making the “media_player.kitchen_sonos” an “Entity” in the Call Service Node. The configuration I’m working with is;

[{"id":"aefbfef0f6a6119e","type":"inject","z":"768d812a6012a3ed","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":1200,"wires":[["9138ad175830307b","859147d757527b5c"]]},{"id":"859147d757527b5c","type":"api-call-service","z":"768d812a6012a3ed","name":"Group Sonos Speakers","server":"fcf9b76b.256a88","version":5,"debugenabled":true,"domain":"media_player","service":"join","areaId":[],"deviceId":[],"entityId":["media_player.kitchen_sonos"],"data":"{\"group_members\":\"- media_player.breakfast_sonos\\n- Media_player.livingroom_sonos\\n- media_player.workshop_sonos\\n\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":930,"y":1200,"wires":[["5c91f7d0266ea9e5"]]},{"id":"fcf9b76b.256a88","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}]

Any assistance you could offer would be greatly appreciated.

I do not know what the service call require, but a minus in the beginning indicate a list and that should not have a , in the end.

If you want to figure out how it should be made, then use the GUI in the HA Developer tools to make the service call and when it works, then switch to YAML mode to see the settings.

Okay, so here are the YAML settings that work;

service: media_player.join
data:
  group_members:
    - media_player.breakfast_sonos
    - media_player.livingroom_sonos
    - media_player.workshop_sonos
target:
  entity_id: media_player.kitchen_sonos

How do I format these for the Node Red Service Call?

I’m able to set the target:, entity id: by using the “Entity” field. For the life of me I cannot figure out how to format the Data field. I thought this should work;

{  "group_members":    ["- media_player.breakfast_sonos    - media_player.livingroom_sonos    - media_player.workshop_sonos"]}

No way!

And, here’s the json that works

{
  "group_members": [
    "media_player.breakfast_sonos",
    "media_player.livingroom_sonos",
    "media_player.workshop_sonos"
  ]
}

It’s the hyphens that shouldn’t be present!

YEAH!!!