postlund / pyatv

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

Airplay pairing issue #1366

Closed Ajay-ue closed 2 years ago

Ajay-ue commented 3 years ago

Describe the bug

atvremote --debug --id --protocol airplay pair Does not work

Does display the pin on screen but final pairing does not return creds

Error log

user@user-HP-ProBook-450-G7:~/repos/DEV/ipcontrol$ atvremote scan
Scan Results
========================================
       Name: Apple TV (16367)
   Model/SW: Apple TV 4, tvOS 15.0 build 19J346
    Address: 192.168.0.105
        MAC: D0:03:4B:2B:A6:8F
 Deep Sleep: True
Identifiers:
 - D0:03:4B:2B:A6:8F
 - 3A5AD3D3-6C1B-4651-A19D-282C0346AB6E
 - D0034B2BA68F
Services:
 - Protocol: Companion, Port: 49152, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory
 - Protocol: AirPlay, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory
 - Protocol: MRP, Port: 49153, Credentials: None, Requires Password: False, Password: None, Pairing: Optional
 - Protocol: RAOP, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory

user@user-HP-ProBook-450-G7:~/repos/DEV/ipcontrol$ atvremote --debug --id D0:03:4B:2B:A6:8F --protocol airplay pair
2021-10-03 15:33:30 DEBUG [pyatv.support.net]: Binding on *:5353
2021-10-03 15:33:30 DEBUG [pyatv.support.net]: Binding on 127.0.0.1:0
2021-10-03 15:33:30 DEBUG [pyatv.support.net]: Binding on 192.168.0.107:0
2021-10-03 15:33:30 DEBUG [pyatv.support.net]: Binding on 192.168.250.1:0
2021-10-03 15:33:30 DEBUG [pyatv.core.scan]: Auto-discovered Apple TV (16367) at 192.168.0.105:49152 via Protocol.Companion ({'rpmac': '1', 'rphn': '3956f11ee747', 'rpfl': '0x36782', 'rpmd': 'AppleTV5,3', 'rpvr': '300.66', 'rpmrtid': 'D80F36C3-19D0-4DF7-BBA5-2E77A2403977', 'rpad': 'c709b6a2e27a', 'rpba': '0E:30:DA:52:CD:0C'})
2021-10-03 15:33:30 DEBUG [pyatv.core.scan]: Auto-discovered Apple TV (16367) at 192.168.0.105:49153 via Protocol.MRP ({'modelname': 'Apple TV', 'allowpairing': 'YES', 'bluetoothaddress': "b'\\xd0\\x03K+\\xa6\\x8e'", 'macaddress': 'd0:03:4b:2b:a6:8f', 'name': 'Apple TV (16367)', 'uniqueidentifier': '3A5AD3D3-6C1B-4651-A19D-282C0346AB6E', 'systembuildversion': '19J346', 'localairplayreceiverpairingidentity': 'D80F36C3-19D0-4DF7-BBA5-2E77A2403977'})
2021-10-03 15:33:30 DEBUG [pyatv.core.scan]: Auto-discovered Apple TV (16367) at 192.168.0.105:7000 via Protocol.AirPlay ({'acl': '0', 'btaddr': 'D0:03:4B:2B:A6:8E', 'deviceid': 'D0:03:4B:2B:A6:8F', 'fex': '1d9/Wt5fFbwI', 'features': '0x5A7FDFD5,0xBC155FDE', 'flags': '0x10244', 'gid': '975027D3-7F7F-42A0-9BD4-D1BA4E4F958F', 'igl': '1', 'gcgl': '1', 'model': 'AppleTV5,3', 'protovers': '1.1', 'pi': 'f986fff4-256f-4003-b3ef-9cd77cd5981e', 'psi': 'D80F36C3-19D0-4DF7-BBA5-2E77A2403977', 'pk': '7c6ddfe1df237bd931d037f5855f035280cc1ea8c211ba49df041d9455ad6fb6', 'srcvers': '566.25.43', 'osvers': '15.0', 'vv': '2'})
2021-10-03 15:33:30 DEBUG [pyatv.core.scan]: Auto-discovered D0034B2BA68F@Apple TV (16367) at 192.168.0.105:7000 via Protocol.RAOP ({'cn': '0,1,2,3', 'da': 'true', 'et': '0,3,5', 'ft': '0x5A7FDFD5,0xBC155FDE', 'sf': '0x10244', 'md': '0,1,2', 'am': 'AppleTV5,3', 'pk': '7c6ddfe1df237bd931d037f5855f035280cc1ea8c211ba49df041d9455ad6fb6', 'tp': 'UDP', 'vn': '65537', 'vs': '566.25.43', 'ov': '15.0', 'vv': '2'})
2021-10-03 15:33:30 DEBUG [pyatv.support.http]: Connected to 192.168.0.105
2021-10-03 15:33:30 DEBUG [pyatv.protocols.airplay.auth]: Setting up new AirPlay Pair-Setup procedure with type AuthenticationType.HAP
2021-10-03 15:33:30 DEBUG [pyatv.support.http]: Sending HTTP/1.1 message: b'POST /pair-pin-start HTTP/1.1\r\nUser-Agent: AirPlay/320.20\r\nConnection: keep-alive\r\nX-Apple-HKP: 3\r\nContent-Type: application/octet-stream\r\n\r\n'
2021-10-03 15:33:30 DEBUG [pyatv.support.http]: Received: b'HTTP/1.1 200 OK\r\nDate: Sun, 03 Oct 2021 10:03:31 GMT\r\nContent-Length: 0\r\nServer: AirTunes/566.25.43\r\n\r\n'
2021-10-03 15:33:30 DEBUG [pyatv.support.http]: Got HTTP response: HttpResponse(protocol='HTTP', version='1.1', code=200, message='OK', headers={'date': 'Sun, 03 Oct 2021 10:03:31 GMT', 'content-length': '0', 'server': 'AirTunes/566.25.43'}, body=''):
2021-10-03 15:33:30 DEBUG [pyatv.support.http]: Sending HTTP/1.1 message: b'POST /pair-setup HTTP/1.1\r\nContent-Length: 6\r\nUser-Agent: AirPlay/320.20\r\nConnection: keep-alive\r\nX-Apple-HKP: 3\r\nContent-Type: application/octet-stream\r\n\r\n\x00\x01\x00\x06\x01\x01'
2021-10-03 15:33:30 DEBUG [pyatv.support.http]: Received: b'HTTP/1.1 200 OK\r\nDate: Sun, 03 Oct 2021 10:03:31 GMT\r\nContent-Length: 409\r\nContent-Type: application/x-apple-binary-plist\r\nServer: AirTunes/566.25.43\r\n\r\n\x06\x01\x02\x02\x10\xa2\x19\x0f{]\x99Q\xec\n\xc5^Ug\xbc!\x8d\x03\xff\x8e\xb1\x87\x93\xc7e\xd3\x1fHm_L\n\xfb\xfc0\xc4\x85}T\xa3U\x85\xc2Zo:\x19\xdc"Th\xdf8\xd9\xdf\xf9\xd02w5r\xe5\x88\xf5\xde\xbbE\xeb\xd6\x87\xeb\xa9u\xdd${\x92\x1b2\xc0\xa0\x0b\x86>!(\xd8g\x97\xe8\xab~\xaaI\x81\x8a\xb9\x17BR\x8fm\x136\xee\xcf\xc8\xb6df\x11T\xd5\xa4\x0b\xe9\xb9\x04\xff\x9f\n\xdfD\xbc\xdb\x84\xf4\xd2D\xc4\xda\xf0\x8a`\xeen\x0f\xa3a\x1c\x87\xba\xd8\xcb\xdf\xd6\x13\xccW\x07vu(\x1c\x85R3\xb9>\x03\x0c\xce\x80\x84\xca\x0c\xd7\xa4\xe32w"\x90\x05\x00\xd2\xb1\xf83\xf3\xe0B\xf0\xda\x14\x982\x98\xa0\x8d,\xad}\xcd\xbep*5\x17\xb2\xdd\xa2\x05>\xb3\x0c\xa9\x01]\x8c\xac\xcb\xe2\x1e<\xb8\xff\xf75\x1c`h\x9c\xc8\x00\xfd\xb2\x08\xea \xaeI\xc4\xd6\xda\xa3\x8c+b\'\xd9\x06\x84\xcd_\xa8\x9ea\xb4\x1d\x8a\x0f\x19\xefw\xa8*\xef\xd6\x19\xc1\x8c\x08i\xca\x04\n\x89\xeeH\xfcO\xa8\xeb\x03\x81?\x8eQ\x04\xa7y\xc8J\xcc\x000\xfaz\x8d\xe8\xb4\x10\xa4\xbc\x95\xf4\xc6\xdf]\x1fL\xde\xc7W%\xa9R\x196\x0c\xb8rE\x00\x87\xfa\xf6$\xf7\xf2\xf4\xf9\xf6\xb7\xe2":^F\xb9C\x98\x91\xe9{VH\x08\xb8\xf0_\x8f\xdc\x8al\xf4\x8d\x88\x10\x0bP\x08\xce\xa3S:\xda\n\xc7n\xfb_\xfeF\x1f\x97\x16!/j/\xf6\x1b?P\x94\x15\x07\x12\xba\x8egg\xbc\xd2\xae\xa0\xbe\x97\xf4*Q1\xe0!\xcd\x16]\x17\xa6|F4\xa3'
2021-10-03 15:33:30 DEBUG [pyatv.support.http]: Got HTTP response: HttpResponse(protocol='HTTP', version='1.1', code=200, message='OK', headers={'date': 'Sun, 03 Oct 2021 10:03:31 GMT', 'content-length': '409', 'content-type': 'application/x-apple-binary-plist', 'server': 'AirTunes/566.25.43'}, body=b'\x06\x01\x02\x02\x10\xa2\x19\x0f{]\x99Q\xec\n\xc5^Ug\xbc!\x8d\x03\xff\x8e\xb1\x87\x93\xc7e\xd3\x1fHm_L\n\xfb\xfc0\xc4\x85}T\xa3U\x85\xc2Zo:\x19\xdc"Th\xdf8\xd9\xdf\xf9\xd02w5r\xe5\x88\xf5\xde\xbbE\xeb\xd6\x87\xeb\xa9u\xdd${\x92\x1b2\xc0\xa0\x0b\x86>!(\xd8g\x97\xe8\xab~\xaaI\x81\x8a\xb9\x17BR\x8fm\x136\xee\xcf\xc8\xb6df\x11T\xd5\xa4\x0b\xe9\xb9\x04\xff\x9f\n\xdfD\xbc\xdb\x84\xf4\xd2D\xc4\xda\xf0\x8a`\xeen\x0f\xa3a\x1c\x87\xba\xd8\xcb\xdf\xd6\x13\xccW\x07vu(\x1c\x85R3\xb9>\x03\x0c\xce\x80\x84\xca\x0c\xd7\xa4\xe32w"\x90\x05\x00\xd2\xb1\xf83\xf3\xe0B\xf0\xda\x14\x982\x98\xa0\x8d,\xad}\xcd\xbep*5\x17\xb2\xdd\xa2\x05>\xb3\x0c\xa9\x01]\x8c\xac\xcb\xe2\x1e<\xb8\xff\xf75\x1c`h\x9c\xc8\x00\xfd\xb2\x08\xea \xaeI\xc4\xd6\xda\xa3\x8c+b\'\xd9\x06\x84\xcd_\xa8\x9ea\xb4\x1d\x8a\x0f\x19\xefw\xa8*\xef\xd6\x19\xc1\x8c\x08i\xca\x04\n\x89\xeeH\xfcO\xa8\xeb\x03\x81?\x8eQ\x04\xa7y\xc8J\xcc\x000\xfaz\x8d\xe8\xb4\x10\xa4\xbc\x95\xf4\xc6\xdf]\x1fL\xde\xc7W%\xa9R\x196\x0c\xb8rE\x00\x87\xfa\xf6$\xf7\xf2\xf4\xf9\xf6\xb7\xe2":^F\xb9C\x98\x91\xe9{VH\x08\xb8\xf0_\x8f\xdc\x8al\xf4\x8d\x88\x10\x0bP\x08\xce\xa3S:\xda\n\xc7n\xfb_\xfeF\x1f\x97\x16!/j/\xf6\x1b?P\x94\x15\x07\x12\xba\x8egg\xbc\xd2\xae\xa0\xbe\x97\xf4*Q1\xe0!\xcd\x16]\x17\xa6|F4\xa3'):
Enter PIN on screen: 5655
2021-10-03 15:33:34 DEBUG [pyatv.protocols.airplay.pairing]: AirPlay PIN changed to 5655
2021-10-03 15:33:35 DEBUG [pyatv.auth.hap_srp]: Client (Proof=778b21ec6490fc8cee08ac2677d48aef718a121a94fa3c05607d53211afdf121822dacaf585cc55f7780571490904aea457bbcc92dbed795c96598688d238761, Public=6bbae96564569c5b10c45a41cafa816e34cfad5e9ead5808ffb02a9216ec804bb09e75e72d9b6dcedfc1086da94b7daf7d564293457b04aa06bf241c9972e20f01586c05099dbe6262fdda77039d6e3bb207225a96e26057b04eb8538a0ff85ada12fe0190d131ee2d17216b183ede919e8c44a6bbf099f57d15444008723a459883d7ea9c390ad61108eb247c1b1a9b2e870e69794546ce4790d2c3cd05d8d5792274d32556009bf8b443c48771e27b9025114f39b8fff51ec104625c3415ca5e59136d0819d7f5de79f49ce66f3cc6791a9acbc8338a90057880ddb0c40ccd2dd738ade3717083a7aafb29e9e30c1cec13dfb473c2d1e8de5a0833cded6...)
2021-10-03 15:33:35 DEBUG [pyatv.support.http]: Sending HTTP/1.1 message: b'POST /pair-setup HTTP/1.1\r\nContent-Length: 457\r\nUser-Agent: AirPlay/320.20\r\nConnection: keep-alive\r\nX-Apple-HKP: 3\r\nContent-Type: application/octet-stream\r\n\r\n\x06\x01\x03\x03\xffk\xba\xe9edV\x9c[\x10\xc4ZA\xca\xfa\x81n4\xcf\xad^\x9e\xadX\x08\xff\xb0*\x92\x16\xec\x80K\xb0\x9eu\xe7-\x9bm\xce\xdf\xc1\x08m\xa9K}\xaf}VB\x93E{\x04\xaa\x06\xbf$\x1c\x99r\xe2\x0f\x01Xl\x05\t\x9d\xbebb\xfd\xdaw\x03\x9dn;\xb2\x07"Z\x96\xe2`W\xb0N\xb8S\x8a\x0f\xf8Z\xda\x12\xfe\x01\x90\xd11\xee-\x17!k\x18>\xde\x91\x9e\x8cD\xa6\xbb\xf0\x99\xf5}\x15D@\x08r:E\x98\x83\xd7\xea\x9c9\n\xd6\x11\x08\xeb$|\x1b\x1a\x9b.\x87\x0eiyEF\xceG\x90\xd2\xc3\xcd\x05\xd8\xd5y"t\xd3%V\x00\x9b\xf8\xb4C\xc4\x87q\xe2{\x90%\x11O9\xb8\xff\xf5\x1e\xc1\x04b\\4\x15\xca^Y\x13m\x08\x19\xd7\xf5\xdey\xf4\x9c\xe6o<\xc6y\x1a\x9a\xcb\xc83\x8a\x90\x05x\x80\xdd\xb0\xc4\x0c\xcd-\xd78\xad\xe3qp\x83\xa7\xaa\xfb)\xe9\xe3\x0c\x1c\xec\x13\xdf\xb4s\xc2\xd1\xe8\xdeZ\x083\xcd\xeda\x03\x81\xb7\xd6\xad<c\xbc\xfa\x8bk|<\x064dk\x1f\x91\x91\xb2\x9a+O\xd1\x9d\xdb_\x0e\xc0\x0ey\xff*Y\xa8[N\xbf\xea\xa1\xeb\'\x83\x9f\xe1\x8e\x88\xd9\x87j\xe5\xc0\x87\xf0J\x05\x96s\xe0\xfb\x0f\xdcc\xdep\xa9D6\xd4\x87\x18\x16\x9a;\xef\xa2,\xca\xf6\xd3(>\xee;s\xacI\xfe\n\x0b\xf9\xb1\x00\x03\x18\xf8\x14\xb4\xe6W\x9d\xd0\xd0Fo\xc3\xdc1Uufr\x18\xf1?T\x08\xc8\xdc\xd9\xfdE\x18\xcf\x025\xf2\x882\xae\x04@w\x8b!\xecd\x90\xfc\x8c\xee\x08\xac&w\xd4\x8a\xefq\x8a\x12\x1a\x94\xfa<\x05`}S!\x1a\xfd\xf1!\x82-\xac\xafX\\\xc5_w\x80W\x14\x90\x90J\xeaE{\xbc\xc9-\xbe\xd7\x95\xc9e\x98h\x8d#\x87a'
2021-10-03 15:33:35 DEBUG [pyatv.support.http]: Received: b'HTTP/1.1 200 OK\r\nDate: Sun, 03 Oct 2021 10:03:35 GMT\r\nContent-Length: 69\r\nContent-Type: application/x-apple-binary-plist\r\nServer: AirTunes/566.25.43\r\n\r\n\x06\x01\x04\x04@m\r"\x118\x15\x11{L\xf9~\xd1Q\x90\xeb\xbd"\x1c\xb5\xc2p\xb0%f\xe6\xbe\x8a\xcbQ*\xac\x85\xc5\x1c7G\xc1\xed\xd0\xbe\x12\x90@t\xd8\xe6:JK\xdf^\xfb\xb6-\xf5d^\xd5*\xb0\xd4|\x15\x0e'
2021-10-03 15:33:35 DEBUG [pyatv.support.http]: Got HTTP response: HttpResponse(protocol='HTTP', version='1.1', code=200, message='OK', headers={'date': 'Sun, 03 Oct 2021 10:03:35 GMT', 'content-length': '69', 'content-type': 'application/x-apple-binary-plist', 'server': 'AirTunes/566.25.43'}, body=b'\x06\x01\x04\x04@m\r"\x118\x15\x11{L\xf9~\xd1Q\x90\xeb\xbd"\x1c\xb5\xc2p\xb0%f\xe6\xbe\x8a\xcbQ*\xac\x85\xc5\x1c7G\xc1\xed\xd0\xbe\x12\x90@t\xd8\xe6:JK\xdf^\xfb\xb6-\xf5d^\xd5*\xb0\xd4|\x15\x0e'):
2021-10-03 15:33:35 DEBUG [pyatv.auth.hap_srp]: Data (Encrypted=9d1312d74e588c91ac47ee5e3680b738a65ee51c998d834b40cd208f990f1fe660bb601c9242bf1d4792767957f28970632270965fa9cf1982c160f4b4cf7d3e74c4a9c50a4285a952bb60ff1493c1f4fffd8efbb2fe1fb8268730c90540efe1c94ec3e134a7fbdf72e1c0bbd99278edda9f15126587562c04ee6143de53e75f86dfbf16bc04007f4e5f21add128cc9bdc45e8ef8f507aee8256)
2021-10-03 15:33:35 DEBUG [pyatv.support.http]: Sending HTTP/1.1 message: b'POST /pair-setup HTTP/1.1\r\nContent-Length: 159\r\nUser-Agent: AirPlay/320.20\r\nConnection: keep-alive\r\nX-Apple-HKP: 3\r\nContent-Type: application/octet-stream\r\n\r\n\x06\x01\x05\x05\x9a\x9d\x13\x12\xd7NX\x8c\x91\xacG\xee^6\x80\xb78\xa6^\xe5\x1c\x99\x8d\x83K@\xcd \x8f\x99\x0f\x1f\xe6`\xbb`\x1c\x92B\xbf\x1dG\x92vyW\xf2\x89pc"p\x96_\xa9\xcf\x19\x82\xc1`\xf4\xb4\xcf}>t\xc4\xa9\xc5\nB\x85\xa9R\xbb`\xff\x14\x93\xc1\xf4\xff\xfd\x8e\xfb\xb2\xfe\x1f\xb8&\x870\xc9\x05@\xef\xe1\xc9N\xc3\xe14\xa7\xfb\xdfr\xe1\xc0\xbb\xd9\x92x\xed\xda\x9f\x15\x12e\x87V,\x04\xeeaC\xdeS\xe7_\x86\xdf\xbf\x16\xbc\x04\x00\x7fN_!\xad\xd1(\xcc\x9b\xdcE\xe8\xef\x8fPz\xee\x82V'
2021-10-03 15:33:39 ERROR [pyatv.scripts.atvremote]: Pairing failed
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pyatv/support/http.py", line 388, in send_and_receive
    await asyncio.wait_for(event.wait(), timeout=4)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 362, in wait_for
    raise futures.TimeoutError()
