matth-x / MicroOcpp

OCPP 1.6 client for microcontrollers
MIT License
340 stars 149 forks source link

Help required: Controller forgets the OCPP URL after power recycle #121

Closed mukeshtalks closed 1 year ago

mukeshtalks commented 1 year ago

@matth-x I am facing an issue with the code attached in this ticket. Controller forgets the OCPP url after power recycle. Can you please help where I am doing wrong? main.txt

mukeshtalks commented 1 year ago

@matth-x can you please have look at this and help me.

matth-x commented 1 year ago

Hi @mukeshtalks, sorry for the delayed response. Can you capture the Serial output and post the part where you set the URL?

mukeshtalks commented 1 year ago

@matth-x sorry for the late reply I am setting the URL through the web interface.

image

The log is below

` * Executing task: platformio device monitor

--- Terminal on /dev/cu.usbserial-0001 | 115200 8-N-1 --- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time --- More details at https://bit.ly/pio-monitor-filters --- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H clock div:2 load:0x3L��bb���4 load:0x3fff001c,len:1044 load:0x40078000,len:10124 load:0x40080400,len:5828 entry 0x400806a8 [AO] info (.pio/libdeps/esp32dev/ArduinoOcpp/src/ArduinoOcpp/Core/Configuration.cpp:96): init new configurations container: /arduino-ocpp.cnf wm:[2] Added Parameter: ocppUrl wm:[2] Added Parameter: wm:[2] Added Parameter: caCert wm:[2] Added Parameter: wm:[2] Added Parameter: httpAuthentication wm:[2] Added Parameter: [main] Start capatitive portal wm:[2] Starting Config Portal wm:[2] AccessPoint set password is VALID wm:[2] Disabling STA wm:[2] Enabling AP wm:[1] StartAP with SSID: EVSE-Config wm:[1] AP IP address: 192.168.4.1 wm:[1] Starting Web Portal wm:[2] HTTP server started wm:[2] Config Portal Running, blocking, waiting for clients... wm:[2] Portal Timeout In 60 seconds [E][WebServer.cpp:633] _handleRequest(): request handler not found wm:[2] <- Request redirected to captive portal wm:[2] <- HTTP Root [E][WebServer.cpp:633] _handleRequest(): request handler not found wm:[2] <- Request redirected to captive portal wm:[2] <- HTTP Root [E][WebServer.cpp:633] _handleRequest(): request handler not found wm:[2] <- Request redirected to captive portal wm:[2] <- HTTP Root wm:[2] <- HTTP Param [E][WebServer.cpp:633] _handleRequest(): request handler not found wm:[2] <- Request redirected to captive portal wm:[2] <- HTTP Root [E][WebServer.cpp:633] _handleRequest(): request handler not found wm:[2] <- Request redirected to captive portal wm:[2] <- HTTP Root wm:[2] <- HTTP Param [E][WebServer.cpp:633] _handleRequest(): request handler not found wm:[2] <- Request redirected to captive portal wm:[2] <- HTTP Root wm:[2] NUM CLIENTS: 1 wm:[2] NUM CLIENTS: 1 wm:[2] <- HTTP Param save
wm:[2] Parameters wm:[2] -------------------- wm:[2] ocppUrl: ws://demo.evconnect.telioev.com:30973/Noida-Test-001 wm:[2] : wm:[2] caCert: wm:[2] : wm:[2] httpAuthentication: wm:[2] : wm:[2] -------------------- [E][WebServer.cpp:633] _handleRequest(): request handler not found wm:[2] <- Request redirected to captive portal wm:[2] <- HTTP Root [E][WebServer.cpp:633] _handleRequest(): request handler not found wm:[2] <- Request redirected to captive portal wm:[2] <- HTTP Root [E][WebServer.cpp:633] _handleRequest(): request handler not found wm:[2] <- Request redirected to captive portal wm:[2] <- HTTP Root wm:[2] <- HTTP Exit wm:[2] shutdownConfigPortal [E][WebServer.cpp:633] _handleRequest(): request handler not found wm:[2] <- Request redirected to captive portal wm:[0] [ERROR] disconnect configportal - softAPdisconnect FAILED wm:[2] restoring usermode STA wm:[2] wifi status: Unknown wm:[2] wifi mode: STA wm:[2] configportal closed wm:[1] config portal exiting wm:[1] AutoConnect wm:[2] ESP32 event handler enabled wm:[2] Connecting as wifi client... wm:[2] setSTAConfig static ip not set, skipping wm:[1] Connecting to SAVED AP: mukrim wm:[2] 30000 ms timeout, waiting for connect... wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] Connection result: WLCONNECTED wm:[1] AutoConnect: SUCCESS wm:[2] Connected in 2918 ms *wm:[1] STA IP Address: 192.168.29.225 [main] host, port, URL: demo.evconnect.telioev.com, 30973, ws://demo.evconnect.telioev.com:30973/Noida-Test-001 [AO] info (.pio/libdeps/esp32dev/ArduinoOcpp/src/ArduinoOcpp/Core/Configuration.cpp:96): init new configurations container: /opstore.cnf [AO] info (.pio/libdeps/esp32dev/ArduinoOcpp/src/ArduinoOcpp/Core/Configuration.cpp:96): init new configurations container: /txstore.jsn [AO] info (.pio/libdeps/esp32dev/ArduinoOcpp/src/ArduinoOcpp/Core/Configuration.cpp:96): init new configurations container: /volatile ` ### In the above log, the URL is set but if I recycle the power of the ESP32 module it forgets the URL I have set. Check the serial log after power recycle. In the log you can see the URL is missing._

