Helper: Utility Meter is missing "device_class"

Hi dear community,

I have implemented the AI-on-the-Edge-Project.

The project provides a MQTT-based sensor, which provides the current value of my water meter. (I have used the MQTT auto discovery to include the sensor data into home assistant.)

I then used a helper Utility Meter to create the following:

I have tried to add the utility meter to the energy dashboard, but the helper is not available. I am guessing, this is because of the missing device_class?
If yes, how do I add the device class to the helper?
Is there an easy way to convert the m3 to litres or do I need to set up a template sensor for that?

Any help is very much appreciated,
Chris

Having a similar issuere here - does anyone have an idea how to add “device_class” to a utility meter?

Hi @juskalalie,

I ended up creating my own template sensor for my water meter. I am converting from m3 to L.

# AI on the Edge: ausgelesene Werte von m3 in L umwandeln.
  - sensor:
    - name: "Watermeter in l"
      unique_id: watermeter_in_l
      icon: "mdi:gauge"
      state: "{{ states('sensor.watermeter_value')|float(default=0) * 1000 }}" # Convert 1 m3 => 1000 l
      unit_of_measurement: L
      device_class: water
      state_class: total_increasing
      availability: "{{ states('sensor.watermeter_value') not in ['unknown', 'unavailable', 'none'] }}"

As the AI-on-the-Edge-Project should provide only increasing values, I was wondering, of “state_class: total_increasing” was correct? I will keep it like this and check in a couple of days, if values are okay in HA.

I’ve just run into the same issue

Did you every get this sorted?

Hi @Uh2 ,

Well, my solution with the conversion from m3 to L is working fine. I did not try to solve the original question anymore, as I want to have it in liters anyway.

Chris

Having said that: I recently implemented AI-on-the-Edge for my gas meter and that just worked fine. No issue with the class.

I actually ran into another post with the same issue, and had to modify two files in HA to get it to work. I replied to that thread so if anyone is interested, check my post history.

Thanks for responding.

Hi @Uh2,

for ease of use: in a couple of months, it will not be very easy to find the topic you found the solution in. Could you post the link to the post, that solved it for you?

Thanks

1 Like

Since he’s being unhelpful, here’s the post he’s talking about: Utiliy Meter not selectable in Energy Dashboard for Water Consumption - #10 by kokel