Troubleshooting Camera Accessory

I am trying to get my cameras from Home Assistant into HomeKit. I had originally done the cameras directly from a bridge. This was leading to stuttering and choppy video. I did some more reading and learned that was because they needed to be added in “Accessory Mode”. So I followed the instructions on the documentation page and the cameras are now added as accessories. Unfortunately, now they do not work at all. They say “No Response”.

I would love to be able to troubleshoot this myself. However, I am having a hard time understanding how to see the requests coming into Home Assistant and likewise what Home Assistant is responding to HomeKit with.

Are there logs anywhere or is there a place I can turn on logging? I want to be sure that the URL Home Assistant is giving to HomeKit is valid.

I think I am heading in the right direction. As indicated in the Troubleshooting section I added these to configuration.yaml.

logger:
  ...
  logs:
    ...
    homeassistant.components.homekit: debug
    pyhap: debug
...

And now I am seeing these messages in the logs like these:

2022-06-30 08:58:56 DEBUG (MainThread) [homeassistant.components.homekit.accessories] New_state: <state camera.backyard=recording; access_token=95932419aadb0c2516b8343575c03252eb0e3d8986d8e8f77650e29e128ca9f0, frontend_stream_type=hls, entity_picture=/api/camera_proxy/camera.backyard?token=95932419aadb0c2516b8343575c03252eb0e3d8986d8e8f77650e29e128ca9f0, friendly_name=Backyard, supported_features=2 @ 2022-06-29T22:48:56.115441-04:00>
2022-06-30 08:58:56 DEBUG (MainThread) [homeassistant.components.homekit.accessories] New_state: <state camera.front_door=recording; access_token=8ed8a26e3820318a20131fffbb915a872de490eaa12150ad4113e395ee6061c9, frontend_stream_type=hls, entity_picture=/api/camera_proxy/camera.front_door?token=8ed8a26e3820318a20131fffbb915a872de490eaa12150ad4113e395ee6061c9, friendly_name=Front Door, supported_features=2 @ 2022-06-29T22:48:56.125603-04:00>
2022-06-30 08:58:56 DEBUG (MainThread) [homeassistant.components.homekit.accessories] New_state: <state camera.garage=recording; access_token=849f8d93dd1a85ccbf87a64e64c46f407a0f46c63118e7d718dc9ddcbabb85b5, frontend_stream_type=hls, entity_picture=/api/camera_proxy/camera.garage?token=849f8d93dd1a85ccbf87a64e64c46f407a0f46c63118e7d718dc9ddcbabb85b5, friendly_name=Garage, supported_features=2 @ 2022-06-29T22:48:56.131012-04:00>
2022-06-30 08:58:56 DEBUG (MainThread) [homeassistant.components.homekit.accessories] New_state: <state camera.patio=recording; access_token=375ad93dbbeaf8e996e3f9ed4abae1d6a0dfb7a61a9ece4c23c52d03cdeb7e4c, frontend_stream_type=hls, entity_picture=/api/camera_proxy/camera.patio?token=375ad93dbbeaf8e996e3f9ed4abae1d6a0dfb7a61a9ece4c23c52d03cdeb7e4c, friendly_name=Patio, supported_features=2 @ 2022-06-29T22:48:56.140475-04:00>
2022-06-30 08:58:56 DEBUG (MainThread) [homeassistant.components.homekit.accessories] New_state: <state camera.unknown_camera_mediaprofile_channel1_mainstream=idle; access_token=e7073a7193f0c8de9ce35dbb7f478c5ed48f7c9f9f841ea67800fd272e075d98, frontend_stream_type=hls, entity_picture=/api/camera_proxy/camera.unknown_camera_mediaprofile_channel1_mainstream?token=e7073a7193f0c8de9ce35dbb7f478c5ed48f7c9f9f841ea67800fd272e075d98, friendly_name=Unknown Camera MediaProfile_Channel1_MainStream, supported_features=CameraEntityFeature.STREAM @ 2022-06-30T08:52:32.596489-04:00>

All of the URLs are relative but if I make them into full URLs (e.g., adding the http://<ha.host>:<my_port>) they all play fine in VLC.

So I guess the question is should the URLs be relative? Or should they be full? If they should be full URLs is there something I can do to make that happen?

I am still at a loss. As far as I can tell, HomeKit is talking to Home Assistant. Home Assistant is providing data back to HomeKit. Yet video is never live in HomeKit. The logs do not seem to be illuminating anything.

I have given up on the whole camera thing and am now just trying to get a simple temperature sensor working. Even temperature sensors are showing as unavailable.

[pyhap.hap_protocol] ('192.168.xxx.xxx', 61978): Connection made to Home Assistant Bridge
[pyhap.hap_protocol] ('192.168.xxx.xxx', 61978) (None): Recv unencrypted: b'POST /pair-verify HTTP/1.1\r\nHost: Home\\032Assistant\\032Bridge\\0329A2B68._hap._tcp.local\r\nContent-Length: 37\r\nContent-Type: application/pairing+tlv8\r\n\r\n\x06\x01\x01\x03 =\x9chg\x9a\'\xd0\xa5\xddi\xa7?\xa0\xad\xe7\xd1G\xe8\xf6\x19%\x82\x89]?\xc8\x83t\xd4K"\x0e'
[pyhap.hap_protocol] ('192.168.xxx.xxx', 61978) (None): h11 Event: Request(method=b'POST', target=b'/pair-verify', headers=<Headers([(b'host', b'Home\\032Assistant\\032Bridge\\0329A2B68._hap._tcp.local'), (b'content-length', b'37'), (b'content-type', b'application/pairing+tlv8')])>, http_version=b'1.1')
[pyhap.hap_protocol] ('192.168.xxx.xxx', 61978) (None): h11 Event: Data(data=bytearray(b'\x06\x01\x01\x03 =\x9chg\x9a\'\xd0\xa5\xddi\xa7?\xa0\xad\xe7\xd1G\xe8\xf6\x19%\x82\x89]?\xc8\x83t\xd4K"\x0e'), chunk_start=False, chunk_end=False)
[pyhap.hap_protocol] ('192.168.xxx.xxx', 61978) (None): h11 Event: EndOfMessage(headers=<Headers([])>)
[pyhap.hap_handler] ('192.168.xxx.xxx', 61978): Request POST for path '/pair-verify': {'host': 'Home\\032Assistant\\032Bridge\\0329A2B68._hap._tcp.local', 'content-length': '37', 'content-type': 'application/pairing+tlv8'}
[pyhap.hap_protocol] ('192.168.xxx.xxx', 61978) (None): Send unencrypted: b'HTTP/1.1 200 OK\r\nContent-Type: application/pairing+tlv8\r\nContent-Length: 6\r\n\r\n\x06\x01\x02\x07\x01\x02'
[pyhap.hap_protocol] ('192.168.xxx.xxx', 61978) (None): h11 Event: NEED_DATA
[pyhap.hap_protocol] ('192.168.xxx.xxx', 61978) (None): Connection lost to Home Assistant Bridge: None

It looks like devices on my network make a connection to the bridge. And then loose connection… is that normal?

I finally got it. I needed to completely delete my Home from HomeKit. Then re-add everything.