Media_player: problem when selecting source

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?

I’m having the same problem. I get a the same error when trying to select my netflix source.

Any help would be great…

My script config:
netflix:
alias: ‘Netflix’
sequence:
- service: media_player.select_source
data:
entity_id: media_player.lg_oled_tv
source: netflix

Your spacing looks off but it could be fine - you need to paste it in highlight the text and click the code button - I’ll come back with the diagram later. It’s the button that looks like '</>'

Is your TV already on when you run that? When you turn your TV on and put it on Netflix what does it say in the dev panel is happening? Is source netflix, or NETFLIX or something else?

- service: media_player.turn_on
  entity_id: media_player.lg_oled_tv
- service: media_player.select_source
  data:
    entity_id: media_player.lg_oled_tv
    source: netflix