Sorry for very basic question. I have a function node that generates a list of media_players that audio should be played on. I want to pass that variable onto the "group_members" attribute in the media_player service.
I know this doesn't work but it's basically what I want to do.
FUNCTION NODE
msg.speakers = "media_player.bathroom, media_player.family_room";
I've also tried an array:
msg.speakers = ["media_player.bathroom", "media_player.family_room"];
CALL SERVICE NODE
domain: media_player
service: join
Data:{"group_members":"{{ speakers }}" }
This "hard-coded" way below works but I want to be able to pass it as a variable. What do I need to do?
Data:
{"group_members":["media_player.bathroom", "media_player.family_room"]}
Here is my flow:
[{"id":"41c32b4e.1038e4","type":"api-call-service","z":"d9abccab.6dc37","name":"","server":"c4f9e6a2.5aace8","version":3,"debugenabled":false,"service_domain":"media_player","service":"join","entityId":"","data":"{\"group_members\":\" {{ speakers }} \"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2300,"y":960,"wires":[[]]},{"id":"48319116.f1a9e","type":"inject","z":"d9abccab.6dc37","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1910,"y":940,"wires":[["4832002c.ec4f5"]]},{"id":"4832002c.ec4f5","type":"function","z":"d9abccab.6dc37","name":"","func":"msg.speakers = [\"media_player.family_room\", \"media_player.guest_bathroom\"];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2090,"y":960,"wires":[["41c32b4e.1038e4"]]},{"id":"c4f9e6a2.5aace8","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]