Solax Inverter Energy Total starts counting from zero after passing value 65535 (16 bit limit)

My “Solax Energy Total” value has surpassed the 65535 (6553.5 kWh) limit and startet counting from zero. I have it setup to read the solax json file locally as a rest sensor.
I think that some value in the json has changed to “1” as a counter of how many times the “Solax Energy Total” values has surpassed its limit.

  1. Does anyone have a solution for this problem and would be so kind to share the code?
  2. Does anyone know which datafield includes the counter?

Here is my dumb solution:

      - name: "Solax Energy Total"
        unit_of_measurement: "kWh"
        state: "{{ state_attr('sensor.solax_rest_local', 'Data')[22] / 10 + 6553.5}}" #or 68
        availability: "{{ state_attr('sensor.solax_rest_local', 'Data')[22] > 1 }}"
        device_class: energy
        state_class: total_increasing
        icon: mdi:chart-line

Inverter: Solax X3 MIC G2 with 10 kWp
I will post my complete code after resolving this issue.

You want (“some value in the json” * 65535.0) + “Solax Energy Total”

That’s about as specific as we can be with the information you provide.