Arduino-HomeKit-ESP8266 icon indicating copy to clipboard operation
Arduino-HomeKit-ESP8266 copied to clipboard

WLAN disconnect / reconnect

Open thncode opened this issue 4 years ago • 2 comments
trafficstars

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?

thncode avatar Sep 12 '21 17:09 thncode

Perhaps the same scenario with this issue https://github.com/Mixiaoxiao/Arduino-HomeKit-ESP8266/issues/139

ruleechen avatar Oct 08 '21 03:10 ruleechen

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); }`

sonicpixel2020 avatar Oct 20 '21 18:10 sonicpixel2020