concurrent.futures._base.TimeoutError

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pyatv/support/__init__.py", line 33, in error_handler
    return await func(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pyatv/protocols/airplay/auth/hap.py", line 78, in finish_pairing
    "/pair-setup", body=hap_tlv8.write_tlv(data), headers=_AIRPLAY_HEADERS
  File "/usr/local/lib/python3.6/dist-packages/pyatv/support/http.py", line 360, in post
    "POST", path, headers=headers, body=body, allow_error=allow_error
  File "/usr/local/lib/python3.6/dist-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 POST /pair-setup (HTTP/1.1)

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pyatv/scripts/atvremote.py", line 178, in pair
    await self._perform_pairing(pairing)
  File "/usr/local/lib/python3.6/dist-packages/pyatv/scripts/atvremote.py", line 211, in _perform_pairing
    await pairing.finish()
  File "/usr/local/lib/python3.6/dist-packages/pyatv/protocols/airplay/pairing.py", line 78, in finish
    self.pin_code,
  File "/usr/local/lib/python3.6/dist-packages/pyatv/support/__init__.py", line 35, in error_handler
    raise exceptions.ConnectionFailedError(str(ex)) from ex
pyatv.exceptions.ConnectionFailedError: no response to POST /pair-setup (HTTP/1.1)
2021-10-03 15:33:39 DEBUG [pyatv.support.http]: Connection closed
user@user-HP-ProBook-450-G7:~/repos/DEV/ipcontrol$ atvremote --debug --id D0034B2BA68F --protocol airplay pair
2021-10-03 15:34:01 DEBUG [pyatv.support.net]: Binding on *:5353
2021-10-03 15:34:01 DEBUG [pyatv.support.net]: Binding on 127.0.0.1:0
2021-10-03 15:34:01 DEBUG [pyatv.support.net]: Binding on 192.168.0.107:0
2021-10-03 15:34:01 DEBUG [pyatv.support.net]: Binding on 192.168.250.1:0
2021-10-03 15:34:01 DEBUG [pyatv.core.scan]: Auto-discovered Apple TV (16367) at 192.168.0.105:49152 via Protocol.Companion ({'rpmac': '1', 'rphn': '3956f11ee747', 'rpfl': '0x36782', 'rpmd': 'AppleTV5,3', 'rpvr': '300.66', 'rpmrtid': 'D80F36C3-19D0-4DF7-BBA5-2E77A2403977', 'rpad': 'c709b6a2e27a', 'rpba': '0E:30:DA:52:CD:0C'})
2021-10-03 15:34:01 DEBUG [pyatv.core.scan]: Auto-discovered Apple TV (16367) at 192.168.0.105:7000 via Protocol.AirPlay ({'acl': '0', 'btaddr': 'D0:03:4B:2B:A6:8E', 'deviceid': 'D0:03:4B:2B:A6:8F', 'fex': '1d9/Wt5fFbwI', 'features': '0x5A7FDFD5,0xBC155FDE', 'flags': '0x10244', 'gid': '975027D3-7F7F-42A0-9BD4-D1BA4E4F958F', 'igl': '1', 'gcgl': '1', 'model': 'AppleTV5,3', 'protovers': '1.1', 'pi': 'f986fff4-256f-4003-b3ef-9cd77cd5981e', 'psi': 'D80F36C3-19D0-4DF7-BBA5-2E77A2403977', 'pk': '7c6ddfe1df237bd931d037f5855f035280cc1ea8c211ba49df041d9455ad6fb6', 'srcvers': '566.25.43', 'osvers': '15.0', 'vv': '2'})
2021-10-03 15:34:01 DEBUG [pyatv.core.scan]: Auto-discovered Apple TV (16367) at 192.168.0.105:49153 via Protocol.MRP ({'modelname': 'Apple TV', 'allowpairing': 'YES', 'bluetoothaddress': "b'\\xd0\\x03K+\\xa6\\x8e'", 'macaddress': 'd0:03:4b:2b:a6:8f', 'name': 'Apple TV (16367)', 'uniqueidentifier': '3A5AD3D3-6C1B-4651-A19D-282C0346AB6E', 'systembuildversion': '19J346', 'localairplayreceiverpairingidentity': 'D80F36C3-19D0-4DF7-BBA5-2E77A2403977'})
2021-10-03 15:34:01 DEBUG [pyatv.core.scan]: Auto-discovered D0034B2BA68F@Apple TV (16367) at 192.168.0.105:7000 via Protocol.RAOP ({'cn': '0,1,2,3', 'da': 'true', 'et': '0,3,5', 'ft': '0x5A7FDFD5,0xBC155FDE', 'sf': '0x10244', 'md': '0,1,2', 'am': 'AppleTV5,3', 'pk': '7c6ddfe1df237bd931d037f5855f035280cc1ea8c211ba49df041d9455ad6fb6', 'tp': 'UDP', 'vn': '65537', 'vs': '566.25.43', 'ov': '15.0', 'vv': '2'})
2021-10-03 15:34:01 DEBUG [pyatv.support.http]: Connected to 192.168.0.105
2021-10-03 15:34:01 DEBUG [pyatv.protocols.airplay.auth]: Setting up new AirPlay Pair-Setup procedure with type AuthenticationType.HAP
2021-10-03 15:34:01 DEBUG [pyatv.support.http]: Sending HTTP/1.1 message: b'POST /pair-pin-start HTTP/1.1\r\nUser-Agent: AirPlay/320.20\r\nConnection: keep-alive\r\nX-Apple-HKP: 3\r\nContent-Type: application/octet-stream\r\n\r\n'
2021-10-03 15:34:01 DEBUG [pyatv.support.http]: Received: b'HTTP/1.1 200 OK\r\nDate: Sun, 03 Oct 2021 10:04:02 GMT\r\nContent-Length: 0\r\nServer: AirTunes/566.25.43\r\n\r\n'
2021-10-03 15:34:01 DEBUG [pyatv.support.http]: Got HTTP response: HttpResponse(protocol='HTTP', version='1.1', code=200, message='OK', headers={'date': 'Sun, 03 Oct 2021 10:04:02 GMT', 'content-length': '0', 'server': 'AirTunes/566.25.43'}, body=''):
2021-10-03 15:34:01 DEBUG [pyatv.support.http]: Sending HTTP/1.1 message: b'POST /pair-setup HTTP/1.1\r\nContent-Length: 6\r\nUser-Agent: AirPlay/320.20\r\nConnection: keep-alive\r\nX-Apple-HKP: 3\r\nContent-Type: application/octet-stream\r\n\r\n\x00\x01\x00\x06\x01\x01'
2021-10-03 15:34:01 DEBUG [pyatv.support.http]: Received: b"HTTP/1.1 200 OK\r\nDate: Sun, 03 Oct 2021 10:04:02 GMT\r\nContent-Length: 409\r\nContent-Type: application/x-apple-binary-plist\r\nServer: AirTunes/566.25.43\r\n\r\n\x06\x01\x02\x02\x10\xc7nd?\xd9\xc0\x95\xa6\xaf\xb3\x14j8\xfa\xc6I\x03\xff^\x80EKb]\xad\x99\x87\x0c|\x13\xd3(\xbb\xf4\xdc\x12\x82\xf0_g\x0fd\x14E\x85\x1aR\x11R\xc8y\xad#\x91\xf2\x1c\x00j\x924\xe7\xcb\xf4`\t\ns\x1c\xd7\xcf\xd6\x01P0Zt\xf3\xac\x01*#\xec\xaf]\x7f\x88A\xdd\xff\x8e\x85\x88\xce\xc9j<m\xdcIV\x1c\xc91pi\xaaEu6\xe1\xf4\x90\xc6Ty\nV_p\xc6n\xa6\xb7\xb1\xdfu\x99=W\x1e\x12\x02\xfb\xccD\xde@\x03\xcf\xc7\x0cr\xfc\x9e\xc0K\xb1V\x97\xe4\x8f\xc3\xc9R\x88e\x16\xbaX\xb0\x7f\xb9|\xd1\xb8\x05\xa3wR9\x94B\xa6\xdb\xaa*\x97R9\xb2\x15\x99\xaf\xed\x12;\xa2;h\x07\xf4N\x9e]p\x11\xb9\xe0g]\xe8\xb3\xe7\xefW\x05\xdeY\xe8\xa2\x8bl\x83\xb2\xadb\x8fZ\xfd\n\xe4\xa6m\xdf\n0@\xa1\xae\xfe\x026\xed \x05\xfc\xb4*9\xdf\n\n\xd2{\r@\xa1\x82\xc6s4\xbb\xdd\xa1)\xdes\xaeB\xb0\x97\xf5\xdfmt\x88(Jp\x92\xdd\xa08\x03\x81D\x86)I\xc8\x8f67\xff\xccueS\xd6Z\x99\xc4\x05\x04\x92\xf2F\xb8\xe2\\\xf0\xf1\xb7!\x13\xa0vz\x98\x04\xe7Xe\xb3\x93M\xe2G*\x99lR\x1ct\rc\xeb>\xeb\xa2\xee\x9f\x96/\xa2\xb6\xe2\xe3\xcd\xddw\xe1\xd6\xa7\x80\x99\x80\xf2\x05\xdfkW\x85\x97\n3\xb2 '\\\x9e\xd0\x80\xe5@^/(\x19yZ\xd6\xc7\x90\xe0N*|^pgx:\xb4\x16\xe1\xa6m\xfdY\xe3\x18O\x14\xef9\x9e\xf1Y\x80@\xbeT-"
2021-10-03 15:34:01 DEBUG [pyatv.support.http]: Got HTTP response: HttpResponse(protocol='HTTP', version='1.1', code=200, message='OK', headers={'date': 'Sun, 03 Oct 2021 10:04:02 GMT', 'content-length': '409', 'content-type': 'application/x-apple-binary-plist', 'server': 'AirTunes/566.25.43'}, body=b"\x06\x01\x02\x02\x10\xc7nd?\xd9\xc0\x95\xa6\xaf\xb3\x14j8\xfa\xc6I\x03\xff^\x80EKb]\xad\x99\x87\x0c|\x13\xd3(\xbb\xf4\xdc\x12\x82\xf0_g\x0fd\x14E\x85\x1aR\x11R\xc8y\xad#\x91\xf2\x1c\x00j\x924\xe7\xcb\xf4`\t\ns\x1c\xd7\xcf\xd6\x01P0Zt\xf3\xac\x01*#\xec\xaf]\x7f\x88A\xdd\xff\x8e\x85\x88\xce\xc9j<m\xdcIV\x1c\xc91pi\xaaEu6\xe1\xf4\x90\xc6Ty\nV_p\xc6n\xa6\xb7\xb1\xdfu\x99=W\x1e\x12\x02\xfb\xccD\xde@\x03\xcf\xc7\x0cr\xfc\x9e\xc0K\xb1V\x97\xe4\x8f\xc3\xc9R\x88e\x16\xbaX\xb0\x7f\xb9|\xd1\xb8\x05\xa3wR9\x94B\xa6\xdb\xaa*\x97R9\xb2\x15\x99\xaf\xed\x12;\xa2;h\x07\xf4N\x9e]p\x11\xb9\xe0g]\xe8\xb3\xe7\xefW\x05\xdeY\xe8\xa2\x8bl\x83\xb2\xadb\x8fZ\xfd\n\xe4\xa6m\xdf\n0@\xa1\xae\xfe\x026\xed \x05\xfc\xb4*9\xdf\n\n\xd2{\r@\xa1\x82\xc6s4\xbb\xdd\xa1)\xdes\xaeB\xb0\x97\xf5\xdfmt\x88(Jp\x92\xdd\xa08\x03\x81D\x86)I\xc8\x8f67\xff\xccueS\xd6Z\x99\xc4\x05\x04\x92\xf2F\xb8\xe2\\\xf0\xf1\xb7!\x13\xa0vz\x98\x04\xe7Xe\xb3\x93M\xe2G*\x99lR\x1ct\rc\xeb>\xeb\xa2\xee\x9f\x96/\xa2\xb6\xe2\xe3\xcd\xddw\xe1\xd6\xa7\x80\x99\x80\xf2\x05\xdfkW\x85\x97\n3\xb2 '\\\x9e\xd0\x80\xe5@^/(\x19yZ\xd6\xc7\x90\xe0N*|^pgx:\xb4\x16\xe1\xa6m\xfdY\xe3\x18O\x14\xef9\x9e\xf1Y\x80@\xbeT-"):
Enter PIN on screen: 3422
2021-10-03 15:34:05 DEBUG [pyatv.protocols.airplay.pairing]: AirPlay PIN changed to 3422
2021-10-03 15:34:05 DEBUG [pyatv.auth.hap_srp]: Client (Proof=8deb1bad1866c763f34286994f5c7f4c67d1ac6af77a6aeeb17bbf24ae615e7964aa8cfe3525920519cee0e6ec29cab5332050efc4449bc0e1cd77b3eb5e6734, Public=89fbc8a860593cc6156ac0cac4e97ed367a10b1489820b3fa7343c9a47f12c6eff8f8193d61bb19f09aa564050e8d71fc042df36a2b3b2a1860c7e08eeb72e2323334245f73bca76a8f48ca81fd1c115bcbffd7ab4d02750d1d4ee37b32baa7ee7e8a18f1077c0dcc2b88c8ef98e1ac44bdd62fea8cecc940f0a79bbcf8de46a25d63ffec16a22d0779e30b0a8e570e53e68e852763d19e9d75e5d867eada3c612200816fb950d2c6dbe49425393279814c3b1c67d03aa1220d425257393e7629d748cfa4920036607a4447cd3520318352cf64b6ba810badc54511e77d71641bf0bb3eeffe3fa400f68568a9a1e6911f3ba30784e00f3cc6121ce5920e84...)
2021-10-03 15:34:05 DEBUG [pyatv.support.http]: Sending HTTP/1.1 message: b'POST /pair-setup HTTP/1.1\r\nContent-Length: 457\r\nUser-Agent: AirPlay/320.20\r\nConnection: keep-alive\r\nX-Apple-HKP: 3\r\nContent-Type: application/octet-stream\r\n\r\n\x06\x01\x03\x03\xff\x89\xfb\xc8\xa8`Y<\xc6\x15j\xc0\xca\xc4\xe9~\xd3g\xa1\x0b\x14\x89\x82\x0b?\xa74<\x9aG\xf1,n\xff\x8f\x81\x93\xd6\x1b\xb1\x9f\t\xaaV@P\xe8\xd7\x1f\xc0B\xdf6\xa2\xb3\xb2\xa1\x86\x0c~\x08\xee\xb7.##3BE\xf7;\xcav\xa8\xf4\x8c\xa8\x1f\xd1\xc1\x15\xbc\xbf\xfdz\xb4\xd0\'P\xd1\xd4\xee7\xb3+\xaa~\xe7\xe8\xa1\x8f\x10w\xc0\xdc\xc2\xb8\x8c\x8e\xf9\x8e\x1a\xc4K\xddb\xfe\xa8\xce\xcc\x94\x0f\ny\xbb\xcf\x8d\xe4j%\xd6?\xfe\xc1j"\xd0w\x9e0\xb0\xa8\xe5p\xe5>h\xe8Rv=\x19\xe9\xd7^]\x86~\xad\xa3\xc6\x12 \x08\x16\xfb\x95\r,m\xbeIBS\x93\'\x98\x14\xc3\xb1\xc6}\x03\xaa\x12 \xd4%%s\x93\xe7b\x9dt\x8c\xfaI \x03f\x07\xa4D|\xd3R\x03\x185,\xf6Kk\xa8\x10\xba\xdcTQ\x1ew\xd7\x16A\xbf\x0b\xb3\xee\xff\xe3\xfa@\x0fhV\x8a\x9a\x1ei\x11\xf3\xba0xN\x00\xf3\xcca!\xceY \xe8N\x03\x81z\x17\xef\x8a\x18\x01\xf3`a\xea\xfd60\xea:?\xfeM\xd3\xf7\xb8\x1d>;\xf4\x17\xe7:\x95?\xc3\xc2kzN$\x98u\x1f\xb2\xc49\xed\xe2(\nW\xd6eO+\x80\x84\xef\x960g\x10i\xffM\xb1\x80\xd0\xd2\xd7\xca\xcf\x86N\x94\xe0\x86\x18\xd1\x9a\xc3\x00\xb9\xfd\xa7y\xe3\xc8|\xe1\x19\r\xfe\x1a\xd8\xfa\xc65\xf9%L\xbe\x9b\xb9\x901:o&\x0f\x9f*\xa9\xc4\xe6\xec.J\xa6q\x1f\xe9\xc2\xbe;\xf6\x9e. \x19@\xca\xb2\x04@\x8d\xeb\x1b\xad\x18f\xc7c\xf3B\x86\x99O\\\x7fLg\xd1\xacj\xf7zj\xee\xb1{\xbf$\xaea^yd\xaa\x8c\xfe5%\x92\x05\x19\xce\xe0\xe6\xec)\xca\xb53 P\xef\xc4D\x9b\xc0\xe1\xcdw\xb3\xeb^g4'
2021-10-03 15:34:05 DEBUG [pyatv.support.http]: Received: b'HTTP/1.1 200 OK\r\nDate: Sun, 03 Oct 2021 10:04:05 GMT\r\nContent-Length: 69\r\nContent-Type: application/x-apple-binary-plist\r\nServer: AirTunes/566.25.43\r\n\r\n\x06\x01\x04\x04@5\xfe\t\x0b[n4sy\xf7\x9ar\x01g\xe0\x1bw\xdd\xf7\xc0\x8cO\xea\xd5Q\x9d\xb0\xf7\x8at\x9c-\x9b\xeaK0b\xb6/\xd2Z\xe7 \x1ec\xa5\xb9\xab\x93\xe2\x05\x87\xa09\xeeL\xa4\xab))\x13\xd2U\x85'
2021-10-03 15:34:05 DEBUG [pyatv.support.http]: Got HTTP response: HttpResponse(protocol='HTTP', version='1.1', code=200, message='OK', headers={'date': 'Sun, 03 Oct 2021 10:04:05 GMT', 'content-length': '69', 'content-type': 'application/x-apple-binary-plist', 'server': 'AirTunes/566.25.43'}, body=b'\x06\x01\x04\x04@5\xfe\t\x0b[n4sy\xf7\x9ar\x01g\xe0\x1bw\xdd\xf7\xc0\x8cO\xea\xd5Q\x9d\xb0\xf7\x8at\x9c-\x9b\xeaK0b\xb6/\xd2Z\xe7 \x1ec\xa5\xb9\xab\x93\xe2\x05\x87\xa09\xeeL\xa4\xab))\x13\xd2U\x85'):
2021-10-03 15:34:05 DEBUG [pyatv.auth.hap_srp]: Data (Encrypted=25ad26e806e0137713c84a80a904cd17ef63e4c33f2217a88b86307432c845e3c0aa6493318e80364e53e885ab537c9041fccfebf5991cf96072ce4ac8ab4faf8de5eec76f6badc57b99555aa30f0802983d23bb4fa16a69f1a5ee9db098e789f7a3a4c0045591ae0424a9b1e783ba85092dd576b737fea8121104bc199d92abadc4eabbbb451d9eb73a07f44b19e35ca12d97df079d4d34a91c)
2021-10-03 15:34:05 DEBUG [pyatv.support.http]: Sending HTTP/1.1 message: b'POST /pair-setup HTTP/1.1\r\nContent-Length: 159\r\nUser-Agent: AirPlay/320.20\r\nConnection: keep-alive\r\nX-Apple-HKP: 3\r\nContent-Type: application/octet-stream\r\n\r\n\x06\x01\x05\x05\x9a%\xad&\xe8\x06\xe0\x13w\x13\xc8J\x80\xa9\x04\xcd\x17\xefc\xe4\xc3?"\x17\xa8\x8b\x860t2\xc8E\xe3\xc0\xaad\x931\x8e\x806NS\xe8\x85\xabS|\x90A\xfc\xcf\xeb\xf5\x99\x1c\xf9`r\xceJ\xc8\xabO\xaf\x8d\xe5\xee\xc7ok\xad\xc5{\x99UZ\xa3\x0f\x08\x02\x98=#\xbbO\xa1ji\xf1\xa5\xee\x9d\xb0\x98\xe7\x89\xf7\xa3\xa4\xc0\x04U\x91\xae\x04$\xa9\xb1\xe7\x83\xba\x85\t-\xd5v\xb77\xfe\xa8\x12\x11\x04\xbc\x19\x9d\x92\xab\xad\xc4\xea\xbb\xbbE\x1d\x9e\xb7:\x07\xf4K\x19\xe3\\\xa1-\x97\xdf\x07\x9dM4\xa9\x1c'
2021-10-03 15:34:09 ERROR [pyatv.scripts.atvremote]: Pairing failed
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pyatv/support/http.py", line 388, in send_and_receive
    await asyncio.wait_for(event.wait(), timeout=4)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 362, in wait_for
    raise futures.TimeoutError()
concurrent.futures._base.TimeoutError

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pyatv/support/__init__.py", line 33, in error_handler
    return await func(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pyatv/protocols/airplay/auth/hap.py", line 78, in finish_pairing
    "/pair-setup", body=hap_tlv8.write_tlv(data), headers=_AIRPLAY_HEADERS
  File "/usr/local/lib/python3.6/dist-packages/pyatv/support/http.py", line 360, in post
    "POST", path, headers=headers, body=body, allow_error=allow_error
  File "/usr/local/lib/python3.6/dist-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 POST /pair-setup (HTTP/1.1)

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pyatv/scripts/atvremote.py", line 178, in pair
    await self._perform_pairing(pairing)
  File "/usr/local/lib/python3.6/dist-packages/pyatv/scripts/atvremote.py", line 211, in _perform_pairing
    await pairing.finish()
  File "/usr/local/lib/python3.6/dist-packages/pyatv/protocols/airplay/pairing.py", line 78, in finish
    self.pin_code,
  File "/usr/local/lib/python3.6/dist-packages/pyatv/support/__init__.py", line 35, in error_handler
    raise exceptions.ConnectionFailedError(str(ex)) from ex
pyatv.exceptions.ConnectionFailedError: no response to POST /pair-setup (HTTP/1.1)
2021-10-03 15:34:09 DEBUG [pyatv.support.http]: Connection closed
user@user-HP-ProBook-450-G7:~/repos/DEV/ipcontrol$ atvremote scan
Scan Results
========================================
       Name: Apple TV (16367)
   Model/SW: Apple TV 4, tvOS 15.0 build 19J346
    Address: 192.168.0.105
        MAC: D0:03:4B:2B:A6:8F
 Deep Sleep: True
Identifiers:
 - D0:03:4B:2B:A6:8F
 - 3A5AD3D3-6C1B-4651-A19D-282C0346AB6E
 - D0034B2BA68F
Services:
 - Protocol: Companion, Port: 49152, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory
 - Protocol: AirPlay, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory
 - Protocol: MRP, Port: 49153, Credentials: None, Requires Password: False, Password: None, Pairing: Optional
 - Protocol: RAOP, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory

user@user-HP-ProBook-450-G7:~/repos/DEV/ipcontrol$ atvremote --debug --id 3A5AD3D3-6C1B-4651-A19D-282C0346AB6E --protocol airplay pair
2021-10-03 15:34:37 DEBUG [pyatv.support.net]: Binding on *:5353
2021-10-03 15:34:37 DEBUG [pyatv.support.net]: Binding on 127.0.0.1:0
2021-10-03 15:34:37 DEBUG [pyatv.support.net]: Binding on 192.168.0.107:0
2021-10-03 15:34:37 DEBUG [pyatv.support.net]: Binding on 192.168.250.1:0
2021-10-03 15:34:37 DEBUG [pyatv.core.scan]: Auto-discovered Apple TV (16367) at 192.168.0.105:49152 via Protocol.Companion ({'rpmac': '1', 'rphn': '3956f11ee747', 'rpfl': '0x36782', 'rpmd': 'AppleTV5,3', 'rpvr': '300.66', 'rpmrtid': 'D80F36C3-19D0-4DF7-BBA5-2E77A2403977', 'rpad': 'c709b6a2e27a', 'rpba': '0E:30:DA:52:CD:0C'})
2021-10-03 15:34:37 DEBUG [pyatv.core.scan]: Auto-discovered Apple TV (16367) at 192.168.0.105:7000 via Protocol.AirPlay ({'acl': '0', 'btaddr': 'D0:03:4B:2B:A6:8E', 'deviceid': 'D0:03:4B:2B:A6:8F', 'fex': '1d9/Wt5fFbwI', 'features': '0x5A7FDFD5,0xBC155FDE', 'flags': '0x10244', 'gid': '975027D3-7F7F-42A0-9BD4-D1BA4E4F958F', 'igl': '1', 'gcgl': '1', 'model': 'AppleTV5,3', 'protovers': '1.1', 'pi': 'f986fff4-256f-4003-b3ef-9cd77cd5981e', 'psi': 'D80F36C3-19D0-4DF7-BBA5-2E77A2403977', 'pk': '7c6ddfe1df237bd931d037f5855f035280cc1ea8c211ba49df041d9455ad6fb6', 'srcvers': '566.25.43', 'osvers': '15.0', 'vv': '2'})
2021-10-03 15:34:37 DEBUG [pyatv.core.scan]: Auto-discovered Apple TV (16367) at 192.168.0.105:49153 via Protocol.MRP ({'modelname': 'Apple TV', 'allowpairing': 'YES', 'bluetoothaddress': "b'\\xd0\\x03K+\\xa6\\x8e'", 'macaddress': 'd0:03:4b:2b:a6:8f', 'name': 'Apple TV (16367)', 'uniqueidentifier': '3A5AD3D3-6C1B-4651-A19D-282C0346AB6E', 'systembuildversion': '19J346', 'localairplayreceiverpairingidentity': 'D80F36C3-19D0-4DF7-BBA5-2E77A2403977'})
2021-10-03 15:34:37 DEBUG [pyatv.core.scan]: Auto-discovered D0034B2BA68F@Apple TV (16367) at 192.168.0.105:7000 via Protocol.RAOP ({'cn': '0,1,2,3', 'da': 'true', 'et': '0,3,5', 'ft': '0x5A7FDFD5,0xBC155FDE', 'sf': '0x10244', 'md': '0,1,2', 'am': 'AppleTV5,3', 'pk': '7c6ddfe1df237bd931d037f5855f035280cc1ea8c211ba49df041d9455ad6fb6', 'tp': 'UDP', 'vn': '65537', 'vs': '566.25.43', 'ov': '15.0', 'vv': '2'})
2021-10-03 15:34:37 DEBUG [pyatv.support.http]: Connected to 192.168.0.105
2021-10-03 15:34:37 DEBUG [pyatv.protocols.airplay.auth]: Setting up new AirPlay Pair-Setup procedure with type AuthenticationType.HAP
2021-10-03 15:34:37 DEBUG [pyatv.support.http]: Sending HTTP/1.1 message: b'POST /pair-pin-start HTTP/1.1\r\nUser-Agent: AirPlay/320.20\r\nConnection: keep-alive\r\nX-Apple-HKP: 3\r\nContent-Type: application/octet-stream\r\n\r\n'
2021-10-03 15:34:38 DEBUG [pyatv.support.http]: Received: b'HTTP/1.1 200 OK\r\nDate: Sun, 03 Oct 2021 10:04:38 GMT\r\nContent-Length: 0\r\nServer: AirTunes/566.25.43\r\n\r\n'
2021-10-03 15:34:38 DEBUG [pyatv.support.http]: Got HTTP response: HttpResponse(protocol='HTTP', version='1.1', code=200, message='OK', headers={'date': 'Sun, 03 Oct 2021 10:04:38 GMT', 'content-length': '0', 'server': 'AirTunes/566.25.43'}, body=''):
2021-10-03 15:34:38 DEBUG [pyatv.support.http]: Sending HTTP/1.1 message: b'POST /pair-setup HTTP/1.1\r\nContent-Length: 6\r\nUser-Agent: AirPlay/320.20\r\nConnection: keep-alive\r\nX-Apple-HKP: 3\r\nContent-Type: application/octet-stream\r\n\r\n\x00\x01\x00\x06\x01\x01'
2021-10-03 15:34:38 DEBUG [pyatv.support.http]: Received: b'HTTP/1.1 200 OK\r\nDate: Sun, 03 Oct 2021 10:04:38 GMT\r\nContent-Length: 409\r\nContent-Type: application/x-apple-binary-plist\r\nServer: AirTunes/566.25.43\r\n\r\n\x06\x01\x02\x02\x10n\xc3\xb5\x07\xd0\x0e\xf6\x17\xdb\xd5\x006\xd3\xafXs\x03\xffW\x9f\xe4\xd5\xc7\xd7R\x18\x87\xbe%!\x8bj\xdf9\xe1\nc\xa9^\x02\xf6\xc7\x17T\xa7\xbc\xf7\x82\x12\x0f\xddz64\xb6\xf9F\xb4\xa7\xc6|}w\x18\xa6\x12\x08\x95\xb9\x11\xdc\x02\x07\x90\x92 \xed\x88\x10\x8d\xdf\xcfa%+L\x997\xa9\xd3l\xfb\x0e\xcaw\x10\x93\x87\xdb\xdf\xe1\x882\x8e\xf7EEn\xffIlqz\xa6\xc4\xa7\x1b\xfb8\x9a\xc6^\xc5\x9c/\x91\xaf\\\x12\xec\xd9g\xce\t\xf5\x1e\x9e\x9a\x89\xb1iK)\x999!\xd8D\xbe\xd7\xc5!\x81|@\xe1@\xe0\xb5\xf9qh3?^\xb2w\xd8\x18\xdc;\xe8\xce\xc4\x1dH=\x94\xab\x84x\x94\xf5;5#F\xcd\xf2F\x9d\xfd\xc6U\x93\xfc\x92\xaf\xfbj$\xf6\xbb\x85j<\r\x98Mhf]\x88\xc2\xf3^\x94\xb8\x15Y\x05Rs\xa9\xc4\x96\xef{\x8a\x9499\xc96V>\xc3\xf5\x1d\xdc\xf4\x18\x84q\x85\xc2\xbe\n\xdcV\x10\xf4\x13\x87\xd5\xcc<6\xf2\xa7\xd1L\xdf\xae\xfb\xd0\xf1\rF\xe0\x1es\xc4\x03\x81\x82\xff,\x87\xd5\xa8b\x04\xcb@@k\x1c\xc6\xb5\xf8\xf7\x88\x7fnep\x06$\xfa\xf6\xc7\xb6\x9b\x9f\x0b\x1a\xee\xae\xfcA\xb0;\x82@\xc4C!\xc0\xd5\xfa\xf6\xbe\xe1u\xb2L2%\xeaJ\xec\xae\x83\xaf\xeb\xca\x15\xbe\xee\x92\xbd\x9b%\xe2\xa1\xe8\x9ez,\x97\xe9\x88\xd4\xb09\x1b\x9e\x0e\xfb,a\xae\xbe[\x1fl\x86\xf1\xef\x01\xed\xd8\xe8\x04W\xa6\xce\x93J\x12V\xc1\xc1\x923\xa8:\xbd\xbak\xdf\x81\x84G\x9f\xdf\xe7v\x17\x18\x0f\t\xd1'
2021-10-03 15:34:38 DEBUG [pyatv.support.http]: Got HTTP response: HttpResponse(protocol='HTTP', version='1.1', code=200, message='OK', headers={'date': 'Sun, 03 Oct 2021 10:04:38 GMT', 'content-length': '409', 'content-type': 'application/x-apple-binary-plist', 'server': 'AirTunes/566.25.43'}, body=b'\x06\x01\x02\x02\x10n\xc3\xb5\x07\xd0\x0e\xf6\x17\xdb\xd5\x006\xd3\xafXs\x03\xffW\x9f\xe4\xd5\xc7\xd7R\x18\x87\xbe%!\x8bj\xdf9\xe1\nc\xa9^\x02\xf6\xc7\x17T\xa7\xbc\xf7\x82\x12\x0f\xddz64\xb6\xf9F\xb4\xa7\xc6|}w\x18\xa6\x12\x08\x95\xb9\x11\xdc\x02\x07\x90\x92 \xed\x88\x10\x8d\xdf\xcfa%+L\x997\xa9\xd3l\xfb\x0e\xcaw\x10\x93\x87\xdb\xdf\xe1\x882\x8e\xf7EEn\xffIlqz\xa6\xc4\xa7\x1b\xfb8\x9a\xc6^\xc5\x9c/\x91\xaf\\\x12\xec\xd9g\xce\t\xf5\x1e\x9e\x9a\x89\xb1iK)\x999!\xd8D\xbe\xd7\xc5!\x81|@\xe1@\xe0\xb5\xf9qh3?^\xb2w\xd8\x18\xdc;\xe8\xce\xc4\x1dH=\x94\xab\x84x\x94\xf5;5#F\xcd\xf2F\x9d\xfd\xc6U\x93\xfc\x92\xaf\xfbj$\xf6\xbb\x85j<\r\x98Mhf]\x88\xc2\xf3^\x94\xb8\x15Y\x05Rs\xa9\xc4\x96\xef{\x8a\x9499\xc96V>\xc3\xf5\x1d\xdc\xf4\x18\x84q\x85\xc2\xbe\n\xdcV\x10\xf4\x13\x87\xd5\xcc<6\xf2\xa7\xd1L\xdf\xae\xfb\xd0\xf1\rF\xe0\x1es\xc4\x03\x81\x82\xff,\x87\xd5\xa8b\x04\xcb@@k\x1c\xc6\xb5\xf8\xf7\x88\x7fnep\x06$\xfa\xf6\xc7\xb6\x9b\x9f\x0b\x1a\xee\xae\xfcA\xb0;\x82@\xc4C!\xc0\xd5\xfa\xf6\xbe\xe1u\xb2L2%\xeaJ\xec\xae\x83\xaf\xeb\xca\x15\xbe\xee\x92\xbd\x9b%\xe2\xa1\xe8\x9ez,\x97\xe9\x88\xd4\xb09\x1b\x9e\x0e\xfb,a\xae\xbe[\x1fl\x86\xf1\xef\x01\xed\xd8\xe8\x04W\xa6\xce\x93J\x12V\xc1\xc1\x923\xa8:\xbd\xbak\xdf\x81\x84G\x9f\xdf\xe7v\x17\x18\x0f\t\xd1'):
Enter PIN on screen: 2091
2021-10-03 15:34:41 DEBUG [pyatv.protocols.airplay.pairing]: AirPlay PIN changed to 2091
2021-10-03 15:34:41 DEBUG [pyatv.auth.hap_srp]: Client (Proof=08c51caddf66e7e0b16f7506eb453d156a43a09e886501e7ba184df9ebfff8343658785efb0c1cd1fb1596ba50fa23171693de15534c97a338901daf9e0079f0, Public=a1f4ea75475a97309245e7222ea9eef3fb2eaf4d527549486b4d23f1b6d6d4fefd67343873c5ddb6eea4284f3ecac2998b16364e516315cdf4c397937e4dd3633c80d912e470cd5bb4a3bcdce1993d428d3a50f031fed1cd2a55bbb14ecc3a70dff9a283c3de85893f06867b3dfca323bdbbc79615d7979783728d3d5686a2eb11f286dce2674ae9a58388a3d7df2250ce3633c053425028aed64656ed33cc9718f3ba0409d6a22923d1b5c46bfe84c68cae0eb976d3b9a2528262675c48c3a7702dbe9611c7cc43d7d333c0728f2b8e09e97c037eeb9eddacaea84630b884c77f2def69c0a5b93e3301d36db95477dce50b330a7f752247262e46b0f428f...)
2021-10-03 15:34:41 DEBUG [pyatv.support.http]: Sending HTTP/1.1 message: b'POST /pair-setup HTTP/1.1\r\nContent-Length: 457\r\nUser-Agent: AirPlay/320.20\r\nConnection: keep-alive\r\nX-Apple-HKP: 3\r\nContent-Type: application/octet-stream\r\n\r\n\x06\x01\x03\x03\xff\xa1\xf4\xeauGZ\x970\x92E\xe7".\xa9\xee\xf3\xfb.\xafMRuIHkM#\xf1\xb6\xd6\xd4\xfe\xfdg48s\xc5\xdd\xb6\xee\xa4(O>\xca\xc2\x99\x8b\x166NQc\x15\xcd\xf4\xc3\x97\x93~M\xd3c<\x80\xd9\x12\xe4p\xcd[\xb4\xa3\xbc\xdc\xe1\x99=B\x8d:P\xf01\xfe\xd1\xcd*U\xbb\xb1N\xcc:p\xdf\xf9\xa2\x83\xc3\xde\x85\x89?\x06\x86{=\xfc\xa3#\xbd\xbb\xc7\x96\x15\xd7\x97\x97\x83r\x8d=V\x86\xa2\xeb\x11\xf2\x86\xdc\xe2gJ\xe9\xa5\x83\x88\xa3\xd7\xdf"P\xce63\xc0SBP(\xae\xd6FV\xed3\xcc\x97\x18\xf3\xba\x04\t\xd6\xa2)#\xd1\xb5\xc4k\xfe\x84\xc6\x8c\xae\x0e\xb9v\xd3\xb9\xa2R\x82bg\\H\xc3\xa7p-\xbe\x96\x11\xc7\xccC\xd7\xd33\xc0r\x8f+\x8e\t\xe9|\x03~\xeb\x9e\xdd\xac\xae\xa8F0\xb8\x84\xc7\x7f-\xefi\xc0\xa5\xb9>3\x01\xd3m\xb9Tw\xdc\xe5\x0b3\n\x7fu"G&.F\xb0\xf4(\xf7\x03\x81F\xdb\x8d\xbb\xab\xd4\x9a\xff\xb3\x8a\x1c\xbf\xf6\xb1\xcd\x8d\xff\xe5~8\xac\'m\x8d\xa4\xf0\x19,\xaa\x10\x06\xcb\t\xa8\x9e;\xc1\xd6>\x1d\x19\x9b\xd2x\xbb\x9b\xc7\xec\xe0\xbf\xdeR7\x83\x80\xa1P\xc1\x84\rL\xe7\x043\xb9\xa2D\x80\xa5~\xa4"\x0e\x1e\x83\xa5V\xb9\x1a\x99Ia \xa5\x01\xa1Jq\xf9\x9d\xa5\xb1\xa6\xa7\xaa-\xbf\xdf\xce%\xa1\xb1\x06ir|%\xa3\x00\xea4\x8e\nr\xa6\xe5\xe5L\xecN\xc4\x07\x0b+\x02\xe1\'\x89_\x04@\x08\xc5\x1c\xad\xdff\xe7\xe0\xb1ou\x06\xebE=\x15jC\xa0\x9e\x88e\x01\xe7\xba\x18M\xf9\xeb\xff\xf846Xx^\xfb\x0c\x1c\xd1\xfb\x15\x96\xbaP\xfa#\x17\x16\x93\xde\x15SL\x97\xa38\x90\x1d\xaf\x9e\x00y\xf0'
2021-10-03 15:34:41 DEBUG [pyatv.support.http]: Received: b'HTTP/1.1 200 OK\r\nDate: Sun, 03 Oct 2021 10:04:41 GMT\r\nContent-Length: 69\r\nContent-Type: application/x-apple-binary-plist\r\nServer: AirTunes/566.25.43\r\n\r\n\x06\x01\x04\x04@\xeb\xe8\xbba\x0by(&\xd87\xf0*W\x02\x94,\xea\x03b\x96\x8bOR\xb4\xecE\xf2\x9fS\x86\xb6H\x00y\xe0\x7fQ\xdc\xde\xdc\xc3\x1b<\xab\x180e\xd41\xd4\xb4\x85\xb4Y"\x92\xec\xff|\xb7\x85WY!'
2021-10-03 15:34:41 DEBUG [pyatv.support.http]: Got HTTP response: HttpResponse(protocol='HTTP', version='1.1', code=200, message='OK', headers={'date': 'Sun, 03 Oct 2021 10:04:41 GMT', 'content-length': '69', 'content-type': 'application/x-apple-binary-plist', 'server': 'AirTunes/566.25.43'}, body=b'\x06\x01\x04\x04@\xeb\xe8\xbba\x0by(&\xd87\xf0*W\x02\x94,\xea\x03b\x96\x8bOR\xb4\xecE\xf2\x9fS\x86\xb6H\x00y\xe0\x7fQ\xdc\xde\xdc\xc3\x1b<\xab\x180e\xd41\xd4\xb4\x85\xb4Y"\x92\xec\xff|\xb7\x85WY!'):
2021-10-03 15:34:41 DEBUG [pyatv.auth.hap_srp]: Data (Encrypted=d570595e9d3877133d18431aaf1b22428de9688476af3077c1baed5e6ef3a4d48082278109d06654b8dd2c80079d195327b6073a1e4467ba4b80885c80c8e0e08e8b4d7941499ef7c18e6f6b6f3118f097384eda7ea4f2bf49c61b1621cfbfce2cd713a28728ed1c13a43786115fb38f8e4978b5afed19e5dd71e6502980254c45bcd8a8d0394221dfd0343fc10a15cfffccb586430c39755c3c)
2021-10-03 15:34:41 DEBUG [pyatv.support.http]: Sending HTTP/1.1 message: b'POST /pair-setup HTTP/1.1\r\nContent-Length: 159\r\nUser-Agent: AirPlay/320.20\r\nConnection: keep-alive\r\nX-Apple-HKP: 3\r\nContent-Type: application/octet-stream\r\n\r\n\x06\x01\x05\x05\x9a\xd5pY^\x9d8w\x13=\x18C\x1a\xaf\x1b"B\x8d\xe9h\x84v\xaf0w\xc1\xba\xed^n\xf3\xa4\xd4\x80\x82\'\x81\t\xd0fT\xb8\xdd,\x80\x07\x9d\x19S\'\xb6\x07:\x1eDg\xbaK\x80\x88\\\x80\xc8\xe0\xe0\x8e\x8bMyAI\x9e\xf7\xc1\x8eoko1\x18\xf0\x978N\xda~\xa4\xf2\xbfI\xc6\x1b\x16!\xcf\xbf\xce,\xd7\x13\xa2\x87(\xed\x1c\x13\xa47\x86\x11_\xb3\x8f\x8eIx\xb5\xaf\xed\x19\xe5\xddq\xe6P)\x80%LE\xbc\xd8\xa8\xd09B!\xdf\xd04?\xc1\n\x15\xcf\xff\xcc\xb5\x86C\x0c9u\\<'
2021-10-03 15:34:45 ERROR [pyatv.scripts.atvremote]: Pairing failed
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pyatv/support/http.py", line 388, in send_and_receive
    await asyncio.wait_for(event.wait(), timeout=4)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 362, in wait_for
    raise futures.TimeoutError()
concurrent.futures._base.TimeoutError

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pyatv/support/__init__.py", line 33, in error_handler
    return await func(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pyatv/protocols/airplay/auth/hap.py", line 78, in finish_pairing
    "/pair-setup", body=hap_tlv8.write_tlv(data), headers=_AIRPLAY_HEADERS
  File "/usr/local/lib/python3.6/dist-packages/pyatv/support/http.py", line 360, in post
    "POST", path, headers=headers, body=body, allow_error=allow_error
  File "/usr/local/lib/python3.6/dist-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 POST /pair-setup (HTTP/1.1)

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pyatv/scripts/atvremote.py", line 178, in pair
    await self._perform_pairing(pairing)
  File "/usr/local/lib/python3.6/dist-packages/pyatv/scripts/atvremote.py", line 211, in _perform_pairing
    await pairing.finish()
  File "/usr/local/lib/python3.6/dist-packages/pyatv/protocols/airplay/pairing.py", line 78, in finish
    self.pin_code,
  File "/usr/local/lib/python3.6/dist-packages/pyatv/support/__init__.py", line 35, in error_handler
    raise exceptions.ConnectionFailedError(str(ex)) from ex
pyatv.exceptions.ConnectionFailedError: no response to POST /pair-setup (HTTP/1.1)
2021-10-03 15:34:45 DEBUG [pyatv.support.http]: Connection closed
user@user-HP-ProBook-450-G7:~/repos/DEV/ipcontrol$ 

How to reproduce the bug?

atvremote scan use any id returned atvremote --debug --id --protocol airplay pair

What is expected behavior?

should pair after display the pin on screen but final pairing does not return creds

Operating System

linux 18.04

Python

3.6

pyatv

0.9.1

Device

TVOS15 Beta

Additional context

Does display the pin on screen but final pairing does not return creds

postlund commented 3 years ago

This error is really strange, it seems so random that the device wouldn't respond to the last message. It's not really possible to figure out what is happening black box style, we would need to look at the logs on device. I assume you have tried restarting the device? Do you use VLANs or are all devices on the same network? Do you own a mac?

postlund commented 2 years ago

Can you try if the latest version of pyatv (0.9.7) still has the same problem?

Ajay-ue commented 2 years ago

Hi Peire,

I am able to work with 0.9.7 using companion. I tried navigation keys and those working fine.

Is that what you wanted to check ?

Thanks & regards AJ

On Mon, Dec 6, 2021 at 3:13 PM Pierre Ståhl @.***> wrote:

Can you try if the latest version of pyatv (0.9.7) still has the same problem?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/postlund/pyatv/issues/1366#issuecomment-986605197, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJMFHPMNZ3E6F3RBRUNPSQLUPSAVFANCNFSM5FHNZPYQ . 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.

postlund commented 2 years ago

Yeah, that is fine by me. Thanks for testing! 👍