Tell HA that the sensor is a water sensor

Hello,
I like to add my water meter to the energy dashboard. Only I don’t get the HA configuration right for it.
I got this sensor working in my config:

sensor:
  - platform: serial
    name: Water Meter
    serial_port: /dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0
    baudrate: 9600 
    value_template: "{{ value.split(':')[1][:-1] }}"

I didn’t find any usefull information how to configure the sensor for this. So what do I have to add to the config so Ha knows this is a water sensor?
Thanks

Refer to the example posted here:
Manual Customization

Add the following two lines then restart Home Assistant (or execute Developer Tools > YAML > Reload all YAML Configuration).

sensor.water_meter:
  device_class: water

Here’s the result:

1 Like

thanks, for the help. Only it doesn’t work yet. Is the order important?
I now have this:

homeassistant:
  customize:
    sensor.water_meter:
      icon: "mdi:water-pump"
      unit_of_measurement: "m3"
      device_class: water
sensor:
  - platform: serial
    name: water_meter
    serial_port: /dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0
    baudrate: 9600 
    value_template: "{{ value.split(':')[1][:-1] }}"

You’re going to need more than just device_class to get a sensor included in energy statistics. You will also need state_class and unit_of_measurement.

References:
Integrating your water usage
state_class

Thanks I solved it.

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.