Is there a way to pass the value of an input_text or input_select value to the ADB command?
I’d like to pass a YouTube video ID from input_text and place that into the ADB command in an automation.
IE:
The automation would include:
service: androidtv.adb_command
data:
command: >-
{% if(true) %}
adb shell am start -a android.intent.action.VIEW -d
“YouTube{{ ‘states{input_text.youtube_selection’ }}”
{% endif %}
target:
entity_id: media_player.fire_tv_192_168_168_74
The input_text contains the YouTube id.
Alternatively, can I construct the command externally and just pass the whole command to the Service:ADBCommand?
Found a solution using scripts.
It turns out you cannot jinja in the command field of the adb_command service
For some reason, I can’t get the indented text to work properly when I paste the code.
script:
firetv_youtube:
alias: Play You Tube Clip
sequence:
service: >
{% if is_state(‘input_select.you_tube_clips’, ‘Ocean’) %} script.youtube_ocean
{% elif is_state(‘input_select.you_tube_clips’, ‘Jazz’) %} script.youtube_jazz
{% elif is_state(‘input_select.you_tube_clips’, ‘Sphere’) %} script.youtube_sphere
{% else %} script.you_tube_jazz
{% endif %}
youtube_sphere:
alias: YouTube Sphere
sequence:
service: androidtv.adb_command
data:
entity_id: “media_player.fire_tv_192_168_168_74”
command: >
am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d “https://www.youtube.com/watch?v=y1qDzW_yWko”
youtube_jazz:
alias: YouTube Jazz
sequence:
service: androidtv.adb_command
data:
entity_id: “media_player.fire_tv_192_168_168_74”
command: >
am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d “https://www.youtube.com/watch?v=Ei_9Uj4JQmU”
youtube_ocean:
alias: YouTube Ocean
sequence:
service: androidtv.adb_command
data:
entity_id: “media_player.fire_tv_192_168_168_74”
command: >
am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d “https://www.youtube.com/watch?v=mxS7dtpNces"[quote="dlemmink, post:2, topic:647131, full:true”]
Would still like a solution to passing an entity state to an adb_command