openairplay/airplay2-receiver

AttributeError: 'Hap' object has no attribute 'accessory_id'

Closed this issue · 5 comments

I'm getting this error using iOS 15 Developer Beta 2 at the first half of the pair-verify step.

POST /pair-verify
-----   Pair-Verify [1/2]
----------------------------------------
Exception occurred during processing of request from ('192.168.1.113', 49212)
Traceback (most recent call last):
  File "C:\Program Files\Python39\lib\socketserver.py", line 316, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Program Files\Python39\lib\socketserver.py", line 347, in process_request
    self.finish_request(request, client_address)
  File "C:\Program Files\Python39\lib\socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Program Files\Python39\lib\socketserver.py", line 720, in __init__
    self.handle()
  File "C:\Program Files\Python39\lib\http\server.py", line 429, in handle
    self.handle_one_request()
  File "C:\Program Files\Python39\lib\http\server.py", line 415, in handle_one_request
    method()
  File "E:\Projects\Web Dev\airplay2-receiver\ap2-receiver.py", line 259, in do_POST
    self.handle_pair_verify()
  File "E:\Projects\Web Dev\airplay2-receiver\ap2-receiver.py", line 579, in handle_pair_verify
    res = self.server.hap.pair_verify(body)
  File "E:\Projects\Web Dev\airplay2-receiver\ap2\pairing\hap.py", line 140, in pair_verify
    res = self.pair_verify_m1_m2(req[Tlv8.Tag.PUBLICKEY])
  File "E:\Projects\Web Dev\airplay2-receiver\ap2\pairing\hap.py", line 233, in pair_verify_m1_m2
    accessory_info = self.accessory_curve_public + self.accessory_id + client_public
AttributeError: 'Hap' object has no attribute 'accessory_id'
----------------------------------------

Weirdly, it works on another phone I have which is running iOS 14. Was a change made in iOS 15 which would be affecting this? I can't think of any other reason why my device on the Developer Beta wouldn't be able to pair.

I have made a few modifications to my usage compared to the main repo:

  • I have removed IPv6 as my device does not support it.
  • I have added support for getting & setting the volume on Windows.

If anyone has any idea why this would happen I would appreciate it.

Kind regards,
N

Upon further inspection, it looks like this is a result of Hap.pair_setup() never getting called when attempting to connect with the iOS 15 device - it skips straight to Hap.pair_verify().

Additionally, after cloning https://github.com/systemcrash/airplay2-receiver/tree/AirPlayFlags from @systemcrash 's draft, I did a bit of testing with which flags/features might work. By removing Ft46HKPairing I was able to successfully get it working. As it stands right now, I don't have nearly enough knowledge on how AirPlay works to say anything for certain. I am however pretty certain that the feature I disabled was HomeKit pairing.

I have 2 HomePods, a speaker, and some other irrelevant HomeKit accessories. I don't know why HomeKit Pairing doesn't work on iOS 15 but does on iOS 14. It'll probably get fixed in PB1 or some future DB.

Sure - how does it fare, now that #27 was merged? You can add/remove flags locally as needed, to remove HomeKit Pairing, until we can find a more stable solution.

Yeah, I can resolve the issue by disabling HKPairing but then the Speaker doesn't pair via HomeKit, which allows finer control over your speakers (everyone can access, same network only, etc). Would be preferrable to have it working, maybe it'll turn out to be an Apple issue and they'll resolve it. /shrug

I suppose to 'be available' in HK, one must send the correct flags in Bonjour which identify the device as a properly specified accessory. If anyone is privvy to the specs, it'd be nice to hear some more.