Mixiaoxiao / Arduino-HomeKit-ESP8266

Native Apple HomeKit accessory implementation for the ESP8266 Arduino core.
MIT License
1.48k stars 278 forks source link

Disconnect on pair setup step 3/3 #240

Open ciananDR opened 7 months ago

ciananDR commented 7 months ago

Below is my serial monitor:

[ 20226] HomeKit: Got new client: local 192.168.0.131:5556, remote 192.168.0.130:52667 [ 20236] HomeKit: [Client 1073685052] Pair Setup Step 1/3 [ 22870] HomeKit: [Client 1073685052] Pair Setup Step 2/3 [ 22884] HomeKit: Call s_mp_exptmod in integer.c, original winsize 6 [ 42140] HomeKit: Call s_mp_exptmod in integer.c, original winsize 5 Current temperature: nan Current Humidity: nan Free heap: 38232, HomeKit clients: 1 [ 51871] HomeKit: [Client 1073685052] Pair Setup Step 3/3 [ 51914] HomeKit: Call ge_double_scalarmult_vartime_lowmem in ge_low_mem.c [ 53339] HomeKit: Added pairing with 378440F9-2E48-4004-87C7-3573BF148FA6 [ 53441] HomeKit: Free saved_preinit_pairing_context [ 53446] HomeKit: [Client 1073685052] Successfully paired [ 53585] HomeKit: [Client 1073685052] Disconnected! [ 53590] HomeKit: [Client 1073685052] Closing client connection [ 53607] HomeKit: Got new client: local 192.168.0.131:5556, remote 192.168.0.130:52670 [ 53617] HomeKit: [Client 1073679460] Pair Verify Step 1/2 [ 54107] HomeKit: Free heap: 40352 [ 54143] HomeKit: [Client 1073679460] Pair Verify Step 2/2 [ 54150] HomeKit: [Client 1073679460] Found pairing with 378440F9-2E48-4004-87C7-3573BF148FA6 [ 54180] HomeKit: Call ge_double_scalarmult_vartime_lowmem in ge_low_mem.c [ 55622] HomeKit: [Client 1073679460] Verification successful, secure session established [ 55630] HomeKit: Free heap: 40464 [ 55706] HomeKit: [Client 1073679460] Get Accessories [ 55929] HomeKit: [Client 1073679460] Disconnected! [ 55935] HomeKit: [Client 1073679460] Closing client connection Free heap: 42584, HomeKit clients: 0 [ 59237] HomeKit: Got new client: local 192.168.0.131:5556, remote 192.168.0.130:52671 [ 59258] HomeKit: [Client 1073679460] Pair Verify Step 1/2 [ 59749] HomeKit: Free heap: 40208 [ 59783] HomeKit: [Client 1073679460] Disconnected! [ 59789] HomeKit: [Client 1073679460] Closing client connection

lumenhu commented 7 months ago

me too, it worked very well two days ago, but I encounter this problem today.

blazing1991 commented 7 months ago

Exactly same here, I'm on latest iOS 17.1.1

yvesgarnier commented 7 months ago

i have the same issue. have you already found the solution? could it be because it is not possible to enter the correct password format? 111-11-111 instead of 1111-1111?

lumenhu commented 7 months ago

I resolved the issue by thoroughly erasing the flash, then reprogramming the firmware to the ESP chip and pairing up again. The root cause of this problem lies in the ESP chip, when it pairing up with an iOS device, the chip saves the device’s ID, referred to as 'Client ID'. If you have successfully paired once without a complete flash erase, the ESP chip will detect the same Client ID during the second pairing attempt, then trigger the issue. In short, the solution is to perform a complete flash erase every time before you reprogram the firmware. And it is advisable to delete the device in the Home App before pairing up with your iOS devices.

blazing1991 commented 7 months ago

Exactly same here, I'm on latest iOS 17.1.1

I also resolved the issue, in my case the problem was in a defective DHT11 sensor, for some reason it was blocking the ESP from finishing setup. First I uploaded a clean example of a temperature sensor and it worked flawlessly. Then I replaced the DHT11 sensor and tested it with a simple sketch to make sure it was giving appropriate numbers. Then combined the code and successfully added esp8266 into the homekit. BUT this piece of sh*t didn't want to work properly anyways, each 1-4h it just loses connection and I had to restart it, which is not what I expected.

After fighting with it for a week I just ended up switching to ESP32 and ESP32-HomeSpan library, which has been working without any problem for a week now.

yvesgarnier commented 7 months ago

hey! thanks a lot for your support. i have disconnected all hardware from the pin and erased the flash using the terminal, but still have this issue. when i set following setting do i still need to erase the flash manually?

Bildschirmfoto 2023-12-07 um 20 26 46

i am able to see the device in the home app but when i try to connect it it shows following message, which translated means: the device is not compatible

IMG_7497

here the serial monitor:

[ 46228] HomeKit: [Client 1073682756] Pair Setup Step 1/3 Current temperature: -127.0 Free heap: 38984, HomeKit clients: 1 Free heap: 39344, HomeKit clients: 1 [ 56389] HomeKit: [Client 1073682756] Pair Setup Step 2/3 [ 56404] HomeKit: Call s_mp_exptmod in integer.c, original winsize 6 [ 75476] HomeKit: Call s_mp_exptmod in integer.c, original winsize 5 Current temperature: -127.0 Free heap: 39504, HomeKit clients: 1 [ 86653] HomeKit: [Client 1073682756] Pair Setup Step 3/3 [ 86696] HomeKit: Call ge_double_scalarmult_vartime_lowmem in ge_low_mem.c [ 88121] HomeKit: Added pairing with 152FE71A-04F4-4B57-803B-CDBBF1699F93 [ 88225] HomeKit: Free saved_preinit_pairing_context [ 88231] HomeKit: [Client 1073682756] Successfully paired [ 88367] HomeKit: [Client 1073682756] Disconnected! [ 88372] HomeKit: [Client 1073682756] Closing client connection [ 88504] HomeKit: Got new client: local 192.168.1.15:5556, remote 192.168.1.148:55353 [ 88516] HomeKit: [Client 1073682756] Pair Verify Step 1/2 [ 89009] HomeKit: Free heap: 41648 [ 89058] HomeKit: [Client 1073682756] Pair Verify Step 2/2 [ 89065] HomeKit: [Client 1073682756] Found pairing with 152FE71A-04F4-4B57-803B-CDBBF1699F93 [ 89095] HomeKit: Call ge_double_scalarmult_vartime_lowmem in ge_low_mem.c [ 90538] HomeKit: [Client 1073682756] Verification successful, secure session established [ 90547] HomeKit: Free heap: 41664 Free heap: 41800, HomeKit clients: 1 [ 90633] HomeKit: [Client 1073682756] Get Accessories [ 90831] HomeKit: [Client 1073682756] Disconnected! [ 90836] HomeKit: [Client 1073682756] Closing client connection