pyatv: Apple TV Beta Component Device Found but not working

Describe the bug

When adding in a tvOS 15 Apple TV it will go through the process, fail after attempting to connect via MRP, then connect on the second pass. However the device shows up in an unknown or off state.

Error log

2021-09-24 09:52:02 DEBUG (MainThread) [custom_components.apple_tv] Failed to find device 0E0C0900-8067-402A-8B7D-626694C20840, trying later
2021-09-24 09:52:02 DEBUG (MainThread) [custom_components.apple_tv] Reconnecting in 3 seconds
2021-09-24 09:52:05 DEBUG (MainThread) [custom_components.apple_tv] Discovering device 0E0C0900-8067-402A-8B7D-626694C20840
2021-09-24 09:52:05 DEBUG (MainThread) [pyatv.support.knock] Knocking at ports [3689, 7000, 49152, 32498] on 192.168.101.102
2021-09-24 09:52:05 DEBUG (MainThread) [pyatv.core.scan] Auto-discovered Aaron’s Office Apple TV at 192.168.101.102:49153 via Protocol.Companion ({'rpmac': '2', 'rphn': 'deb8e651221a', 'rpfl': '0x36782', 'rpha': '81a561441c3d', 'rpmd': 'AppleTV5,3', 'rpvr': '300.66', 'rpad': '0d1dcee80ed1', 'rphi': '3b03ae3df964', 'rpba': 'AA:C0:F5:90:11:FE', 'rpmrtid': '27BE55E3-3D19-4FDA-AC4C-2702E803D7C8'})
2021-09-24 09:52:05 DEBUG (MainThread) [pyatv.core.scan] Auto-discovered Aaron’s Office Apple TV at 192.168.101.102:7000 via Protocol.AirPlay ({'acl': '0', 'btaddr': 'C8:69:CD:6E:59:98', 'deviceid': 'C8:69:CD:6E:59:99', 'fex': '1d9/Wt5fFbwI', 'features': '0x5A7FDFD5,0xBC155FDE', 'flags': '0x18644', 'gid': 'E2D924C4-DB86-4450-BC3F-809BE32D3212', 'igl': '1', 'gcgl': '1', 'model': 'AppleTV5,3', 'protovers': '1.1', 'pi': '6c5b37d1-077c-4fe4-b776-38e088923c88', 'psi': '27BE55E3-3D19-4FDA-AC4C-2702E803D7C8', 'pk': 'dbfa4c99cdcdbbdfc93acb2717ab51d43d615b06910648e361c6269190308cdd', 'srcvers': '566.25.43', 'osvers': '15.0', 'vv': '2'})
2021-09-24 09:52:05 DEBUG (MainThread) [pyatv.core.scan] Auto-discovered C869CD6E5999@Aaron’s Office Apple TV at 192.168.101.102:7000 via Protocol.RAOP ({'cn': '0,1,2,3', 'da': 'true', 'et': '0,3,5', 'ft': '0x5A7FDFD5,0xBC155FDE', 'sf': '0x18644', 'md': '0,1,2', 'am': 'AppleTV5,3', 'pk': 'dbfa4c99cdcdbbdfc93acb2717ab51d43d615b06910648e361c6269190308cdd', 'tp': 'UDP', 'vn': '65537', 'vs': '566.25.43', 'ov': '15.0', 'vv': '2'})
2021-09-24 09:52:05 DEBUG (MainThread) [custom_components.apple_tv] Failed to find device 0E0C0900-8067-402A-8B7D-626694C20840 with address 192.168.101.102, trying to scan
2021-09-24 09:52:05 DEBUG (MainThread) [pyatv.support.net] Binding on *:5353
2021-09-24 09:52:05 DEBUG (MainThread) [pyatv.support.net] Binding on 127.0.0.1:0
2021-09-24 09:52:05 DEBUG (MainThread) [pyatv.support.net] Binding on 192.168.101.240:0

If I attempt to “Turn On” the device

2021-09-24 09:54:45 DEBUG (MainThread) [custom_components.apple_tv] Not starting connect loop (True, True)

How to reproduce the bug?

Integrate device via Beta Component

What is expected behavior?

Device functions with media states, etc.

Operating System

Docker

Python

3.9

pyatv

0.9

Device

Apple TV 4 tvOS 15

Additional context

Same behavior on additional Apple TVs tested on

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

@geekofweek You mentioned MRP… We have seen cases where upgraded tvOS 15 devices for some reason announce a non-working MRP service. I can see this become a problem as the unique id saved and used to later discover a device is the one from MRP. This will work poorly once the service is removed as the device won’t be found anymore, which looks like the situation you have right now.

I think I will do it like this… I will extend pyatv.scan to support scanning for a list of identifiers (instead of just one) and also save all identifiers to the config entry when adding a new device. That way I can scan for all identifiers used by a device. That is much more future proof and will solve this problem in particular. Will get on it as soon as I can, hang tight! 👊

(same applies to you, too, @gloaysa)

I think we can close this now.

I would have preferred to not have to re-pair either, but there are technical restrictions that gives no other choice (i.e. it’s impossible to not solve), unfortunately.

Awesome! 👍 Yeah, newer versions of Sonos speakers that support AirPlay will probably show up now.

Ok, I can see the problem but very annoying that Home Assistant doesn’t guard this better. I pushed an update, bumping the config entry to a new version. This should hopefully make all devices appear in the Integration page again, albeit disabled. Just remove them before adding a new device again, hopefully that works.