Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align grid measurements structure with pv and battery (BC) #18063

Merged
merged 7 commits into from
Jan 11, 2025

Conversation

andig
Copy link
Member

@andig andig commented Jan 5, 2025

Follow-up to #17943

Use identical structure for grid measurements, drop unused energy total.

Before:

"gridConfigured": true,
"gridPower": -300,
"gridPowers": [-100, -200, 0],
"gridEnergy": 10000,
"gridCurrents": [1,2,3],

After:

"gridConfigured": true,
"grid": {
  "power": -300,
  "powers": [-100, -200, 0],
  "energy": 10000,
  "currents": [1,2,3]
},

TODO

@andig andig added the infrastructure Basic functionality label Jan 5, 2025
@andig andig requested a review from naltatis January 5, 2025 12:30
@andig andig changed the title Align grid measurements structure with pv and battery Align grid measurements structure with pv and battery (BC) Jan 5, 2025
@marq24
Copy link
Contributor

marq24 commented Jan 10, 2025

first of all THANKS for the mention! - this helps a lot (to avoid trouble with the integration) - I am going to review the PR this evening and will provide feedback

@marq24
Copy link
Contributor

marq24 commented Jan 10, 2025

I have added now the following to the integration:
at startup it will be checked, if /api/state will include a grid object (if yes I do check additional, if the keys "pwer" & "currents" is present)...

if YES -> new Code: I will extract sensor data from ["grid"]["power"] & ["grid"]["currents"][0-2]

if NO -> old Code: I will extract sensor data from ["gridPower"] & ["gridCurrents"][0-2]

marq24 added a commit to marq24/ha-evcc that referenced this pull request Jan 11, 2025
marq24 added a commit to marq24/ha-evcc that referenced this pull request Jan 11, 2025
marq24 added a commit to marq24/ha-evcc that referenced this pull request Jan 11, 2025
marq24 added a commit to marq24/ha-evcc that referenced this pull request Jan 11, 2025
handling new grid object (supporting PR evcc-io/evcc#18063)
marq24 added a commit to marq24/ha-evcc that referenced this pull request Jan 11, 2025
handling new grid object (supporting PR evcc-io/evcc#18063)
@andig
Copy link
Member Author

andig commented Jan 11, 2025

@naltatis mqtt/influx sollten jetzt vorbereitet sein

@naltatis
Copy link
Member

@andig wir haben leider einen Fall übersehen. Es kann heute durchaus vorkommen, dass kein Grid-Meter konfiguriert ist, wir aber dennoch eine gridPower haben. Grund ist, dass wir die Gridpower bei fehlendem Meter aus Ladezustand oder Ladeleistung ableiten und auch veröffentlichen. Das ist in dem Anwendungsfall relevant wenn ich evcc bspw. nur mit dynamischen Strompreisen (ohne PV) einsetze.

Siehe:
https://github.com/evcc-io/evcc/blob/master/tests/smart-cost-only.spec.js
https://github.com/evcc-io/evcc/blob/master/tests/smart-cost-only.evcc.yaml

In der UI wird in diesem Fall [PV], [Min+PV] durch die option [Smart] ersetzt.

Daher würde ich vorschlagen die gridConfigured-Änderung zu reverten.

@naltatis
Copy link
Member

@andig ich hab den gridConfigured-Revert gerade gepusht. Wenn das für dich passt kann der PR rein.

@andig
Copy link
Member Author

andig commented Jan 11, 2025

Gut, dass Du dafür einen Test hast!

@andig andig merged commit 9dcb1fa into master Jan 11, 2025
6 checks passed
@andig andig deleted the feat/measurements-2 branch January 11, 2025 15:33
@StefanSchoof
Copy link
Contributor

@TheNinth7 Betrifft dieser Breaking Change deine Garmin App?

@TheNinth7
Copy link

@TheNinth7 Betrifft dieser Breaking Change deine Garmin App?

Ja, vielen Dank für den Hinweis. Werde auch eine Abfrage einbauen um die alte und die neue Struktur zu unterstützen. Ab welcher evcc Version wird die Änderung denn umgesetzt?

@StefanSchoof
Copy link
Contributor

Die aktuelle 0.132.1 hat das noch nicht. Also mit der Version nach der 0.132.1.

@TheNinth7
Copy link

TheNinth7 commented Jan 13, 2025

Noch eine Frage dazu:

Für Batterie und PV gibt es ja aggregierte Werte pvPower und batteryPower direkt unter result. Fürs Netz wird es aber den gridPower direkt unter result nicht mehr geben, sondern nur noch als "power" unter dem Element grid?

Also so schaut es jetzt aus:

{ "result": { "battery": [ { "power":956.3000000000001,"energy":1957.15122,"capacity":0,"soc":17.900000000000002,"controllable":true}], "batteryPower":956.3, "batterySoc":17.9, "gridPower":-1.6, "homePower":2305, "pv":[{"power":1350.3000000000002}], "pvPower":1350.3 } }

Und so wird es in Zukunft aussehen?

{ "result": { "battery": [ { "power":956.3000000000001,"energy":1957.15122,"capacity":0,"soc":17.900000000000002,"controllable":true}], "batteryPower":956.3, "batterySoc":17.9, "grid": { "power":-1.6 } "homePower":2305, "pv":[{"power":1350.3000000000002}], "pvPower":1350.3 } }

@naltatis
Copy link
Member

Ja, genau so ist das.

@TheNinth7
Copy link

Danke! Hab gerade die neue Version der Garmin-App online gestellt. Hab es mit einem Mockup getestet, hoffe es klappt dann auch mit der nächsten evcc-Version (das jq-Filtering kann ich mit einem Mockup nicht testen).

@Maddin2020
Copy link

Noch eine Frage dazu. Der Syntax für eine Pushnachricht scheint dann nicht mehr zu gehen. Muss ich den auch anpassen

Eigenverbrauch: {{round (divf .homePower 1000) 3 }} kW geht noch richtig

Netz-Leistung: {{round (divf .gridPower 1000) 3 }} kW
Solar-Leistung: {{round (divf .pvPower 1000) 3 }} kW funktionieren nicht mehr sondern es kommt immer nur 0 in die Anzeige
IMG_0838

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Basic functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants