Skip to content

SoC Module evcc: fixed API call#2598

Merged
benderl merged 5 commits intoopenWB:masterfrom
lordblobo:master
Jul 31, 2025
Merged

SoC Module evcc: fixed API call#2598
benderl merged 5 commits intoopenWB:masterfrom
lordblobo:master

Conversation

@lordblobo
Copy link
Contributor

@lordblobo lordblobo commented Jul 26, 2025

The evcc module was broken in current master for two reasons:

  1. API call had been modified to use "template" field in NewRequest() call in previous commit, which however did not exist in NewRequest() -> added template field to request in vehicle2_pb2.pyi.
    It likely still requires modifications to the proto files and recompilation of the pb2 "do not edit" files, I am not familiar with pb2 though.

  2. Vehicle_to_fetch is not returned by function call but is referenced and used later. Added it.

Successfully tested with two different Audi models in two differenct accounts.

@lordblobo
Copy link
Contributor Author

lordblobo commented Jul 27, 2025

Updated the commit and previous comment. I realized there had been a previous commit to implement the template field (and in fact evcc now supports this new API), so the real fix is to add the template field to NewRequest().

Still needs a fix of the protos and recompilation of pb2 files, which however I am not familiar with.

vehicle_pb2.NewRequest(
token=config.sponsor_token,
type="template",
type=template,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

template ist nun eine Variable, die nicht gesetzt worden ist. Was für einen string erwartet die API denn für template?
Ich hatte damals aufgrund diese Issues https://github.com/snaptec/openWB/issues/2868 das Template-Feld hinzugefügt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, das muss natürlich "template" sein - das ist mir leider als Fehler reingerutscht, jetzt korrigiert.
An dieser Stelle war dein ursprünglicher Commit korrekt.

Allerdings fehlt im Master bei Newrequest() das template-Datenfeld und somit ist der Mechanismus jetzt "broken":
"Protocol message NewRequest has no "template" field."

Ich hatte zuerst testhalber auf die "alte API" umgebaut, also deinen Commit rückgängig gemacht, und die fehlende vehicle_to_fetch variable ergänzt. Damit erfolgreich getestet. Das war mein erster Commit.

Dann bin ich über das von dir verlinkte Issue und deinen vorherigen Commit gestolpert und habe statt Rückbau auf die alte API das template-Feld wieder hinzugefügt, und bei Newrequest() ergänzt.

Hier müssen aber wohl auch noch die Protos für pb2 angepasst und neu kompiliert werden. Da fehlt mir persönlich die Erfahrung mit pb2 / gRPC.

Ich habe mal bei evcc in die Sourcen geschaut und bin verwirrt: hier ist im aktuellen Master auch noch die "alte" API ohne "template" implementiert.
Warum andig also die Änderung bei dir requested hat, das bei evcc selbst aber wohl noch nicht eingeflossen ist erschließt sich mir nicht. Ich habe im EVCC SoC-Thread einen Beitrag dazu erstellt aber noch keine Rückmeldung:
https://forum.openwb.de/viewtopic.php?p=130801#p130801

Copy link
Contributor

@LKuemmel LKuemmel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bitte noch nach den Einrückungen schauen.

@andig
Copy link
Contributor

andig commented Jul 29, 2025

Der Code auf OpenWB Seite ist (mangel Phython-Knowhow) nicht von mir, daher kann ich wenig beitragen. Sieht erstmal nicht falsch aus, v.a. wenn es funktioniert!

@lordblobo
Copy link
Contributor Author

Der Code auf OpenWB Seite ist (mangel Phython-Knowhow) nicht von mir, daher kann ich wenig beitragen. Sieht erstmal nicht falsch aus, v.a. wenn es funktioniert!

Bzgl. pb2 Protos beziehe ich mich auch auf evcc:
https://github.com/evcc-io/evcc/blob/master/api/proto/vehicle.proto
Hier ist in den NewRequest() Protos das Template-Feld auch nicht implementiert, sonder nur token, type und config.
Also die "alte" API.

Wird dieser Teil aus evcc auch für die evcc Cloud verwendet? Handelt es sich dabei um anderen Code oder schaue ich einfach an der falschen Stelle?

Ich versuche derzeit herauszufinden, ob/warum (und wie) die pb2-Protos für gRPC angepasst werden müssten, habe deshalb auch in evcc direkt geschaut.

@andig
Copy link
Contributor

andig commented Jul 30, 2025

Hier ist in den NewRequest() Protos das Template-Feld auch nicht implementiert, sonder nur token, type und config.
Also die "alte" API.

Doch, ist es. template: xyz ist einfach ein Teil der Config Map die zu übergeben ist.

@lordblobo
Copy link
Contributor Author

Doch, ist es. template: xyz ist einfach ein Teil der Config Map die zu übergeben ist.

Ach so, jetzt wird das klarer :-)
Dann hat sich ja am Aufruf und an den Protos praktisch nichts geändert und der Commit von mir müsste so passen.

@lordblobo lordblobo requested a review from LKuemmel July 30, 2025 19:44
@benderl
Copy link
Contributor

benderl commented Jul 31, 2025

Kann der PR dann gemerged werden?

@lordblobo
Copy link
Contributor Author

Kann der PR dann gemerged werden?

Von mir aus gerne. Läuft bei mir seit einer Woche im Dauerbetrieb stabil, mit zwei eingerichteten Fahrzeugen/Abfragen.

@benderl benderl merged commit a0a8232 into openWB:master Jul 31, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants