muppet3000 / homeassistant-grott

Home Assistant Integration for Grott - MQTT
MIT License
73 stars 17 forks source link

Displays EPVTotal, and not PVEnergyTotal #8

Closed mriksman closed 1 year ago

mriksman commented 1 year ago

Hi,

epvtotal, epv1today, epv1total, epv2today and epv2total is the power generated on the DC (or PV) side. pvenergytoday and pvenergytotal is on the AC side.

-  pvenergytoday        :  17.8
-  pvenergytotal        :  104.9
-  epvtotal             :  106.5
-  epv1today            :  9.9
-  epv1total            :  56.0
-  epv2today            :  8.1
-  epv2total            :  50.5

The difference between DC and AC will be the inverter efficiency (98% based on the epvtotal and pvenergytotal.

In Home Assistant, the value for pvenergytotal is missing. Instead, it is displaying epvtotal. When determining how much Solar was produced and consumed, you need to use the AC converted energy pvenergytotal.

Are you able to add pvenergytotal to Home Assistant?

image

hajkenek commented 1 year ago

I opened the same issue (didn't saw yours). The same problem in my grott instance. I have pvenergytotal and it is not equal to epvtotal and pvenergytoday is equal to self-consumption (strange name) So we need to wait for op.

If you want to add them manually for now, check last screenshot on my issue #11 You need to add this in mqtt section in configuration.yaml

PS. I'm using unique_id and name for posibility to change entitiy data through lovelace and state_class to store data in long term statistic so you can add sensor without them.

mqtt:
  sensor:
  - name: xxx_energy_today
    unique_id: xxx_energy_today
    state_topic: energy/growatt
    value_template: "{{ value_json['values']['pvenergytoday'] | int / 10  }}"
    state_class: measurement
    unit_of_measurement: "kWh"
    icon: mdi:solar-power
muppet3000 commented 1 year ago

Hi Both,

Thank you for your contributions to this ticket. Sorry for the delayed response, I've been on holiday.

@hajkenek - Are you happy for me to close #11 as a duplicate of this one?

@mriksman - Thank you for your explanation of the difference between the AC and DC conversion, that explains the difficulties I was having when I was performing all of the mappings into Home Assistant!!!

Am I correct in saying that what is missing is pvenergytotal and that is the same as pvenergytoday but it's the all-time total instead of just today's total?

I will map it to Self-Consumption (Solar + Battery) Energy - Total (pvenergytotal). To explain the Self-Consumption name: This is because this value is what your house consumes from the PV & Battery output during the day, it isn't the total PV generation + Battery usage because it excludes any PV energy that is exported to the grid. Therefore it is the energy that you have generated/stored that you have then consumed.

The difference between the sums is as @mriksman has explained - one is the values in AC, the other is in DC. I should update these names to reflect this in the future, do you agree they should change as follows:

muppet3000 commented 1 year ago

This functionality is now available on the main branch for testing (you can select this in the re-download menu in HACS)

mriksman commented 1 year ago

@muppet3000 - I don't have battery, so I can't comment; but what makes you think this is 'consumed' and includes battery? These values feel like they are just related to the power generation on the input side (from the PV) and on the output side (the AC side - what you actually get)

Looking at the web GUI vs the values in Grott/HA image image I can't find any reference to epvtotal on the web GUI.

Looking at the API document (https://growatt.pl/wp-content/uploads/2020/01/Growatt-Server-Open-API-protocol-standards.pdf), I would imagine powerTotal is the power generated after the inverter (the AC side). epvTotal would be the power generated on the DC side (the PV solar array). I don't think epvtotal is important, unless you want to calculate the efficiency.

My option would be to label them simply as Total Power Generation (Input PV) - epvtotal (I don't think there is an epvtoday?) Total Power Generation - pvenergytotal (according to the API this is powertotal) Today Power Generation - pvenergytoday (according to the API this is powertoday)

muppet3000 commented 1 year ago

Hi @mriksman - Sorry, I missed this last week, I'll read through and confirm the values as you've suggested.

Can you at least confirm for me that the new values I added are displaying correctly (if you ignore the names)?

mriksman commented 1 year ago

Yes; values are good.

muppet3000 commented 1 year ago

Awesome, that's a good start.

I'll take a more detailed look at the naming at some point this week.

muppet3000 commented 1 year ago

I've been looking at this this evening and I agree that I've completely messed up the naming here.

What's odd is that my epvtotal which is the AC value is higher than my eactotal:

- epvtotal: 13183.7
- eactotal: 16598.1

- pvenergytoday: 30.9
- eactoday: 30.9

- epvall (calculated): 30.4 - This is what I see on the WebUI under 'Solar' for today

- pvenergytotal: <not available on my system>

Based on your suggestions they should be labelled as follows: epvtotal - PV Generated Energy (DC) - Total eactotal - PV Generated Energy (AC) - Total pvenergytoday - PV Generated Energy (DC) - Today eactoday - PV Generated Energy (AC) - Today

epvall (calculated) - PV-All Energy - Total (Calculated) pvenergytotal - PV Generated Energy (DC) - Total - Is this the same as the epvtotal value?

What do you think? What I can't explain is why my values are the opposite way around to what they should be i.e. AC and DC seem to be the opposite way around.....

mriksman commented 1 year ago

What model have you got? Battery? In the grott logs, I show

     - Grott data record length 585
     - layout   :  T060104X
     - no matching record layout found, try generic
     - Record layout used :  T06NNNNX

https://github.com/johanmeijer/grott/blob/60b802ecdac130c07730cff7da3bcd50ef4be61c/grottconf.py#L753 What is yours?

There is also an interesting Excel sheet here, but only seems to relate to SPH. https://github.com/johanmeijer/grott/blob/master/examples/Documentation/Growatt%20Layout%20definitions%20.xlsx Notice Item 53 is Eactoday_H which he has both eactoday and pvenergytoday listed. Confirmed they are the same address - https://github.com/johanmeijer/grott/blob/60b802ecdac130c07730cff7da3bcd50ef4be61c/grottconf.py#L821

Perhaps just leave the naming generic - as it come from grott? Let the user decide what and how the values are.

Total Power Generation - epvtotal
Today Power Generation - epvall
Total Power Generation - pvenergytotal
Today Power Generation - pvenergytoday
Total Power Generation - eactotal
Today Power Generation - eactoday
muppet3000 commented 1 year ago

Hi @mriksman - sorry I haven't come back to this for a while, I've been really busy with non-computer things while the weather has been so nice here in the UK. I'm picking this one up now. I think you've made a really good suggestion with the naming, that way people can go through them on their own and make a decision. I have been through all of the links you mentioned and as you say - it's all correct, it's just unclear what those values are used for, so best to just stick with the names as you suggested.

muppet3000 commented 1 year ago

Pushed this change to main now, it will be 'official' in the next release, but if you want to test before then it's good to go.

mriksman commented 1 year ago

How can I get HA to update its labels..?

muppet3000 commented 1 year ago

You need to go into HACS for the integration and then click "redownload" and then choose 'main' from the dropdown.

mriksman commented 1 year ago

Yes, I have the latest image And I have the new SDM Smart Meter values (issue #7)

But some of labels are still the old labels? image

muppet3000 commented 1 year ago

Ahhhh, I didn't change the PV ones as I thought they were correct, these are the ones that I changed: https://github.com/muppet3000/homeassistant-grott/commit/07473c9ee95d7b716dc04f5a2e45da73b323df1d

Can you confirm that those ones have changed as expected?

mriksman commented 1 year ago

I'm not sure I understand. My screenshot shows that only one has changed pvenergytotal. The other two should be Power Generation - Today (pvenergytoday) and Power Generation - Total (epvtotal)

muppet3000 commented 1 year ago

Did you rename them yourself in HA at some point? Some of those names are different to what it has ever been in the code - did you add something like the values in brackets to some of the existing labels? That will have over-written the value from the Integration and taken precedence.

The ones from your screen grab that have not changed are:

The one called "PV-All Energy - Today (pvenergytoday)" used to be called "Self-Consumption (Solar + Battery) Energy - Today (pvenergytoday)" and it looks like you may have renamed it.

muppet3000 commented 1 year ago

If you click on the stat and then click the settings icon, you can change the name of the stat e.g.: image

image

If there's a value in the 'name' field then you can just delete it and hit 'update' and it'll revert back to the default name.

mriksman commented 1 year ago

Yup image All good for me now, thanks.

muppet3000 commented 1 year ago

Thank goodness for that, I was really worried it was some really obscure bug in the integration.

Are we in agreement that the names are now as they should be so I could close this in the next release?

mriksman commented 1 year ago

I'm happy with what I've got for the names.

muppet3000 commented 1 year ago

Released in v1.1.0