I am trying to make an “enque” button, that queues a video on my chromecast.
i can get it worknig with “static” video id. but i would like to get the video id from a text_input helper.
This is a working button service call:
# This button works fine. but is not dynamic.
type: button
tap_action:
action: call-service
service: media_player.play_media
service_data:
media_content_type: cast
media_content_id: >
{"app_name": "youtube","enqueue": "true","media_id": "5qap5aO4i9A"}
target:
entity_id: media_player.tv_tv
icon: mdi:animation-play
name: Add video to queue
but this is not:
# This button gives this error:
# Failed to call service media_player/play_media. Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
type: button
tap_action:
action: call-service
service: media_player.play_media
service_data:
media_content_type: cast
media_content_id: >
{% set msg = { "app_name": 'youtube', 'enqueue': 'true', 'media_id': states('input_text.vidid') } %}
{{ msg|to_json }}
target:
entity_id: media_player.tv_tv
icon: mdi:animation-play
name: Add video to queue
the service call above does work in the developer tools (services):
# this works, and queues the video on the chromecast
service: media_player.play_media
target:
entity_id: media_player.tv_tv
data:
media_content_type: cast
media_content_id: >
{% set msg = { "app_name": 'youtube', 'enqueue': 'true', 'media_id': states('input_text.vidid') } %}
{{ msg|to_json }}
I have been checking my templates throughout the process in the developer tools, and they render to valid json strings.
But i get errors when trying to get the button working regardless.
so i am totally stuck as to why this won’t work.
Any help is greatly appreciated!
I havent been able to familiarize myself with the home assistant codebase yet, so maybe that’s my next step?