Annoying Energy Meter Drop

Annoying problem. Anyone who knows a way to fix (ignore) this.
Sometimes the shelly returns 0, and the HA energy starts messuring from zero again. My code is as follows. Any good ideas. ?

- sensor:
  - name: "120 - Energy Total"
    unique_id: 120_energy_total
    state: >-
      {{
        [ states('sensor.shelly_shem_3_3494547481ea_1_total_consumption'),
          states('sensor.shelly_shem_3_3494547481ea_2_total_consumption'),
          states('sensor.shelly_shem_3_3494547481ea_3_total_consumption'),
        ] | map('float') | sum
      }}
    availability: >-
      {{
        [ states('sensor.shelly_shem_3_3494547481ea_1_total_consumption'),
          states('sensor.shelly_shem_3_3494547481ea_2_total_consumption'),
          states('sensor.shelly_shem_3_3494547481ea_3_total_consumption'),
        ] | map('float') | sum >= 0
      }}
    unit_of_measurement: kWh
    device_class: energy
    state_class: total_increasing