Where Do I Enter the DMAP Pairing Code?

I get this new device notification in integrations:
2022-05-10_13-20-02

I click configure and get this:

I click submit and get this:

I made sure my AppleTV was running and checked the display attached to it. There was nothing in the way of a confirmation or request. I also checked iTunes on yamadoshi: nothing there either. There’s also nothing new on the AppleTV integration.

When I close the last dialog, the integration request disappears and no new integration is added. After a few minutes, the request reappears.

After setting up my AppleTV and entering numerous PIN’s, I was able to add several HomePods. They didn’t require any PIN’s.

I’m running 2022.5.3 in docker. I also verified that the MacOS image had media sharing turned on in Preferences.

Update

I got further. I had to change AirPlay Receiver from “Current User” to “Anyone on the same network”. I did the submit again. A message popped up asking me to accept or decline the pairing. After accepting it, I got a PIN display screen. I did an escape and got this:

I entered the PIN. It then gave me this:

I didn’t see anywhere to enter the code on the Mac or the AppleTV. When I clicked Submit, it aborted the process and displayed this:

Update

I found an item in the AppleTV thread that said to go to remotes in the system menu and enter it there. That seems logical. The problem is that Home Assistant doesn’t appear as an option anywhere I can see.

What is found I the initial picture is iTunes or the music all running on a computer, not an Apple TV. You will find a “Home Assistant” entry in the list to the left you can use for pairing. Seems to be some problems with translation though since a pin code should be displayed in the second dialog…

@postlund, thanks for the response. I’ve read through your main thread on the integration, but couldn’t find anything that helps. On my AppleTV(latest 4k), I go to Settings/Remotes and Devices/Remote App and Devices after starting the pairing process. I just see my iPhone there. When you say:

Where should I be looking for this list? On the AppleTV or in Home Assistant?

The reason I’m doing this is to be able to do TTS to my Mac Pro. I’m mentioning it in case that’s not possible with this interface.

Assuming we are still talking about the device in your initial post, then it has nothing to do with an Apple TV. That is the Music app or iTunes running on a computer on your network. Assuming you have a recent enough computer, you should check the Music app on the computer named yamadoshi.

Regarding TTS to a Mac Pro, that is something that might be possible if it runs macOS Monterey and you have enabled it to act as an AirPlay receiver. I have however not verified it to be compatible (I don’t have a Mac running Monterey). If you manage to get it working I’m interested in the result.

@postlund, I found the listing for Home Assistant in Music. I wasn’t looking in the right place for it. The only problem now is that there are four of them and I can’t delete them. I even tried a restart of the OS. I did try enter a new code into one of them. It wasn’t recognized. Any idea how to get rid of them so I can start fresh? It’s late here so I’ll look into it more tomorrow.

Tomorrow

I couldn’t find a way to delete them so I just tried entering the PIN into different ones. When I chose the top one, the PIN was accepted and Music said the remote was paired. After clicking submit in Home Assistant, I got another PIN for Airplay. I escaped and entered it and then got another code. When I escaped again and entered the code, I got this.

I forgot exactly what I did next, but another PIN appeared. I escaped and entered the new PIN and got the same dialog. On one attempt, I got this:

This logic must have been in a loop because the dialog flickered from being redisplayed.

I rebooted Home Assistant and tried again. It started from the beginning and took me to the same error.

After entering the PIN in Music, one of the Home Assistant devices disappears from the list on the left, three remain.

Turned on Logging

I turned on debug logging to see if I could anything useful. I couldn’t repair with Music until I deleted the remote. I got the same problem again. Here’s an error that came up in the log:

