snaptec / openWB

openWB - die modulare Wallbox
https://openwb.de
GNU General Public License v3.0
341 stars 205 forks source link

BMW-SOC-Module: fix authentication #2836

Closed rleidner closed 2 months ago

rleidner commented 2 months ago

repair authentication issue

rleidner commented 2 months ago

Wäre gut wenn der PR bald in den master/nightly kommt, damit die BMW-Fahrer das testen können.

Chringbay commented 2 months ago

Hi! Danke, dass du dich darum gekümmert hast!

Ich habe die Datei i3soc.py auf meiner Stand-alone (Stable - 1.9.303) ersetzt und bekomme folgende Meldungen: (die Anmeldung scheint zu funktionieren, mit falschen Anmeldedaten bekomme ich dazu Fehlermeldungen)

Hast du eine Idee woran es liegt? Brauche ich das Nightly-Build? urllib3 ist auf Version 2.0.7 und chardet auf 5.2.0 (für Python 3)

`2024-04-28 20:14:53: PID: 5864: Lp1: timer = 1 (LV1) at 77 main modules/soc_i3/main.sh 2024-04-28 20:14:43: PID: 4524: Lp1: Nothing to do yet. Incrementing timer. (LV1) at 81 main modules/soc_i3/main.sh 2024-04-28 20:14:43: PID: 4524: Lp1: timer = 0 (LV1) at 77 main modules/soc_i3/main.sh FileNotFoundError: [Errno 2] No such file or directory: 'undefined/soc_i3_cp1.json' tf = open(storeFile, 'w', encoding='utf-8') File "/var/www/html/openWB/modules/soc_i3/i3soc.py", line 104, in write_store write_store() File "/var/www/html/openWB/modules/soc_i3/i3soc.py", line 430, in main main() File "/var/www/html/openWB/modules/soc_i3/i3soc.py", line 459, in Traceback (most recent call last):

During handling of the above exception, another exception occurred:

FileNotFoundError: [Errno 2] No such file or directory: 'undefined/soc_i3_cp1.json' tf = open(storeFile, 'w', encoding='utf-8') File "/var/www/html/openWB/modules/soc_i3/i3soc.py", line 100, in write_store Traceback (most recent call last): Request failed write_store_file: Exception [Errno 2] No such file or directory: 'undefined/soc_i3_cp1.json' load_store: store file not found, new authentication required RequestsDependencyWarning) /usr/lib/python3/dist-packages/requests/init.py:91: RequestsDependencyWarning: urllib3 (1.26.12) or chardet (3.0.4) doesn't match a supported version! 2024-04-28 20:14:35: PID: 3373: Lp1: SoC: 0 (LV1) at 119 main /var/www/html/openWB/modules/soc_i3/main.sh 2024-04-28 20:14:35: PID: 3373: Lp1: Requesting SoC (LV1) at 101 main /var/www/html/openWB/modules/soc_i3/main.sh 2024-04-28 20:14:35: PID: 3373: Lp1: timer = 20005 (LV1) at 77 main /var/www/html/openWB/modules/soc_i3/main.sh 2024-04-28 20:14:33: PID: 3097: Lp1: Nothing to do yet. Incrementing timer. (LV1) at 81 main modules/soc_i3/main.sh`

rleidner commented 2 months ago

Hi! Danke, dass du dich darum gekümmert hast!

Ich habe die Datei i3soc.py auf meiner Stand-alone (Stable - 1.9.303) ersetzt und bekomme folgende Meldungen: (die Anmeldung scheint zu funktionieren, mit falschen Anmeldedaten bekomme ich dazu Fehlermeldungen)

Hast du eine Idee woran es liegt? Brauche ich das Nightly-Build? urllib3 ist auf Version 2.0.7 und chardet auf 5.2.0 (für Python 3)

`2024-04-28 20:14:53: PID: 5864: Lp1: timer = 1 (LV1) at 77 main modules/soc_i3/main.sh 2024-04-28 20:14:43: PID: 4524: Lp1: Nothing to do yet. Incrementing timer. (LV1) at 81 main modules/soc_i3/main.sh 2024-04-28 20:14:43: PID: 4524: Lp1: timer = 0 (LV1) at 77 main modules/soc_i3/main.sh FileNotFoundError: [Errno 2] No such file or directory: 'undefined/soc_i3_cp1.json' tf = open(storeFile, 'w', encoding='utf-8') File "/var/www/html/openWB/modules/soc_i3/i3soc.py", line 104, in write_store write_store() File "/var/www/html/openWB/modules/soc_i3/i3soc.py", line 430, in main main() File "/var/www/html/openWB/modules/soc_i3/i3soc.py", line 459, in Traceback (most recent call last):

During handling of the above exception, another exception occurred:

FileNotFoundError: [Errno 2] No such file or directory: 'undefined/soc_i3_cp1.json' tf = open(storeFile, 'w', encoding='utf-8') File "/var/www/html/openWB/modules/soc_i3/i3soc.py", line 100, in write_store Traceback (most recent call last): Request failed write_store_file: Exception [Errno 2] No such file or directory: 'undefined/soc_i3_cp1.json' load_store: store file not found, new authentication required RequestsDependencyWarning) /usr/lib/python3/dist-packages/requests/init.py:91: RequestsDependencyWarning: urllib3 (1.26.12) or chardet (3.0.4) doesn't match a supported version! 2024-04-28 20:14:35: PID: 3373: Lp1: SoC: 0 (LV1) at 119 main /var/www/html/openWB/modules/soc_i3/main.sh 2024-04-28 20:14:35: PID: 3373: Lp1: Requesting SoC (LV1) at 101 main /var/www/html/openWB/modules/soc_i3/main.sh 2024-04-28 20:14:35: PID: 3373: Lp1: timer = 20005 (LV1) at 77 main /var/www/html/openWB/modules/soc_i3/main.sh 2024-04-28 20:14:33: PID: 3097: Lp1: Nothing to do yet. Incrementing timer. (LV1) at 81 main modules/soc_i3/main.sh`

Das Problem scheint hier zu sein: FileNotFoundError: [Errno 2] No such file or directory: 'undefined/soc_i3_cp1.json Die Datei liegt in der ramdisk (env var RAMDISKDIR) und nicht in 'undefined' Wie startest Du den Abruf? Der Pfad wird in der openwb Umgebung bzw. in main.sh gesetzt. EDIT: in main.sh hattennoch enige export statements gefehlt. Ich habe das korrigiert.

rleidner commented 2 months ago

Bitte die Anmerkungen aus https://github.com/openWB/core/pull/1589 beachten.: ist comitted.

joerki16 commented 2 months ago

Die Fehlermeldung existiert weiter im letzten nightly 1.9.304.0 (2024-04-29 15:23:47 +0200 [f762494d] )

FileNotFoundError: [Errno 2] No such file or directory: 'undefined/soc_i3_cp1.json' tf = open(storeFile, 'w', encoding='utf-8') File "/var/www/html/openWB/modules/soc_i3/i3soc.py", line 113, in write_store write_store() File "/var/www/html/openWB/modules/soc_i3/i3soc.py", line 435, in main main() File "/var/www/html/openWB/modules/soc_i3/i3soc.py", line 464, in

rleidner commented 2 months ago

Right and thanks for the heads up. It worked in the test but not in the real environment - sorry. There was still an issue to get environment variables into the soc module. This is fixed now and PR created.