Configure Door Sensor as Metering Pulse

Hi there,

I try to use an aqara door sensor to measure my gas consumption. Everytime “door opens” I have consumed 0,01m^3 of gas.

Now I want this to shown up in the energy tab, or be used in an riemann sum integration but I do not know how.

I tried it with an automation, add 0.01 to a input_number everytime the sensor is switched to open but then I only have the consumed gas value as a number, not usable in this rieman integration.

Does anyone have an idea how to convert this open events of the door sensor to be used as utitility meter readings?

Not need to through Riemann.

Untested:

template:
  - trigger:
    - platform: state
      entity_id: binary_sensor.thedoor
      to: "on"
    sensor:
    - name: "Gaz Output"
      state: '{{ states("sensor.gaz_output") | float + 0.01 }}'
      unit_of_measurement: "m³"
      device_class: gas
      state_class: total_increasing

Oh that looks really simple! Thanks! Will give it a try