Energy dashboard shows high solar production

Since a fe weeks I get a strange behaviour of my solar production data.
I have 4kWh solar panels on my roof and a Solax converter. I can obtain my data using an API from the Solax portal. The daily increase in solar energy is sent to the energy dashboard. using the following config:

- platform: rest
  scan_interval: 90
  resource: https://www.solaxcloud.com:9443/proxy/api/getRealtimeInfo.do?tokenId=000000000000&sn=xxxxxxxxx
  name: "Solax"
  json_attributes_path: "$.result"
  json_attributes:
    - yieldtoday
    - yieldtotal
    - acpower
    - uploadTime
    - inverterStatus
  value_template: >
        {% set ignore = ['unknown', 'unavailable'] %}
        {{ trigger.from_state.state not in ignore and
           trigger.to_state.state not in ignore and
           trigger.to_state.state != trigger.from_state.state }}
  
- platform: template
  sensors:
    solax_today:
      friendly_name: "Solax today"
      value_template: "{{ state_attr('sensor.solax', 'yieldtoday') }}"
      unit_of_measurement: "KWh"

sensor:
  - name: dashboard_energy
    state: "{{ states('sensor.solax_today')|float(0) }}" 
    unit_of_measurement: 'kWh'
    state_class: total_increasing
    device_class: energy
    attributes:         
      last_reset: '1970-01-01T00:00:00+00:00'

But the results are swown here:

When I look at the data from the Solax portal I see this the graph with small interruptions.The logbook shows some errors in the status at that moment.

So when there was a misreading from the Solax portal this shows in the dasboard Energy going to 0 and then doubling the value when e new ready is coming in (because it went from 0 to the correct value).

How can I correct this?

If the sensor.solax_today is unavailable, you set the template with state_class total increasing to 0. That means it will think you reset the meter, and the next real value is considered all new production, not an increase of the previous total before 0.

To prevent that add an availability template to it

    available: "{{ is_number(states('sensor.solax_today')) }}"

To correct it, go to the developer tools, statistics, look up the sensor and use the icon to the right to find and correct the high value (just put 0 there).

Hi Edwin,

Thanks for your reply.
I gat a warning though: Invalid config for ‘template’ from integration ‘sensor’ at sensors.yaml, line 24: ‘available’ is an invalid option for ‘sensor.template’, check: sensors->solax_today->available

- platform: template
  sensors:
    solax_today:
      friendly_name: "Solax today"
      value_template: "{{ state_attr('sensor.solax', 'yieldtoday') }}"
      unit_of_measurement: "KWh"
      available: "{{ is_number(states('sensor.solax_today')) }}"

Hi Edwin,

Sorry misread your comment. Added the line to the Dashboard Energy sensor. Let’s check if today is any better.

It could also be the other template has the same problem with state_attr(‘sensor.solax’, ‘yieldtoday’). It does not use the float(0) filter so I think that might be ok. I think it must be called availability or availability_template there though. I can never remember.