postlund / pyatv

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

TV and HomePod OS 15 #1318

Closed crxporter closed 2 years ago

crxporter commented 3 years ago

What's on your mind?

So I've been watching this whole saga of "is it broken or will it work" with the TV OS betas the past few months. I think today is a good day to ask since the betas are complete and it's release day.

From what I can tell, pyatv 0.9 should work with TV OS 15. But I believe I will have to pair with my Apple TVs, which I have not done for a while.

I'm running simply like this currently:

atvscript -s 10.11.11.1 push_updates

Apart from pairing and entering credentials, will there be anything else necessary when I upgrade?

As always I really appreciate all of your effort. Sorry I haven't had more time lately to help test...

postlund commented 3 years ago

Yeah, now you will need 0.9.0 which technically is not out yet. But master works fine. The gist is this:

Of course you need to provide the corresponding credentials for atvremote/atvscript. Other than that the API is the same, so no difference (which is the point of the API). I'm working on the final pieces for the "pairing requirements" API, which will tell you if a protocol needs pairing. It's an important piece that has been missing for far too long.

The HomePod does not require any pairing for anything. Just enter the address and it should "just work" (I think a company had that as part of their slogan at some point).

crxporter commented 3 years ago

Awesome! So for the push_updates part of atvscript, will I need airplay and companion pairing? Or just airplay?

I'm not (currently) using any other piece of the API.

I think a company had that as part of their slogan at some point

🔥 🔥

postlund commented 3 years ago

You will only need airplay for that part 👍

Note that you need to re-pair with 0.9.0 (which I assume you will based on your earlier statement), it's a new type of credentials needed and it won't work with credentials from pairing with an earlier version of pyatv.

crxporter commented 3 years ago

Excellent.

Yeah I was aware I'll have to re-pair especially since I'm not even paired right now, just connecting without any credentials.

Last question, any chance there's some new discovery with all the recent changes which would help with #958 ?

postlund commented 3 years ago

I have not looked into that situation, no. Some part of me makes me believe there's no difference, but it would be better to explore that properly again. If you want to help out with that I'm up for verifying it again.

crxporter commented 3 years ago

I'll have a look once I get updated and if I find anything interesting I'll meet you over at #958 to discuss.

Thanks for the update notes!

crxporter commented 2 years ago

So I was planning to leave this closed but now I'm having some trouble pairing. I noticed you're "around" gh this afternoon... Any quick fix for this?

pi@pihole:~ $ atvremote -s 10.11.11.3 --protocol airplay pair
2021-09-22 15:22:19 ERROR [pyatv.scripts.atvremote]: Pairing failed
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/pyatv/support/__init__.py", line 33, in error_handler
    return await func(*args, **kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/pyatv/protocols/airplay/auth/hap.py", line 43, in start_pairing
    await self.http.post("/pair-pin-start", headers=_AIRPLAY_HEADERS)
  File "/home/pi/.local/lib/python3.7/site-packages/pyatv/support/http.py", line 360, in post
    "POST", path, headers=headers, body=body, allow_error=allow_error
  File "/home/pi/.local/lib/python3.7/site-packages/pyatv/support/http.py", line 413, in send_and_receive
    f"{protocol} method {method} failed with code "
pyatv.exceptions.ProtocolError: HTTP/1.1 method POST failed with code 400: Bad Request

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/pyatv/scripts/atvremote.py", line 172, in pair
    await self._perform_pairing(pairing)
  File "/home/pi/.local/lib/python3.7/site-packages/pyatv/scripts/atvremote.py", line 182, in _perform_pairing
    await pairing.begin()
  File "/home/pi/.local/lib/python3.7/site-packages/pyatv/protocols/airplay/pairing.py", line 63, in begin
    self.pairing_procedure.start_pairing, exceptions.PairingError
  File "/home/pi/.local/lib/python3.7/site-packages/pyatv/support/__init__.py", line 41, in error_handler
    raise fallback(str(ex)) from ex
pyatv.exceptions.PairingError: HTTP/1.1 method POST failed with code 400: Bad Request
crxporter commented 2 years ago

Ah. I had to change airplay to "Anyone on the same network" instead of "only people sharing this home"

postlund commented 2 years ago

You beat me to it!

crxporter commented 2 years ago

I'm in!

Now for the other 2 TV's. All systems go with the first though.

postlund commented 2 years ago

I have discovered that the acl zeroconf property is 1 in the case you experienced here, so I can mark pairing requirement as Disabled. It will allow for better error messages, which is great 👍