Apple TV Integration - tvOS 15 Beta

Hi, i have the following error, i also delete in config_entries, but still the same after reboot, can you help me?

Logger: homeassistant
Source: config_entries.py:740
First occurred: 7:40:29 AM (10 occurrences)
Last logged: 7:41:08 AM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/loader.py”, line 566, in get_platform
cache[full_name] = self._import_platform(platform_name)
File “/usr/src/homeassistant/homeassistant/loader.py”, line 583, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
File “/usr/local/lib/python3.9/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1030, in _gcd_import
File “”, line 1007, in _find_and_load
File “”, line 972, in _find_and_load_unlocked
File “”, line 228, in _call_with_frames_removed
File “”, line 1030, in _gcd_import
File “”, line 1007, in _find_and_load
File “”, line 986, in _find_and_load_unlocked
File “”, line 680, in _load_unlocked
File “”, line 850, in exec_module
File “”, line 228, in _call_with_frames_removed
File “/usr/src/homeassistant/homeassistant/components/apple_tv/init.py”, line 6, in
from pyatv import connect, exceptions, scan
File “/usr/local/lib/python3.9/site-packages/pyatv/init.py”, line 24, in
from pyatv.protocols import PROTOCOLS
File “/usr/local/lib/python3.9/site-packages/pyatv/protocols/init.py”, line 10, in
from pyatv.protocols import airplay as airplay_proto
File “/usr/local/lib/python3.9/site-packages/pyatv/protocols/airplay/init.py”, line 28, in
from pyatv.protocols import mrp
File “/usr/local/lib/python3.9/site-packages/pyatv/protocols/mrp/init.py”, line 56, in
from pyatv.protocols.mrp import messages, protobuf
File “/usr/local/lib/python3.9/site-packages/pyatv/protocols/mrp/messages.py”, line 8, in
from pyatv.protocols.mrp import protobuf
File “/usr/local/lib/python3.9/site-packages/pyatv/protocols/mrp/protobuf/init.py”, line 6, in
from .ProtocolMessage_pb2 import ProtocolMessage
File “/usr/local/lib/python3.9/site-packages/pyatv/protocols/mrp/protobuf/ProtocolMessage_pb2.py”, line 21, in
_ERRORCODE = DESCRIPTOR.message_types_by_name[‘ErrorCode’]
AttributeError: ‘NoneType’ object has no attribute ‘message_types_by_name’

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

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 733, in async_create_flow
integration.get_platform(“config_flow”)
File “/usr/src/homeassistant/homeassistant/loader.py”, line 575, in get_platform
raise ImportError(
ImportError: Exception importing homeassistant.components.apple_tv.config_flow

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/discovery_flow.py”, line 74, in async_process_pending_flows
await gather_with_concurrency(
File "/usr/src/homeassistant/homeassistant/util/async
.py", line 185, in gather_with_concurrency
return await gather(
File “/usr/src/homeassistant/homeassistant/util/async_.py”, line 183, in sem_task
return await task
File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 203, in async_init
flow, result = await task
File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 221, in _async_init
flow = await self.async_create_flow(handler, context=context, data=data)
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 740, in async_create_flow
raise data_entry_flow.UnknownHandler
homeassistant.data_entry_flow.UnknownHandler

and also

This error originated from a custom integration.

Logger: homeassistant.loader
Source: custom_components/apple_tv/init.py:6
Integration: Apple TV
First occurred: 7:52:35 AM (259 occurrences)
Last logged: 8:15:10 AM

Unexpected exception importing platform custom_components.apple_tv.config_flow
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/loader.py”, line 566, in get_platform
cache[full_name] = self._import_platform(platform_name)
File “/usr/src/homeassistant/homeassistant/loader.py”, line 583, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
File “/usr/local/lib/python3.9/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1030, in _gcd_import
File “”, line 1007, in _find_and_load
File “”, line 972, in _find_and_load_unlocked
File “”, line 228, in _call_with_frames_removed
File “”, line 1030, in _gcd_import
File “”, line 1007, in _find_and_load
File “”, line 986, in _find_and_load_unlocked
File “”, line 680, in _load_unlocked
File “”, line 850, in exec_module
File “”, line 228, in _call_with_frames_removed
File “/config/custom_components/apple_tv/init.py”, line 6, in
from pyatv import connect, exceptions, scan
File “/usr/local/lib/python3.9/site-packages/pyatv/init.py”, line 24, in
from pyatv.protocols import PROTOCOLS
File “/usr/local/lib/python3.9/site-packages/pyatv/protocols/init.py”, line 10, in
from pyatv.protocols import airplay as airplay_proto
File “/usr/local/lib/python3.9/site-packages/pyatv/protocols/airplay/init.py”, line 28, in
from pyatv.protocols import mrp
File “/usr/local/lib/python3.9/site-packages/pyatv/protocols/mrp/init.py”, line 56, in
from pyatv.protocols.mrp import messages, protobuf
File “/usr/local/lib/python3.9/site-packages/pyatv/protocols/mrp/messages.py”, line 8, in
from pyatv.protocols.mrp import protobuf
File “/usr/local/lib/python3.9/site-packages/pyatv/protocols/mrp/protobuf/init.py”, line 6, in
from .ProtocolMessage_pb2 import ProtocolMessage
File “/usr/local/lib/python3.9/site-packages/pyatv/protocols/mrp/protobuf/ProtocolMessage_pb2.py”, line 21, in
_ERRORCODE = DESCRIPTOR.message_types_by_name[‘ErrorCode’]
AttributeError: ‘NoneType’ object has no attribute ‘message_types_by_name’

You have some other (custom integration) that depends on an old version of protobuf. The diagnostics might help you finding it.

Can you please tell me how?

Sorry if this is a stupid Q :slight_smile:
I had this working before but with the latest HA update I went back and tried the internal integration but I found that my Homepod was missing so I removed everything and re-installed the plugin.

But I think the latest upgrade of my Homepod broke the integration?
Apple TV works fine?
Homepod sw: 15.3

Trying to add Homepod with Apple TV Beta HAC 3.01
I keep getting this error:





image

I have tried removing all trace of the old setup from the core.config_entries and done multiple reboots?
Any input is much appreciated! (Lessons learned if it works done mess with it!)

This beta was passed onto the latest HA release. Uninstall this beta, restart HA and let it auto discover. No need for the beta anymore. It’s even in the release notes. :slight_smile:

You need to go into the Home app and change access settings for speakers and televisions to “Everyone on the same network”. Should work after that.

1 Like

The new Version works great, an my HomePod Mini’s are all discovered and shows what is playing currently.

Is there a way to control and start playlists / radio stations from apple music on the Homepod with Home Assistant?

No, currently not. I have not managed to figure out how that works (yet).

2 Likes

That did the trick but after adding my Apple TV and my Homepod I cant edit any of the fields (Cant even close the settings window) I have done a reboot and adding the devices works but I normally name all my devices by room - device - item

It is like its “read only”

@postlund - I have been patiently waiting for this integrated release of your AppleTV integration for tvOS15. I just upgraded my Home Assistant to 2022.2.2 and all of my AppleTVs have been automatically discovered. I just configured my main family room AppleTV4K(2021) and everything went great.

Thank you so much for all of your hard work on this integration!

1 Like

What is the integration good for? Just to play/pause playback?

Playback controls, navigation (up, left, menu, etc), metadata, artwork, app listing and launching and streaming audio (local and remote file) via AirPlay (works with TTS).

1 Like

Ah ok. How do I use tts?

You either click the three dots on the media player in the fronted and use the ui from there. Or you use any of the services in the tts component, e.g. tts.google_translate_say.

Does this also apply to airport express gen 2? I can’t get volume and tts working. :slight_smile:

Yes, TTS should work (check the logs). Volume will only work for whatever you are steaming to it in Home Assistant (like when using TTS). You can’t change volume (or anything else for that matter) when someone else is streaming. That’s a limitation in AirPlay.

My ATV integration stopped working recently. I’m not sure when this happened. I removed device and when I try to add it again, it doesn’t show up in the list. Not only that, but trying to add it with the static IP address of the Apple TV does not work either.

I’ve tried multiple restarts of both Home Assistant and the Apple TV. Double checked the IP address and tried it both with and without the beta integration in HACS. I also tried to log it, but nothing shows up in the logs. Not even without the “default: warn” disabled (holy shit there are a lot of log entries when that’s disabled!).

I know it’s hard to troubleshoot this without logs, but does any of you have an idea what’s going on? I use HA Core with Docker, without net-host, but that has never caused any problems before…

I tried it with and without the beta integration (installed with HACS).

If you’re on the latest HA core version then you don’t need the HACS beta integration anymore. It’s been added to the native integration now.

Try removing the HACS beta, then restart HA and see if it auto-discovers. If not, then try adding it manually via the devices/integrations page.

Thanks for your reply! Yes, I’m aware of that. But I tried it with and without the HACS beta integration, just to be sure. Apologies if that wasn’t clear in my previous post.

Didn’t work either way though. I currently have it uninstalled and discovery nor adding it manually works. Really odd.

When you add it manually, what message do you get?