goecharger / go-eCharger-API-v2

New API specification for V3 and V4 go-eCharger
90 stars 21 forks source link

Clarification: ppv/pgrid docs & writable #199

Open tennox opened 5 months ago

tennox commented 5 months ago

Hey there :) First, thanks for openly documenting & making available an API for self-controlled Home automation :medal_military:

There is some unclarity around how to tell the charger if (/how much) PV excess energy is available via API, instead of controlling charge state "manually" (meaning: via own software outside go-e app).

I've read in some places (e.g. this blog post or this comment) that the parameters ppv and pgrid can actually be written to and used to achieve this. But the documentation is lacking any description and lists them as read-only.

Could you clarify?

Twiederh commented 5 months ago

They can be written using ids/set in MQTT. You need to provide a json like this: { payload: { pPv: 6000, pGrid: -5000, pAkku: 0 } };

with MQTT the endpoint is GoEcharger/<serialnumber>/ids/set

The uppercase letters are important.

After the values have been written, ppv, pgrid and pakku will no longer be null and provide the values you have set with the ids endpoint.

I have implemented this with Nodered today and was able to do a quick PV-only charge of my car.

mleck28 commented 5 months ago

Hello Twiederh,

I have some problems with this. Last Year there was no problems. But now I sent the values, I see the pgrid-value in the app, but the car doesn't load. "Laden nicht erlaubt Eco Modus Ladepause"

Did you have any idea?

Twiederh commented 5 months ago

Hi, da die Meldung auf deutsch ist, vermute ich, dass wir uns auf deutsch unterhalten können :-) Ich habe das gestern erst implementiert und hatte leider bisher nicht genügend Sonne, um ausführlich zu testen. Spätestens morgen sollte ich ausführlich testen können. ich lese die Werte mittels MQTT Explorer aus, was siehst Du denn da bei pgrid? Damit das Laden starten kann, müssen mindestens 1400W Überschuss da sein. Außerdem wird das Laden 3-Phasig gestartet, wenn also nicht genügend Strom von der PV verfügbar ist, wird erst mal auf einphasig umgeschaltet und dann das Laden neu gestartet.

Wichtig ist, dass pGrid als negativer Wert geschickt wird, wenn Überschuss da ist.

Ich melde mich, wenn ich weiter getestet habe.

Viele Grüße, Thomas.

mleck28 commented 5 months ago

Hi, vielen Dank für Deine schnelle Rückmeldung. Ich habe das negative Vorzeichen von meiner alten Version nicht mit übernommen. Daran lag es. Jetzt habe ich das Problem das "car" nicht in Status 1 geht, wenn kein Auto angesteckt ist, stattdessen kommt eine "4". Das ist hinderlich :-(

Twiederh commented 5 months ago

Also ich habe das heute getestet, bis darauf, dass ich in meiner Logik in Nodered einen Fehler hatte, lief das Laden einwandfrei, es ist auch wohl nicht mehr so, dass am Anfang dreiphasig geladen wird, das Laden hat bei mir einphasig angefangen und wurde auf dreiphasig umgestellt. Ich muss noch an der Ladelogik arbeiten, sodass ich das Laden bei 80% stoppen kann aber das kann ich erst machen, wenn unsere Zoe wieder leergefahren ist :-)

mleck28 commented 5 months ago

Super. Bei mir klappt es nun eigentlich auch - es lag an dem Negativwert. Jetzt stehe ich vor dem Problem, dass ich 3 Wallboxen und zwei E-Autos habe. Ich ordne die Autos bisher den Wallboxen zu (Reihenfolge des Ansteckens). Nun muss ich aber eine Art Regler entwerfen, damit ich die Einspeisung/ Bezug für jede Wallbox bzw. dessen zugeordneten Autos berechnen und anpassen kann.

Twiederh commented 5 months ago

Ich ich habe zwei E-Autos, aber nur eine Go-E (aber auch noch zwei Tesla Wall Connector Gen 3). Ich habe mir für die GUI der Go-E in Nodered eine Dropdown-Liste gebaut, mit der ich einfach zwischen den beiden Autos (und einem Gastfahrzeug) umschalten kann. Damit beeinflusse ich die automatische Abschaltung bei einem bestimmten SoC, bei der Zoe soll abgeschaltet werden, beim Tesla nicht (der kann das intern). Das gleiche kann man dann natürlich auch auf die Ladeleistungen anwenden.

bruma59 commented 4 months ago

what are the parameters you're using for PV surplus charging Normally it has only to start when the minimum grid-feedin is reached, the fst value Its start in my go-e 56.2 beta when grid-feedin is lower than the pgt value (deltap becomes negative) when it's starts charging it keeps the power around the pgt value what's correct, the deltap value (positive) switches the charging off, but it kick back in with a grid-feedin value of pgt which is to low to do PV surplus, it has to wait for the fst value lmo=4; fup=true; grid value is send in pGrid within ids (pAkku:0 and pPv:0)

