I am trying to use input_text on a card to then trigger an echo to pay a song or an artist. I have this in node red for now, but may just make an automation. I find easier to debug in node red. I cannot get the input text msg.payload into the json for the play_media service… I know it is something simple I am missing in the Function Node or how the JSON{} works… any help please
Blockquote
[{“id”:“2a9c9088.7baf1”,“type”:“tab”,“label”:“Flow 1”,“disabled”:false,“info”:“”},{“id”:“2a9d12ee.e7eb2e”,“type”:“api-call-service”,“z”:“2a9c9088.7baf1”,“name”:“Echo”,“server”:“2a12269e.94634a”,“service_domain”:“media_player”,“service”:“play_media”,“data”:“{"entity_id":"media_player.tap"}”,“mergecontext”:“”,“output_location”:“payload”,“output_location_type”:“msg”,“x”:970,“y”:100,“wires”:[]},{“id”:“8a7111b0.3f192”,“type”:“inject”,“z”:“2a9c9088.7baf1”,“name”:“”,“topic”:“”,“payload”:“On”,“payloadType”:“str”,“repeat”:“”,“crontab”:“”,“once”:false,“onceDelay”:0.1,“x”:130,“y”:100,“wires”:[[“29bf545.ecb0aac”]]},{“id”:“29bf545.ecb0aac”,“type”:“api-current-state”,“z”:“2a9c9088.7baf1”,“name”:“Music Text”,“server”:“2a12269e.94634a”,“outputs”:1,“halt_if”:“”,“halt_if_type”:“str”,“halt_if_compare”:“is”,“override_topic”:false,“entity_id”:“input_text.music”,“state_type”:“str”,“state_location”:“payload”,“override_payload”:“msg”,“entity_location”:“data”,“override_data”:“msg”,“x”:310,“y”:100,“wires”:[[“ec76dac9.4c7dc8”]]},{“id”:“ec76dac9.4c7dc8”,“type”:“function”,“z”:“2a9c9088.7baf1”,“name”:“Format”,“func”:“var music = msg.payload \nvar message = ‘{"data": {"entity_id": "media_player.tap", "media_content_id":’ + music + ‘,"media_content_type": "AMAZON_MUSIC" }}’\n\nmsg.payload = message\n\nreturn msg;\n”,“outputs”:1,“noerr”:0,“x”:520,“y”:100,“wires”:[[“2db4af87.8639d”]]},{“id”:“2db4af87.8639d”,“type”:“json”,“z”:“2a9c9088.7baf1”,“name”:“”,“property”:“payload”,“action”:“”,“pretty”:false,“x”:770,“y”:100,“wires”:[[“2a9d12ee.e7eb2e”]]},{“id”:“2a12269e.94634a”,“type”:“server”,“z”:“”,“name”:“Home Assistant1”,“legacy”:false,“hassio”:true,“rejectUnauthorizedCerts”:true,“ha_boolean”:“y|yes|true|on|home|open”,“connectionDelay”:false}]