marxram / spidr

Privacy for Deye Microinverters using ESP 8266 / 32 module
13 stars 2 forks source link

Impossible to change WLAN settings with flashed `spidr_1.1.ino.heltec_wifi_kit32_V3.bin` (topic moved to new thread) #14

Open mailmarcus opened 3 months ago

mailmarcus commented 3 months ago

Hi Roland, I have moved parts of my previous issue report to a different thread, to hopefully cleaning up communication.

device: Heltec Wifi_Kit_32_V3.1

After not being able to flash spidr_1.1.ino.heltec_wifi_kit32_V3.bin directly with Tasmotizer or Chrome and web.esphome.io, I tried to "PREPARE FOR FIRST USE" via Chrome and https://web.esphome.io/. This ended with "Configuration installed!".

I then logged into the WLAN hotspot esphome-web-564f94 and uploaded the spidr_1.1.ino.heltec_wifi_kit32_V3.bin OTA.

Then the device rebooted and its display showed the SPIDR information, also showing the WIFI SSID: SPIDR-net Password: SPIDR-pass but the available WLAN hotspot was "ESP_564F94" (and not SPIDR-net).

The log dowloaded via web.esphome.io was:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x420f82ee
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x39c
load:0x403c9700,len:0x9bc
load:0x403cc700,len:0x28dc
entry 0x403c98c0
E (252) esp_core_dump_flash: No core dump partition found!
E (252) esp_core_dump_flash: No core dump partition found!
#------------------------------------------------------------- #
# [Start Up] Setup()                                           #
#------------------------------------------------------------- #
Initialize Preferences Manager...
Load Preferences into Variables...
#------------------------------------------------------------- #
# [Preferences] Loading Preferences                           #
#------------------------------------------------------------- #
Loaded Home WiFi SSID: YOUR-HOME-WIFI
Loaded Home WiFi Key: [DEBUG]YOUR-WIFI-PASSKEY
Loaded Inverter WiFi SSID: AP_12345678
Loaded Inverter WiFi Key: [DEBUG] 12345678
Loaded Relais WiFi SSID: EM_12345678
Loaded Relais WiFi Key: [HIDDEN]
Loaded MQTT Broker Host: 
Loaded MQTT Broker Port: 1883
Loaded MQTT Broker User: Client-USER
Loaded MQTT Broker Password: [HIDDEN]
Loaded Inverter Web Access User: admin
Loaded Inverter Web Access Password: [HIDDEN]
NTP Sync Enabled: 1
GMT Offset Seconds: 0
DST Offset Seconds: 0
NTP Server: ptbtime1.ptb.de
NTP Fallback Server: ptbtime2.ptb.de
WiFi Connection Time Window (seconds): 10
Duration Stay In Home Network (ms): 180000
Duration Stay In Home Network First Boot (ms): 10000
Duration Stay In AP Network (ms): 180000
WiFi AP Mode Attempt Window For Home Network (s): 10
Inverter Offline Timeout (seconds): 360
WiFi AP Name: SPIDR-net
WiFi AP Password: [DEBUG] SPIDR-pass
Timing Display Duration Power (ms): 5000
Timing Display Duration Energy Today (ms): 5000
Timing Display Duration Energy Total (ms): 5000
Timing Display Duration Energy Time (ms): 4000
Timing Display Duration Energy Graph (ms): 10000
Initialize Display Manager...
#------------------------------------------------------------- #
# [Start Up] Setup Time()                                      #
#------------------------------------------------------------- #
#------------------------------------------------------------- #
# [WiFi Connect] Attempting to connect to SSID: YOUR-HOME-WIFI
#------------------------------------------------------------- #
............
[wifi_connect] Failed to connect to WiFi network. Retrying...
............
[wifi_connect] Failed to connect to WiFi network. Retrying...
Failed to connect after multiple attempts.
Build Date: Apr 30 2024  Build Time: 21:02:23
Now() = 268  Build Epoch1714510943
NTP Server: ptbtime1.ptb.de
NTP Fallback Server: ptbtime2.ptb.de
GMT Offset: 0h
DST Offset: 0h
Waiting for time to synchronize with NTP server...
Now() = 289  Build Epoch 1714510943
Failed to obtain time from NTP server. Using build time as fallback.
#------------------------------------------------------------- #
# [Skipping] MQTT Manager as Server is empty                   #
#------------------------------------------------------------- #
#------------------------------------------------------------- #
# [WiFi Connect] Attempting to connect to SSID: YOUR-HOME-WIFI
#------------------------------------------------------------- #
............
[wifi_connect] Failed to connect to WiFi network. Retrying...
............
[wifi_connect] Failed to connect to WiFi network. Retrying...
Failed to connect after multiple attempts.
EnergyDisplay: Initializing display intervals.
Intervals set to: Power: 5000 ms, Today: 5000 ms, Total: 5000 ms, Graph: 10000 ms, Time: 4000
EnergyDisplay started.
Generate Test Data
#------------------------------------------------------------- #
# [STATECHANGE] ENTERING >> HOME_NETWORK_MODE                  #
#------------------------------------------------------------- #
[handleHomeNetworkMode]  [ERR] No WiFi Connection!!
[cndHomeNetworkToInverterNetwork] switch_reason_first_boot
millis: 89448
lastStateChangeMillis: 60143
timeToNextTry: 10000
Switch Reason Standard: FirstBoot Read Inverter
[handleHomeNetworkMode] Switching to Inverter Network Mode for data update.
WebServerManager: Web server stopped.
#------------------------------------------------------------- #
# [WiFi Connect] Attempting to connect to SSID: AP_12345678
#------------------------------------------------------------- #
[wifi_connect] Attempting to connect to WiFi AP_12345678
............
[wifi_connect] Failed to connect to WiFi network. Retrying...
............
[wifi_connect] Failed to connect to WiFi network. Retrying...
Failed to connect after multiple attempts.
#------------------------------------------------------------- #
# [STATECHANGE] ENTERING >> INVERTER NETWORK MODE              #
#------------------------------------------------------------- #
[handleInverterNetworkMode] [ERR] No WiFi Connection!!
[handleInverterNetworkMode] Exiting Inverter Network Mode --> Home Network Mode
#------------------------------------------------------------- #
# [WiFi Connect] Attempting to connect to SSID: YOUR-HOME-WIFI
#------------------------------------------------------------- #
............
[wifi_connect] Failed to connect to WiFi network. Retrying...
............
[wifi_connect] Failed to connect to WiFi network. Retrying...
Failed to connect after multiple attempts.
EnergyDisplay started.
Build Date: Apr 30 2024  Build Time: 21:02:23
Now() = 379  Build Epoch1714510943
NTP Server: ptbtime1.ptb.de
NTP Fallback Server: ptbtime2.ptb.de
GMT Offset: 0h
DST Offset: 0h
Waiting for time to synchronize with NTP server...
Now() = 399  Build Epoch 1714510943
Failed to obtain time from NTP server. Using build time as fallback.
#------------------------------------------------------------- #
# [STATECHANGE] ENTERING >> HOME_NETWORK_MODE                  #
#------------------------------------------------------------- #
[handleHomeNetworkMode]  [ERR] No WiFi Connection!!
[handleHomeNetworkMode]  [ERR] No WiFi Connection!!
[handleHomeNetworkMode]  [ERR] No WiFi Connection!!
[handleHomeNetworkMode] Switching to AP Mode due to timeout.
WebServerManager: Web server stopped.
#------------------------------------------------------------- #
# [WiFi AP Mode] Start AP SSID: SPIDR-net Password: SPIDR-pass
#------------------------------------------------------------- #
AP mode activated with SSID: SPIDR-net, IP: 192.168.4.1
WebServerManager: Initializing preferences manager...
WebServerManager: Setting up routes...
WebServerManager: Web server started.
#------------------------------------------------------------- #
# [STATECHANGE] ENTERING >> AP_MODE                            #
#------------------------------------------------------------- #
Build Date: Apr 30 2024  Build Time: 21:02:23
Now() = 522  Build Epoch1714510943
NTP Server: ptbtime1.ptb.de
NTP Fallback Server: ptbtime2.ptb.de
GMT Offset: 0h
DST Offset: 0h
Waiting for time to synchronize with NTP server...
Now() = 543  Build Epoch 1714510943
Failed to obtain time from NTP server. Using build time as fallback.
[handleAPMode] No client connected. Switching back to Home Network Mode.
#------------------------------------------------------------- #
# [WiFi AP Mode] Stop AP 
#------------------------------------------------------------- #
AP mode deactivated. Switched to STA mode.
WebServerManager: Web server stopped.
#------------------------------------------------------------- #
# [WiFi Connect] Attempting to connect to SSID: YOUR-HOME-WIFI
#------------------------------------------------------------- #
............
[wifi_connect] Failed to connect to WiFi network. Retrying...
............
[wifi_connect] Failed to connect to WiFi network. Retrying...
Failed to connect after multiple attempts.
EnergyDisplay started.
#------------------------------------------------------------- #
# [STATECHANGE] ENTERING >> HOME_NETWORK_MODE                  #
#------------------------------------------------------------- #
[handleHomeNetworkMode]  [ERR] No WiFi Connection!!
[handleHomeNetworkMode]  [ERR] No WiFi Connection!!
[handleHomeNetworkMode]  [ERR] No WiFi Connection!!
[handleHomeNetworkMode] Switching to AP Mode due to timeout.
WebServerManager: Web server stopped.
#------------------------------------------------------------- #
# [WiFi AP Mode] Start AP SSID: SPIDR-net Password: SPIDR-pass
#------------------------------------------------------------- #
AP mode activated with SSID: SPIDR-net, IP: 192.168.4.1
WebServerManager: Initializing preferences manager...
WebServerManager: Setting up routes...
WebServerManager: Web server started.
#------------------------------------------------------------- #
# [STATECHANGE] ENTERING >> AP_MODE                            #
#------------------------------------------------------------- #

