Manual Input for water in the energy dashboard

As I did not find a comprehensive description on how to work with a manual input for water consumption in the energy dashboard, this works:

An input-helper records the ever increasing total of the water meter:

A template sensor reads that input, stores the data and makes it available to the dashboard:

template:
  sensor:
    - name: meter_wasser_bad
      state: "{{ states.input_number.meter_wasser_bad.state }}"
      unit_of_measurement: "m³"
      state_class: total_increasing
      device_class: water
5 Likes

I have the same helper created a few days ago and now created the same template sensor with device_class: water.

But I can’t add this to my energy dashboard. In the statistics menu are values.

ok, could you check:

  • did you also set unit_of_measurement: "m³"?
  • Does the template entity have the value you expect?
  • Does the state template show a value when entered into dev-tools / template?
  • You might need to wait until the statitics job runs for the next time

This is my template sensor:

      - name: "Wasserzähler"
        unit_of_measurement: "m3"
        state: "{{ states.input_number.wasserzahler.state | round(3) }}"
        state_class: total_increasing
        device_class: water

The entity has the correct value and it shows the correct value when tried in dev-tools.

How often does the statistics job run?

Please try to switch

unit_of_measurement: "m3"

to

unit_of_measurement: "m³"

(Superscript 3)

1 Like

Yeah… now it is available, I shouldn’t have created the sensor on my ipad :smiley:

Thanks for your help :slight_smile:

2 Likes

Hi,
I hope you can help me too.
I made two Number-Helper (both have the same problem).

Number-Helper:

Sensor:

      - name: meter_wasser_erlenbach
        state: "{{ states.input_number.meter_wasser_erlenbach }}"
        unit_of_measurement: "m³"
        state_class: total_increasing
        device_class: water

My Output in dev-tools / template:

<template TemplateState(<state input_number.meter_wasser_erlenbach=33.0004; initial=None, editable=True, min=0.0, max=99999.0, step=0.0001, mode=box, unit_of_measurement=m³, icon=mdi:water, friendly_name=meter_wasser_erlenbach @ 2022-11-08T14:29:45.677281+01:00>)>

The Number has values, the sensor has no values.

Any Ideas?

For me, this is the correct sensor code:

      - name: meter_wasser_erlenbach
        state: "{{ states('input_number.meter_wasser_erlenbach') |float}}"
        unit_of_measurement: "m³"
        state_class: total_increasing
        device_class: water

Try

state: "{{ states.input_number.meter_wasser_erlenbach.state }}"

states.input_number.meter_wasser_erlenbach ist the complete object that is displayed in the devtools while you sensor only needs the number in .state.

2 Likes

Sorry…I thougth I copied your code 1:1…

the value in the input sensor are added together in the energy area
Is there a solution for this?

The purpose of water in the energy dashboard seems to be to track the source utility-meters, not individual devices. For this usecase summing the sensors is the way to track your consumption.

There is no extra tracking individual devices like for electrical power.

okay, i already thought so and removed it from energie, what does your solution look like?
do you use it as a history card?
like this:

Actually, I only have two source- meters so that’s no worry for me.
If I had, I’d probably use the apex-chart card from hacs. (Provided, that it can access the long term stats, didn’t check)

1 Like

I am doing something wrong… I get errors (I put this in sensors.yaml)
Besides the names but I first want the formatting right…

- platform: template
  sensors:
    meter_wasser_erlenbach:  Missing property "value_template"
      state: "{{ states('input_number.meter_wasser_erlenbach') |float}}"  Property state is not allowed.
      unit_of_measurement: "m³"
      state_class: total_increasing
      device_class: water        

I’d first like to say big thanks to @elfrinjo for sharing this! This is exactly what I was looking for.

To @ehorsting1982 what if you change meter_wasser_erlenbach: to name: "meter_wasser_erlenbach"?

I got it right this time. Not yet seeing anything on the energy dashboard, but I will give it some time.