2022-05-12 15:54:21 DEBUG (MainThread) [pyatv.core.protocol] Got heartbeat 73 (AirPlay:10.0.0.124)
2022-05-12 15:54:22 DEBUG (MainThread) [pyatv.support.http] Connection closed
2022-05-12 15:54:22 DEBUG (MainThread) [pyatv.support.http] Connection closed
2022-05-12 15:54:22 DEBUG (MainThread) [pyatv.support.http] Connection closed
2022-05-12 15:54:22 DEBUG (MainThread) [pyatv.support.http] Sending HTTP/1.1 message: b’POST /pair-setup-pin HTTP/1.1\r\nUser-Agent: pyatv/0.10.0\r\nContent-Length: 85\r\n\r\nbplist00\xd2\x01\x02\x03\x04VmethodTuserSpin_\x10\x1052E2EF5EDE7FFA91\x08\r\x14\x19\x1d\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x000’
2022-05-12 15:54:22 DEBUG (MainThread) [pyatv.support.http] Received: b"HTTP/1.1 200 OK\r\nDate: Thu, 12 May 2022 22:54:22 GMT\r\nContent-Length: 342\r\nContent-Type: application/x-apple-binary-plist\r\nServer: AirTunes/610.19.1\r\n\r\nbplist00\xd2\x01\x02\x03\x04RpkTsaltO\x11\x01\x00H\x90\xbcJ\xc5M\x17\xb8\x8a}u\xf9\xbf\x11\x8a\x83\xf1\x8b\xb76\x8a\x12\r\xb1\x7f%\x7f\x19\x81\t\xab\xf6|S\xad{\xa3\xd0\xe3\x05\x8a\xfax\xe7\x14/\xf9\xac\x97s\x1f\x10I\xcaN\x0f\xfd\x82\xf1\xc9\xdb<\xfa\xc1rw3x\x14\xe5\xee\x92\xf4\xdf(\x9e\xe34\x80\xcd\xe3i\x7fC\x08\xd7\x80~\xd3\xc8\xfd\x7f\xecN\xa2\xff\xda\x0b\x85T\xff\xec\xc4'v\xfa\x01\x8c\x97\xa4\xd8q\x893\xefH/\x90r\x0e\xb5N;\x92\xbe2\x9dx\xc7\xe2\xdd[{qu\x00\xd1\xd5\xe6\xce]c\xec\x06\x9e=aN\x15+\xdd\x10\x1b\xc9G\xec\x9d:\x03\xdc\xd4+\xb76e\xe7e\xf7\x92\xa9\xdb\xc2\xffFW\xc7\xfc\x84\xb7\x99\x9d\x85\x8f\xd9\x9fs\xa8\x0f\xf8\xe9\xc1\xbe\xfa\xfe\xdc\x90\xfe\xa3\x8aJ\xbfN1\x90t\xce#\x1f\x8cv\xe6s\xc0N\xe1\x1a\xec\x1f\x96\xf9{\xb5\xa0\xdd\xf3:\xa1 \xb0u\x14\xbbn\xeb_\x98\xa4\x98\xf2\xc7\x1f\x97\x9e\x1c3\x9a\x89\n\x0f\x93\xdb\xb2\x91\xff\xd9O\x10\x10\xb3\x03$\xc1\x8b\xc9<\xcd\xd1\xc2c\xf1\xc7A\x85\xb5\x00\x08\x00\r\x00\x10\x00\x15\x01\x19\x00\x00\x00\x00\x00\x00\x02\x01\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01," 2022-05-12 15:54:22 DEBUG (MainThread) [pyatv.support.http] Got HTTP response: HttpResponse(protocol='HTTP', version='1.1', code=200, message='OK', headers={'date': 'Thu, 12 May 2022 22:54:22 GMT', 'content-length': '342', 'content-type': 'application/x-apple-binary-plist', 'server': 'AirTunes/610.19.1'}, body=b"bplist00\xd2\x01\x02\x03\x04RpkTsaltO\x11\x01\x00H\x90\xbcJ\xc5M\x17\xb8\x8a}u\xf9\xbf\x11\x8a\x83\xf1\x8b\xb76\x8a\x12\r\xb1\x7f%\x7f\x19\x81\t\xab\xf6|S\xad{\xa3\xd0\xe3\x05\x8a\xfax\xe7\x14/\xf9\xac\x97s\x1f\x10I\xcaN\x0f\xfd\x82\xf1\xc9\xdb<\xfa\xc1rw3x\x14\xe5\xee\x92\xf4\xdf(\x9e\xe34\x80\xcd\xe3i\x7fC\x08\xd7\x80~\xd3\xc8\xfd\x7f\xecN\xa2\xff\xda\x0b\x85T\xff\xec\xc4’v\xfa\x01\x8c\x97\xa4\xd8q\x893\xefH/\x90r\x0e\xb5N;\x92\xbe2\x9dx\xc7\xe2\xdd[{qu\x00\xd1\xd5\xe6\xce]c\xec\x06\x9e=aN\x15+\xdd\x10\x1b\xc9G\xec\x9d:\x03\xdc\xd4+\xb76e\xe7e\xf7\x92\xa9\xdb\xc2\xffFW\xc7\xfc\x84\xb7\x99\x9d\x85\x8f\xd9\x9fs\xa8\x0f\xf8\xe9\xc1\xbe\xfa\xfe\xdc\x90\xfe\xa3\x8aJ\xbfN1\x90t\xce#\x1f\x8cv\xe6s\xc0N\xe1\x1a\xec\x1f\x96\xf9{\xb5\xa0\xdd\xf3:\xa1 \xb0u\x14\xbbn\xeb_\x98\xa4\x98\xf2\xc7\x1f\x97\x9e\x1c3\x9a\x89\n\x0f\x93\xdb\xb2\x91\xff\xd9O\x10\x10\xb3\x03$\xc1\x8b\xc9<\xcd\xd1\xc2c\xf1\xc7A\x85\xb5\x00\x08\x00\r\x00\x10\x00\x15\x01\x19\x00\x00\x00\x00\x00\x00\x02\x01\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01,"):
2022-05-12 15:54:22 DEBUG (MainThread) [pyatv.support.http] Sending HTTP/1.1 message: b’POST /pair-setup-pin HTTP/1.1\r\nUser-Agent: pyatv/0.10.0\r\nContent-Length: 347\r\n\r\nbplist00\xd2\x01\x02\x03\x04RpkUproofO\x11\x01\x00wM\xfa\xea\xd4\xd1\xb4A\xb3\xa9\xb8\x1b \xde\xcdh\xb5\t8Ck\xaf\xc3\xe7\x0f\xbb\xc3\xe0\xe4T\x82\xdf\xda\xe5H\x92\xa3\xe5>\x06\xc5\xd4=6\xbc\xf9\x84Z!\xad8,\xdd$\xf9\xa2-"G\x04\xea236\xc6\xab[\xba$\x17\xaa\x14K\xae\x0c\xf7\xeb);\xd6]p\x9e\x9fz\xbaAtq\xb5\xb6\xa4=%\xdc\xca\x9e\x96\xa4\xec\x16\xc5\x93\x0f\xa2\'$\xf6\x94W\xd8u\xbb<\xc0\x07&\xc0\xdb\xb5:J]\xef\xe1\x95\xed\xef\x18\xe8\xbdj\xbe\x0f+.\x80\xbbQ\xcfc\xe5\noe\xf5\x9d\xba\x15\x87\xfcx,\x05\x00i\xa2m\x8c\xe8h\x05v\x9b\xa7:B\xb6\xda\xa4\xd7\xfd\x18H\x8f\xd5\xff\x10\xde\x9f}>,\x10\x11\x8dc\xfc\xfb%\x7f\xea\xcdbiC6[\xae\x1f*\x88\xc2LD\x91B\xe8g)^=\x00\xb31\xc4\xa83\xe3n\x8f?\xec\xbb\x12\xefi\xf9/\x8fwT.\xfdg\x83f\xe4\x11O\xcfG\x17\xdf\x1e:\x9afXb\x9c(\xbc,O\x10\x14+\xbb[\xfeA\x1f@\x00\x0c\x8130*Z[\x9b\xad\xf2\xbf=\x00\x08\x00\r\x00\x10\x00\x16\x01\x1a\x00\x00\x00\x00\x00\x00\x02\x01\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x011’
2022-05-12 15:54:22 DEBUG (MainThread) [pyatv.support.http] Received: b’HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\nServer: AirTunes/610.19.1\r\n\r\n’
2022-05-12 15:54:22 DEBUG (MainThread) [pyatv.support.http] Got HTTP response: HttpResponse(protocol=‘HTTP’, version=‘1.1’, code=500, message=‘Internal Server Error’, headers={‘content-length’: ‘0’, ‘server’: ‘AirTunes/610.19.1’}, body=’’):
2022-05-12 15:54:22 ERROR (MainThread) [homeassistant.components.apple_tv.config_flow] Authentication problem
Traceback (most recent call last):
File “/usr/local/lib/python3.9/site-packages/pyatv/support/init.py”, line 33, in error_handler
return await func(*args, **kwargs)
File “/usr/local/lib/python3.9/site-packages/pyatv/protocols/airplay/auth/legacy.py”, line 62, in finish_pairing
await self._send_plist(
File “/usr/local/lib/python3.9/site-packages/pyatv/protocols/airplay/auth/legacy.py”, line 79, in _send_plist
return await self.http.post(
File “/usr/local/lib/python3.9/site-packages/pyatv/support/http.py”, line 359, in post
return await self.send_and_receive(
File “/usr/local/lib/python3.9/site-packages/pyatv/support/http.py”, line 412, in send_and_receive
raise exceptions.HttpError(
pyatv.exceptions.HttpError: HTTP/1.1 method POST failed with code 500: Internal Server Error

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

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/apple_tv/config_flow.py”, line 429, in async_step_pair_with_pin
await self.pairing.finish()
File “/usr/local/lib/python3.9/site-packages/pyatv/protocols/airplay/pairing.py”, line 74, in finish
await error_handler(
File “/usr/local/lib/python3.9/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 500: Internal Server Error

I am running Monterey and will let you know if TTS works once I get past setting it up. TTS works with my HomePods. They’re the original ones, not the minis.