Rogue Values in Solar Production

Hi All,
This has only been running a little over 24 hours & and seeing so teething isssues.
I’m getting some strange read readings on my Solar Production statistics,
Typically numbers that are a multiple of about 21,677.63 kWh.

That number or it’s multiple would be coming from either my template or the Integration of the values.
First, where it comes from.
I have a Hybrid Inverter in with Eastron Meters on both the Mains Supply Input and the Load Output.
Screenshot 2022-12-28 083903

The input meter’s total today reads 70,727.80 kWh
The output meter’s total reads 49,049.98 kWh
Subtracting them gives me a Net total of my all time Solar Production; as in the Number above.

This is my Template which did have an error in the availability that I have now maybe fixed.

  #Test Alternate Code
template:
  - sensor:
      - name: "Inverter_Production"
        unique_id: "inverter_net_prod_test"
        unit_of_measurement: "kWh"
        device_class: energy
        state_class: total_increasing
        state: >
          {{ states ('sensor.sdm220m_3_import_active_energy') | float(2) | round(2)
          - states ('sensor.sdm220m_2_import_active_energy') | float(2) | round(2)}}
        availability: >
          {{ states ('sensor.sdm220m_3_import_active_energy') | float(none) != none and
              states ('sensor.sdm220m_2_import_active_energy') | float(none) != none }}

The error I changed, was paste related in the availability & this:-

        availability: >
          {{ states ('sensor.sdm220m_3_power') | float(none) != none and
              states ('sensor.sdm220m_2_power') | float(none) != none }}

Am yet to prove that it is fixed; needs to run overnight for that to prove it’s self.

The other thing that I want to question is the state.class: total_increasing
While fundamentaly I know this is considered correct, does the integration take into account that my “Increasing Total” can actually Decrease during certain periods?

This situation exists for one specific reason; the inverter consumes a bit around 60 to 75W to maintain it’s self. So in the dead of the night, a neat 1000W load would require an input of say 1075W.
So for say 12 hours of zero PV panel input, the Net production from the template would reduce by 0.9kWh.

Would this be a problem with the coding behind the Energy page that does the Integration of the values?
On one had I can see that it might not be, as there’s still an area under the curve, but my maths is getting a bit rusty on this.

Any thoughts?

A better availability template:

        availability: >
          {{ states ('sensor.sdm220m_3_import_active_energy') | is_number and
              states ('sensor.sdm220m_2_import_active_energy') | is_number }}

What about energy from the battery (supplied to the load), that may have been charged by the grid?

Thanks for the Template suggestion.
Will try it in the morning.
The change I made today did not get applied as I got distractions before I rebooted.
(Suspect I can reload the templates in configuration.yaml without rebooting).

I’m ignoring that at the moment, as battery storage is secondary.
Essentially I have 32 12V 20ah Panasonic SLAs, paralleled in 8 banks @ 48V.
The batteries have all served a couple of years in 3kVA UPS’s before being repurposed into my Hybrid Inverter.

Basic Configuration is like this:

Inverter belongs to the Apex/Voltronic/MPP Solar Family & down the track I will monitor it via EspHome with probably this… PipSolar PV Inverter — ESPHome if it’s compatible.

Inverter is an MPP Solar Hybrid… MPP Solar Inc » MPI Hybrid Series

Just for the Record & benefit of other Newbies like me, it seems that the fact that my Total DECREASES overnight is not an issue.
I tend to consider it a positive actually as it’s indicating that my system has a “Cost” when running overnight without Solar input.

That can be seen clearly here:-