postlund / pyatv

A client library for Apple TV and AirPlay devices
https://pyatv.dev
MIT License
888 stars 100 forks source link

Add API suggesting if pairing is required or not #1138

Closed postlund closed 3 years ago

postlund commented 3 years ago

What feature would you like? You currently need to know if pairing is required or not (it usually is), but it would be nice to provide a field that states if pairing is required or not. That would be helpful from a programmatic point of view.

Describe the solution you'd like I need to summarize how each protocol works in regards of pairing, so I can put a nail into the final design. Some always require pairing (Companion) and some provide necessary information via zeroconf or by fetching information from the remote end. I hope that I don't have to make any such calls during scanning though, but can fully rely on zeroconf.

Any other information to share? No

Schlaubischlump commented 3 years ago

I'm sure you most likely already know that, but maybe it is helpful to someone. To check if the pin-pairing introduced in TV-OS 10.2 is required you can check the zeroconf status flags (sf) entry:

sf & 0x200

To check if a password for RAOP is required one can use something like this:

(sf & 0x80) or pw

Old devices, such as Shairport-sync only provide the pw zeroconf field with a boolean value. New devices use the status flags instead.

postlund commented 3 years ago

That's great to know! I was aware of the pw flag but not sure about the flags, that will certainly help. Thanks! 👍

postlund commented 3 years ago

I tried to summarize everything in #1309 and add a suggested API. Since you showed some interest here @Schlaubischlump, feel free to have a look (if you want to and have time for it). I might have missed something, so an additional set of eyes would be great.

postlund commented 3 years ago

Fixed by #1316.