In an attempt to log into the console to manually change the WLAN credentials, I opened a guest WIFI hotspot with SSID: YOUR-HOME-WIFI and WiFi Key: YOUR-WIFI-PASSKEY, and the device obtained an IP from my guest WLAN. (I was however unable to access the device's IP in my guest network, probably a safety feature of my router). The log however shows successful joining of my guest WIFI:

[02:36:12]------------------------------------------------------------- #
[02:36:12]# [Start Up] Setup()                                           #
[02:36:12]#------------------------------------------------------------- #
[02:36:12]Initialize Preferences Manager...
[02:36:12]Load Preferences into Variables...
[02:36:12]#------------------------------------------------------------- #
[02:36:12]# [Preferences] Loading Preferences                           #
[02:36:12]#------------------------------------------------------------- #
[02:36:12]Loaded Home WiFi SSID: YOUR-HOME-WIFI
[02:36:12]Loaded Home WiFi Key: [DEBUG]YOUR-WIFI-PASSKEY
[02:36:12]Loaded Inverter WiFi SSID: AP_12345678
[02:36:12]Loaded Inverter WiFi Key: [DEBUG] 12345678
[02:36:12]Loaded Relais WiFi SSID: EM_12345678
[02:36:12]Loaded Relais WiFi Key: [HIDDEN]
[02:36:12]Loaded MQTT Broker Host: 
[02:36:12]Loaded MQTT Broker Port: 1883
[02:36:12]Loaded MQTT Broker User: Client-USER
[02:36:12]Loaded MQTT Broker Password: [HIDDEN]
[02:36:12]Loaded Inverter Web Access User: admin
[02:36:12]Loaded Inverter Web Access Password: [HIDDEN]
[02:36:12]NTP Sync Enabled: 1
[02:36:12]GMT Offset Seconds: 0
[02:36:12]DST Offset Seconds: 0
[02:36:12]NTP Server: ptbtime1.ptb.de
[02:36:12]NTP Fallback Server: ptbtime2.ptb.de
[02:36:12]WiFi Connection Time Window (seconds): 10
[02:36:12]Duration Stay In Home Network (ms): 180000
[02:36:12]Duration Stay In Home Network First Boot (ms): 10000
[02:36:12]Duration Stay In AP Network (ms): 180000
[02:36:12]WiFi AP Mode Attempt Window For Home Network (s): 10
[02:36:12]Inverter Offline Timeout (seconds): 360
[02:36:12]WiFi AP Name: SPIDR-net
[02:36:12]WiFi AP Password: [DEBUG] SPIDR-pass
[02:36:12]Timing Display Duration Power (ms): 5000
[02:36:12]Timing Display Duration Energy Today (ms): 5000
[02:36:12]Timing Display Duration Energy Total (ms): 5000
[02:36:12]Timing Display Duration Energy Time (ms): 4000
[02:36:12]Timing Display Duration Energy Graph (ms): 10000
[02:36:12]Initialize Display Manager...
[02:36:12]#------------------------------------------------------------- #
[02:36:12]# [Start Up] Setup Time()                                      #
[02:36:12]#------------------------------------------------------------- #
[02:36:12]#------------------------------------------------------------- #
[02:36:12]# [WiFi Connect] Attempting to connect to SSID: YOUR-HOME-WIFI
[02:36:12]#------------------------------------------------------------- #
[02:36:13]........
[wifi_connect] Connected to WiFi network: YOUR-HOME-WIFI with IP: 192.168.179.2
[02:36:15]Build Date: Apr 30 2024  Build Time: 21:02:23
[02:36:15]Now() = 18  Build Epoch1714510943
[02:36:15]NTP Server: ptbtime1.ptb.de
[02:36:15]NTP Fallback Server: ptbtime2.ptb.de
[02:36:15]GMT Offset: 0h
[02:36:15]DST Offset: 0h
[02:36:15]Connected to Wi-Fi.
[02:36:16]Waiting for time to synchronize with NTP server...
[02:36:21]Now() = 1717979779  Build Epoch 1714510943
[02:36:21]NTP sync successful.
[02:36:24]#------------------------------------------------------------- #
[02:36:24]# [Skipping] MQTT Manager as Server is empty                   #
[02:36:24]#------------------------------------------------------------- #
[02:36:24]#------------------------------------------------------------- #
[02:36:24]# [WiFi Connect] Attempting to connect to SSID: YOUR-HOME-WIFI
[02:36:24]#------------------------------------------------------------- #
[02:36:24][wifi_connect] Already connected to YOUR-HOME-WIFI with IP: 192.168.179.2
[02:36:26]EnergyDisplay: Initializing display intervals.
[02:36:26]Intervals set to: Power: 5000 ms, Today: 5000 ms, Total: 5000 ms, Graph: 10000 ms, Time: 4000
[02:36:26]EnergyDisplay started.
[02:36:26]Generate Test Data
[02:36:26]#------------------------------------------------------------- #
[02:36:26]# [STATECHANGE] ENTERING >> HOME_NETWORK_MODE                  #
[02:36:26]#------------------------------------------------------------- #
[02:36:27][handleHomeNetworkMode] Start Web Server Manager
[02:36:27]WebServerManager: Initializing preferences manager...
[02:36:27]WebServerManager: Setting up routes...
[02:36:27]WebServerManager: Web server started.
[02:36:34][cndHomeNetworkToInverterNetwork] switch_reason_first_boot
[02:36:34]millis: 37050
[02:36:34]lastStateChangeMillis: 26943
[02:36:34]timeToNextTry: 10000
[02:36:34]Switch Reason Standard: FirstBoot Read Inverter
[02:36:34][handleHomeNetworkMode] Switching to Inverter Network Mode for data update.
[02:36:34]WebServerManager: Web server stopped.
[02:36:34]#------------------------------------------------------------- #
[02:36:34]# [WiFi Connect] Attempting to connect to SSID: AP_12345678
[02:36:34]#------------------------------------------------------------- #
[02:36:35][wifi_connect] Attempting to connect to WiFi AP_12345678
[02:36:45]............
[wifi_connect] Failed to connect to WiFi network. Retrying...
[02:36:56]............
[wifi_connect] Failed to connect to WiFi network. Retrying...
[02:36:56]Failed to connect after multiple attempts.
[02:37:03]#------------------------------------------------------------- #
[02:37:03]# [STATECHANGE] ENTERING >> INVERTER NETWORK MODE              #
[02:37:03]#------------------------------------------------------------- #
[02:37:03][handleInverterNetworkMode] [ERR] No WiFi Connection!!
[02:37:03][handleInverterNetworkMode] Exiting Inverter Network Mode --> Home Network Mode
[02:37:03]#------------------------------------------------------------- #
[02:37:03]# [WiFi Connect] Attempting to connect to SSID: YOUR-HOME-WIFI
[02:37:03]#------------------------------------------------------------- #
[02:37:06]..
[wifi_connect] Connected to WiFi network: YOUR-HOME-WIFI with IP: 192.168.179.2
[02:37:08]EnergyDisplay started.
[02:37:09]#------------------------------------------------------------- #
[02:37:09]# [STATECHANGE] ENTERING >> HOME_NETWORK_MODE                  #
[02:37:09]#------------------------------------------------------------- #
[02:37:09][handleHomeNetworkMode] Start Web Server Manager
[02:37:09]WebServerManager: Initializing preferences manager...
[02:37:09]WebServerManager: Setting up routes...
[02:37:09]WebServerManager: Web server started.

The aforementioned WLAN hotspot "ESP_564F94" was still showing up. Should this not be deactivated when the device enters a home network?

Anyway, I signed into this open WLAN and could open the SPIDR config (http://192.168.4.1/config). There, I changed the config to the following (with my correct WLAN settings!) and hit update.

Edit: My WLAN key is just 16 numbers, no special characters. My SSID are just 3 letters/numbers, not very complex.

SPIDR-Config

Then the device's display went dark but it did not sign into my home WLAN but instead used my guest WLAN again. The log shows:

[02:51:28]WebServerManager: Web server started.
[02:52:03]Received form data:
[02:52:03]WiFi Settings:
[02:52:03]Home SSID: (correct one, only changed for copy and paste!)
[02:52:03]Home Key: (correct one, only changed for copy and paste)
[02:52:03]Inverter SSID: 123
[02:52:03]Inverter Key: 123
[02:52:03]Relais SSID: 123
[02:52:03]Relais Key: 123
[02:52:03]MQTT Broker Settings:
[02:52:03]Broker Host: 
[02:52:03]Broker Port: 1883
[02:52:03]Broker User: 
[02:52:03]Broker Password: 
[02:52:03]Main Topic: 
[02:52:03]Web Access Credentials:
[02:52:03]Inverter Web User: 123
[02:52:03]Inverter Web Password: 123
[02:52:03]Relais Web User: 123
[02:52:03]Relais Web Password: 123
[02:52:03]RELOADING PREFERENCES
[02:52:03]#------------------------------------------------------------- #
[02:52:03]# [Preferences] Loading Preferences                           #
[02:52:03]#------------------------------------------------------------- #
[02:52:03]Loaded Home WiFi SSID: YOUR-HOME-WIFI
[02:52:03]Loaded Home WiFi Key: [DEBUG]YOUR-WIFI-PASSKEY
[02:52:03]Loaded Inverter WiFi SSID: AP_12345678
[02:52:03]Loaded Inverter WiFi Key: [DEBUG] 12345678
[02:52:03]Loaded Relais WiFi SSID: EM_12345678
[02:52:03]Loaded Relais WiFi Key: [HIDDEN]
[02:52:03]Loaded MQTT Broker Host: 
[02:52:03]Loaded MQTT Broker Port: 1883
[02:52:03]Loaded MQTT Broker User: Client-USER
[02:52:03]Loaded MQTT Broker Password: [HIDDEN]
[02:52:03]Loaded Inverter Web Access User: admin
[02:52:03]Loaded Inverter Web Access Password: [HIDDEN]
[02:52:03]NTP Sync Enabled: 1
[02:52:03]GMT Offset Seconds: 0
[02:52:03]DST Offset Seconds: 0
[02:52:03]NTP Server: ptbtime1.ptb.de
[02:52:03]NTP Fallback Server: ptbtime2.ptb.de
[02:52:03]WiFi Connection Time Window (seconds): 10
[02:52:03]Duration Stay In Home Network (ms): 180000
[02:52:03]Duration Stay In Home Network First Boot (ms): 10000
[02:52:03]Duration Stay In AP Network (ms): 180000
[02:52:03]WiFi AP Mode Attempt Window For Home Network (s): 10
[02:52:03]Inverter Offline Timeout (seconds): 360
[02:52:03]WiFi AP Name: SPIDR-net
[02:52:03]WiFi AP Password: [DEBUG] SPIDR-pass
[02:52:03]Timing Display Duration Power (ms): 5000
[02:52:03]Timing Display Duration Energy Today (ms): 5000
[02:52:03]Timing Display Duration Energy Total (ms): 5000
[02:52:03]Timing Display Duration Energy Time (ms): 4000
[02:52:03]Timing Display Duration Energy Graph (ms): 10000
[02:52:20]Build Date: Apr 30 2024  Build Time: 21:02:23
[02:52:20]Now() = 1717980738  Build Epoch1714510943
[02:52:20]NTP Server: ptbtime1.ptb.de
[02:52:20]NTP Fallback Server: ptbtime2.ptb.de
[02:52:20]GMT Offset: 0h
[02:52:20]DST Offset: 0h
[02:52:20]Connected to Wi-Fi.
[02:52:20]Time previously synchronized or NTP sync not required.

Any suggestions? Big thanks in advance, Marcus

marxram commented 3 months ago

Hi @mailmarcus,

let's organize a small debuugging session via phone or signal?

The ESP stores all configurations in a file system. It seems that after you first flashed and configured it with esphome, somehow this is not compatible with SPIDR.

SPIDR also checks during boot, if it can read the config from the flash filesystem. If that fails, it will use precompiled defaults.

I would suggest, we first get a clean flashing procedure done (alsi including wiping the config data) and then see if this special issue still exists.

Please contact me via spidr ähtt marxram DoT de (PS: Speaking German is fine ;-)