I am fairly new with all of this and I have come to a roadblock with my limited experience.
The idea is to have two input_selects, one to pick the location of the chromecast and one to pick a radio station to stream
My input-selects looks like this
radio_station:
name: Radio Station
options:
- "-"
- Hot108
- The Beat
initial: "-"
icon: mdi:radio
radio_station_location:
name: Radio Location
options:
- Kitchen
- Backyard
initial: "Kitchen"
icon: mdi:radio
and my radio automation looks like this:
alias: Radio
trigger:
platform: state
entity_id: input_select.radio_station
action:
- service: script.turn_on
data_template:
entity_id:
- service: media_player.play_media
data_template:
entity_id: >
{% if input_select.radio_station_location == 'Kitchen' %}
media_player.kitchen
{%-elif input_select.radio_station_location == 'Backyard' %}
media_player.backyard
{% endif %}
media_content_id: >
{% if input_select.radio_station == 'Hot108' %}
"http://jbmedia-edge1.cdnstream.com:80/hot108"
{%-elif input_select.radio_station == 'The Beat' %}
"http://live.leanstream.co/CKBTFM-MP3"
{% endif %}
media_content_type: 'audio/mp3'
- service: input_select.select_option
data:
entity_id: input_select.radio_station
option: "-"
and when I attempt to actually use it I see a large error:
17-02-26 11:08:27 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/template.py", line 99, in async_render
return self._compiled.render(kwargs).strip()
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "<template>", line 1, in top-level template code
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/jinja2/sandbox.py", line 385, in getattr
value = getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'input_select' is undefined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step
result = next(coro)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/automation/__init__.py", line 294, in async_trigger
yield from self._async_action(self.entity_id, variables)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/automation/__init__.py", line 376, in action
yield from script_obj.async_run(variables)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/script.py", line 117, in async_run
yield from self._async_call_service(action, variables)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/script.py", line 147, in _async_call_service
self.hass, action, True, variables, validate_config=False)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/service.py", line 88, in async_call_from_config
config[CONF_SERVICE_DATA_TEMPLATE]))
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/service.py", line 84, in _data_template_creator
for key, item in value.items()}
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/service.py", line 84, in <dictcomp>
for key, item in value.items()}
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/service.py", line 81, in _data_template_creator
return [_data_template_creator(item) for item in value]
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/service.py", line 81, in <listcomp>
return [_data_template_creator(item) for item in value]
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/service.py", line 84, in _data_template_creator
for key, item in value.items()}
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/service.py", line 84, in <dictcomp>
for key, item in value.items()}
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/service.py", line 84, in _data_template_creator
for key, item in value.items()}
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/service.py", line 84, in <dictcomp>
for key, item in value.items()}
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/service.py", line 86, in _data_template_creator
return value.async_render(variables)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/template.py", line 101, in async_render
raise TemplateError(err)
homeassistant.exceptions.TemplateError: UndefinedError: 'input_select' is undefined
I have hit a complete road block as to what the next step is.