I want to create a webradio playing om my chromecast.
The links to the stations i want to play doesn’t end with .mp3
If i understand tis right i can’t send that kind of links from Home Assistant to chromecast.
The webradio is an input_select and i want to execute shell_command
I use pychromecast and pyhon-files to start my webradiostations.
input_select:
webradio:
name: Webradio
options:
- Inget spelas
- Bandit Rock
- Rockklassiker
initial: Inget spelas
The shell command.
shell_command:
python: python "{{cmd}}"
This is a woking automation.
automation:
- alias: test webradio
trigger:
platform: state
entity_id: input_select.webradio
to: "Rockklassiker"
action:
service: shell_command.python
data:
cmd: '/home/hass/.homeassistant/radio/rock_klass.py'
I can’t get this working. Can i use shell command like this?
- alias: test2 webradio
trigger:
platform: state
entity_id: input_select.webradio
action:
service: shell_command.python
data_template:
cmd: >
{% if is_state("input_select.webradio", "Bandit Rock") %}
'/home/hass/.homeassistant/radio/bandit.py'
{% elif is_state("input_select.webradio", "Rockklassiker") %}
'/home/hass/.homeassistant/radio/rock_klass.py'
{% else %}
none
{% endif %}