Yurik72 / ESPHap

ESP32/ESP8266 Arduino library for native Apple Homekit Accessory Protocol (HAP)
MIT License
264 stars 60 forks source link

device does not reconnect on power outage/loss #112

Closed seamaster101 closed 2 years ago

seamaster101 commented 2 years ago

I have accessory connected successfully and working. If there is a power outage/loss on the deice and the wifi AP, the device does not restore its connection to the internet for the simple reasons that the wifi AP takes 2-3 minutes to get online and the device does try to connect initially, but there is on internet connection so it stops. How can we fix that?

Yurik72 commented 2 years ago

Your question is depends what you are using to connect to Wifi if you are using WifiManager https://github.com/tzapu/WiFiManager . This behaviour isw predictable. if device can't connect during connection timeout to your device it's automatically start configuration portal. I think this is normal

My advice try to adjust WifiManager setting _connectTimeout by call setConnectTimeout _configPortalTimeout by call setConfigPortalTimeout

0 is unlimited

Means by increasing _connectTimeout your device will try to connect to your AP for instance 5 min, which is give a chanse to restore AP after power loss

by setting _configPortalTimeout you can specify ho long device will keep configuration mode. For instance if you specify 5 min. Device will restart restart after that and will try again to connect to your AP