Arduino-HomeKit-ESP8266
Arduino-HomeKit-ESP8266 copied to clipboard
WLAN disconnect / reconnect
I am using this great lib since quite a while successfully. Great work!!! Now I wanted to make some of my appliances a bit more robust in terms of WLAN dependency. The appliance should work if there is no WLAN as well (of course without Homekit support during the outage). Starting without WLAN and connecting when it is available works great, but if the device is connecting to WLAN during the start phase, losing connection later and (successfully) reconnecting does not allow to reconnect to existing Homekit clients.
The log says
[ 174632] HomeKit: Starting server [ 174636] HomeKit: Using existing accessory ID: FB:A0:23:18:B6:65 [ 174642] HomeKit: Found admin pairing with 03C48AC3-703E-40F8-BD39-392369FB4997, disabling pair setup [ 174651] HomeKit: Configuring MDNS [ 174656] HomeKit: MDNS restart: Glashaus, IP: 192.168.178.148 [ 174662] HomeKit: Init server over
but no reconnect...
Is there any reconnect / reset option or need for such situations?
Perhaps the same scenario with this issue https://github.com/Mixiaoxiao/Arduino-HomeKit-ESP8266/issues/139
I added this to my loop:
` uint32_t next_wifi_connect;
void loop() {
const uint32_t t1 = millis(); if (WiFi.status() != WL_CONNECTED) { if (t1 > next_wifi_connect) { // reconnect every 5 seconds next_wifi_connect = t1 + 5 * 1000; wifi_connect(); my_homekit_setup(); } } else { my_homekit_loop(); } delay(10); }`