Twiederh commented 4 months ago

I do not work with the internal settings too much. I set pgt to -200 as recommended in the app itself, other than that I only send pPV, pGrid and pAkku. Since I have a home battery (Tesla Powerwall), I usually deduct 4600W from pGrid until my Powerwall reaches 90% to give it a priority, but this is configurable. Until the Powerwall is full I send pAkku with the value of 0.

bruma59 commented 4 months ago

I'm setting the parameters within the app, pgt -450, single fase, prefer feed-in, 3f switching 7kW whatever I enter as starting power level, charging starts when PV surplus reaches (feedin level) 450W pPV = 0 do I need to enter a value? I don't have a battery system

tennox commented 3 months ago

They can be written using ids/set in MQTT. You need to provide a json like this: { payload: { pPv: 6000, pGrid: -5000, pAkku: 0 } };

with MQTT the endpoint is GoEcharger/<serialnumber>/ids/set

I configured my go-e charger to be on mqtt topic go-eCharger, and receive go-eCharger/pgrid = null. When I do:

$ mosquitto_pub -h 192.168.178.147 -t go-eCharger/ids/set -m '{"pGrid": 1000, "pPv": 2000, "pAkku":0}'

I get a go-eCharger/ids/result = unknown api key: ids.

Also I tried:

What am I doing wrong? :cry:

Twiederh commented 3 months ago

This is how I am using Nodered to have it working:

I would try to leave everything as default, check, if a mosquitto client can read the values from the server the Go-E writes to and try to set the values with Nodered.

Also: this is proven to work, why do you start with sending the values and not getting the values for the grid first and then work on sending them to the Go-E-charger?

[ { "id": "36f44b74645e3f5d", "type": "tab", "label": "Flow 2", "disabled": false, "info": "", "env": [] }, { "id": "da25acd5294631b0", "type": "mqtt in", "z": "36f44b74645e3f5d", "name": "", "topic": "Powerwall/grid", "qos": "2", "datatype": "auto-detect", "broker": "31dc70c0d498e9bc", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 180, "y": 120, "wires": [ [ "d624a0cff94d5059" ] ] }, { "id": "d624a0cff94d5059", "type": "function", "z": "36f44b74645e3f5d", "name": "PPV an Go-E", "func": "var grid = msg.payload;\nvar battery = global.get('battery');\nvar home = global.get('home');\nvar solar = global.get('solar');\nvar backup = global.get('backup');\nvar pwminWatt = global.get('pwminWatt');\nvar pwminSoC = global.get('pwminSoC');\nvar goeMsg = { payload: { pPv:solar, pGrid: grid, pAkku: battery } };\nvar soc = global.get('real_soc' || 0);\n// Pseudoeinspeisung berechnen\nvar pseudogrid = battery + pwminWatt + grid;\n\n// wenn unter Mindestladung Powerwall\nif (soc < pwminSoC) {\n goeMsg.payload.pAkku = 0;\n goeMsg.payload.pGrid = pseudogrid;\n}\n// Wenn Mindestladung Powerwall erreicht\nelse {\n goeMsg.payload.pAkku = battery;\n // Go-E darf alles ziehen\n goeMsg.payload.pAkku = 0;\n goeMsg.payload.pGrid = grid + battery;\n}\n\n// wenn Strom aus der Powerwall gezogen wird\nif (battery > 0) {\n goeMsg.payload.pAkku = battery;\n}\n\n\nreturn goeMsg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 470, "y": 120, "wires": [ [ "f9ea8b774655dc0f" ] ] }, { "id": "f9ea8b774655dc0f", "type": "mqtt out", "z": "36f44b74645e3f5d", "name": "", "topic": "go-eCharger1234567/ids/set", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "31dc70c0d498e9bc", "x": 940, "y": 120, "wires": [] }, { "id": "31dc70c0d498e9bc", "type": "mqtt-broker", "name": "Mosquitto", "broker": "mosquitto.wiederhol.de", "port": "1883", "clientid": "Nodered", "autoConnect": true, "usetls": false, "protocolVersion": "4", "keepalive": "60", "cleansession": true, "autoUnsubscribe": true, "birthTopic": "", "birthQos": "0", "birthRetain": "false", "birthPayload": "", "birthMsg": {}, "closeTopic": "", "closeQos": "0", "closeRetain": "false", "closePayload": "", "closeMsg": {}, "willTopic": "", "willQos": "0", "willRetain": "false", "willPayload": "", "willMsg": {}, "userProps": "", "sessionExpiry": "" } ]

tennox commented 3 months ago

Turns out that I was on an old firmware - I did update, but apparently it only updated to an intermediate version and I needed to update again :thinking:

This works now:

mosquitto_pub -h 192.168.178.147 -t go-eCharger/ids/set -m '{"pGrid": 1000, "pPv": 2000, "pAkku":0}'

Interesting changelog entry I stumbled upon:

pgrid target for charging with PV surplus (api key "pgt")

needs to be investigated :thinking: