libretiny-eu / libretiny

PlatformIO development platform for IoT modules
http://docs.libretiny.eu/
MIT License
382 stars 55 forks source link

Captive Portal conflicts with regular web server, breaks HA's API #204

Open Linwood-F opened 8 months ago

Linwood-F commented 8 months ago

I am not certain this is a libretiny issue however with 30 devices I have so far only seen it there, along with other wifi anomalies.

I have Novostellar 20w floods and used cloudcutter, then flashed with esphome. They mostly work. I am using board generic-bk7231n-qfn32-tuya using bk72xx on esphome 2023.10.5 and home assistant 2023.10.5 supervisor 2023.11.0 OS 11.1.

The issue is that with captive portal enabled as well as web server, the device sometimes goes into a mode where it displays the captive portal web instead of the regular web. Note that it is NOT using the AP fallback (which is also defined), it is on the Wifi network normally, at its (manual) IP address.

I have tried changing the web server's port (the captive portal's port not being changeable) but this captive portal display still appears at the new port.

HA's API does not work when it gets into this mode, there is no accessible USB connection so I cannot get logs either. The only path to resolving it is turn off captive portal and do an OTA from the captive portal display. This is difficult as there's some kind of timeout where it appears to restart/reset, returning to the same situation, but often before an OTA can complete.

Some physical devices of same type seem more prone to this than others, and it is intermittent (though I have one that seems to do it almost every time). I posted this as a question here, and that thread has some screen shots as well, though other than showing it really is the captive portal they do not provide significant info.

It appears as though the various web service(s) are somehow conflicting. And preventing HA's API from working. I am not using MQTT.

I have retired this particular device from use and can experiment with it, if someone can give me any ideas how to get more useful information.

Linwood