Which data to link to Solar panel energy dashboard

Hey all.

Recently got started with home assistant and been struggling a bit with the energy dashboard. So for the only metrics I have in Home Assistant is solar panel data, which comes from the solax cloud api.

This data is fine and works correctly. I have three main values:

  • Production today, untill now
  • Production since forever
  • Current W production

I have this in my configuration

- sensor:
    - name: PV yield (Now2)
      state: "{{ states('sensor.solax_now') | float }}"
      unit_of_measurement: "Wh"
      state_class: total_increasing
      device_class: energy
      attributes:
        last_reset: "1970-01-01T00:00:00+00:00"
- sensor:
    - name: PV yield (Today)
      state: "{{ states('sensor.solax_today') | float }}"
      unit_of_measurement: "kWh"
      state_class: total_increasing
      device_class: energy
      attributes:
        last_reset: "1970-01-01T00:00:00+00:00"
- sensor:
    - name: PV yield (Total)
      state: "{{ states('sensor.solax_total') | float }}"
      unit_of_measurement: "kWh"
      state_class: total_increasing
      device_class: energy
      attributes:
        last_reset: "1970-01-01T00:00:00+00:00"

I’ve added all three of these fields into the energy dashboard, just so I could later remove the faulty ones and leave the correct one.

The problem I have is that it does not seem to realise Total and Today consumption are delta values. it just keeps on increasing them, leaving me with something like this:


I don’t even understand how it even reaches those values :-). My actual generation up to now was actually (only) 4.9 kWh

So what needs to change where in order to get the correct values in there?

Found the issue here.

My metrics were correct. The problem was that I was querying the Solax REST API way too often, resulting in 0 values being returned. As soon as the statistics has a 0 value, and next time the real value again, it will add it up to the already existing total, skewing the stats.

I changed my polling frequency and changed my config like this:

solax_total:
      friendly_name: "PV total"
      unit_of_measurement: "kWh"
      value_template: >
        {% if value == "0" %}{{ states.sensor.solax_garage_total.state | float }}
        {% else %}{{ (states('sensor.solax_garage_total') | float) }}{% endif %}