How to configure sensor to make it show up in Energy Dashboard as Water Source

Hi,

I had created an input_number to track my warm and cold water utility meter. I then create a template sensor that reads the input_number and calculates into the right unit.

My excerpt from sensors.yaml:

# Wasserverbrauch
- platform: template
  sensors:
    kaltwasser_verbrauch:
      friendly_name: Kaltwasser-Verbrauch
      value_template: "{{ states('input_number.kaltwasserstand') | float / 1000.0 }}"
      device_class: volume
      unit_of_measurement: 'm³'
      unique_id: bba96c8e-0c68-4685-a926-83f9dcef7ccf
    warmwasser_verbrauch:
      friendly_name: Warmwasser-Verbrauch
      value_template: "{{ states('input_number.warmwasserstand') | float / 1000.0 }}"
      device_class: volume
      unit_of_measurement: 'm³'
      unique_id: 982eebdf-8030-48ba-880b-e7978b539663

But these do not show up in the dropdown list of the Energy Dashboard Water Source configuration field. What is wrong?

I also tried device_class: water, but also did not work.

Thanks for help,
Kind regards

I have the same problem. I have been tracking water consumption for a while now, using a sensor which has unit_of_measurement: ‘m3’ and state_class: total_increasing, but it does not show up in the drop down list of the energy dashboard configuration.

edit: Well, I fixed my issue, not sure if yours is related, but apparently I was still stuck on esphome 2022.3.X. The repo changed since 2022.4.0 and I wasn’t aware or alerted. After removing the old integration and installing the new I was updated to Esphome 2022.10.2 and I was able to set device_class to water and was able to add it to the energy dashboard.

Yeah same goes for me. When I use device_class: water, it will trow an error either in the editor or when compiling:
“Unknown value ‘water’, did you mean ‘battery’, ‘power’?.”

In other examples it seems that it should be able to take that value for it to become available in the Energy Dash. Any help is appreciated. I can also post the config yaml if requested.

Cheers

I have the same issue. Where exactly the you declare the device_class: water ? In your config.yaml?

Only just saw your comment. The device_class is specified in the sensor code on the esp device. So you edit it in esphome part of home assistant where you compile it to the device.

I followed this tutorial: Build a cheap water usage sensor using ESPhome and a proximity sensor - PieterBrinkman.com

And you can add the device_class in one of the sensors, like pulse_meter of pulse_counter. I used the latter.

Hope this helps.

Yep It does! Thank you!

1 Like

Any hints how to setup a MQTT water sensor? I have set up my sensor as following:

mqtt:
    - sensor:
          - state_topic: "blabla"
          unit_of_measurement: "m³"
          name: "Water Total Consumption"
          object_id: "mqtt_sensor_water_litres_total"
          state_class: total_increasing
          device_class: water

Still I am not able to select the sensor in the energy dashboard as water source: “No matching statistics found”. I have tried both m3 and m³ as unit.