core: Apple TV not working properly anymore (websocket API)

The problem

I experience problems since I updated my Apple TV to the latest version (16.2 , 20K362) on my HA instance 2022.12.7. I tried to turn on and off Apple TV and got the below error message. It seems that something is not working anymore and I think its due to the update of Apple TV OS. I am not an expert and try to deliver as much information as I can. Nor a restart of HA or Apple TV helped.

What version of Home Assistant Core has the issue?

Home Assistant 2022.12.7

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

websocket_api, apple tv

Link to integration documentation on our website

No response

Diagnostics information

home-assistant_apple_tv_2022-12-20T12-20-17.220Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/apple_tv/media_player.py:397
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 12:49:32 (5 occurrences)
Last logged: 13:11:26

[547816021520] Command _hidC failed
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/locks.py", line 214, in wait
    await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
    return fut.result()
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/api.py", line 139, in _send_command
    resp = await self._protocol.exchange_opack(
  File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/protocol.py", line 157, in exchange_opack
    return await self._exchange_generic_opack(frame_type, data, identifier, timeout)
  File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/protocol.py", line 170, in _exchange_generic_opack
    unpacked_object = await self._queues[identifier].wait(timeout)
  File "/usr/local/lib/python3.10/site-packages/pyatv/support/collections.py", line 130, in wait
    await asyncio.wait_for(self._event.wait(), timeout)
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1745, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1782, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 943, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call
    await result
  File "/config/custom_components/apple_tv/media_player.py", line 397, in async_turn_on
    await self.atv.power.turn_on()
  File "/usr/local/lib/python3.10/site-packages/pyatv/core/facade.py", line 343, in turn_on
    await self.relay("turn_on", priority=self.OVERRIDE_PRIORITIES)(
  File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/__init__.py", line 191, in turn_on
    await self.api.hid_command(False, HidCommand.Wake)
  File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/api.py", line 234, in hid_command
    await self._send_command(
  File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/api.py", line 150, in _send_command
    raise exceptions.ProtocolError(f"Command {identifier} failed") from ex
pyatv.exceptions.ProtocolError: Command _hidC failed

Additional information

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.apple_tv Source: custom_components/apple_tv/init.py:166 Integration: Apple TV First occurred: 12:37:36 (13 occurrences) Last logged: 13:16:43

Connection lost to Apple TV “Apple TV 4K”


Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.apple_tv.media_player Source: custom_components/apple_tv/media_player.py:159 Integration: Apple TV First occurred: 13:16:48 (1 occurrences) Last logged: 13:16:48

Failed to update app list Traceback (most recent call last): File “/usr/local/lib/python3.10/asyncio/locks.py”, line 214, in wait await fut asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “/usr/local/lib/python3.10/asyncio/tasks.py”, line 456, in wait_for return fut.result() asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File “/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/api.py”, line 139, in _send_command resp = await self._protocol.exchange_opack( File “/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/protocol.py”, line 157, in exchange_opack return await self._exchange_generic_opack(frame_type, data, identifier, timeout) File “/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/protocol.py”, line 170, in _exchange_generic_opack unpacked_object = await self._queues[identifier].wait(timeout) File “/usr/local/lib/python3.10/site-packages/pyatv/support/collections.py”, line 130, in wait await asyncio.wait_for(self._event.wait(), timeout) File “/usr/local/lib/python3.10/asyncio/tasks.py”, line 458, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File “/config/custom_components/apple_tv/media_player.py”, line 159, in _update_app_list apps = await self.atv.apps.app_list() File “/usr/local/lib/python3.10/site-packages/pyatv/core/facade.py”, line 395, in app_list return await self.relay(“app_list”)() File “/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/init.py”, line 166, in app_list app_list = await self.api.app_list() File “/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/api.py”, line 230, in app_list return await self._send_command(“FetchLaunchableApplicationsEvent”, {}) File “/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/api.py”, line 150, in _send_command raise exceptions.ProtocolError(f"Command {identifier} failed") from ex pyatv.exceptions.ProtocolError: Command FetchLaunchableApplicationsEvent failed

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 19 (3 by maintainers)

Most upvoted comments

When i disable the Apple remote entity in the UI and enable it again, everything functions for a short while.

Schermafbeelding 2023-01-28 om 13 13 21 Schermafbeelding 2023-01-28 om 13 17 13 Schermafbeelding 2023-01-28 om 13 19 01

This is an ongoing issue. Constant disconnects and errors coming from this integration even with “Allow Access: Everyone” selected.

quick update, I deleted the custom_component and used the apple_tv integration from HA instead.

I still get this error and I can see in Node-RED that there es in error with the API.

Logger: homeassistant.components.websocket_api.http.connection Source: components/apple_tv/media_player.py:427 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 14:13:31 (1 occurrences) Last logged: 14:13:31

[547331592048] Command _hidC failed Traceback (most recent call last): File “/usr/local/lib/python3.10/asyncio/locks.py”, line 214, in wait await fut asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “/usr/local/lib/python3.10/asyncio/tasks.py”, line 456, in wait_for return fut.result() asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File “/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/api.py”, line 139, in _send_command resp = await self._protocol.exchange_opack( File “/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/protocol.py”, line 157, in exchange_opack return await self._exchange_generic_opack(frame_type, data, identifier, timeout) File “/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/protocol.py”, line 170, in _exchange_generic_opack unpacked_object = await self._queues[identifier].wait(timeout) File “/usr/local/lib/python3.10/site-packages/pyatv/support/collections.py”, line 130, in wait await asyncio.wait_for(self._event.wait(), timeout) File “/usr/local/lib/python3.10/asyncio/tasks.py”, line 458, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py”, line 200, in handle_call_service await hass.services.async_call( File “/usr/src/homeassistant/homeassistant/core.py”, line 1745, in async_call task.result() File “/usr/src/homeassistant/homeassistant/core.py”, line 1782, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File “/usr/src/homeassistant/homeassistant/helpers/entity_component.py”, line 213, in handle_service await service.entity_service_call( File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 678, in entity_service_call future.result() # pop exception if have File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 943, in async_request_call await coro File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 715, in _handle_entity_call await result File “/usr/src/homeassistant/homeassistant/components/apple_tv/media_player.py”, line 427, in async_turn_on await self.atv.power.turn_on() File “/usr/local/lib/python3.10/site-packages/pyatv/core/facade.py”, line 353, in turn_on await self.relay(“turn_on”, priority=self.OVERRIDE_PRIORITIES)( File “/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/init.py”, line 193, in turn_on await self.api.hid_command(False, HidCommand.Wake) File “/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/api.py”, line 234, in hid_command await self._send_command( File “/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/api.py”, line 150, in _send_command raise exceptions.ProtocolError(f"Command {identifier} failed") from ex pyatv.exceptions.ProtocolError: Command _hidC failed

Bildschirm­foto 2022-12-23 um 14 13 33

home-assistant_apple_tv_2022-12-23T13-16-44.876Z.log