postlund / pyatv

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

Add support for transient pairing in Companion #1535

Open postlund opened 2 years ago

postlund commented 2 years ago

What feature would you like?

I managed to figure out how transient pairing works in Companion (corresponding feature exists in AirPlay as well). It is automatic in the sense that no PIN or anything is required but the resulting connection is similar to a "guest account". So not much can be one over the resulting channel. I have however verified that setting up a connection works towards my HomePod and laptop (macOS). I have used buttons like play and pause on the HomePod with no problems. There's no tvremoteservice on macOS (at least not in Big Sur) so it doesn't work with macOS. An interesting note though is that it is possible to start a session towards com.apple.announce (on the HomePod), which might open up for proper announcements via Siri as (discovered by @jdsnape) instead of relying on streaming audio for TTS.

Describe the solution you'd like

Authentication shall be automatic in case it is supported. Early investigations suggests that bit 10 (DeviceWasSetupForHKAccessControl) in rpFl might be used to determine if transient pairing can be used or not (not 100% sure, but looks like it now at least).

Any other information to share?

I will publish my findings in the documentation when I have some time to update and try to implement support for it. Shouldn't be that hard.

postlund commented 2 years ago

I tried com.apple.announce.announcement.message and it didn't work, so I feat that it is not possible to use transient pairing for announcements.