core icon indicating copy to clipboard operation
core copied to clipboard

HomeKit Controller fails to pair with LIFX beam

Open RyanTheTide opened this issue 2 years ago • 40 comments

The problem

When attempting to pair my LIFX Beam directly to Home Assistant using the homekit_controller integration it requests the pairing code and then fails with the error message:

Incorrect HomeKit code. Please check it and try again.

Upon retrying with the exact same code I get:

An unhandled error occurred while attempting to pair with this device. This may be a temporary failure or your device may not be supported currently.

What version of Home Assistant Core has the issue?

core-2022.6.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

HomeKit_Controller

Link to integration documentation on our website

https://www.home-assistant.io/integrations/homekit_controller/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

**Log from Home Assistant Core**

2022-06-20 00:16:41 ERROR (MainThread) [homeassistant.components.homekit_controller.config_flow] Pairing attempt failed with an unhandled exception
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/homekit_controller/config_flow.py", line 362, in async_step_pair
pairing = await self.finish_pairing(code)
File "/usr/local/lib/python3.9/site-packages/aiohomekit/controller/ip/discovery.py", line 149, in finish_pairing
request, expected = state_machine.send(response)
File "/usr/local/lib/python3.9/site-packages/aiohomekit/protocol/__init__.py", line 226, in perform_pair_setup_part2
raise InvalidError("M5: not an error or a proof")
aiohomekit.exceptions.InvalidError: M5: not an error or a proof
2022-06-20 00:17:41 ERROR (MainThread) [homeassistant.components.homekit_controller.config_flow] Pairing attempt failed with an unhandled exception
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/homekit_controller/config_flow.py", line 362, in async_step_pair
pairing = await self.finish_pairing(code)
File "/usr/local/lib/python3.9/site-packages/aiohomekit/controller/ip/discovery.py", line 149, in finish_pairing
request, expected = state_machine.send(response)
File "/usr/local/lib/python3.9/site-packages/aiohomekit/protocol/__init__.py", line 226, in perform_pair_setup_part2
raise InvalidError("M5: not an error or a proof")
aiohomekit.exceptions.InvalidError: M5: not an error or a proof


### Additional information

_No response_

RyanTheTide avatar Jun 19 '22 14:06 RyanTheTide

Hey there @jc2k, @bdraco, mind taking a look at this issue as it has been labeled with an integration (homekit_controller) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

Can you get it to happen multiple times?

Also, can you confirm its this model? https://www.lifx.com/products/lifx-beam

bdraco avatar Jun 19 '22 14:06 bdraco

Yes, multiple attempts result in the same error messages in order of “Incorrect HomeKit Code” & “An Unhandled Error Has Occurred”.

Model of the kit is same as listed on website, Model # L3BEAMKITIN. On the power input/controller the Model is # LBCTLDC2INT.

RyanTheTide avatar Jun 20 '22 14:06 RyanTheTide

Did you buy it in the US market? I'll try to pickup the exact model if testing if I can find it in stock

bdraco avatar Jun 20 '22 14:06 bdraco

Unfortunately not, I am Australian and did pick it up from our major electronic retailer JBHIFI, however doing a little research and also inspecting my box I don’t believe there is any particular models for each market unlike the switches. In the box I have AU power prongs, US power prongs, UK power prongs & EU power prongs to select between. If my guess is correct the one you will be able to obtain will be the exact same model.

Edit: there is a US model (L3BEAMKITUS) however the international one (L3BEAMKITIN) tends to be more advertised. The second of which is what I own. IMG_4029

RyanTheTide avatar Jun 20 '22 15:06 RyanTheTide

They seem to be sold out everywhere so I bid on one on ebay. Will see if I get it in a few days

bdraco avatar Jun 20 '22 15:06 bdraco

Sadly it ended up going for big bucks so I didn't win. Looking for another way to get one

bdraco avatar Jun 24 '22 16:06 bdraco

