Template Sensor: Gas Meter Consumption

Hello everybody,
can someone help me with the template sensor below?

The MQTT sensor always receives a pules
State: 814 Pules

  - platform: mqtt
    name: Gaszaehler_Verbrauch_pulse
    state_topic: "ESP_Easy/Pulse/Total"
    unit_of_measurement: "m3"
    icon: 'mdi:fire'

I would like to convert that now. According to this, one pule corresponds to exactly 0.01 m³.

Sensor:
  - platform: template
    sensors:
      cost_daily:
        friendly_name: Gas_Gesamtverbrauch
        unit_of_measurement: 'm³'
        value_template: "{{ (states('verbrauch_day_gas') | float * 0.01) | round(2) }}" 


utility_meter:
 verbrauch_day_gas:
    source: sensor.Gaszaehler_Verbrauch_pulse
    cycle: daily

Does anyone have any solution for? Unfortunately, I still don’t see through enough.

Thanks and best regards
Jan

That’s not your entity_id. Entity_id’s consist of a domain; sensor, light, switch, cover, etc and an object_id. You can find these entity_id’s in the dev tools states page or by clicking on the entity in the integration it was created in.

based on your name "name: Gaszaehler_Verbrauch_pulse" in your mqtt configuration and the assumption that this is a sensor, I would expect your entity_id to be: sensor.gaszaehler_verbrauch_pulse, not verbrauch_day_gas. Making your states method states('sensor.gaszaehler_verbrauch_pulse')

1 Like

Thank You!