Entity for water not showing up in Energy dashboard

Hi,

I have an entity that provides me the current value of my water meter but is a an input number. In order to use it in the Energy dashboard I convert it to a template sensor.

      - name: "Template Water Consumption (Total)"
        unit_of_measurement: "m³"
        state: "{{ states('input_number.water_consumption_total')|float / 1000 }}"
        unique_id: "template_water_consumption_total"
        device_class: water
        state_class: total_increasing

The template sensor is shown in the list of entities. For the gas consumption this setup worked very well but in this case it does not show up when I try to add a water source.

Anyone has an idea what is missing here?

Thanks in advance
Jan

I have the (almost) exact same setup but also read of issues with device_class ‘water’ …might depend on which HA install you have. I am on HA 2022.12.8 and this is my template sensor

      - name: "Water Usage"
        unique_id: Water_Main
        unit_of_measurement: "m³"
        device_class: water
        state_class: total_increasing
        state: "{{ states('input_number.watermeter') |float(0) }}"

EDIT, so with me this works (!) on HA docker 2022.12.8

And btw… it is a total_increasing from a meter reading so not needed to divide. …might even be wrong as what you feed is no longer m3 but m3/1000 = liter

Thanks for your responses. My total is in liters. So I have to divide by 1000… at least I guest :rofl:

But your sensor says m3…hence imo unit wrong. As soon as my HAOS is back (2023.1.6) I can try there as well…

But my input_number.water_consumption_total is in liters. So I need to convert back to m³ in order to have m³ as required by the Energy dashboard, correct?

I also tried with float(0) as you did, but still not recognized :sob:

Ah… I fully admit to now know every water meter :crazy_face: …only those that register m3
So I donot think the sensor will show wrong data then but just the wrong unit …
What is your HA setup/version?
EDIT… come to think of it, your approach is OK with .1000 (sorry it is a bit early)

So, tried it with HAOS 2023.1.6 now as well… no issue adding both to the energy dashboard
Reading your first post… now I am unclear what (!) is not working?

‘template_water_consumption_total’ is not showing up in the configurtion dialog:

Weird, errors in the log ?

Ha, this was the final hint :star_struck: There was indeed an error in the log. It said that the template sensor could not be converted from ‘l’ to ‘m³’ as the unit was liters in the first place. I fixed it in the developer tools and now I could add it to the Energy dashboard. It now shows a message ‘statistics_not_defined’ but I guess this will be removed once the statistics have been collected.

Thank you so much! :partying_face: