maximkulkin / esp-homekit-demo

Demo of Apple HomeKit accessory server library
MIT License
808 stars 233 forks source link

I can't pair it with homekit #408

Open Kristian8606 opened 3 years ago

Kristian8606 commented 3 years ago

I try to pair the device but always to no avail

HomeKit: Starting server HomeKit: Using existing accessory ID: 78:2D:23:65:7A:7E HomeKit: Configuring mDNS HomeKit: Got new client connection: 55 from 192.168.0.110 HomeKit: [Client 55] Pair Setup Step 1/3 HomeKit: [Client 55] Pair Setup Step 2/3 HomeKit: [Client 55] Pair Setup Step 3/3 HomeKit: Added pairing with EE50190D-642E-4437-B1F7-657F0714E992 HomeKit: Configuring mDNS HomeKit: [Client 55] Successfully paired HomeKit: [Client 55] Closing client connection

after restart

`WiFI ready

HomeKit: Starting server HomeKit: Using existing accessory ID: 78:2D:23:65:7A:7E HomeKit: Found admin pairing with EE50190D-642E-4437-B1F7-657F0714E992, disabling pair setup HomeKit: Configuring mDNS`

Kristian8606 commented 3 years ago

5ECFFB31-EF4D-43B5-AB55-6009F51F6018

maximkulkin commented 3 years ago

It says "after restart". What restart? You're not supposed to reboot accessory right after pairing.

Kristian8606 commented 3 years ago

after restart

`WiFI ready

HomeKit: Starting server HomeKit: Using existing accessory ID: 78:2D:23:65:7A:7E HomeKit: Found admin pairing with EE50190D-642E-4437-B1F7-657F0714E992, disabling pair setup HomeKit: Configuring mDNS`

Kristian8606 commented 3 years ago

but no accessory is displayed in the home. When trying to pair again, the accessory was not found because it appears to be paired

Kristian8606 commented 3 years ago

Because of my poor English, my question may have confused you, sorry. When I try to pair I get a HomeKit: [Client 55] Closing client connection and the error in the photo above. Then I restart esp and try to pair again but it behaves as if it is paired

maximkulkin commented 3 years ago

Disconnection after pair setup is a normal procedure. Controller then reconnects, goes through pair verification and then downloads accessory definition and shows what kind of services accessory provides on the UI. From your log I can't tell what happens after pair setup.

peros550 commented 3 years ago

if I got it right , Kristian says that accessory paired in logs, but never in home iOS app.

Kristian8606 commented 3 years ago

this is all available information and according to it the device seems to be paired but in fact the device is not displayed in the home application due to the shown on photo error

Kristian8606 commented 3 years ago

I noticed that the size of led.bin is 681 kb I think this may be a problem?

AramVartanyan commented 3 years ago

This issue could be triggered by values out of boundaries or improper characteristics defined. I have never received this message. 🤔

Kristian8606 commented 3 years ago

just following the example i haven't changed anything

Kristian8606 commented 3 years ago

I forgot to specify that I use led example ESP8266_RTOS_SDK

Kristian8606 commented 3 years ago

What causes this error? I get it often. !!! HomeKit: [Client 4] Failed to compute SRP shared secret (code -2)

maximkulkin commented 3 years ago

This is out of memory error.

peros550 commented 3 years ago

I get this error also, right after setting up the wifi. Solution seems to be to hard reset the board and try again. It looks the wifi config procedure eats some memory which isn’t freed?

maximkulkin commented 3 years ago

@peros550 I do not know what is exactly in your case, but wifi_config can cause memory fragmentation (because you run homekit server when wifi_config hasn't fully stopped yet), so it goes like ( ), then wifi_config stops and you get ( ), so memory is fragmented and there might not be enough memory chunks.

peros550 commented 3 years ago

Thanks Maxim. No worries it's not a big issue on my case since a reboot clears the problem. Any idea how we could calculate what kind of memory each RTOS task consumes in design time?

maximkulkin commented 3 years ago

@peros550 Yes, you can. Basically, it's the stack size you allocate for your task + some fixed overhead ( + everything your task allocates while running ).

tosie commented 3 years ago

@Kristian8606 In the past I have seen this problem when not using the newest git submodules. Try to update all submodules, rebuild everything, erase the flash and flash again (maybe some of these steps are not necessary, but it worked for me).

git pull --recurse-submodules
make -C examples/... clean
make -C examples/... all
make -C examples/... erase_flash
make -C examples/... flash
choosegit commented 3 years ago

I also have the this problem,In debugging,When I find something wrong, the log is:

>>> HomeKit: Configuring mDNS
>>> HomeKit: [Client 55] Successfully paired
>>> homekit_client_process: [Client 55] Finished processing
>>> HomeKit: [Client 55] Closing client connection

When there is no problem, the log is:

>>> HomeKit: [Client 4] Successfully paired
>>> HomeKit: [Client 4] Closing client connection
>>> HomeKit: Got new client connection: 4
>>> HomeKit: [Client 4] Pair Verify Step 1/2
>>> HomeKit: [Client 4] Pair Verify Step 2/2
>>> HomeKit: [Client 4] Found pairing with E4D1A879-C96A-4297-A752
>>> HomeKit: [Client 4] Verification successful, secure session established
>>> HomeKit: [Client 4] Get Accessories
>>> HomeKit: [Client 4] Update Characteristics
>>> HomeKit: [Client 4] Update Characteristics
>>> HomeKit: [Client 4] Update Characteristics
>>> HomeKit: [Client 4] Get Characteristics

It seems to have some problem with validation

maximkulkin commented 3 years ago

@choosegit could you please recompile firmware with HomeKit debug logs enabled and reupload logs

choosegit commented 3 years ago

static inline int hwrand_generate_block(uint8_t *buf, size_t len) This function causes the problem

jmgutierrezc1 commented 2 years ago

I do have a similar problem, everything work very well and I can pair with Homekit, the problem come if I lose power>

0:30:05.969 -> >>> [ 74] HomeKit: Using existing accessory ID: 66:41:E3:25:57:20 00:30:05.969 -> >>> [ 80] HomeKit: Found admin pairing with 08F9D6E6-E39C-4A1C-A379-521136694FAA, disabling pair setup 00:30:05.969 -> >>> [ 89] HomeKit: Configuring MDNS 00:30:05.969 -> >>> [ 92] HomeKit: Init server over 00:30:05.969 -> Free heap: 40288, HomeKit clients: 0 00:30:10.992 -> Free heap: 40336, HomeKit clients: 0

I never get the accessory to work again. the accessories do not response again on Homekit I have to reset, connect to my wifi again delete the accessory from Homekit and re-pair

mdemir4421 commented 8 months ago

worked for me.

void remove_all_pairings() { homekit_storage_reset(); }

void setup() { // Your setup code here, including WiFi connection and homekit setup remove_all_pairings(); // Call this function to remove all pairings // Continue with the rest of your setup... }

void loop() { // Your loop code here }