Reconnecting to /dev/cu.usbserial-0001 .... Connected! n:4 load:0x�len:1044 load:0x40078000,len:10124 load:0x40080400,len:5828 entry 0x400806a8 [AO] info (.pio/libdeps/esp32dev/ArduinoOcpp/src/ArduinoOcpp/Core/Configuration.cpp:96): init new configurations container: /arduino-ocpp.cnf wm:[2] Added Parameter: ocppUrl wm:[2] Added Parameter: wm:[2] Added Parameter: caCert wm:[2] Added Parameter: wm:[2] Added Parameter: httpAuthentication wm:[2] Added Parameter: [main] Start capatitive portal wm:[2] Starting Config Portal wm:[2] AccessPoint set password is VALID wm:[2] Disabling STA wm:[2] Enabling AP wm:[1] StartAP with SSID: EVSE-Config wm:[1] AP IP address: 192.168.4.1 wm:[1] Starting Web Portal wm:[2] HTTP server started wm:[2] Config Portal Running, blocking, waiting for clients... wm:[2] Portal Timeout In 60 seconds wm:[2] Portal Timeout In 30 seconds wm:[2] Portal Timeout In 0 seconds wm:[1] config portal has timed out wm:[2] shutdownConfigPortal wm:[0] [ERROR] disconnect configportal - softAPdisconnect FAILED wm:[2] restoring usermode STA wm:[2] wifi status: Unknown wm:[2] wifi mode: STA wm:[2] configportal closed wm:[1] config portal exiting wm:[1] AutoConnect wm:[2] ESP32 event handler enabled wm:[2] Connecting as wifi client... wm:[2] setSTAConfig static ip not set, skipping wm:[1] Connecting to SAVED AP: mukrim wm:[2] 30000 ms timeout, waiting for connect... wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] . wm:[2] Connection result: WL_CONNECTED wm:[1] AutoConnect: SUCCESS wm:[2] Connected in 2818 ms *wm:[1] STA IP Address: 192.168.29.225 [main] Invalid OCPP URL. Restart. ets Jun 8 2016 00:22:57

mukeshtalks commented 1 year ago

@matth-x please help me i have shared the log in my last post and way i am configuring the webs socket URL

matth-x commented 1 year ago

The device loses the configuration between the boot sequences. Everything looks okay at the first boot and at the second boot, so the error could originate in between. Can you search for more debug messages (starting with [AO] ERROR)? It could, for example complain about flash memory shortages or other file system errors which could damage the URL store.

Generally, the SECC example was just intended for proof-of-concepts. After all, the integration of WiFiManager is not the best and I would advise to write an own maintenance portal for productive use (WiFiManager or another project, at your choice).

matth-x commented 1 year ago

Closing this due to inactivity