khoih-prog / ESP_WiFiManager

This is an ESP32 / ESP8266 WiFi Connection Manager with fallback web configuration portal. Use this library for configuring ESP32 (including ESP32-S2 and ESP32-C3), ESP8266 modules' WiFi, etc. Credentials at runtime. You can also specify static DNS servers, personalized HostName, fixed or random AP WiFi channel. With examples supporting ArduinoJson
MIT License
371 stars 97 forks source link

Timezone list in config portal missing? #74

Closed bit4man closed 2 years ago

bit4man commented 2 years ago

Describe the bug

I'm using several of the examples as provided, as is - in this case "ConfigOnDoubleReset.ino". The example works except for TZ data. The example reports that there are no TZ data in the configuration file, but the Config Portal does not offer an option to select/store a TZ data piece either. It just shows "Timezone: " and nothing after it.

If the config portal is supposed to offer an option to setup a Timezone, it's not there. Preferred method would be to default to the NTP data offered by DHCP if this is used. I understand this project is not keen on DHCP, but it would simplify the setup a lot of that was included. If not, the messages in the portal and in the code that this can be configured later, are wrong and better instructions needs to be used setting the TZ data as needed.

Steps to Reproduce

Using PlatformIO, install ESP_WifiManager and elect the "ConfigOnDoubleReset" example. Copy to a main.cpp file as is. No changes required.

Use a Wemo D1 R1 (ESP8266) connected, build and upload the sketch. On first run, the portal will be shown. If this unit already has a wifi configuration data file, then do the reset click while the ESP manager initializes to force the WifiManager portal to activate.

Go to the portal from a mobile device like a phone. Notice the initial screen shows no Time Zone. When you click "Configuration" you do not get a TZ option. Expected to see North American timezones given the USING_AMERICA is set to true.

Expected behavior

Select a Timezone. Either from DHCP or allow me to set it in the configuration portal.

Actual behavior

Timezone remains blank and it looks like UTC is the fallback; unable to set the correct timezone for time functions.

Information

Platform.io core: 5.23 - home 3.4.0
ESP8266 version: Expressif 8266 3.2.0
OS: Fedora 34
Linux workstation 5.15.6-100.fc34.x86_64 #1 SMP Wed Dec 1 13:41:51 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
khoih-prog commented 2 years ago

Thanks for your interest in the library.

I've just tested the unmodified ConfigOnDoubleReset example and have no issue with NTP and Timezone at all

Starting ConfigOnDoubleReset with DoubleResetDetect using LittleFS on ESP8266_NODEMCU_ESP12E
ESP_WiFiManager v1.7.8
ESP_DoubleResetDetector v1.2.1
[WM] RFC925 Hostname = ConfigOnDoubleReset
[WM] Set CORS Header to :  Your Access-Control-Allow-Origin
ESP Self-Stored: SSID = HueNet1, Pass = password
[WM] * Add SSID =  HueNet1 , PW =  password
Got ESP Self-Stored Credentials. Timeout 120s for Config Portal
[WM] LoadWiFiCfgFile 
[WM] OK
[WM] stationIP = 192.168.2.186 , gatewayIP = 192.168.2.1
[WM] netMask = 255.255.255.0
[WM] dns1IP = 192.168.2.1 , dns2IP = 8.8.8.8
Got stored Credentials. Timeout 120s for Config Portal
[WM] Current TZ_Name = America/Toronto , TZ =  EST5EDT,M3.2.0,M11.1.0
LittleFS Flag read = 0xD0D04321
No doubleResetDetected
Saving config file...
Saving config file OK
[WM] * Add SSID =  HueNet1 , PW =  password
[WM] * Add SSID =  HueNet2 , PW =  password
ConnectMultiWiFi in setup
[WM] ConnectMultiWiFi with :
[WM] * Flash-stored Router_SSID =  HueNet1 , Router_Pass =  password
[WM] * Add SSID =  HueNet1 , PW =  password
[WM] * Additional SSID =  HueNet1 , PW =  password
[WM] * Additional SSID =  HueNet2 , PW =  password
[WM] Connecting MultiWifi...
[WM] WiFi connected after time:  1
[WM] SSID: HueNet1 ,RSSI= -46
[WM] Channel: 2 ,IP address: 192.168.2.132
After waiting 4.46 secs more in setup(), connection result is connected. Local IP: 192.168.2.132
[WM] freeing allocated params!
Local Date/Time: Mon Dec  6 16:44:23 2021
Stop doubleResetDetecting
Saving config file...
Saving config file OK
Local Date/Time: Mon Dec  6 16:45:23 2021

I suggest you start over, using Arduino IDE to verify it's working OK to retrieve the TZ automatically. If OK, then moving forward gradually to see where / when it's broken.

I don't like and won't add the option to modify the TZ manually, as I don't see the reason to use TZ if you can't access NTP to get the correct time.

Be sure to check that you haven't modified the example's code and you can access the NTP server.

Also have a look at previous TZ-related issues to see anything can be applied in your case.

I'm closing the issue now, unless you can prove this is the bug of this library.

Good Luck