Gasverbrauchszähler, Tagessumme wird um 0 Uhr wieder abgezogen

Hallo Zusammen,

in Grafana sehe ich seit kurzem, dass der Gasverbrauch jeden Tag um 0 Uhr exakt als Minuswert in die Datenbank geschrieben wird. Ist das erforderlich oder kann das weg? Ich finde nicht die Stelle wo man das einstellen kann. Oder kann man die negativen Werte in Grafana einfach ausblenden?

grafik

Den Gaszähler lese ich mit ESPHome und einem passenden Readkontakt aus:

esphome:
  name: gaszaehler

esp8266:
  board: esp01_1m
  restore_from_flash: true  # Total Counter im Flash speichern

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "sssssssssssssssssssssssssssss"

ota:
  password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

wifi:
  ssid: "rrrrrrrrrrrrrrrrrrrrrr"
  password: "wwwwwwwwwwwwwwwww"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Gaszaehler Fallback Hotspot"
    password: "6dddddddddddd"

captive_portal:

#globals:
#  - id: total_pulses
#    type: int
#    restore_value: yes  # Total Counter im Flash speichern
#    initial_value: '634144.0'  # hier kann der Gaszählerstand initialisiert werden

globals:
  - id: total_pulses
    type: int
    restore_value: yes  # Total Counter im Flash speichern
    initial_value: '0'  # startet mit 0
  - id: imp_ratio
    type: float
    restore_value: false
    initial_value: '0.01'  # vom Gaszaehler
  - id: Zustandszahl
    type: float
    restore_value: false
    initial_value: '0.9655'  # aus der Gasrechnung 14.6.2022
  - id: Brennwert
    type: float
    restore_value: false
    initial_value: '10.361'  # aus der Gasrechnung 14.6.2022
  - id: initial_consumption
    type: float
    restore_value: false
    initial_value: '634153.70'  # hier kann der Gaszählerstand initialisiert werden
  - id: initial_energy_consumption
    type: float
    restore_value: false
    initial_value: id(initial_consumption) * id(Brennwert) * id(Zustandszahl) / 1000.0
    
binary_sensor:
  - platform: gpio
    id: internal_pulse_counter
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
    name: "Live-Impuls"
    filters:
      - delayed_on: 10ms
    on_press:
      then:
        - lambda: id(total_pulses) += 1;

sensor:
  - platform: template
    name: "Gaszaehler"
    device_class: gas
    update_interval : 10s
    unit_of_measurement: "m³"
    state_class: "total_increasing"
    icon: "mdi:fire"
    accuracy_decimals: 2
    lambda: |-
      return id(total_pulses) * 0.01; 
  
  - platform: template
    name: 'Gasverbrauch Energy'
    device_class: energy
    state_class: total_increasing
    update_interval : 10s    
    icon: 'mdi:fire'
    accuracy_decimals: 1
    unit_of_measurement: "kWh"
    lambda: return id(initial_energy_consumption) + (id(total_pulses) * id(imp_ratio) * id(Brennwert) * id(Zustandszahl));

  - platform: template
    name: 'Gasverbrauch Kosten'
    device_class: monetary
    state_class: total_increasing
    update_interval : 10s    
    icon: 'mdi:monetary'
    accuracy_decimals: 1
    unit_of_measurement: "€"
    lambda: return id(initial_energy_consumption) + (id(total_pulses) * id(imp_ratio) * id(Brennwert) * id(Zustandszahl)*0,462);

Vielen Dank für einen kurzen Hinweis.
georgy_boy