I have trouble to reconnect my Apple TV 4 TvOS 15. I have upgraded to latest Beta and removed all entities related that i can find and also removed pytv as remote on the apple tv. My Apple TV 3 paires without a problem.
i get this:
2021-10-24 12:22:55 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 151, in async_init
flow, result = await task
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 177, in _async_init
result = await self._async_handle_step(flow, flow.init_step, data, init_done)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 256, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File "/config/custom_components/apple_tv/config_flow.py", line 165, in async_step_zeroconf
return await self.async_find_device_wrapper(self.async_found_zeroconf_device)
File "/config/custom_components/apple_tv/config_flow.py", line 225, in async_find_device_wrapper
return await next_func()
File "/config/custom_components/apple_tv/config_flow.py", line 203, in async_found_zeroconf_device
await self.async_set_unique_id(self.device_identifier)
File "/config/custom_components/apple_tv/config_flow.py", line 105, in device_identifier
if identifier in entry.data[CONF_IDENTIFIERS]:
KeyError: 'identifiers'
2021-10-24 12:23:04 ERROR (MainThread) [custom_components.apple_tv] Failed to connect
Traceback (most recent call last):
File "/config/custom_components/apple_tv/__init__.py", line 259, in _connect_loop
conf = await self._scan()
File "/config/custom_components/apple_tv/__init__.py", line 290, in _scan
identifiers = set(self.config_entry.data[CONF_IDENTIFIERS])
KeyError: 'identifiers'
pyatv.exceptions.PairingError: HTTP/1.1 method POST failed with code 470: Connection Authorization Required
2021-10-24 20:36:13 ERROR (MainThread) [custom_components.apple_tv.config_flow] Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/apple_tv/config_flow.py", line 323, in async_pair_next_protocol
await self.pairing.begin()
File "/usr/local/lib/python3.9/site-packages/pyatv/protocols/dmap/pairing.py", line 97, in begin
await self._publish_service(ipaddr, port)
File "/usr/local/lib/python3.9/site-packages/pyatv/protocols/dmap/pairing.py", line 125, in _publish_service
await mdns.publish(
File "/usr/local/lib/python3.9/site-packages/pyatv/core/mdns.py", line 546, in publish
await loop.run_in_executor(None, zconf.register_service, zsrv)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.9/site-packages/zeroconf/_core.py", line 559, in register_service
run_coro_with_timeout(
File "/usr/local/lib/python3.9/site-packages/zeroconf/_utils/asyncio.py", line 95, in run_coro_with_timeout
return asyncio.run_coroutine_threadsafe(aw, loop).result(
File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 445, in result
return self.__get_result()
File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 390, in __get_result
raise self._exception
File "/usr/local/lib/python3.9/site-packages/zeroconf/_utils/asyncio.py", line 89, in await_awaitable
task = await aw
File "/usr/local/lib/python3.9/site-packages/zeroconf/_core.py", line 587, in async_register_service
await self.async_check_service(info, allow_name_change, cooperating_responders)
File "/usr/local/lib/python3.9/site-packages/zeroconf/_core.py", line 732, in async_check_service
raise NonUniqueNameException
zeroconf._exceptions.NonUniqueNameException
I have successfully installed the integration via HACS. I am unsure what I am supposed to do next. Should my AppleTV’s auto-populate on my normal integrations page? (Do I need to wipe my old AppleTV integrations beforehand?)
Yes, they should auto-populate as usual. If they don’t, you probably have old entries left. It’s easiest to just remove them manually from .storage/core.config_entries for now. I’m gonna try to make an update to the integration soon and bump config entry version so they don’t load at all, which should easier. I’m not sure how to do this properly yet as there is no migration path in this case.
Thanks, clearing the old entities from my ./storage directory worked.
I did initially get a series of errors (see past edit history of this comment for more information). Some series of restarts and updating to tvOS 15.1 kicked the fix into action. My AppleTV now correctly show its status in Home Assistant. Rock on!
I’ve just installed last 1.7 beta version and it isn’t working
this is from the logs:
Logger: homeassistant.setup
Source: setup.py:178
First occurred: 21:02:58 (1 occurrences)
Last logged: 21:02:58
Setup failed for apple_tv: Unable to import component: cannot import name 'ATTR_CONNECTIONS' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)
I reverted to 1.6 and added two Apple TVs (Apple TV 4K, Apple TV 4K second generation). I was able to call media_player.media_play_pause on the 2nd gen, but couldn’t get remote.send_command to work on either device. After a short while, the media_player calls stopped working on the 2nd gen.
I don’t see anything in the logs when I run commands via Developer Tools. I assume it’s because HA is unable to discover the Living Room Apple TV. It only finds the Office Apple TV.
2021-10-28 16:03:15 DEBUG (MainThread) [custom_components.apple_tv] Starting connect loop
2021-10-28 16:03:15 DEBUG (MainThread) [custom_components.apple_tv] Discovering device Office Apple TV
2021-10-28 16:03:16 DEBUG (MainThread) [custom_components.apple_tv] Connecting to device Office Apple TV
2021-10-28 16:03:17 DEBUG (MainThread) [custom_components.apple_tv] Changing address to 192.168.86.XXX
2021-10-28 16:03:17 DEBUG (MainThread) [custom_components.apple_tv] Connect loop ended