revk / ESP32-RevK

My tools for ESP32 projects under ESP-IDF
GNU General Public License v3.0
7 stars 6 forks source link

Changing access point settings leads to weird results #26

Closed sam-m7 closed 9 months ago

sam-m7 commented 9 months ago

Hello,

yesterday I've connected a Faikin to of my ACs which is further away from the IOT wifi router. I've noticed that even tough it's fully set up, when loosing the wifi connection, it's creating it's own access point again allowing everyone to change the wifi settings and connect the Faikin to their own wifi, doing whatever they want with it. I didn't like this (to my knowledge even when coverage is good, it's pretty easy to disrupt and deliberately disconnect wifi devices from the outside) and found the access point settings here. But they don't seam to work properly, at least from how I understand the documentation.

From the documentation, I thought setting appass would solve it. But setting just this doesn't change anything. The created AP is still unprotected. When setting apssid too, the wifi access point is protected and has the correct SSID. The only problem is that now the ap is always created, even when connected to wifi. It also seams like the DHCP is only working while it is connected to the wifi, when the connection is lost, network settings are not getting configured on my machine. When also setting apwait and aptime, it seams like DHCP is working after apwait. I haven't noticed that aptime is deactivating the AP or DHCP (if it's also seconds). But even with apwait and aptime set, the access point is shown all the time, which I wouldn't expect from the documentation and would also mean a lot of mostly unused networks being shown in our home all the time. This could probably be prevented by aphide, which I haven't tried, but from my understanding the AP should only be active when not connected to the wifi.

Maybe it would even make sense to create a setting which prevents the AP to be created at all (and also disables all other resets, like due to the wifireset setting for example).

revk commented 9 months ago

Indeed, sounds like some good ideas. I'll looks in to it this week.

sam-m7 commented 9 months ago

Indeed, sounds like some good ideas. I'll looks in to it this week.

Great, no rush. Thanks!

revk commented 9 months ago

OK I have made a change that allows appass to be used on the automatic AP mode (i.e. when no aassid set).

Let me know if that is doing what you need...

I'll look in to other controls as well.

sam-m7 commented 9 months ago

Thanks! I've installed the Beta and tested it, setting apssid andaptime/apwait to null where I've set it. The result was that when I turn off the wifi, the AP is now protected by the password and is only up when wifi is not connected, so far so good and how I expected it.

I've noticed the following behavior though (which I haven't had with the open access point, but more or less the same as with the ssid set): First I can always connect to the access point itself, but my laptop won't get an IP (works with all other wifi networks flawlessly though). My phone seems to have a higher success rate, but sometimes also doesn't finish with the network setup. Once my phone connected, it seams to work better on the laptop too. After I was connected to it's own access point, the Faikin module won't connect to the regular wifi anymore once it's back. I could only get it to reconnect by changing some of the settings and providing the wifi password seams to help too, but I had to try a few times, mostly it does not really react or reboot and just says settings stored, WiFi not connected. But after some time I've got them back in the wifi.

I think if there will be an option to disable resets and prevents the access point to be created in the first place I might use that instead of the appass, although I haven't decided yet. It feels a lot more secure with the appass setting now already :)

revk commented 9 months ago

I can look more later today when I am back from holiday.

revk commented 9 months ago

Setting apwait to 0 will turn off the AP mode for not being on line.

Still comes on if no wifissid is set though.

sam-m7 commented 9 months ago

Setting apwait to 0 will turn off the AP mode for not being on line.

Still comes on if no wifissid is set though.

Works, thanks a lot!