I am trying to setup a script for turning on my TV and automatically switching it to a specific media source.
In order to allow the TV to boot properly before being able to switch to a media source, my script has a 20 second pause before switching the source.
Unfortunately when the select_source service is invoked, I get the following error on the log file:
Traceback (most recent call last):
File “/usr/lib/python3.4/asyncio/tasks.py”, line 233, in _step
result = coro.throw(exc)
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/core.py”, line 1054, in _event_to_service_call
yield from service_handler.func(service_call)
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/media_player/init.py”, line 364, in async_service_handler
yield from getattr(player, method[‘method’])(**params)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/media_player/webostv.py”, line 290, in select_source
self._current_source_id = self._source_list[source][‘id’]
KeyError: ‘smartshare’
I even tried to turn on the TV on a scene and deal with the source switch afterwards, as seen in my script:
scene
- name: Movie Time Scene
emulated_hue_name: Movie Time Scene Xpto
entities:
media_player.tv:
state: on
script:
activate_movie_time:
alias: Movie Time
sequence:
- service: scene.turn_on
entity_id: scene.movie_time_scene
- delay:
seconds: 20
- service: media_player.select_source
data:
entity_id: media_player.tv
source: smartshare
The TV is turned on, but the source is not modified. Nonetheless, if I run the script when the TV is on, it works as it should.
BTW, I’m using the webostv implementation of the media_player (it is a 2015 LG smart TV).
Any clues about this issue?