I am able to have the script with constant id and cast it to my chromecast. I am trying to improve the script to take a parameterized youtube url. This script will be called from automation reading value from textbox. I am not sure how to get it work with templated variable.
My script
alias: Chromecast
fields:
youtube_id:
description: Id of the youtube video.
example: "QKae1k1BDdA"
sequence:
- target:
entity_id: media_player.chromecast
data:
media_content_type: cast
media_content_id: '{ "app_name": "youtube", "media_id": "{{youtube_id}}" }'
service: media_player.play_media
mode: single