postlund / pyatv

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

Airport Express is discovered, but cannot be paired. #1581

Closed autoneub closed 2 years ago

autoneub commented 2 years ago

What do you need help with?

Using Home Assistant 2021.12.1 Supervised in VM running on Mac Mini 2012 macOS 10.13.6 Apple TV Beta integration v2.2.0 via HACS My Gen 2 Airport Express is discovered, but cannot pair. First attempt was RAOP issue Screen Shot 2022-01-04 at 10 38 39 PM Now this... Screen Shot 2022-01-04 at 11 26 16 PM

The APX has no password set for connecting via AirPlay. I checked the logs directly after attempting and nothing showed.

Any help you could provide would be appreciated. Thank you for such an incredible integration by the way.

postlund commented 2 years ago

You need to open the Home app, go to home settings and allow anyone on the same network to connect to speakers and televisions. That should solve the problem.

autoneub commented 2 years ago

Thank you for such a speedy response. I currently already have that set. I didn't mention, but I also have a couple HomePod minis that paired without issue. Any other thoughts?

postlund commented 2 years ago

Hmm, that's strange. Is the AirPort standalone or added to your home? It would help if you could provide some scan log for me with atvremote scan. You need pyatv installed first and if you have docker set up anywhere, it's easiest to use that. You have some instructions here:

https://pyatv.dev/documentation/#installing-pyatv

autoneub commented 2 years ago

It's in my "Home" app. I don't have docker setup but I will try it in a virtual environment and get back to you with scan logs. Thanks!

postlund commented 2 years ago

Great! I've changed my mind, atvremote --debug scan would give me more to work with.

postlund commented 2 years ago

Did you manage to get any debug logs?

autoneub commented 2 years ago

Shoot no. Sorry. My workload has picked up a bit so i haven’t had much time the last couple weeks. Hopefully next week I’ll have some downtime.

On Wed, Jan 19, 2022, at 4:36 AM, Pierre Ståhl wrote:

Did you manage to get any debug logs?

— Reply to this email directly, view it on GitHub https://github.com/postlund/pyatv/issues/1581#issuecomment-1016375671, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALN3FMM2NWSJQVNEQAS3RGDUW2O3ZANCNFSM5LJIFRSA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>

autoneub commented 2 years ago
Name: Shop Kitty
   Model/SW: AirPort Express (gen 2), AirPortOS 7.8.1
    Address: 192.168.1.133
        MAC: XX:XX:XX:XX:XX:XX
 Deep Sleep: False
Identifiers:
 - XX:XX:XX:XX:XX:XX
 - XXXXXXXXXXXX
Services:
 - Protocol: AirPlay, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: Disabled
 - Protocol: RAOP, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: Disabled
autoneub commented 2 years ago

And this gobbldeygook too...


2022-02-02 16:09:08 DEBUG [pyatv.core.scan]: Auto-discovered Shop Kitty at 192.168.1.133:7000 via Protocol.AirPlay ({'acl': '1', 'deviceid': 'XX:XX:XX:XX:XX:XX', 'features': '0x445D0A00,0x1C340', 'rsf': '0x0', 'fv': 'p20.78100.3', 'flags': '0x4', 'model': 'AirPort10,115', 'manufacturer': 'Apple Inc.', 'serialnumber': 'C86LN76MDV2R', 'protovers': '1.1', 'srcvers': '366.0', 'pi': 'abdeddef-956c-4b43-b89b-b5c01dc8f2e4', 'gid': 'abdeddef-956c-4b43-b89b-b5c01dc8f2e4', 'gcgl': '0', 'pk': '4695e547ba89762918f7b30d37325e42cf5c4fe3bdf7c494db58f3e134ba13cf'})
2022-02-02 16:09:08 DEBUG [pyatv.core.scan]: Auto-discovered XXXXXXXXXXXX@Shop Kitty at 192.168.1.133:7000 via Protocol.RAOP ({'cn': '0,1', 'da': 'true', 'et': '0,4', 'ft': '0x445D0A00,0x1C340', 'fv': 'p20.78100.3', 'md': '2', 'am': 'AirPort10,115', 'sf': '0x4', 'tp': 'UDP', 'vn': '65537', 'vs': '366.0', 'pk': '4695e547ba89762918f7b30d37325e42cf5c4fe3bdf7c494db58f3e134ba13cf'})
autoneub commented 2 years ago

I tried to remove the device password in the airport utility, but it wouldn't let me update it without a password in the field. There is no airplay password required. (this is the device password to change settings).

postlund commented 2 years ago

Yeah, I think this is a flag parsing error on my end. If you try for instance atvremote -s 192.168.1.133 stream_file=https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_1MG.mp3, does that work?

autoneub commented 2 years ago

so I apologize as I'm not super fluent in command line or linux. I installed atvremote via the terminal in my mac mini - the scan sent back the info above. So I just pasted your above command into the terminal and got this back...

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyatv/support/http.py", line 388, in send_and_receive
    await asyncio.wait_for(event.wait(), timeout=4)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/tasks.py", line 490, in wait_for
    raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError

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

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyatv/scripts/atvremote.py", line 719, in _run_application
    return await cli_handler(loop)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyatv/scripts/atvremote.py", line 513, in cli_handler
    return await _handle_commands(args, config, loop)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyatv/scripts/atvremote.py", line 614, in _handle_commands
    ret = await _handle_device_command(args, cmd, atv, loop)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyatv/scripts/atvremote.py", line 662, in _handle_device_command
    return await _exec_command(atv.stream, cmd, True, *cmd_args)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyatv/scripts/atvremote.py", line 685, in _exec_command
    value = await tmp(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyatv/core/facade.py", line 382, in stream_file
    await self.relay("stream_file")(file, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyatv/protocols/raop/__init__.py", line 352, in stream_file
    await client.initialize(self.core.service.properties)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyatv/protocols/raop/raop.py", line 457, in initialize
    await self._setup_session()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyatv/protocols/raop/raop.py", line 486, in _setup_session
    resp = await self.rtsp.setup(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyatv/support/rtsp.py", line 175, in setup
    return await self.exchange("SETUP", headers=headers, body=body)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyatv/support/rtsp.py", line 258, in exchange
    resp = await self.connection.send_and_receive(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyatv/support/http.py", line 391, in send_and_receive
    raise TimeoutError(f"no response to {method} {uri} ({protocol})") from ex
TimeoutError: no response to SETUP rtsp://192.168.1.3/1674132472 (RTSP/1.0)

If this was the incorrect thing to do, please let me know what I can do differently. I don't have docker running so I can't help in that way. Also this isn't a huge deal and I may not be educated enough in this field to even help you. I appreciate your patience.

autoneub commented 2 years ago

Okay so I'm not sure if you did anything on your end, but today the airport express was autodiscovered (even though I had been ignoring it) so I just tried it and it worked!

APX is now in HA and shows that music is playing.

Thank you for helping me with this and I appreciate your whole appletv integration with HA. So wonderful!