G-Two / smoke-x-receiver

An ESP32+LoRa application to bridge a ThermoWorks Smoke X remote thermometer to Home Assistant via MQTT
MIT License
14 stars 5 forks source link

Heltec WiFi LoRa 32 V3 fails to connect to wifi #16

Open PhantomPhoton opened 9 months ago

PhantomPhoton commented 9 months ago

I have a pair of Heltec WiFi LoRa 32 V3 devices and I flashed 11ee2e1b9aca7720f41952ff312d80455dfe8d9f on them. The flash takes just fine and I can connect to the AP, however, when I configure the wifi module, it fails to connect to the wifi and falls back to the AP mode.

Debugging this, I see in the console that the values are sent back to the web browser, however, when I dump the values loaded from the nfs (added a log line at https://github.com/G-Two/smoke-x-receiver/blob/11ee2e1b9aca7720f41952ff312d80455dfe8d9f/main/app_wifi.c#L183 ), the SSID and password are set correctly, however, the mode and auth_type are always zero. I patched my nodes by hard coding app_wifi_params.mode = WIFI_MODE_STA and app_wifi_params.auth_type = WIFI_AUTH_WPA2_PSK at that same location and the device connects successfully to my wifi.

I haven't figured out exactly where the values for mode and auth_type are going awol, but wanted to get it written up and submitted.

Thank you so much for the project!

bmoline978 commented 9 months ago

Thank you for finding this - I am seeing the same behavior, and your workaround works for me as well

G-Two commented 9 months ago

Thanks for writing this up. I'll try to replicate the failure and see if I can trace the root cause.

G-Two commented 9 months ago

I think I found the problem. The web UI was sending the authType and mode values as strings while the backend JSON parser was expecting ints. It should work now with https://github.com/G-Two/smoke-x-receiver/commit/36260a32af5be54eaf51d9e2cb2fb500c0daacd4

G-Two commented 9 months ago

Be sure to clear your browser cache after reflashing otherwise the old frontend code might run.