Can't add water meter to energy dashboard

Hi

I have a simple GPIO pin (it’s a NPN sensor reading every 1L from my analog water meter) that’s going on and off each 1L. Everytime this sensor goes on, it adds 1L to my counter.watermeter in HASS, the third entity in the picture.

It looks like this:
image

The second entity is called sensor.water_meter_total, this is a template sensor derived from counter.watermeter:

  - platform: template
    sensors:
      water_meter_total:
        friendly_name: "Water meter consumption"
        unique_id: "sensor.water_meter_total_m³"
        value_template: >
          {{ states('counter.watermeter') |float * 0.001 }}
        unit_of_measurement: m³

I’m not able to add this sensor to my energy dashboard to track my water usage (since the november 2022.11 update). This has something to do with the statistics, but how do I fix this please?

Need to add attributes to your sensor.

Check my post: Water Meter in Energy Dashboard Not Available - #3 by mirecekd

1 Like

That was the solution indeed! It seems that I was using the legacy template integration.

This one is working correct:

template:
  - sensor:
      - name: "water_meter_total"
        unique_id: "sensor.water_meter_total_m³"
        state: >
          {{ states('counter.watermeter') |float * 0.001 }}
        unit_of_measurement: m³
        device_class: water
        state_class: total_increasing

Tnx!