Apple TV Integration - tvOS 15 Beta

What version of Home Assistant do you have?

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.

You need to provide and kind of log or exact service calls you tried to make, otherwise it’s not really possible to troubleshoot.

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

Yeah, it’s probably not connected. Did you remove the old devices when upgrading? Otherwise you need to do that.

Hi there! Trying to set up the integration, but it seems that the version restriction isn’t permitting my to install on beta.

Is there a workaround for this in the meantime?

@postlund

I have now double checked again and can’t find any old things in my setup.

This is my latest error when I get the message “Avbruten”


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'

Apparently setting minimum required version is repository wide and not possible to specify per version, so locking down didn’t work. I have removed the required version, hopefully HACS will pick that up. Otherwise I will have to make another release again.

That particular error can only happen when an old entry exists. I’ll see if I can fix the migration path to at least solve that. It’s a bit tricky now as latest version only works on an unreleased version of Home Assistant, but I’ll see what I can do.

If you are using TTS with this integration (e.g. to HomePod), please see this issue or you might lose support for it: Are you using the Home Assistant integration for TTS? Look at this! · Issue #1435 · postlund/pyatv · GitHub

Hi!

Ok, the the entity be named something else’s than what for example the media_player.xxx name was? I have searched for “”apple” in my lists and can’t find anything related to this. Only phones left now

I deleted both Apple TVs from Integrations, waited for them to be discovered and added them again. Both have been working perfectly since then. Thanks for your work on this!

1 Like

When I attempt to use TTS over any Apple TV or HomePod, I receive a message stating tts cloud_say undefined.

What makes this stranger is that as soon as I see this message, Home Assistant crashes and I am forced to restart HA from my VM and I cannot find a log containing the error message. Any ideas?

I think I made the mistake of installing the most recent version without realizing that I needed an unreleased version of HA. I’ve tried removing it and reinstalling v1.6.0, but I’m still seeing the errors that others mentioned above. Is there something special I need to do to fully remove the incompatible version of the integration?

I have removed the requirement for any particular version at all and made a new release without the requirement as well, but HACS seems tot have cached the required version from before :confused: Not sure what to do about it.

Do you have any other media player that TTS works with? I believe cloud_say refers to the Nabu casa TTS service, I guess you can search the forums here in case someone else has seen the same error.

Yes. Cloud_say works perfectly with my Sonos.

Does not work at all with HomePod.

same problems like the others. In addition to that, it seems I can’t remove the devices and delete the integration. Stuck.

I have an advanced bug that may not be on the critical path, but wanted to post here if helpful. May not even be a bug, but rather a design consideration.

I have a “Skip Forward 10 seconds” button. To enable it, I pull the media_position attribute from my AppleTV and use a function in Node Red to add 10 and reset the seek position.

Home Assistant appears to cache the attributes for a period of time. That means that the current media_position attribute is often stale. Is there a trigger I can call to force the entity to refresh and get the latest attributes?

i am having the exact same problem.

git issue her https://github.com/postlund/pyatv/issues/1221