kellerza / sunsynk

Deye/Sunsynk Inverter Python library and Home Assistant OS Addon
https://kellerza.github.io/sunsynk/
MIT License
229 stars 95 forks source link

Total Grid Import: Does not match with actual grid import #140

Open kloon opened 1 year ago

kloon commented 1 year ago

You Inverter

Details about your Inverter: Sunsynk 8KW Single Phase - Firmware COMM:E426 MCU:6022-1724

Describe the issue/bug and what you expect

The total grid import sensor does not seem accurate. As per #134 I think this again comes down to the mode the inverter is set in.

Things I am noticing:

I can see according to the sensor this data is retrieved directly from modbus registers 78 and 80 on the inverter and can confirm that the sunsynk app also does not align correctly with actual grid import so I guess this is one of those issues around should it be fixed in the addon or not. I have also read on social media about people complaining about the numbers on the synsynk app does not match that of actual readings on accounts and it varies quite a bit.

I have not had time to go through a more detailed look at the modbus document to see if there are registers one can combine to get to the right numbers so would like to hear anyone else's findings on this.

kloon commented 1 year ago

To test this theory, I have gone ahead and set up a Riennman Sum Integral sensor on the CT grid sensor value, and then setup a Utility meter sensor on the Riennman Sum Integral sensor so it resets every day.

Will see how it goes over the next couple of days and report back with my findings.

kellerza commented 1 year ago

To test this theory, I have gone ahead and set up a Riennman Sum Integral sensor on the CT grid sensor value, and then setup a Utility meter sensor on the Riennman Sum Integral sensor so it resets every day.

Will see how it goes over the next couple of days and report back with my findings.

If you do such type of post processing you should keep in mind that grid_ct_power by itself will have filters (avergae/step) applied, so you probably need to use grid_ct_power:now which will report it every 2 seconds

In the end the CT sensor is not 100% accurate, but the total_grid_import - total_gird_export is probably more accurate

It might even be total_grid_import + total_gird_export if you try to compare it to your municipal utility meter

kloon commented 1 year ago

The problem with total_grid_import is that it does not keep track of non-essential energy usage if the inverter is in limit to load mode.

My geyser for example has a separate energy sensor and I can see when I switch the geyser on during evenings or early mornings that energy is missing from my grid total, I have monitored the CT sensor to confirm that 3kwh gets imported while the geyser runs, but on the energy dashboard that is all missing from the totals being reported and in the graphs.

kellerza commented 1 year ago

I've never thought of that, but now that you mention it, I am probably seeing something similar.

During the evenings I switch to "limit to load" so that I do not drain my batteries with the geyser. But I have also been seeing a mismatch between my reported energy use and my prepaid meter. This would explain it.

It would not be easy to fix. You could:

  1. try an integral on the grid_ct_sensor as you suggested.
  2. sum the total_grid_import with the total_non_ess (external meter), but you will have to account for the inverter program, since you should not sum these during zero export/export to grid
kloon commented 1 year ago

So the custom sensors have been running for a day now and so far they match up with my actual grid usage fairly accurately. I will give it another couple of days to be 100% sure and then switch it out in my energy dashboard.

It would obviously be great if there was a new sensor integrated into the sunsynk integration that once can just reference, but at least I think the custom sensors route is a workaround.

Might even send off an email to Sunsynk about this and hear what they say.

kellerza commented 1 year ago

How is your sensors working out? Do you mind posting the config here, or even adding it to the examples in the docs?

kloon commented 1 year ago

According to my calculations, the custom sensor is working as it should and reporting correctly. I am just waiting for my next monthly bill to confirm 100% that things align. I'd be happy to share the sensor config, which way you prefer.

I have emailed some people in Sunsynk about this and also opened a ticket, but yet to receive any response.

ga-it commented 1 year ago

Same issue here with exporting and the "Total Grid Import" value. When mode was "Zero Export" then sum value was correct and included non-essentials and reflected correctly on sunsynk.net. After enabling export, non-essential KWH were not included in the grid import nor consumption figures. The instantaneous read sensor "Non-Essential power" (KW) does pick up the geyser, etc but cannot be used to feed the energy dashboard which wants a cumulative measure. If this sensor was available as a sum, then you could correct the grid import value.

kellerza commented 1 year ago

It’s unfortunate that these sensors change when you change the export mode.

The addon does not keep any state. And this is not something I plan on adding soon. To calculate the energy, you will have to keep state

@kloon solution of doing this in HASS is probably your best option today

kloon commented 1 year ago

The workaround is to set up a new helper sensor using Riemann Sum https://www.home-assistant.io/docs/energy/faq/#creating-an-energy-sensor-out-of-a-power-sensor that is based on your CT power sensor.

So using the addon, expose Grid CT power sensor, then create a new Helper under Settings -> Devices & Services -> Helpers in homeassistant, and follow the guide as per above link on setting up a Riemann Sum sensor based on the Grid CT power` sensor.

It does take a day or two for the new sensor to start working reliably and reset at the start of the day. What I did at first was to add the new sensor to the Energy Dashboard as an individual device, you can also add the SS Total Grid Import sensor to compare the two.

kloon commented 1 year ago

I finally got a reply from Sunsynk on this issue after 3 weeks, no surprise it was a generic one saying to update to the latest firmware, which I did, yet the issue is still present.

kellerza commented 1 year ago

Adding a wontfix label as this is the Inverter's bahaviour, but will keep the issue open for reference