Really not understanding how to measure my export power (Utility Meter integration)

I have a GoodWe solar panel system (plus batteries) that will export excess power back to the grid. I am also using the standard GoodWe integration to get the raw data.
One of the sensors is the ‘instantaneous’ power either imported from or exported to the grid. (The difference is in the sign of the value). From this I have derived 2 sensors that show the power (Watts) imported or exported. These both seem to be showing reasonable values for a given situation.
Note that all these sensors update about every ~10 seconds (which is why I put the ‘instantaneous’ in inverted commas).
I want to monitor the energy (kWh preferably but Wh is fine) that I am exporting.
I think the Utility Meter is what I need (cycle is daily) but I seem to be getting crazy results.
I am also having trouble determining if I need the ‘delta_values’ to be set or not, but both give figures that are way off. (I thought that it should be set to ‘false’ as each sample is not the difference from the previous one but that does not seem to align with the description for this setting in the documentation.)
Anyway, so far today the ‘utility meter’ says that I’ve exported 1.9MW from my panels (that can generate 5kW at any point in time)! (I wish - that would really help the bank balance!!!)
(BTW I’ve also tried using the Riemann Sum integration but that can’t be reset and also gives values that are way too high as well.)
How is the utility meter supposed to be set up for my situation?
I suspect that a 10-second sampling is too high for some built-in assumption about the rate of the samples, but how else should I transform the sensor data from the GoodWe into something to feed the utility meter?
Susan

The utility meter does not convert power to energy. It only counts energy for a defined “cycle” then resets, so you can make hourly/daily/monthly totals from an always increasing energy sensor.

What you want is the Riemann Sum integration. This converts power to energy. Use the “left” method.

To be clear, you are saying that I have my ‘instantaneous’ sensor that feeds a Riemann Sum sensor that feeds the Utility Meter sensor - correct?
Susan

You don’t need the utility meter if using the HA energy dashboard.

Except that the HA energy Dashboard showed silly values:


Taken just now.
The Grid shows the same amount going to and from the grid. The solar and battery are showing the same amount going out and into the house which us way over what the house actually used.
I couldn’t find anywhere that documents how the change readings.
Also (for example) the PV generated 29.9kWh until now today, not 27.5kWh
Susan

I have a goodwe system (Brisbane). The 10 second refresh is fine. What sensors do you see from the Goodwe?
What sensors have you added in the Energy dashboard’s configuration to which section (grid, solar, batteries)?
As @tom_l has said, if you are using the HA Energy dashboard it does most of the work for you.

It’s evening for me, and I currently see this in the Goodwe integration details:
image

So I’m importing (Active Power, -ve) 2,305W from the grid to cover my current use of 2,305W (House Consumption). PV Power is 0W, and goes positive when generating.

In dashboard config (I think I may have renamed a couple of these, but the sensor names are original I think):
Solar:
image

Grid in:
image

Grid out:
image

Battery I don’t have, but I think you would use:
image
…and discharge for the other one.

(BTW I’m in Melbourne)

That’s just it - how to do edit this dashboard?
On the ‘Overview’ dashboard there are the 3 little dots that let you “Edit Dashboard” but there are no such buttons on the Energy dashboard.
Anyway - the sequence of sensors etc. I mention above is working nicely. (Of course it took a day to get sensible readings - the first day was only reading from after I edited it.)
Susan

1 Like

Settings → Dashboards → Energy

Ah - I was doing that but clicking the ‘Open’ button (on the right) and not the entry itself.
(Where is that head-banging on brick wall emoji!)
Susan

1 Like

OK - I think this is still relevant enough to continue in this thread…

When I try to add the sensors to the Energy dashboard, it says that the sensors do not have the expected device class.

I tried to add “device_class: energy” to the sensor definition:

  • platform: integration
    source: sensor.grid_import
    name: grid_energy_import
    unit_prefix: k
    unit_time: h
    round: 2
    method: left

I get an error that ‘device_class’ is not allowed. Moving back a sensor (as it were) I can use:

  grid_export:
    unique_id: "grid_export"
    friendly_name: "Grid Export"
    unit_of_measurement: "W"
    device_class: energy
    value_template: >-
        {% if states('sensor.on_grid_mode') == 'Exporting' %}
            {{ states('sensor.on_grid_export_power') | int }}
        {% else %}
            0
        {% endif %}

but this still leaves the error in the Energy Dashboard editor.

What am I doing wrong?
Susan

You have the wrong device class. That should be device_class: power for a power sensor.

Your Riemann Sum sensor should then be able to create the required device and state classes when it converts this power to energy.

After fixing this you may have to go to the Developer Tools → Statistics page and fix any historical values that have the wrong device classes by pressing all the “FIX ISSUE” buttons.