AchimPieters / esp32-homekit-demo

esp32-homekit-demo
https://www.studiopieters.nl
MIT License
14 stars 2 forks source link

Found admin pairing, disabling pair setup: cannot find device #11

Open gojimmypi opened 1 month ago

gojimmypi commented 1 month ago

Is your feature request related to a problem? Please describe.

My iPhone does not detect the ESP32 device. At startup time on the ESP32, I see this:

I (2835) esp_netif_handlers: sta ip: 192.168.1.41, mask: 255.255.255.0, gw: 192.168.1.1
I (2835) IP_EVENT: WiFI ready
>>> HomeKit: Starting server
>>> HomeKit: Using existing accessory ID: (my MAC address)
>>> HomeKit: Found admin pairing with (some GUID value), disabling pair setup
>>> HomeKit: Configuring mDNS

It appears to occur here in the code:

        pairing_t pairing;
        while (!homekit_storage_next_pairing(&pairing_it, &pairing)) {
                if (pairing.permissions & pairing_permissions_admin) {
                        INFO("Found admin pairing with %s, disabling pair setup", pairing.device_id);
                        server->paired = true;
                        break;
                }
        }

Describe the solution you'd like

Suggestions on how to address this. What does it mean, and why can I not pair a new device?

Describe alternatives you've considered

Rebooted both phone and device. Problem persists.

Additional context

I've previously added and removed this device.

AchimPieters commented 1 month ago

@gojimmypi the right way to remove your HomeKit accessory is:

Remove accessories that aren’t responding from the Home app. Select an accessory, scroll down to accessory settings and select Remove Accessory.

If you remove it when it is not connected, your accessory will think it is still connected, if you then want to connect to it again, it will say already connected.

Solution:

Rebuild a new main.bin file, then first do an esptool.py erase_flash and then re-flash your esp32 with your new code.

gojimmypi commented 1 month ago

do an esptool.py erase_flash and then re-flash

aha! that worked perfectly! thank you so much.

gojimmypi commented 1 month ago

Do you think it would be a good idea to have that suggestion in the ESP32 log?

btw - I've added https://github.com/AchimPieters/esp32-homekit/compare/main...gojimmypi:esp32-homekit:patch-1 in https://github.com/AchimPieters/esp32-homekit/pull/1 that adds staging / preview wolfssl support to the esp32-homekit.

The version there includes a Kconfig file for disabling features more easily in menuconfig to limit flash size.