Reed sensor in gasmeter - wrong consumption

Hey guys,

lately I started using HA and tried some integrations/projects.

I stumbled upon a project that lets you read the impulses from an “non-smart” gas meter via a reed contact and an ESP

This is the link I used (it’s in german)

So anyway… I installed everything on my gas counter.
The code on the ESP is the following

  - platform: pulse_counter
      number: GPIO5
      mode: INPUT_PULLUP
    name: “Gasverbrauch”
    update_interval : 60s
      - lambda: |-
          static float total_value = 0.0;
          total_value += x * 0.01;
          return total_value;
      - debounce: 1.5s
    unit_of_measurement: “m³”
    accuracy_decimals: 2
    device_class: gas
    state_class: total_increasing
    icon: ‘mdi:fire’  

Unfortunately the values I receive are waaaay off


Made a photo of the meter at round about 0:00 and just a minute ago.
The usage on the meter states 1.9 m3 gas
Homeassistant tells me 6.7m3

Any ideas on how to fix this ?

Format your code correctly.
I use a binary sensor in esp and a counter in HA in cooperation with a utility meter to measure gas.


should be fixed now, ty for the link