jlusiardi / homekit_python

A python implementation to work as both HomeKit controller and accessory.
Apache License 2.0
216 stars 41 forks source link

Error pairing the Aqara FP2 presence sensor #246

Open TomasWeij opened 2 months ago

TomasWeij commented 2 months ago

Hi,

When trying to pair the Aqara FP2 presence sensor through 'python3 -m homekit.pair', the function always returns "perform_pair_setup: State not M4". I tried various ways to mitigate this problem, e.g. resetting the device.

Any advise would be appreciated, since me and my buddy ChatGPT can't figure out why this sensor won't pair, but e.g. HomeBridge will.

Thanks!

TomasWeij commented 2 months ago

Debug logging:

2024-04-12 00:59:11,918 selector_events.py:0054 DEBUG Using selector: EpollSelector /home/pi/.local/lib/python3.11/site-packages/homekit/zeroconf_impl/init.py:199: FutureWarning: <homekit.zeroconf_impl.CollectingListener object at 0x74eb4950> has no update_service method. Provide one (it can be empty if you don't care about the updates), it'll become mandatory. ServiceBrowser(zeroconf, '_hap.tcp.local.', listener) 2024-04-12 00:59:12,930 init.py:0110 DEBUG #1 ios -> accessory: send SRP start request 2024-04-12 00:59:12,931 init.py:0065 DEBUG write message: [ <6, b'\x01'>, <0, b'\x01'>, ] 2024-04-12 00:59:13,710 init.py:0072 DEBUG response: [ <6, 2>, <3, b'\xf9\xda\xa7CN\x9e\x06\x0e\xb9\xe0\xa9\x15\x86\r\xf2s6\x8c\xbc\x16\x96Q\xceI\xb8\x8a\xa27\x94\xf2m \xe7\xc7%\x13N\xbd\x9c\xb6W\x97\x1f\xe7\x13\r\x9d\tc\x90\xe0\xc8\xe3 A>p\x00^\xeb\x9f\rb\xc9\x1d\xd98\xff\xa4\xe2mi\xe5\x13=q[/2\x90\xb0\x83\xdd\xed6\xf7\x9b\x89$\x8b\xa0T@dX\x7f\xc1\xf4\xa4\xd3P5\xc1\x83\xdc\x05\t\xe7\x82\xc6\x99Z\xf3\x80\xb4\x13u\x92N\xaa\xf3\xa7\x85V\x9fR\xd9\xca\x939\xc5\xac\xda\x18\xdcm\xa2K\xf2:J@F\xab\xb5)\x8bc<\xa2\x9f\x8d\x07zn:E?%\xfc\xf7v\xf6\x17\xddR\xe4v\xfc\xae\x7fn\x0c\xb4\x9c\x9dUp}FJ\xb5\x1b;\xa7")\x82\xcf\xdf\x16v\x82\xe1\x82\xd4\xa3\xdd\x00\xd2P\x88\xd8\x9a\xa7\x0c\xb0<\x8a\xec\xedB\xa1q\x04\xd3\x8b\xb1\x00p\xfcwqBV\x95\xeb\xc5\xc8#8\x87\xd5/\xd8\xa0\x85\x01P\x00\xccSI\x8c\xb4\xad\x97\xdcV\x80\xa4^\xa2\xea0a\xf1a\xac\t\xa5\xc9WDJ\x95M\xc3N2\x1e{\x1c\xe9[#Z\xc4\xd5n\xc9\x12\xccP\x07[y\xdb\x89\x9c1q\xcb\xb9\xd0\xa2\x0c\xd76\xda\xca\xd663\x8dmX\xc9\xdbr\x9d\xa9\r@\x9a\n\x88\xdc\x9c&G\x7f%\xfa\xb1\x98\xe3L\x92\xf1\xac\xc4\xfa\x8b\x9b\x84\xe1\xe4\xaa\x87\x80\x11\xf6].&\xbe\xaa|Y\xb0C|\x0c\xe5\xdfu\x07\x0b\xbamf\x87#\xa5\x8d9y\xe1\x0cp\xf7\x95\xd6\xef.\x06\xec\xb0\x8d}t'>, <2, b'\xf2\xdb\xdd\x02\xaeNG \xecg\xfb2\xf3X\xdf\xbc'>, ] 2024-04-12 00:59:13,711 __init__.py:0127 DEBUG #3 ios -> accessory: send SRP verify request Enter device pin (XXX-YY-ZZZ): 308-14-979 2024-04-12 00:59:22,095 __init__.py:0065 DEBUG write message: [ <6, b'\x03'>, <3, b'.\x93\xd2O\xdf\x8b\x89w\x89!\x05n\xe2\x854c,\xec\x05\x05J\xa1Y\xc3\xecP\xd9Q\xd7Pvw\xd8>6\x98\xa0\xab\xc9X*\x08>DM\xd2&\x1e\xd2\xbb\x142\xd0z\xbf\x1c\xe4\r\xe5\xfe\xa8I\xae\x8c\x0fx\xaai\x10\x97\xf5Q;\xba\x08}.\xb61\xbd\x7f)\x81%\xc8\x12Jd-_\x02\x849\xf9\x86\xf5\xccg\x1cU\xe6\x8f\xac\xeeO\xe98\x83&lQKm\xd9\x9bi-\xa4-\x02\x7fe\x80\xf4\xf9b\x97k\xea\xe0\xed\xd3\xca\xbc\xd4c\x97\xca\x93"\xe3\xf4\x0b\xb6\x92?\xc72\x90\xc6\xdd=\x83\xbf\x90\xc4\x17>H\xd0\xd3\x90t\x8e\x1c\x00\x15\xb2{"\xc6\xfew\xc7"a\xf7\xafc\x08a\x95\xff\xf8\xe0\xebdr\xc0\x83w\x07\x18\x8as\xc5\xf3\xb6\xc8X\xa4>\xf0.E\xb9\x11\xf8\x84E\x9cyY\x8e\xcfi\x93\xcd<\\xb8G\xf5J\xefY\xb7*"C]\xd7\'\xdb\xcc\n7\xdad.\xed+\xbcU\xf5\xc3h\xf9\x06\x8b\x1e\xd2lI\xdd\xfcM\xb1\x94\xe5\xf2\xd4b\xde\x9b\x01\xbc\x06\xfa\x8e;D\xc2\x9d1^\x1c[\xfe\xad\x15\x86\xc6\x954\x81\x8c\xd7uY\x11\\xa9\xcb\xec\xc5\x04&9\n\xaa\xb9\xd5\x94j\xbd\x04\xa5D\xe2\t\xe4\x87\x14\x06\r8\x1f\xe1|\xdc\xb3p\x88)\xc2\']Cv\xe5\xc4XBCn\xa1\x15\xad\x83\xcf\xb05`\xf2\x8b&;\xae-;l\x8d\xf2\xa7\xab\x97\xf2s\xf8\xa5\xe2\x8cC_\xd9?9y\xc1\xa3\x05\xc8~\x19\x94\xff\x1a\x7f\x17\x96\xbc,'>, <4, b"\xb7)\xc7\x80\xa8\x0e\x00/\xeb{\xb0\xca'.\xaaq\x98\x1b\xee4\xf6\xfc\x03\xc9\x9d [\xc38r\xa6}\xb8\xd1y\x92\xfexD\xf7\xb4\xb0\x98\xe6\x91\xd9\x0ebH1\x81\xc7]\x03\xb9-w\x00FLW)\x9c\xe7">, ] 2024-04-12 00:59:22,738 init.py:0072 DEBUG response: [ ] 2024-04-12 00:59:22,739 init.py:0183 DEBUG #5 ios -> accessory: send SRP exchange request perform_pair_setup: State not M4 2024-04-12 00:59:22,740 pair.py:0085 DEBUG perform_pair_setup: State not M4 Traceback (most recent call last): File "/home/pi/.local/lib/python3.11/site-packages/homekit/pair.py", line 78, in finish_pairing(pin_function()) File "/home/pi/.local/lib/python3.11/site-packages/homekit/controller/controller.py", line 415, in finish_pairing request, expected = state_machine.send(response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/.local/lib/python3.11/site-packages/homekit/protocol/init.py", line 186, in perform_pair_setup_part2 assert response_tlv.first_by_id(TlvTypes.State) and response_tlv.first_by_id( ^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: perform_pair_setup: State not M4

jrocharodrigues commented 2 months ago

I'm having the same problem. Did you find a solution?