Happy to buy it here and redirect it to you if you wish, just an option as it’s in stock everywhere here and my exact model. If so cost of the LIFX Beam at the moment on sale is AUD$299 at our aforementioned JBHIFI (https://www.jbhifi.com.au/products/lifx-beam-light-starter-kit). Not sure shipping costs from there but if it interests you just let me know.

RyanTheTide avatar Jun 26 '22 14:06 RyanTheTide

299$ is a bit steep for a device just to buy for testing. I don't have any actual use for it besides helping out with HomeKit controller and LIFX testing

bdraco avatar Jun 27 '22 03:06 bdraco

No worries, it’s definitely not cheap. Did find another one bidding on eBay (https://www.ebay.com.au/itm/304537668017). If anything comes up where I can help let me know. Thanks again.

RyanTheTide avatar Jun 27 '22 09:06 RyanTheTide

I'd be interested in seeing the pairing log (with aiohomekit: debug in your logging config). Mostly to see if the device is returning an empty response or if its returning a key not in the spec that we don't know to look for.

Right now if the devices advertises SUPPORTS_APPLE_AUTHENTICATION_COPROCESSOR via zeroconf we do an authenticated pairing, otherwise we don't. However this isn't well documented in the spec and is something we've had to guess. It's possible we are using the wrong pairing type for your device, and something i'd normally check by compairing and iOS and HomeKit Controller pairing (e.g. by looking at packet captures in Wireshark). Or by editing this and forcing it to both True and False to see which if any works.

If editing that bit of code doesn't work, it'd be back to wireshark and/or trying to acquire a known "broken" device.

We are seeing some other devices where a valid pin is rejected with an auth error (e.g. https://github.com/home-assistant/core/issues/70231). I think this has happened for newer hardware revisions of some products (e.g. I have an Eve Extend that works fine). This is making acquiring testdevices even harder, because we can't tell if something is old stock or new stock easily most of the time. It's possible there is a newer version of the pairing dance (for a new revision of the security chip?). We know that there are other types of pairing (transient and split pairing) but these are not documented in the public documentation, only referenced in the accessory development kit - we don't get to see the controller side.

Jc2k avatar Jun 27 '22 09:06 Jc2k

Managed to order one from the EU. https://tools.usps.com/go/TrackConfirmAction_input?tLabels=LS383622777NL

bdraco avatar Jul 01 '22 01:07 bdraco

@RyanTheTide still waiting for the device to show up, but can you confirm it still doesn't work in 2022.7 as there have been some fixes that could have an impact here?

bdraco avatar Jul 07 '22 16:07 bdraco

Well as luck would have it, the postal services seems to have lost the device in transit.

Hopefully it will eventually show up

bdraco avatar Jul 19 '22 21:07 bdraco

Good news. They found it and it's out for delivery. Unfortunately I won't be back home until the end of the month

bdraco avatar Jul 30 '22 22:07 bdraco

I have a bunch of Beams in the house and can help with testing too.

Djelibeybi avatar Aug 08 '22 14:08 Djelibeybi

@Djelibeybi debug logs for aiohomekit would be really helpful for when the pairing fails after https://github.com/Jc2k/aiohomekit/pull/137 is released

I'm hoping to finish it today but ... Monday

bdraco avatar Aug 08 '22 17:08 bdraco

https://github.com/home-assistant/core/pull/76488 is the PR to bump which will give us easier to read pairing logs

bdraco avatar Aug 08 '22 20:08 bdraco

I have reproduced the issue with one of my Beams. Do you only need the aiohomekit.* log entries? I can't spot anything confidential in them, but then I don't speak byte array either, so if there's a particular thing I should remove before posting, let me know.

Djelibeybi avatar Aug 09 '22 07:08 Djelibeybi

The protocol is AIUI PFS, so you don't leak your security code if we see it. Keypairs get rotated per session. And your device is (the one that looks like a Mac) gets rotated on a device reset. So fine to post.

Jc2k avatar Aug 09 '22 07:08 Jc2k

This is the entire aiohomekit.* log from clicking the Configure button to getting the Invalid HomeKit Code error:

2022-08-09 17:34:25.839 DEBUG (MainThread) [aiohomekit.controller.ble.controller] Starting BLE controller with instance: <homeassistant.components.bluetooth.models.HaBleakScannerWrapper object at 0x7f4ef81901c0>
2022-08-09 17:34:25.844 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Starting reconnect loop to 192.168.254.49:80
2022-08-09 17:34:25.844 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.254.49:80
2022-08-09 17:34:25.846 DEBUG (MainThread) [aiohomekit.protocol] #1 ios -> accessory: send SRP start request
2022-08-09 17:34:25.846 DEBUG (MainThread) [aiohomekit.protocol.tlv] sending [
2022-08-09 17:34:25.846 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw request: b'POST /pair-setup HTTP/1.1\r\nHost: 192.168.254.49\r\nContent-Length: 6\r\nContent-Type: application/pairing+tlv8\r\n\r\n\x06\x01\x01\x00\x01\x01'
2022-08-09 17:34:33.692 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw response: bytearray(b"\x06\x01\x02\x03\xff\xaf\xf4\x9f}\x98?Q\xeb\x0c9XV`u\xfb_\x06}\xe0\x88\xb5\x817\x95.`\xce7\x8b\xf9\xda\x1d,\xa9\xf3KO._\xa6\x83\xd2\xcf\x86\xa9\xc0\xe1\x96\xc7\xc6\xb2\xf7;\xdb\xe5\xb2\x8a\xb5U\n\xdc\xe9I\xeb\xc7R3J\x8fNN\xff\x82*\x08\xe2l\x94\xda\x10w\x19,^7\x94\x8a1\xbe\xd4\xb2\x0b\xb0)B\xf0<A\x83\x11\xd7\xe5\xab\xc7\xd4\x82\xd7(\x13\x12\x9e\xb2\xff\xdc\xb2\x0b\xee\xe5@\x12\xeaZ\x85*\xe8\xd7\xf4\x85\xe0Q9d;*\xd8\xea+\x92\xa3t\xce\xacnRU\xaa8\xdc0\xe7\xd7\\\x1a\x06\x0c\x8c\xd1@\xf4\xbdJ\xf1\xd5qf\xfa=\x8b9\xe0\x95\xf2\xd3Q\x06i\xcd\xd3\xec*\'\xf3o_+\xf1\xbdn\xf7g\xc9\xcc\xd5\xca\x8d\xe3\x81\xa5.c&\x99S\xd0\xa6\xa2\xe7\xf0\x19\xe3\xa3\x1b@\xc4\x80C9\x0b\x1e\xee\x1a\\\xd3\x14\xcd\'awaZ\x11:\x90\xf3\x12\x97\xb8\xc9E\xd8\xd2\xdc(\xff\xb3XhI\xcc\xae\xbf#\xe7\x1a\x82\x03\x81\xaf\xc7\xc3\x9d\xf2\x90\xd20\x87\x90\xc9\xe6W\xa2\xd4\xb4\xe06\xafp#\xca\xff\xd8Z\xb5.\xf8\xb0\xea\xd9b\xf5qN\x86\x1c\xf5\xf9\xa4\xd3F\xf6\xce\x01\x1c\xe2$/\x9aLI\xb43\xe9h39\x99\x90OeB1@\x0b\xc2\x1f\xe3\xad\xd8L\x08\xe9k\x9e\x0e\xc4\x00\xda\xe3\x8ep\xa2\x8a\xb5$\xf1\x0b1\x84\x87\xda\x00\\\x05\xa9n@\x18\xfe\xea\xba\xe8\xfd=oT\xc0)\x81\x80\xc2\xb4K\xbf\xe8\xc3\xc4\x8a[\x9f2\x04\x14\xe1_\x9a\'\x02\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00")
2022-08-09 17:34:33.692 DEBUG (MainThread) [aiohomekit.protocol.tlv] receiving [
2022-08-09 17:34:33.692 DEBUG (MainThread) [aiohomekit.protocol] #3 ios -> accessory: send SRP verify request
2022-08-09 17:34:44.682 DEBUG (MainThread) [aiohomekit.protocol.tlv] sending [
2022-08-09 17:34:44.682 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw request: b"POST /pair-setup HTTP/1.1\r\nHost: 192.168.254.49\r\nContent-Length: 457\r\nContent-Type: application/pairing+tlv8\r\n\r\n\x06\x01\x03\x03\xff\x14\xa9\x9d\x0e\xc5\x06\xb0\x1cxF\xa1\xb3\x9a\xc3\x12@\xaf\xdd\xad\xfe*7'\xc7\x13\xdfP\x19\xb2\x07N\t\x89\xce\x8e\xc2x)\x99\x8c\xd8\xc5\xf7b\x89v\xc9%R:\xb1\\\x973\x88\xc5\x12\x94\xb7\x10\xbb\x0f\x1a\xc5\xc7X\xb7\x11\xdb\xb0@\x95\x96Il~@\xe3\x04\xd0\x84\xc6\xcd\xa27\x99\x12\xa8\xd7O;\x0cC\x07\x9e6%\xce\x8c\x95\x1d%n\x98\x07}\xd1\xdd\x10\xb5\xf3\x95\xfd\xc5\x81\x95u\xb9%\xf5\x02\xe2\t\xa7w/\xa1bw\xae\x0e\x8b\xbd\xef5uU\x7fj\xdf1\n{\x1e\xe1\x91\xdd\x13\x8c\x04\xa6\xe8\xee2K\t\x89\xf6\xc3\xb6\x17\x9f\xd4k\x0fBF\xfc\x86g\xb5\xc8O\xeck\xe2\xb9\x0ehN\x08\xa6K\xca\x9a#\xcd\xb1h.J\x1dt\x12\xeb\xfb\xe4\x05{\xad\x01\x8cc)G\xfe\xcbm\x06\x9d\xee\xcd\xa7U\xc0\xa3\xc0\x99\x81~\x9c60\x83vx\xb3\xc4vt\xa6\xbc\x9f\xa1\xc1Y\xa1j\xd0\xc7m\xef>g\xd4\xbcV\x8f\xde\xc4\xc0\xe6\xdb~\x83\x03\x81\xca]64\x9c\x90\x92R\xcf\t\xa3\x13\x1a\xc5\xae$+\xa8\x99y\x06\xd9\xdb\x0b\xbd\x00\xe4k\x17\xd3\xba\x8f\xce\xff\xab8\xe1ur\xdc\xd9\xf3v\x1e\xad\xab\x15\xc3p\x10d\x89n\xe4\xc8\xea1\xe3\xc1\x8b7H\x03\x9b\xacG\xa5\xedMGK\xcf\xf7\x03\xb9\xc0a=\xc4\x88\x8a\xddy\tw:\x9a\x1d\xack\x9fpO\x7fs\x87\x02\xce\xbc\x87\xd1#5p\xd5\x9bL~n)\xado\xc0\x1f\x9d\x9c\xe8Ndt6\xa0\x7f\xcb\xee\xd3\x87y\xfc\x04@x\x86\xbc\xd1\x1c\x9c\xcc\xc7(6\xa8\x128\xe5*\x1b\x80{>BW\xdf]\xf0!\xba\x15yB\x85DSmA\x13\xbdGb\x07\xb9\xfc\xfa\xb4n\xaa\xdb\x8cwlYV\x03\x84\xec=\x01\x02K\xdfA\xbc6\xf4\x80"
2022-08-09 17:34:47.526 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw response: bytearray(b'\x06\x01\x04\x07\x01\x02')
2022-08-09 17:34:47.526 DEBUG (MainThread) [aiohomekit.protocol.tlv] receiving [
2022-08-09 17:34:47.526 DEBUG (MainThread) [aiohomekit.protocol] #5 ios -> accessory: send SRP exchange request
2022-08-09 17:34:47.530 DEBUG (MainThread) [aiohomekit.protocol] #1 ios -> accessory: send SRP start request
2022-08-09 17:34:47.530 DEBUG (MainThread) [aiohomekit.protocol.tlv] sending [
2022-08-09 17:34:47.530 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw request: b'POST /pair-setup HTTP/1.1\r\nHost: 192.168.254.49\r\nContent-Length: 6\r\nContent-Type: application/pairing+tlv8\r\n\r\n\x06\x01\x01\x00\x01\x01'
2022-08-09 17:34:54.848 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw response: bytearray(b'\x06\x01\x02\x03\xffF\x98\x8c\x18\r\xfd\xfe\xdd\x89\x9c\x08\xd4\xdd=,j\xea\x02//\nG\xb4\xfdU;&\xfb\xee|\x99\xac\'F\x9e\x8f\t\xf0_\xcc\t\x82k\xac\x17\xde\xae6j.\x90\xda\x029\xe2\x07\xe9D\x94\xd0\xfd\xd7\xfdO\x85o\x98\xb5\xef&\x86\x1c\x044\xe3%\x83\x087`\xda=\x96\x98\xd0\xd5\xee\x14\xad\xdf;\xdc\xa3B,c\xa7\x99L\x80\x15(\xb8m\xee\xa5\xa0\xb5\xcd`R\x91\xf9\xfe\xca\x17\x83S\x08\xc5\x91\xfd?\xde\xdb\xd5C\xa7\xc4s\x8a\xbe\xe7\xd0\x8ba5\\\xe0\xbf\x1c\xfc&\x9d\x1eMU\x0eXI\x02\xda*Q\xeeuUjL\xf8=9ea[\xeaq<J\x82O\x91^Ej\xc79o\x0f[\xa9:\xf8\x81F\xbb\x12\xa1\xaaq`O@\xb4\xe7\xe9\xfe\xa0\xc7j=\xb2\x8b1\xdej\x83l\x1c\xb5D2!U\xb7\xa0\xba\x0f\xb2\xb9$x\xef\xe1\'\xc8\xafR\xb4\x1c\xa9\xad\xae\x8a>d\xbbn\'\x1b\xcf\xaa\xac\xd1n\xe4\x8d\x8c\xb0\xa40\xf3">S\x03\x81\xca\xf9U)1\xb5\x89\xd1P]\x9e..\xd0\xd2\x0b\x00h\xd4D8\xa4\x9dmu\x1f8G\x84cV\x84\xcaHO\xfdI\x9e*\x037\xbd$\xa0\xc07\x14\xcc \xe72\x0fIoy\x06\x1f{\x91\xd4\xafV8>\xe8i@\xe6\xc18\xf1\xa0\xa4\xaf\xaa\x7f\xb1;\xe4X\xb4\x93\xd1]\x96\x19\x85;4\x0b\xe8\xf8co\xfd+\xf2\xdcH\x0fk\xb9\xe3G\x8a\x96%F6!(\x02\x86\xea\xb3\x1e\xd3\xbc\xf9\x13o)\xa9\xce\x82\xc9R\x8d\xcd\x02\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2022-08-09 17:34:54.848 DEBUG (MainThread) [aiohomekit.protocol.tlv] receiving [
2022-08-09 17:34:54.848 DEBUG (MainThread) [aiohomekit.protocol] #3 ios -> accessory: send SRP verify request

That Beam is still unpaired so I can retry it with different log settings if necessary.

Djelibeybi avatar Aug 09 '22 07:08 Djelibeybi

Can you post the TLVs (they are multi-line) 2022-08-09 17:34:25.846 DEBUG (MainThread) [aiohomekit.protocol.tlv] sending [ ... 2022-08-09 17:34:54.848 DEBUG (MainThread) [aiohomekit.protocol.tlv] receiving [

bdraco avatar Aug 09 '22 17:08 bdraco

Whoops. I should've realised my filtering was a little too aggressive. I'll run it again later and that detail.

Djelibeybi avatar Aug 09 '22 21:08 Djelibeybi

Here you go:

2022-08-10 07:51:36.060 DEBUG (MainThread) [aiohomekit.controller.ble.controller] Starting BLE controller with instance: <homeassistant.components.bluetooth.models.HaBleakScannerWrapper object at 0x7f42655ff9d0>
2022-08-10 07:51:36.066 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Starting reconnect loop to 192.168.254.49:80
2022-08-10 07:51:36.066 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.254.49:80
2022-08-10 07:51:36.070 DEBUG (MainThread) [aiohomekit.protocol] #1 ios -> accessory: send SRP start request
2022-08-10 07:51:36.070 DEBUG (MainThread) [aiohomekit.protocol.tlv] sending [
  6 (State): (1 bytes/<class 'bytearray'>) 0x01
  0 (Method): (1 bytes/<class 'bytearray'>) 0x01
]

2022-08-10 07:51:36.070 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw request: b'POST /pair-setup HTTP/1.1\r\nHost: 192.168.254.49\r\nContent-Length: 6\r\nContent-Type: application/pairing+tlv8\r\n\r\n\x06\x01\x01\x00\x01\x01'
2022-08-10 07:51:43.834 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw response: bytearray(b'\x06\x01\x02\x03\xff\x82\xa1\x91\xfa\r\xf9\xff\x01]\x92\xf3\xd4E\x84\x9b\xb3\xd6\x8e\t\xb8\xef\x12\xa9\x8d\xe8\x0b\x0eh\x84\x9c\xd5\x93\xb8\xe0\xfeD@\xe992\xee\xdbsR\x96\x8c\xf6!\x9c\xa7\xc0\tA\x15\xb8!"AJY\xaa\xf6\xe8\xd4\xd5\xec<\xe1M\r\xf9\x07J\xcd\x9b\xf6\xeb)\xd1\xbb\'3\'G\xe7^\x0c\x18\xb9\xca\x14\xd2\x8fH\xb7\x9eH6\xfa\xd8\xa6\xe72\xb9\xcd\xb1C\x03Yq\x83C\xd9\xebZ\xf4&\xc2\x03\x82\x9az\x90;\x81Z2\x9ec\xb7R\xa6\xa6\xed\x81:P\x95\x96\xcav\xd0\x0b\x17\xf5~t6&;9\xf6x\x00\xb5\xdc\xa7\xd0&\xf6G\xd11\xc7\xdd~A\xe5%\xa7N\xff\xea  f(\xaf\xd5\x7frz+Z\xe9D\xceo\xadOS@\x84"tR\x87Q%`_!i?]\r\x19\xc4x\x15\x91\xe1\x91\x9d\xdf\x88R,\xc3\xf1Gi\x12\xd2]\xa3\xe0W,`=\xfe\xdb\xf9\xf9\xbcO\xf8\xf8\xbb}\xdcB\x8e\xd3\xfc\xec3c\x99\xd5\xa2\xed2\xfe\x03\x81\x08v\x0c\x08\xc4\x01\xd9"n\x89x_LIWb\xb9E\x94`u\xda=[\xfcM\xac\x02V\x82\x924\xade\x9b\xa1/\x8dw(\xf0\x07\x8d\x9f\x9a\x83\x9d\xe5\xdb5$\x98\xed\xday0{D\x93_\xc77A\xa8c\xd1VQ\xf3\xce\x06\x0e\x08\x00\x95\xab\xefd\x1c\x12\x17\x18\x8c\x91\x89\xc6\x9f&t\x93\xd2\xd8|A\x95\xe4\xd62s4J\xc4\x8a"\xc9We\xe2\xc4D\x13KeVB/r\x03;]\x98\xe3&R\x9c\x81\x1f\xdf\x84\x02\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2022-08-10 07:51:43.834 DEBUG (MainThread) [aiohomekit.protocol.tlv] receiving [
  6 (State): (1 bytes/<class 'bytearray'>) 0x02
  3 (PublicKey): (384 bytes/<class 'bytearray'>) 0x82a191fa0df9ff015d92f3d445849bb3d68e09b8ef12a98de80b0e68849cd593b8e0fe4440e93932eedb7352968cf6219ca7c0094115b82122414a59aaf6e8d4d5ec3ce14d0df9074acd9bf6eb29d1bb27332747e75e0c18b9ca14d28f48b79e4836fad8a6e732b9cdb1430359718343d9eb5af426c203829a7a903b815a329e63b752a6a6ed813a509596ca76d00b17f57e7436263b39f67800b5dca7d026f647d131c7dd7e41e525a74effea20206628afd57f727a2b5ae944ce6fad4f534084227452875125605f21693f5d0d19c4781591e1919ddf88522cc3f1476912d25da3e0572c603dfedbf9f9bc4ff8f8bb7ddc428ed3fcec336399d5a2ed32fe08760c08c401d9226e89785f4c495762b945946075da3d5bfc4dac0256829234ad659ba12f8d7728f0078d9f9a839de5db352498edda79307b44935fc73741a863d15651f3ce060e080095abef641c1217188c9189c69f267493d2d87c4195e4d63273344ac48a22c95765e2c444134b6556422f72033b5d98e326529c811fdf84
  2 (Salt): (16 bytes/<class 'bytearray'>) 0x00000000000000000000000000000000
]

2022-08-10 07:51:43.834 DEBUG (MainThread) [aiohomekit.protocol] #3 ios -> accessory: send SRP verify request
2022-08-10 07:51:53.624 DEBUG (MainThread) [aiohomekit.protocol.tlv] sending [
  6 (State): (1 bytes/<class 'bytearray'>) 0x03
  3 (PublicKey): (384 bytes/<class 'bytearray'>) 0x284bb4c73809cc4c73b7e9a654c83a61df72955fad93ec10aebd98cb56ac5c7db2a72f2d01b371057dd81ad716563ab9ee541d22ffec752c033ae06631e069c0afb53d41be8d65e96833bc2727865d1e9c4678151fea07c4f47b0ea10681002fe29734c06384ea4a5fbc0160cde03ae6b8c07622b32aea2366af27ebc33ddf423983853e57d5a28db9b14c0efee6c031a5cf150fd9b1813a9148276f2ed7542205ee38b9f4fc3bac8b503bef552e13e37fefbb2a18c52457f2963244fcfa9f95ce5deca8b9104311b5c57b8efcb248b5f1471003de52b2a30918f5b31e4a53cbb0f04e4ce312e87fbd86ab09a45a67687007baf136cd012b7781ed24740268cbf411aa2bb2136e9dd9513ba7ad4e3cf7be3efb8ab1b5bfdc6f363f75732f264903840fccdb0dc7cd9c5d1ad0793465a5fc646aaecfd7d6ab0c2aa4ed175d482b329428bcaa35f4d7931bcf8363168602182b6b04167d2713cd13402f6b2ef5a4668ccefa7e7f1563f5d2b7cd0024ff26bcf98d361378fa97d3c725aa2fd86f06
  4 (Proof): (64 bytes/<class 'bytearray'>) 0x812ade14ec6bc0e7680700dca9280e6f5977187bdf68a51df5c2e6a564d1e72688b9f4ac29295a5bb76db78bb9f3ec987f3879c179ddc6d9195024cd41e9f7aa
]

2022-08-10 07:51:53.625 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw request: b'POST /pair-setup HTTP/1.1\r\nHost: 192.168.254.49\r\nContent-Length: 457\r\nContent-Type: application/pairing+tlv8\r\n\r\n\x06\x01\x03\x03\xff(K\xb4\xc78\t\xccLs\xb7\xe9\xa6T\xc8:a\xdfr\x95_\xad\x93\xec\x10\xae\xbd\x98\xcbV\xac\\}\xb2\xa7/-\x01\xb3q\x05}\xd8\x1a\xd7\x16V:\xb9\xeeT\x1d"\xff\xecu,\x03:\xe0f1\xe0i\xc0\xaf\xb5=A\xbe\x8de\xe9h3\xbc\'\'\x86]\x1e\x9cFx\x15\x1f\xea\x07\xc4\xf4{\x0e\xa1\x06\x81\x00/\xe2\x974\xc0c\x84\xeaJ_\xbc\x01`\xcd\xe0:\xe6\xb8\xc0v"\xb3*\xea#f\xaf\'\xeb\xc3=\xdfB9\x83\x85>W\xd5\xa2\x8d\xb9\xb1L\x0e\xfe\xe6\xc01\xa5\xcf\x15\x0f\xd9\xb1\x81:\x91H\'o.\xd7T"\x05\xee8\xb9\xf4\xfc;\xac\x8bP;\xefU.\x13\xe3\x7f\xef\xbb*\x18\xc5$W\xf2\x962D\xfc\xfa\x9f\x95\xce]\xec\xa8\xb9\x10C\x11\xb5\xc5{\x8e\xfc\xb2H\xb5\xf1G\x10\x03\xdeR\xb2\xa3\t\x18\xf5\xb3\x1eJS\xcb\xb0\xf0NL\xe3\x12\xe8\x7f\xbd\x86\xab\t\xa4Zghp\x07\xba\xf16\xcd\x01+w\x81\xed$t\x02h\x03\x81\xcb\xf4\x11\xaa+\xb2\x13n\x9d\xd9Q;\xa7\xadN<\xf7\xbe>\xfb\x8a\xb1\xb5\xbf\xdco6?us/&I\x03\x84\x0f\xcc\xdb\r\xc7\xcd\x9c]\x1a\xd0y4e\xa5\xfcdj\xae\xcf\xd7\xd6\xab\x0c*\xa4\xed\x17]H+2\x94(\xbc\xaa5\xf4\xd7\x93\x1b\xcf\x83c\x16\x86\x02\x18+k\x04\x16}\'\x13\xcd\x13@/k.\xf5\xa4f\x8c\xce\xfa~\x7f\x15c\xf5\xd2\xb7\xcd\x00$\xff&\xbc\xf9\x8d6\x13x\xfa\x97\xd3\xc7%\xaa/\xd8o\x06\x04@\x81*\xde\x14\xeck\xc0\xe7h\x07\x00\xdc\xa9(\x0eoYw\x18{\xdfh\xa5\x1d\xf5\xc2\xe6\xa5d\xd1\xe7&\x88\xb9\xf4\xac))Z[\xb7m\xb7\x8b\xb9\xf3\xec\x98\x7f8y\xc1y\xdd\xc6\xd9\x19P$\xcdA\xe9\xf7\xaa'
2022-08-10 07:51:56.435 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw response: bytearray(b'\x06\x01\x04\x07\x01\x02')
2022-08-10 07:51:56.435 DEBUG (MainThread) [aiohomekit.protocol.tlv] receiving [
  6 (State): (1 bytes/<class 'bytearray'>) 0x04
  7 (Error): (1 bytes/<class 'bytearray'>) 0x02 [Authentication]
]

2022-08-10 07:51:56.435 DEBUG (MainThread) [aiohomekit.protocol] #5 ios -> accessory: send SRP exchange request
2022-08-10 07:51:56.440 DEBUG (MainThread) [aiohomekit.protocol] #1 ios -> accessory: send SRP start request
2022-08-10 07:51:56.440 DEBUG (MainThread) [aiohomekit.protocol.tlv] sending [
  6 (State): (1 bytes/<class 'bytearray'>) 0x01
  0 (Method): (1 bytes/<class 'bytearray'>) 0x01
]

2022-08-10 07:51:56.440 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw request: b'POST /pair-setup HTTP/1.1\r\nHost: 192.168.254.49\r\nContent-Length: 6\r\nContent-Type: application/pairing+tlv8\r\n\r\n\x06\x01\x01\x00\x01\x01'
2022-08-10 07:52:03.789 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw response: bytearray(b'\x06\x01\x02\x03\xff<\xadg\xd2\xc7[\xe1\xd6\r\xd6q\x88\xfe\x85P\x8a\x1c\xd6\x06\xa0B\x82]\xa0\xec\xecF\xfe\x08\xd0\xe7\xa2e!\xab\xfb\xaaq|\xef\x8eD\xaab$\xa8$n\xe2\xd6\xb8\xe7\xbf\x05\x1do\x1f\x99\xaa\xd8C\xac2i\x90\x03"\x9d\xa01\x14\x84\xffF\'Z\x1e\xf5\x85\x12\xe3\'\xde\x0e#?\xb7\xe0\xfd\x95,\xa5}\x9a\x98\x1e\xc2\xf1}MJl\xc6\x14\x95w\x16\tM\xe3\xceo\xd1\xe3Z\x0c\xe4/\xab\xac[v\r\x10\x01q\x88T\xc0\x93&\xe8\xabg\x1c\xf5\xd9\xa2\xa9\xe6\xf6\xbb\x02\x03\x10T\xc2\x92\xb6R\xd8=\xae\x89p"\x8d\x1b9\x0b\x9f\xf7\xd8\x83W~O1\xac<\x16r\xaa\xbb\x9cWV\xc9\x97K\xe5\xc6\xcc\x9d)^G?\x9a\xd9ij\xcc\xe0(x\xeex\xf00\xbc0\xc9\x96\xa0\xc3\xbc\xad@\xe7\xf2`\xd7G\r\x88`o\xa8\xb1P\xdf\x0c&t$\x94\xa9\xda\x12&q\xc2\'\x8e\x14\xe2\xfd<\xad\xa2Y=\xab\xcb\x15%\xea\xdd\xa3\xa5I\xcaP\xdf\x03\x81\xe8`X\x03\xc2@\xb0}v\x82\xe8\xa2ws\xf5-\xe1\xe6.\xdd\xe01\x95\x1f\xdb \xd1m\x81\x81\x0el\xf6\x07\x84eE\x92\xd5D\xbf\x9dQ\x81Z}ND\xbf\xdd\x85\xe6G\x85s\xb9\xfd\x875\xc4\xa9\x89\r6\xcf\x1bs\x9f+\x02\xa7\xb4SG3\xb69d\xf98\xab\xce\x91\xbf\xf4\x03\xc1(\xf5\xd9(F\'\xcb|bK\xb5\xf5\x81\xa8 \xb4F~\xaa?\x83y\x0ct,\x96\xb0\xcd\xf8\x93R\xcb\xad\xdc\xc9\xaf\xcde\x94d\xfcP\x02\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2022-08-10 07:52:03.789 DEBUG (MainThread) [aiohomekit.protocol.tlv] receiving [
  6 (State): (1 bytes/<class 'bytearray'>) 0x02
  3 (PublicKey): (384 bytes/<class 'bytearray'>) 0x3cad67d2c75be1d60dd67188fe85508a1cd606a042825da0ecec46fe08d0e7a26521abfbaa717cef8e44aa6224a8246ee2d6b8e7bf051d6f1f99aad843ac32699003229da0311484ff46275a1ef58512e327de0e233fb7e0fd952ca57d9a981ec2f17d4d4a6cc614957716094de3ce6fd1e35a0ce42fabac5b760d1001718854c09326e8ab671cf5d9a2a9e6f6bb02031054c292b652d83dae8970228d1b390b9ff7d883577e4f31ac3c1672aabb9c5756c9974be5c6cc9d295e473f9ad9696acce02878ee78f030bc30c996a0c3bcad40e7f260d7470d88606fa8b150df0c26742494a9da122671c2278e14e2fd3cada2593dabcb1525eadda3a549ca50dfe8605803c240b07d7682e8a27773f52de1e62edde031951fdb20d16d81810e6cf60784654592d544bf9d51815a7d4e44bfdd85e6478573b9fd8735c4a9890d36cf1b739f2b02a7b4534733b63964f938abce91bff403c128f5d9284627cb7c624bb5f581a820b4467eaa3f83790c742c96b0cdf89352cbaddcc9afcd659464fc50
  2 (Salt): (16 bytes/<class 'bytearray'>) 0x00000000000000000000000000000000
]

2022-08-10 07:52:03.789 DEBUG (MainThread) [aiohomekit.protocol] #3 ios -> accessory: send SRP verify request

Still not a lot of output. This is the entire log from clicking configure to invalid code.

Djelibeybi avatar Aug 09 '22 21:08 Djelibeybi

Well 2 (Salt): (16 bytes/<class 'bytearray'>) 0x00000000000000000000000000000000 thats a problem

bdraco avatar Aug 09 '22 22:08 bdraco

Either we have a bug in the TLV parser or the device is replying with a salt of all 0s.

bdraco avatar Aug 09 '22 22:08 bdraco

Doesn't look like a bug in the TLV parser though

bdraco avatar Aug 09 '22 22:08 bdraco

I know LIFX had to add software-based HomeKit support to some of their older devices, like the Gen2 Beams, so the latter is feasible. That's assuming Apple would approve/certify a device that did this, because they're all natively supported by HomeKit.

Djelibeybi avatar Aug 09 '22 22:08 Djelibeybi

The device is advertising it has an apple coprocessor, but it might not.

Pairing might work if we ask to pair without the coprocessor

bdraco avatar Aug 09 '22 22:08 bdraco

Can you try disabling PairSetupWithAuth?

https://github.com/Jc2k/aiohomekit/blob/652b55f7c911050a7304551a8c3fd882e1e5f914/aiohomekit/protocol/init.py#L113

    request_tlv = [
        (TLV.kTLVType_State, TLV.M1),
        (TLV.kTLVType_Method, TLV.PairSetupWithAuth if with_auth else TLV.PairSetup),
    ]

replace with

    request_tlv = [
        (TLV.kTLVType_State, TLV.M1),
        (TLV.kTLVType_Method, TLV.PairSetup),
    ]

bdraco avatar Aug 09 '22 22:08 bdraco

It didn't like that either:

2022-08-10 08:24:07.950 DEBUG (MainThread) [aiohomekit.controller.ble.controller] Starting BLE controller with instance: <homeassistant.components.bluetooth.models.HaBleakScannerWrapper object at 0x7f15d8c1d1c0>
2022-08-10 08:24:07.955 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Starting reconnect loop to 192.168.254.49:80
2022-08-10 08:24:07.955 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.254.49:80
2022-08-10 08:24:07.957 DEBUG (MainThread) [aiohomekit.protocol] #1 ios -> accessory: send SRP start request
2022-08-10 08:24:07.957 DEBUG (MainThread) [aiohomekit.protocol.tlv] sending [
  6 (State): (1 bytes/<class 'bytearray'>) 0x01
  0 (Method): (1 bytes/<class 'bytearray'>) 0x00
]

2022-08-10 08:24:07.957 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw request: b'POST /pair-setup HTTP/1.1\r\nHost: 192.168.254.49\r\nContent-Length: 6\r\nContent-Type: application/pairing+tlv8\r\n\r\n\x06\x01\x01\x00\x01\x00'
2022-08-10 08:24:15.829 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw response: bytearray(b'\x06\x01\x02\x03\xff\x0f\xe2"\xed+\xc8\x1fe=]\x1c\x89V;\x17\x19\xeb\x89u\x92\x113d\x06\x085\x93\xecQs\x98\xf5\x93\\\xd7\xfe\ng\x94\x8d\xbc\x82HD\xc3\xc9\xb3\xa6\xc6\xf7\x8a+\x82\x97\x99\xc3<=\x18\x9b\x12\x0c\x9eC\xade\xce\xc3\xa61\'\ro\xe0(R<84\xa4w\x1eAA\xcab4\xde \x9d\x84\x8d\xcd\x8e5\xe1(+\xf9\xac+?.q\xedn\xdd\xfb%\xcai-\xbe\xfa\xbb|,\x84h\xe1YxQ\xac\x84\x88\x8dX7\xd6;W\r6\xb8\xb8\xd3\x15\xfdr\x92o:g\xf0\xd8@\xa4:\xc5N\xd1v\xb9I\xe3\x8f\xe3\xb1\x9d^\xad_\xe0\x8c\x81\xa2\xcc\xb7\x90\x0c|G:4\x11N\xcbQ\x15\xa9\'\x84\xea\x9eS\xfd\n\xfaC\xd6\xb0\x84\x85\xa6\xc1\xc9%2\x7f\xc3\xa6\xca[.%\xd6\x9e\x14\xb2\x83\x19\xe3\xcf\x94\x0c\xe6\xc5\xf6\xde\x17\x1f\x13\xf8\xca\xa0,9S\x03\xb5\x10\xf8\xceS\xd2.\x98\x15\x02QV{\xd8W\x00\xec}ye2\r\x08\x98*\x03\x81\xe8\xc7E\xc7\xc9\\\'~\xa9\xad\xdc\xb4\xd5\xe7\r]Z\xc4N.\xb9|\xe4\xa2\x98\x14\xc3Q\x16\x17\xc3\xfe\x06SESW\x8f!\xc0\xc7\x03\x1f\'\x80\xfd\xd2~\xa65\xca\xc4\xff\x81\xf9\xe1\xfe"\x07\x19\xed\xf0\xe7\xa9\xde\xbc\x9d\x87P\xec\xbb\x96^\xe3\xca\x93\xf0\x06B\x0c\x05\xd5\x05|(|\x91I\xab\xd9\xa71\xa7\xb8\x8e%b\xf5\xc6\xfe\xd8+\xc1\x16\xbc\xd8Z\x05t\x12\xb8\x0e7\x0eY\xc2\x96Z\x9b\r\xa1\xf4\x1ezef\x15\x14\xbc\x02\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2022-08-10 08:24:15.829 DEBUG (MainThread) [aiohomekit.protocol.tlv] receiving [
  6 (State): (1 bytes/<class 'bytearray'>) 0x02
  3 (PublicKey): (384 bytes/<class 'bytearray'>) 0x0fe222ed2bc81f653d5d1c89563b1719eb89759211336406083593ec517398f5935cd7fe0a67948dbc824844c3c9b3a6c6f78a2b829799c33c3d189b120c9e43ad65cec3a631270d6fe028523c3834a4771e4141ca6234de209d848dcd8e35e1282bf9ac2b3f2e71ed6eddfb25ca692dbefabb7c2c8468e1597851ac84888d5837d63b570d36b8b8d315fd72926f3a67f0d840a43ac54ed176b949e38fe3b19d5ead5fe08c81a2ccb7900c7c473a34114ecb5115a92784ea9e53fd0afa43d6b08485a6c1c925327fc3a6ca5b2e25d69e14b28319e3cf940ce6c5f6de171f13f8caa02c395303b510f8ce53d22e98150251567bd85700ec7d7965320d08982ae8c745c7c95c277ea9addcb4d5e70d5d5ac44e2eb97ce4a29814c3511617c3fe06534553578f21c0c7031f2780fdd27ea635cac4ff81f9e1fe220719edf0e7a9debc9d8750ecbb965ee3ca93f006420c05d5057c287c9149abd9a731a7b88e2562f5c6fed82bc116bcd85a057412b80e370e59c2965a9b0da1f41e7a65661514bc
  2 (Salt): (16 bytes/<class 'bytearray'>) 0x00000000000000000000000000000000
]

2022-08-10 08:24:15.829 DEBUG (MainThread) [aiohomekit.protocol] #3 ios -> accessory: send SRP verify request
2022-08-10 08:24:25.922 DEBUG (MainThread) [aiohomekit.protocol.tlv] sending [
  6 (State): (1 bytes/<class 'bytearray'>) 0x03
  3 (PublicKey): (384 bytes/<class 'bytearray'>) 0xfe1cfdf6a29c4bed3d5fb6af06a51ec6bbc2fc80e1151eed7ed4448426e54ac89e5bf43ce7cc14917454359768bf440e28b19780e736810dde32ac3e73b08a91d37cee4b4b960cd4355df1c045430744c37c22033f2b99b3987b8b62605f886c5408e73bde555358f973ad1c660c0cae6aaa4c783299f796d2af8a625d15bbfe557da22ab50e9781ad1005d4468ccc2b44cba5c2fb443ddbbc4af3d49540dd2b5c0faa36cbe7fc1af25142ee4f9676c6f7159c4a7a2abcc2581d1d3794c8868a155a62877d15b46fd335b88f984edc653fbaa0333de6854e17cb6cf56abc8901896cd9acb3202c5af03a78a56411df23bbf3c6f708153edc5184c0a0b16dd90cd8930293dd2cb34bacf9bf6fbe1381a3fbc67edc0767bfd6665667d46880f087d215cc234d1aebcb4fc26773f93847fbb4f73ac39955560cee428737cbff438378fb4830c68ede68f8cdafce0cacbb8fc79ee7c584a0926e021d0590b42ff4d4fb9a6e6972c719e609b1d2bbc3c1ca9a9a3418edf30a418d60ddeae80cdc37d1
  4 (Proof): (64 bytes/<class 'bytearray'>) 0x48ef6af7c65c595d70579992f9b068c2ca6c8b42a27ab1a09eb91c5f3248b23a65b63d9a1e1fe0ff756e2b1a51c8a1144fc1ecf692243c07a5042c656037190f
]

2022-08-10 08:24:25.922 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw request: b'POST /pair-setup HTTP/1.1\r\nHost: 192.168.254.49\r\nContent-Length: 457\r\nContent-Type: application/pairing+tlv8\r\n\r\n\x06\x01\x03\x03\xff\xfe\x1c\xfd\xf6\xa2\x9cK\xed=_\xb6\xaf\x06\xa5\x1e\xc6\xbb\xc2\xfc\x80\xe1\x15\x1e\xed~\xd4D\x84&\xe5J\xc8\x9e[\xf4<\xe7\xcc\x14\x91tT5\x97h\xbfD\x0e(\xb1\x97\x80\xe76\x81\r\xde2\xac>s\xb0\x8a\x91\xd3|\xeeKK\x96\x0c\xd45]\xf1\xc0EC\x07D\xc3|"\x03?+\x99\xb3\x98{\x8bb`_\x88lT\x08\xe7;\xdeUSX\xf9s\xad\x1cf\x0c\x0c\xaej\xaaLx2\x99\xf7\x96\xd2\xaf\x8ab]\x15\xbb\xfeU}\xa2*\xb5\x0e\x97\x81\xad\x10\x05\xd4F\x8c\xcc+D\xcb\xa5\xc2\xfbD=\xdb\xbcJ\xf3\xd4\x95@\xdd+\\\x0f\xaa6\xcb\xe7\xfc\x1a\xf2QB\xeeO\x96v\xc6\xf7\x15\x9cJz*\xbc\xc2X\x1d\x1d7\x94\xc8\x86\x8a\x15Zb\x87}\x15\xb4o\xd35\xb8\x8f\x98N\xdce?\xba\xa03=\xe6\x85N\x17\xcbl\xf5j\xbc\x89\x01\x89l\xd9\xac\xb3 ,Z\xf0:x\xa5d\x11\xdf#\xbb\xf3\xc6\xf7\x08\x15>\xdcQ\x84\xc0\xa0\xb1m\xd9\x03\x81\x0c\xd8\x93\x02\x93\xdd,\xb3K\xac\xf9\xbfo\xbe\x13\x81\xa3\xfb\xc6~\xdc\x07g\xbf\xd6fVg\xd4h\x80\xf0\x87\xd2\x15\xcc#M\x1a\xeb\xcbO\xc2gs\xf98G\xfb\xb4\xf7:\xc3\x99UV\x0c\xeeB\x877\xcb\xffC\x83x\xfbH0\xc6\x8e\xdeh\xf8\xcd\xaf\xce\x0c\xac\xbb\x8f\xc7\x9e\xe7\xc5\x84\xa0\x92n\x02\x1d\x05\x90\xb4/\xf4\xd4\xfb\x9anir\xc7\x19\xe6\t\xb1\xd2\xbb\xc3\xc1\xca\x9a\x9a4\x18\xed\xf3\nA\x8d`\xdd\xea\xe8\x0c\xdc7\xd1\x04@H\xefj\xf7\xc6\\Y]pW\x99\x92\xf9\xb0h\xc2\xcal\x8bB\xa2z\xb1\xa0\x9e\xb9\x1c_2H\xb2:e\xb6=\x9a\x1e\x1f\xe0\xffun+\x1aQ\xc8\xa1\x14O\xc1\xec\xf6\x92$<\x07\xa5\x04,e`7\x19\x0f'
2022-08-10 08:24:28.766 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw response: bytearray(b'\x06\x01\x04\x07\x01\x02')
2022-08-10 08:24:28.766 DEBUG (MainThread) [aiohomekit.protocol.tlv] receiving [
  6 (State): (1 bytes/<class 'bytearray'>) 0x04
  7 (Error): (1 bytes/<class 'bytearray'>) 0x02 [Authentication]
]

2022-08-10 08:24:28.766 DEBUG (MainThread) [aiohomekit.protocol] #5 ios -> accessory: send SRP exchange request
2022-08-10 08:24:28.770 DEBUG (MainThread) [aiohomekit.protocol] #1 ios -> accessory: send SRP start request
2022-08-10 08:24:28.770 DEBUG (MainThread) [aiohomekit.protocol.tlv] sending [
  6 (State): (1 bytes/<class 'bytearray'>) 0x01
  0 (Method): (1 bytes/<class 'bytearray'>) 0x00
]

2022-08-10 08:24:28.770 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw request: b'POST /pair-setup HTTP/1.1\r\nHost: 192.168.254.49\r\nContent-Length: 6\r\nContent-Type: application/pairing+tlv8\r\n\r\n\x06\x01\x01\x00\x01\x00'
2022-08-10 08:24:36.089 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw response: bytearray(b'\x06\x01\x02\x03\xff]\xc6\xe5@\xbc\x99\xa8F\x8f9\xb5\'I\xc9m#\r\x86\xa9\xa5|~\xf5\x1b\x90M\xad!\x81\rKlpO\xcc\x8c\xb8\xac\x9e<\xda\xbbTg\xbb\'\xcaY1n\x89|\x0e~\xe0\x14(\xac\xe4?\xbf\xe7\x0e\xa9\xa4\x00\xb3\xdc\x8a\xbd\x0ef^\xd4\xf7\xf5\xd4GR\rot\x10D2Ex\x83\x0e\xfe\x99\x9f$\x98\xce\xbb\xff\xd0\x148\x9fs\xd2uZ\xe1eK\xf8\x8c\xc7\xa4\x06\xd5e\x9e\x1fx"\x17+\xf7\x1d\x85)8\xac\xb6\x16\xc9\xb3\xa4\x05\xb8\tC\x0e~\xc1i:\xc7\xc8\xd3\xb6\xfa\x1a\xe3\x9c\xd2\xacM\xf1#\'\x1fJA\x92\xf6\xd2-qi\xc8Hj\xde\x84\xcf)\x08P\xb2\xbd\x01\x88\x01zRgC\xd8\x81\xea\xbc\r,\x05\x15,\xc2\x9a\xc12^$&D\xbf3\xef\xecp\xd4X)\xbe\xb8J\xb1Q\x11$hK\x94RU\xa9\x14\xcb\xcf\xd7\xf3]\x85M)\xa5k\xec\xfd\x8c\xa4y\x08\xc8\xf8o\x030\xdd\xa6.\x95S\xcc\xf0\x97w\xa6O|\x8d\x03\x81\xde\xb1\tO\xdd/+F\x90\xfa\xd1:#\xca\xd3^R|w\x0c\xe2\x00VH\xb1P\xa6\x82\x08\xafk\x847&\x05\xd9b\xb3\xdeB8\xbaM\x9f?1\x00\x1c\xe9\xe3\xe4\x04\xaf\xf9\xd8\xb5sp\xf0\x9a\x89ma\xfboj\x19H\xc6\x11\xf6\xcfe\x80\xc0\xffe\xb2\xef\xa5V\xdb\xff\x80)Z\xbf\xc9\xad\xcd\x08I\xa5_A\xfc\xec\xa1\x99\xb5\x98S\xec\xa0\xcbPe\xbf\xcf\xd9\xc0+(,\x92\x86\x89p=\x1d\x865t(\x85\xf9C5x\x02\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2022-08-10 08:24:36.090 DEBUG (MainThread) [aiohomekit.protocol.tlv] receiving [
  6 (State): (1 bytes/<class 'bytearray'>) 0x02
  3 (PublicKey): (384 bytes/<class 'bytearray'>) 0x5dc6e540bc99a8468f39b52749c96d230d86a9a57c7ef51b904dad21810d4b6c704fcc8cb8ac9e3cdabb5467bb27ca59316e897c0e7ee01428ace43fbfe70ea9a400b3dc8abd0e665ed4f7f5d447520d6f741044324578830efe999f2498cebbffd014389f73d2755ae1654bf88cc7a406d5659e1f7822172bf71d852938acb616c9b3a405b809430e7ec1693ac7c8d3b6fa1ae39cd2ac4df123271f4a4192f6d22d7169c8486ade84cf290850b2bd0188017a526743d881eabc0d2c05152cc29ac1325e242644bf33efec70d45829beb84ab1511124684b945255a914cbcfd7f35d854d29a56becfd8ca47908c8f86f0330dda62e9553ccf09777a64f7c8ddeb1094fdd2f2b4690fad13a23cad35e527c770ce2005648b150a68208af6b84372605d962b3de4238ba4d9f3f31001ce9e3e404aff9d8b57370f09a896d61fb6f6a1948c611f6cf6580c0ff65b2efa556dbff80295abfc9adcd0849a55f41fceca199b59853eca0cb5065bfcfd9c02b282c928689703d1d8635742885f9433578
  2 (Salt): (16 bytes/<class 'bytearray'>) 0x00000000000000000000000000000000
]

2022-08-10 08:24:36.090 DEBUG (MainThread) [aiohomekit.protocol] #3 ios -> accessory: send SRP verify request

Looks like it might actually be sending an all-zero salt.

Djelibeybi avatar Aug 09 '22 22:08 Djelibeybi

Does this device actually pair with an iphone ?

bdraco avatar Aug 09 '22 22:08 bdraco

Yes, I unpaired it from real HomeKit to test it with Home Assistant. I can repair it to HomeKit proper in about 30-45 minutes when I'm back at my desk.

Djelibeybi avatar Aug 09 '22 22:08 Djelibeybi

diff --git a/aiohomekit/protocol/tlv.py b/aiohomekit/protocol/tlv.py
index 37cbcb5..77506aa 100644
--- a/aiohomekit/protocol/tlv.py
+++ b/aiohomekit/protocol/tlv.py
@@ -172,7 +172,7 @@ class TLV:
                 result[-1][1] += value
             else:
                 result.append([key, value])
-        logger.debug("receiving %s", TLV.to_string(result))
+        logger.debug("receiving %s as %s", ba, TLV.to_string(result))
         return result
 
     @staticmethod
@@ -217,6 +217,7 @@ class TLV:
                     for b in value[:length]:
                         result.append(b)
                     value = value[length:]
+        logger.debug("actual bytes: %s", result)
         return result
 
     @staticmethod

In case its a bug in the TLV decode, this should show us the raw bytes

bdraco avatar Aug 09 '22 22:08 bdraco

2022-08-10 09:15:25.211 DEBUG (MainThread) [aiohomekit.controller.ble.controller] Starting BLE controller with instance: <homeassistant.components.bluetooth.models.HaBleakScannerWrapper object at 0x7f44e5c6c580>
2022-08-10 09:15:25.216 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Starting reconnect loop to 192.168.254.49:80
2022-08-10 09:15:25.216 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.254.49:80
2022-08-10 09:15:25.218 DEBUG (MainThread) [aiohomekit.protocol] #1 ios -> accessory: send SRP start request
2022-08-10 09:15:25.218 DEBUG (MainThread) [aiohomekit.protocol.tlv] sending [
  6 (State): (1 bytes/<class 'bytearray'>) 0x01
  0 (Method): (1 bytes/<class 'bytearray'>) 0x00
]

2022-08-10 09:15:25.218 DEBUG (MainThread) [aiohomekit.protocol.tlv] actual bytes: bytearray(b'\x06\x01\x01\x00\x01\x00')
2022-08-10 09:15:25.218 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw request: b'POST /pair-setup HTTP/1.1\r\nHost: 192.168.254.49\r\nContent-Length: 6\r\nContent-Type: application/pairing+tlv8\r\n\r\n\x06\x01\x01\x00\x01\x00'
2022-08-10 09:15:33.166 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw response: bytearray(b'\x06\x01\x02\x03\xff\xa48\xb1\xe2\xb0\x13F\x0f\xae?+]\xd9\xf2\xdeS\xda\x06\x88\xbd\x0b\xea\x07C\xfb\xd2\xb6\xb5\xbc\x9f\xe7\xd0D\x03AQ\xa9\x17U\xa6\xc4\xe4J\x9b\xd1C\x95\x97\x13\xed\xfbS\xdbB\x16U\xd7*\xbc\x00\xc4\xe3)\x0b$\xd6\x0e\xe5+\xc9\xee\xefI\xc1\xdd\x80*\x15c\x04\xc9\xa6RIPf\x94\x839\xad@\xb7\xbf-\xa7\xe9q\xf8\xb4l\xdc,%\xea\x19}2\x9f\xbd9\xe74\xfc\x13;\x00\xbb.3\xa4\xc8\x8cR|\x87.\xb5I\xccO\xc8\x9f=u(\xc3\x869\x8e\xe5j\x8ey\xa0\xcbh!\xab\x8a\x16\x9f\xe5\xffA_\xe0\x7f\x8fU\xf7\x15\xdbQ\xfa\xa7\xd3\xe0\xc8\xf4\x88\xd0\xdcB\xc1OM"y\x0fie\xaf\xbb`LWo@\xc5`V6\xe9\x1a[\xc4\xc6,_>+\xfb\x14\xd9\xcb\xb3\x8d\xf0\xa6e\xd2a\xfd=B\x87\x08*[\xda\xc7\xe36\rUNm\x07\xa2T\x06\xc4S\x18Z\xf5T\xd0\x95\xe5"\xd9\x9fg\n\xa6\xe7\xaa\xe3\x7fH\x14\xaa\x91{\x03\x81\xef`v\xc62/\nl\'\xa2\xca\x14Gs3l\xe3\xbb\\\xd1\xac.\x94.mQ\x9cm\xfc\x01rx\xf1!\xe8\x93\x1f\xa2\x9d\xa88a\'\x9d\x0f\xb1\xab\xde`\x8e_(\xf6\x02\xf0nC\x03"L\xd9\x81\xd9+\xdc.\xf1H\x99~ \xcf\xb6\xa1\x80P\xd6\xd9\xb2\x18\xac\x04A\xfc\xdb\xc3O\xc5,\xf0ot\x7fx\xca\xabfR\x1c\x8a\xbbx7\xb9(\xacv\x80b\x01\xaa\x1c\xe0\xba\xd4\x1fx\xde\xa0\xb0\xcdi\xab2\x1d-y$;\x02\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2022-08-10 09:15:33.166 DEBUG (MainThread) [aiohomekit.protocol.tlv] receiving bytearray(b'\x06\x01\x02\x03\xff\xa48\xb1\xe2\xb0\x13F\x0f\xae?+]\xd9\xf2\xdeS\xda\x06\x88\xbd\x0b\xea\x07C\xfb\xd2\xb6\xb5\xbc\x9f\xe7\xd0D\x03AQ\xa9\x17U\xa6\xc4\xe4J\x9b\xd1C\x95\x97\x13\xed\xfbS\xdbB\x16U\xd7*\xbc\x00\xc4\xe3)\x0b$\xd6\x0e\xe5+\xc9\xee\xefI\xc1\xdd\x80*\x15c\x04\xc9\xa6RIPf\x94\x839\xad@\xb7\xbf-\xa7\xe9q\xf8\xb4l\xdc,%\xea\x19}2\x9f\xbd9\xe74\xfc\x13;\x00\xbb.3\xa4\xc8\x8cR|\x87.\xb5I\xccO\xc8\x9f=u(\xc3\x869\x8e\xe5j\x8ey\xa0\xcbh!\xab\x8a\x16\x9f\xe5\xffA_\xe0\x7f\x8fU\xf7\x15\xdbQ\xfa\xa7\xd3\xe0\xc8\xf4\x88\xd0\xdcB\xc1OM"y\x0fie\xaf\xbb`LWo@\xc5`V6\xe9\x1a[\xc4\xc6,_>+\xfb\x14\xd9\xcb\xb3\x8d\xf0\xa6e\xd2a\xfd=B\x87\x08*[\xda\xc7\xe36\rUNm\x07\xa2T\x06\xc4S\x18Z\xf5T\xd0\x95\xe5"\xd9\x9fg\n\xa6\xe7\xaa\xe3\x7fH\x14\xaa\x91{\x03\x81\xef`v\xc62/\nl\'\xa2\xca\x14Gs3l\xe3\xbb\\\xd1\xac.\x94.mQ\x9cm\xfc\x01rx\xf1!\xe8\x93\x1f\xa2\x9d\xa88a\'\x9d\x0f\xb1\xab\xde`\x8e_(\xf6\x02\xf0nC\x03"L\xd9\x81\xd9+\xdc.\xf1H\x99~ \xcf\xb6\xa1\x80P\xd6\xd9\xb2\x18\xac\x04A\xfc\xdb\xc3O\xc5,\xf0ot\x7fx\xca\xabfR\x1c\x8a\xbbx7\xb9(\xacv\x80b\x01\xaa\x1c\xe0\xba\xd4\x1fx\xde\xa0\xb0\xcdi\xab2\x1d-y$;\x02\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') as [
  6 (State): (1 bytes/<class 'bytearray'>) 0x02
  3 (PublicKey): (384 bytes/<class 'bytearray'>) 0xa438b1e2b013460fae3f2b5dd9f2de53da0688bd0bea0743fbd2b6b5bc9fe7d044034151a91755a6c4e44a9bd143959713edfb53db421655d72abc00c4e3290b24d60ee52bc9eeef49c1dd802a156304c9a652495066948339ad40b7bf2da7e971f8b46cdc2c25ea197d329fbd39e734fc133b00bb2e33a4c88c527c872eb549cc4fc89f3d7528c386398ee56a8e79a0cb6821ab8a169fe5ff415fe07f8f55f715db51faa7d3e0c8f488d0dc42c14f4d22790f6965afbb604c576f40c5605636e91a5bc4c62c5f3e2bfb14d9cbb38df0a665d261fd3d4287082a5bdac7e3360d554e6d07a25406c453185af554d095e522d99f670aa6e7aae37f4814aa917bef6076c6322f0a6c27a2ca144773336ce3bb5cd1ac2e942e6d519c6dfc017278f121e8931fa29da83861279d0fb1abde608e5f28f602f06e4303224cd981d92bdc2ef148997e20cfb6a18050d6d9b218ac0441fcdbc34fc52cf06f747f78caab66521c8abb7837b928ac76806201aa1ce0bad41f78dea0b0cd69ab321d2d79243b
  2 (Salt): (16 bytes/<class 'bytearray'>) 0x00000000000000000000000000000000
]

2022-08-10 09:15:33.166 DEBUG (MainThread) [aiohomekit.protocol] #3 ios -> accessory: send SRP verify request
2022-08-10 09:15:40.918 DEBUG (MainThread) [aiohomekit.protocol.tlv] sending [
  6 (State): (1 bytes/<class 'bytearray'>) 0x03
  3 (PublicKey): (384 bytes/<class 'bytearray'>) 0x1eff95a3ca1539d33f2be91fcdb2a79f9342c6cb7e5da27d3ee00bbd8a703a61bebb5b001caa1f6efa14dc2257f0ab350a3ba6fd4243d78e5b926b9c9255f92de97c48f4a436e28050b232a1250be310ceb9636964ae9b9d6e448c8ae7a185150e339516b986b7b707bbd97028f0d57d9755ed4c61e0fa0ea80512592f755e077f381a6cdcc70d444d201e564760ecad0919f5bba2387b01bcc428f26fb2bf121f688afd919edb953d9e1016af2b4bc17376a55fa1c5a1ded829c12a93973f246c74585d95950016e269177bc594ab7acd00a41b82adcc4e2d6474371dd5536977ec92fc5c15efa11965e61749aaacabc4b74b4342b72e2d1bc3338f34803094f05230c25b7a831e61fb2e8de1f910d989b8a4cc35bc060fdd7fc68466091f1d58c35f548c0a5e771098e03764e426c7e163f461eed9d0f85aab4fc39ce022d02f273b288eb7be3148bc8b14ae64de13372a22ea6a6b67945ba262dca5d37cf2c02f2c580f0b0fff7064b604729bf380aa31e2bc61c55fd9e567da1c770224a1
  4 (Proof): (64 bytes/<class 'bytearray'>) 0x127582eaa6e6cf60ec12abf5f6051b3ed2ddb179200a21448d1d8998e8ad831d7054ba8fd18187fce0078a1e6e3e06978a49d556c54ff56da1f32a8c6e21e2cb
]

2022-08-10 09:15:40.918 DEBUG (MainThread) [aiohomekit.protocol.tlv] actual bytes: bytearray(b'\x06\x01\x03\x03\xff\x1e\xff\x95\xa3\xca\x159\xd3?+\xe9\x1f\xcd\xb2\xa7\x9f\x93B\xc6\xcb~]\xa2}>\xe0\x0b\xbd\x8ap:a\xbe\xbb[\x00\x1c\xaa\x1fn\xfa\x14\xdc"W\xf0\xab5\n;\xa6\xfdBC\xd7\x8e[\x92k\x9c\x92U\xf9-\xe9|H\xf4\xa46\xe2\x80P\xb22\xa1%\x0b\xe3\x10\xce\xb9cid\xae\x9b\x9dnD\x8c\x8a\xe7\xa1\x85\x15\x0e3\x95\x16\xb9\x86\xb7\xb7\x07\xbb\xd9p(\xf0\xd5}\x97U\xedLa\xe0\xfa\x0e\xa8\x05\x12Y/u^\x07\x7f8\x1al\xdc\xc7\rDM \x1eVG`\xec\xad\t\x19\xf5\xbb\xa28{\x01\xbc\xc4(\xf2o\xb2\xbf\x12\x1fh\x8a\xfd\x91\x9e\xdb\x95=\x9e\x10\x16\xaf+K\xc1sv\xa5_\xa1\xc5\xa1\xde\xd8)\xc1*\x93\x97?$ltX]\x95\x95\x00\x16\xe2i\x17{\xc5\x94\xabz\xcd\x00\xa4\x1b\x82\xad\xccN-dt7\x1d\xd5Siw\xec\x92\xfc\\\x15\xef\xa1\x19e\xe6\x17I\xaa\xac\xab\xc4\xb7KCB\xb7.-\x1b\xc33\x8f4\x800\x03\x81\x94\xf0R0\xc2[z\x83\x1ea\xfb.\x8d\xe1\xf9\x10\xd9\x89\xb8\xa4\xcc5\xbc\x06\x0f\xdd\x7f\xc6\x84f\t\x1f\x1dX\xc3_T\x8c\n^w\x10\x98\xe07d\xe4&\xc7\xe1c\xf4a\xee\xd9\xd0\xf8Z\xabO\xc3\x9c\xe0"\xd0/\';(\x8e\xb7\xbe1H\xbc\x8b\x14\xaed\xde\x137*"\xeajkg\x94[\xa2b\xdc\xa5\xd3|\xf2\xc0/,X\x0f\x0b\x0f\xffpd\xb6\x04r\x9b\xf3\x80\xaa1\xe2\xbca\xc5_\xd9\xe5g\xda\x1cw\x02$\xa1\x04@\x12u\x82\xea\xa6\xe6\xcf`\xec\x12\xab\xf5\xf6\x05\x1b>\xd2\xdd\xb1y \n!D\x8d\x1d\x89\x98\xe8\xad\x83\x1dpT\xba\x8f\xd1\x81\x87\xfc\xe0\x07\x8a\x1en>\x06\x97\x8aI\xd5V\xc5O\xf5m\xa1\xf3*\x8cn!\xe2\xcb')
2022-08-10 09:15:40.918 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw request: b'POST /pair-setup HTTP/1.1\r\nHost: 192.168.254.49\r\nContent-Length: 457\r\nContent-Type: application/pairing+tlv8\r\n\r\n\x06\x01\x03\x03\xff\x1e\xff\x95\xa3\xca\x159\xd3?+\xe9\x1f\xcd\xb2\xa7\x9f\x93B\xc6\xcb~]\xa2}>\xe0\x0b\xbd\x8ap:a\xbe\xbb[\x00\x1c\xaa\x1fn\xfa\x14\xdc"W\xf0\xab5\n;\xa6\xfdBC\xd7\x8e[\x92k\x9c\x92U\xf9-\xe9|H\xf4\xa46\xe2\x80P\xb22\xa1%\x0b\xe3\x10\xce\xb9cid\xae\x9b\x9dnD\x8c\x8a\xe7\xa1\x85\x15\x0e3\x95\x16\xb9\x86\xb7\xb7\x07\xbb\xd9p(\xf0\xd5}\x97U\xedLa\xe0\xfa\x0e\xa8\x05\x12Y/u^\x07\x7f8\x1al\xdc\xc7\rDM \x1eVG`\xec\xad\t\x19\xf5\xbb\xa28{\x01\xbc\xc4(\xf2o\xb2\xbf\x12\x1fh\x8a\xfd\x91\x9e\xdb\x95=\x9e\x10\x16\xaf+K\xc1sv\xa5_\xa1\xc5\xa1\xde\xd8)\xc1*\x93\x97?$ltX]\x95\x95\x00\x16\xe2i\x17{\xc5\x94\xabz\xcd\x00\xa4\x1b\x82\xad\xccN-dt7\x1d\xd5Siw\xec\x92\xfc\\\x15\xef\xa1\x19e\xe6\x17I\xaa\xac\xab\xc4\xb7KCB\xb7.-\x1b\xc33\x8f4\x800\x03\x81\x94\xf0R0\xc2[z\x83\x1ea\xfb.\x8d\xe1\xf9\x10\xd9\x89\xb8\xa4\xcc5\xbc\x06\x0f\xdd\x7f\xc6\x84f\t\x1f\x1dX\xc3_T\x8c\n^w\x10\x98\xe07d\xe4&\xc7\xe1c\xf4a\xee\xd9\xd0\xf8Z\xabO\xc3\x9c\xe0"\xd0/\';(\x8e\xb7\xbe1H\xbc\x8b\x14\xaed\xde\x137*"\xeajkg\x94[\xa2b\xdc\xa5\xd3|\xf2\xc0/,X\x0f\x0b\x0f\xffpd\xb6\x04r\x9b\xf3\x80\xaa1\xe2\xbca\xc5_\xd9\xe5g\xda\x1cw\x02$\xa1\x04@\x12u\x82\xea\xa6\xe6\xcf`\xec\x12\xab\xf5\xf6\x05\x1b>\xd2\xdd\xb1y \n!D\x8d\x1d\x89\x98\xe8\xad\x83\x1dpT\xba\x8f\xd1\x81\x87\xfc\xe0\x07\x8a\x1en>\x06\x97\x8aI\xd5V\xc5O\xf5m\xa1\xf3*\x8cn!\xe2\xcb'
2022-08-10 09:15:43.758 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw response: bytearray(b'\x06\x01\x04\x07\x01\x02')
2022-08-10 09:15:43.758 DEBUG (MainThread) [aiohomekit.protocol.tlv] receiving bytearray(b'\x06\x01\x04\x07\x01\x02') as [
  6 (State): (1 bytes/<class 'bytearray'>) 0x04
  7 (Error): (1 bytes/<class 'bytearray'>) 0x02 [Authentication]
]

2022-08-10 09:15:43.758 DEBUG (MainThread) [aiohomekit.protocol] #5 ios -> accessory: send SRP exchange request
2022-08-10 09:15:43.763 DEBUG (MainThread) [aiohomekit.protocol] #1 ios -> accessory: send SRP start request
2022-08-10 09:15:43.763 DEBUG (MainThread) [aiohomekit.protocol.tlv] sending [
  6 (State): (1 bytes/<class 'bytearray'>) 0x01
  0 (Method): (1 bytes/<class 'bytearray'>) 0x00
]

2022-08-10 09:15:43.763 DEBUG (MainThread) [aiohomekit.protocol.tlv] actual bytes: bytearray(b'\x06\x01\x01\x00\x01\x00')
2022-08-10 09:15:43.763 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw request: b'POST /pair-setup HTTP/1.1\r\nHost: 192.168.254.49\r\nContent-Length: 6\r\nContent-Type: application/pairing+tlv8\r\n\r\n\x06\x01\x01\x00\x01\x00'
2022-08-10 09:15:51.116 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.254.49: raw response: bytearray(b'\x06\x01\x02\x03\xff\xa2q\xd4G\xa3\xa32\xc3\xea\x19K\xdf\x8b\xee\xbb"\xab\xdb\x8f\x1a-\n\xac\xcd\x8c0\xa07lg\xd3\x8e/\xed\xd4\xd7\xc2*M\xd9\xeb\xefy\xe0\xb2\xff\xfeo\x138\xf4\x07\xcc\xcd\xe9.\xf8G\xe9\x1aC\xbc\xf2\xab\xbbp\x18\xa4qa\x92]-X\n\xafkV}\xeb\xc3<\xa1>\xd6\xf9\x0e\xf5#F\xaa\xf6\xeb\xeb\xda\x8f~\x11\x83\n\x1e\xa9\x93\x99\x8fB\xc6Z\xc54\xa8m\xa3`z\t\x97\xbe\xed\xcak<\xfcG\x80\xc3\xdbpY\x95\x83\xe4\xf8\xaa#\x08\xb5\xc9\x9e\xb1\xef\xc0\xcbrh\xa820#\x00\xd2\x9eV\x92\x06\xdf\x91\xd4>\xc6\x122_6S\xb8\xbe\xbb\x059\xdf\xe6\xdf\xe9\xb6\x18b\x8f\xfb\xbd\x98_\x8fv5\xb3\xbd\xd1\x86CTm*\xf7\xacJy\xfe{\xce*\xd7:\x99\x86;\'h\xcf\xd3\x04\x11\x85\xda\xe8Px\xf4\xcf\x9f\x80\xe0S?\xcaJ\xde\x99\x08E\ra\xd4Y\x11=\x1b\x10\r\xa3E\xe4\xfa\xd8\xa9+\xb9\xd3X\x1e\xbcwW\r\xad\x03\x81\x07j\x9aC\xcc\xd3\xbc\xc9X5\xcf\x14be6\xaf\xfb\xd7b\xbex\x0e\'\x98:\xed\x92\xc1\x12\x02ZB<2W\xd0\xb2\xdbAw\xc4?\x8b\xa5\xca\xa5\x97\x89`\x8d\xe5c\xeaC&s\x1b\xefZ`pMA\xed\x15\xd4M\xc7\xabgD\xe2\n\x1c\x86\x97v\xa5\xa7\xd4\x8a\xe87\x1c\x9e\xae\xb0m\x02l\xccL\xa3\xab\xec\xa9\x00T-\x1a\xdb\x84n\xc35H\xf7k\xc9\xce\xcd\xdf}\x8a\xcf\x16v\xc3 r\x87\x1b\xb0\xa5->\x0e\xd2\xc7\x02\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2022-08-10 09:15:51.116 DEBUG (MainThread) [aiohomekit.protocol.tlv] receiving bytearray(b'\x06\x01\x02\x03\xff\xa2q\xd4G\xa3\xa32\xc3\xea\x19K\xdf\x8b\xee\xbb"\xab\xdb\x8f\x1a-\n\xac\xcd\x8c0\xa07lg\xd3\x8e/\xed\xd4\xd7\xc2*M\xd9\xeb\xefy\xe0\xb2\xff\xfeo\x138\xf4\x07\xcc\xcd\xe9.\xf8G\xe9\x1aC\xbc\xf2\xab\xbbp\x18\xa4qa\x92]-X\n\xafkV}\xeb\xc3<\xa1>\xd6\xf9\x0e\xf5#F\xaa\xf6\xeb\xeb\xda\x8f~\x11\x83\n\x1e\xa9\x93\x99\x8fB\xc6Z\xc54\xa8m\xa3`z\t\x97\xbe\xed\xcak<\xfcG\x80\xc3\xdbpY\x95\x83\xe4\xf8\xaa#\x08\xb5\xc9\x9e\xb1\xef\xc0\xcbrh\xa820#\x00\xd2\x9eV\x92\x06\xdf\x91\xd4>\xc6\x122_6S\xb8\xbe\xbb\x059\xdf\xe6\xdf\xe9\xb6\x18b\x8f\xfb\xbd\x98_\x8fv5\xb3\xbd\xd1\x86CTm*\xf7\xacJy\xfe{\xce*\xd7:\x99\x86;\'h\xcf\xd3\x04\x11\x85\xda\xe8Px\xf4\xcf\x9f\x80\xe0S?\xcaJ\xde\x99\x08E\ra\xd4Y\x11=\x1b\x10\r\xa3E\xe4\xfa\xd8\xa9+\xb9\xd3X\x1e\xbcwW\r\xad\x03\x81\x07j\x9aC\xcc\xd3\xbc\xc9X5\xcf\x14be6\xaf\xfb\xd7b\xbex\x0e\'\x98:\xed\x92\xc1\x12\x02ZB<2W\xd0\xb2\xdbAw\xc4?\x8b\xa5\xca\xa5\x97\x89`\x8d\xe5c\xeaC&s\x1b\xefZ`pMA\xed\x15\xd4M\xc7\xabgD\xe2\n\x1c\x86\x97v\xa5\xa7\xd4\x8a\xe87\x1c\x9e\xae\xb0m\x02l\xccL\xa3\xab\xec\xa9\x00T-\x1a\xdb\x84n\xc35H\xf7k\xc9\xce\xcd\xdf}\x8a\xcf\x16v\xc3 r\x87\x1b\xb0\xa5->\x0e\xd2\xc7\x02\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') as [
  6 (State): (1 bytes/<class 'bytearray'>) 0x02
  3 (PublicKey): (384 bytes/<class 'bytearray'>) 0xa271d447a3a332c3ea194bdf8beebb22abdb8f1a2d0aaccd8c30a0376c67d38e2fedd4d7c22a4dd9ebef79e0b2fffe6f1338f407cccde92ef847e91a43bcf2abbb7018a47161925d2d580aaf6b567debc33ca13ed6f90ef52346aaf6ebebda8f7e11830a1ea993998f42c65ac534a86da3607a0997beedca6b3cfc4780c3db70599583e4f8aa2308b5c99eb1efc0cb7268a832302300d29e569206df91d43ec612325f3653b8bebb0539dfe6dfe9b618628ffbbd985f8f7635b3bdd18643546d2af7ac4a79fe7bce2ad73a99863b2768cfd3041185dae85078f4cf9f80e0533fca4ade9908450d61d459113d1b100da345e4fad8a92bb9d3581ebc77570dad076a9a43ccd3bcc95835cf14626536affbd762be780e27983aed92c112025a423c3257d0b2db4177c43f8ba5caa59789608de563ea4326731bef5a60704d41ed15d44dc7ab6744e20a1c869776a5a7d48ae8371c9eaeb06d026ccc4ca3abeca900542d1adb846ec33548f76bc9cecddf7d8acf1676c32072871bb0a52d3e0ed2c7
  2 (Salt): (16 bytes/<class 'bytearray'>) 0x00000000000000000000000000000000
]

2022-08-10 09:15:51.116 DEBUG (MainThread) [aiohomekit.protocol] #3 ios -> accessory: send SRP verify request

I didn't revert the previous change to aiohomekit/protocol/__init__.py but I did power cycle the Beam just in case it needed a reboot to reset the salt or something. Doesn't seem to have made a difference though.

Djelibeybi avatar Aug 09 '22 23:08 Djelibeybi

The salt is literally coming from the device as \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00

bdraco avatar Aug 09 '22 23:08 bdraco

That's not very salty.

Djelibeybi avatar Aug 10 '22 00:08 Djelibeybi

I’ll reach out to LIFX support and see if I can get someone from the dev team to have a look at this thread & fingers crossed might get some info.

As a side note the offical pairing methods to Apple Home and even the LIFX app can be consistently buggy on this device.

RyanTheTide avatar Aug 10 '22 01:08 RyanTheTide

Sure. I know/knew some folks at LIFX in Melbourne too, but to be honest, I'm not entirely sure who's still there.

And I've (touch wood) never had a single issue connecting my LIFX devices to wifi or HomeKit. But I've been doing it since the Kickstarter, so I've had a lot of practice. 😂

Djelibeybi avatar Aug 10 '22 01:08 Djelibeybi

The second one I ordered showed up here today.

I was able to get the pairing working by adding padding with the 00000000000000000 salt

https://github.com/Jc2k/aiohomekit/pull/150#pullrequestreview-1071939978

bdraco avatar Aug 13 '22 11:08 bdraco

2022.8.5 has the changes that hopefully will fix pairing. Please let us know.

bdraco avatar Aug 16 '22 05:08 bdraco

2022.8.5 has the changes that hopefully will fix pairing. Please let us know.

Up and running now!

image

RyanTheTide avatar Aug 19 '22 23:08 RyanTheTide