Describe the bug
When use an automation to turn on the media player or change the source, in the log of Home Assistant we see the error:
Update for media_player.skyq_salotto fails
and the source not change
To Reproduce
Steps to reproduce the behavior:
- Create an automation with an action that change the source
action:
- service: media_player.turn_on
entity_id: media_player.skyq_salotto
- delay: 00:00:25
- service: media_player.select_source
entity_id: media_player.skyq_salotto
data:
source: Sky_TG_24
- run the automation
- look in the logs of Home Assistant
- there will be several error of type:
Home Assistant WebSocket API
Update for media_player.skyq_salotto fails
If use the Services tools on the Development Tools, the source change work without error
Expected behavior
Change source with automation without error
Screenshots
![Schermata 2020-10-28 alle 16 29 38](https://user-images.githubusercontent.com/58476884/97458330-e1ade680-193a-11eb-9300-442a88d82df2.png)
![Schermata 2020-10-28 alle 16 30 51](https://user-images.githubusercontent.com/58476884/97458434-fab69780-193a-11eb-82f8-a84b8e4fe6bc.png)
Component versions
- SkyQ 2.4.4
- I think 2.4.3
Your configuration
YAML
Your configuration from the options dialogue
or
Your configuration.yaml
media_player:
- platform: skyq
name: SkyQ Salotto
host: 192.xxx.xxx.xxx
room: salotto
live_tv: True
generate_switches_for_channels: true
sources:
SkyAtlantic: '1,1,0'
RAI_1: '1,0,1'
RAI_2: '1,0,2'
Sky_TG_24: '1,0,0'
RAI_3: '1,0,3'
Sky_Uno: '1,0,8'
FOX: '1,1,2'
SkySport_24: '2.0.0'
SkySport_Uno: '2,0,1'
SkySport_SerieA: '2,0,2'
DAZN: '2,0,9'
Canale_5: '1,0,5'
Italia_1: '1,0,6'
Accendi: 'power'
Output of HA logs
Logger: homeassistant.components.websocket_api.http.connection.1591156944
Source: helpers/network.py:113
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 16:13:47 (1 occurrences)
Last logged: 16:13:47
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 138, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1335, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1370, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 470, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 655, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 507, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/homeassistant/scene.py", line 311, in async_activate
await async_reproduce_state(
File "/usr/src/homeassistant/homeassistant/helpers/state.py", line 106, in async_reproduce_state
await asyncio.gather(
File "/usr/src/homeassistant/homeassistant/helpers/state.py", line 100, in worker
await platform.async_reproduce_states( # type: ignore
File "/usr/src/homeassistant/homeassistant/components/media_player/reproduce_state.py", line 111, in async_reproduce_states
await asyncio.gather(
File "/usr/src/homeassistant/homeassistant/components/media_player/reproduce_state.py", line 70, in _async_reproduce_states
await call_service(SERVICE_TURN_ON, [])
File "/usr/src/homeassistant/homeassistant/components/media_player/reproduce_state.py", line 55, in call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1335, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1370, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 470, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 655, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 507, in _handle_entity_call
await result
File "/config/custom_components/skyq/media_player.py", line 369, in async_turn_on
await self.async_update()
File "/config/custom_components/skyq/media_player.py", line 352, in async_update
await self._async_updateCurrentProgramme()
File "/config/custom_components/skyq/media_player.py", line 468, in _async_updateCurrentProgramme
appImageUrl = await self._appImageUrl.async_getAppImageUrl(
File "/config/custom_components/skyq/utils.py", line 93, in async_getAppImageUrl
base_url = get_url(hass, allow_internal=False)
File "/usr/src/homeassistant/homeassistant/helpers/network.py", line 113, in get_url
raise NoURLAvailableError
homeassistant.helpers.network.NoURLAvailableError
Logger: homeassistant.helpers.entity
Source: helpers/network.py:120
First occurred: 14:01:15 (4 occurrences)
Last logged: 16:13:45
Update for media_player.skyq_salotto fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 469, in async_device_update
await self.async_update() # type: ignore
File "/config/custom_components/skyq/media_player.py", line 352, in async_update
await self._async_updateCurrentProgramme()
File "/config/custom_components/skyq/media_player.py", line 468, in _async_updateCurrentProgramme
appImageUrl = await self._appImageUrl.async_getAppImageUrl(
File "/config/custom_components/skyq/utils.py", line 93, in async_getAppImageUrl
base_url = get_url(hass, allow_internal=False)
File "/usr/src/homeassistant/homeassistant/helpers/network.py", line 80, in get_url
request_host = _get_request_host()
File "/usr/src/homeassistant/homeassistant/helpers/network.py", line 120, in _get_request_host
raise NoURLAvailableError
homeassistant.helpers.network.NoURLAvailableError
Additional context
Add any other context about the problem here.