SoC Module evcc: fixed API call#2598
Conversation
|
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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
LKuemmel
left a comment
There was a problem hiding this comment.
Bitte noch nach den Einrückungen schauen.
|
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: 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. |
Doch, ist es. |
Ach so, jetzt wird das klarer :-) |
|
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. |
The evcc module was broken in current master for two reasons:
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.
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.