EnergyDashboard - Water entity with device_class and state_class still not available

Hi,

I am using a Ai_on_the_Edge Device which provides the WaterConsumption via MQTT. The config looks like this

mqtt:
  sensor:
    - state_topic: "wasserzaehler/main/value"
      unit_of_measurement: "m3"
      state_class: "total_increasing"
      device_class: water
      value_template: "{{ value }}"
      name: Kaltwasserbezug
      icon: "mdi:gauge-low"
      unique_id: Kaltwasserbezug

template:
  - sensor:
      - name: "Wasserverbauch"
        unit_of_measurement: "m³"
        device_class: water
        state_class: total_increasing
        state: "{{ states('sensor.Kaltwasserbezug')|float}}"
availability_template: "{{ states('sensor.Wasserverbrauch') != None }}"

but the original sensor “Kaltwasserbezug” is not available via EnergyDashboard, only if I try it via the Template “Wasserverbrauch”.
Does someone know the reason? I added the template because the Kaltwasserbezug was not available.

The Template has the disadvantage that everyday the AI Device does not provide data for some time and then the sensor-data Kaltwasserbezug is not available. In the statistics has this the effect that some old data for the template is used. I do not understand why or how can I change this behavior.

HA02
HA01


can someone help here?

thanks
Marc

Try this:
Create a new mqtt sensor, remove the sensor template and use customization.

mqtt:
  sensor:
    - name: "Kaltwasserbezug"
      state_topic: "wasserzaehler/main/value"
      state_class: total_increasing
      value_template: "{{ value }}"
      unit_of_measurement: "m³"
      device_class: water
      icon: mdi:gauge-low

homeassistant:
  customize:
    sensor.kaltwasserbezug:
      friendly_name: Wasserverbauch

result:
Entity not defined

mqtt:
  sensor:
    - state_topic: "wasserzaehler/main/value"
      unit_of_measurement: "m3"
      state_class: "total_increasing"
      device_class: water
      value_template: "{{ value }}"
      name: Kaltwasser
      icon: "mdi:gauge-low"
      unique_id: Kaltwasser
sensor.Kaltwasser:
   friendly_name: Wasserverbrauch

I tried some more combinations and completly new names. I think I need to wait some time until the new sensor will be available. currently only the old one with this error is available

I had a similar problem with a water meter entity I was working on… ultimately on the “Statistics” tab of developer tools it listed the entity and the ability to “fix issue” because I didn’t have the UOM set when the entity was first created. Once I did that they showed up.

1 Like

so. no changes today.

kaltwasserbezug is not available in energy dashboard.
So I would need the template? - no other ideas - Is it a bug ?

state_class: total_increasing
unit_of_measurement: m3
device_class: water
icon: mdi:gauge-low
friendly_name: Kaltwasserbezug

→ no issues shown in the statistics tab.
→ long term stats in recorder available.
→ still issues with the graph when no data is provided via mqtt

graph

Unit of measurement must be “m³” not “m3”

1 Like

Ahh… good eye… so yes after that change it should show up in the statistics page with an issue to fix.

amazing- thanks. so now the original sensor is available and I could remove the template.sensor.

any idea how to prevent the false(negative values) from the sensor?