Manual Water Meter Tracking in Home Assistant

Cover image

For a long time I wanted to track my water consumption in Home Assistant. I had my eye on projects like AI on the edge - watermeter which allow to read out analog meters automatically. I just do not have time for another DIY project at the moment, therefore a cool new fancy solution has to wait. I wanted a simple, quick, "good enough" solution. I came up with something that is not perfect and requires manually reading the water meter, but it only took me 30 minutes to set up.

The idea is to track the water meter manually. Every week I want to get a notification on my smartphone which reminds me to read the water meter and record its value. I need an easy & quick way to enter the values into Home Assistant, otherwise I wont do it. At last, the entered values should be treated as normal sensor values. I want to be able to display them in the UI and use them in queries and reports from within Grafana. Here are the steps I used to achieve this:

1. Manual track an input value

You can easily track input values manually in Home Assistant using only the UI. Go to Settings > Devices & Services > Helpers and create a Helper for a Number. e.g. I created four input values for each water meter in my flat.

Create an input value for a number
Create an input value for a number

Next I created a new Dashboard. I set a specific url "meters" for it. The url allows to later open it easily from within a push notification. I added the input values to the dashboard and voilà, my input form is ready.

Cards with input fields for all my utility meters
Cards with input fields for all my utility meters

2. User friendly values to display - Weekly, Monthly, Yearly

Perfect, I have my total water consumption now tracked inside Home Assistant and could use it in Grafana reports or display it in the UI. But instead of the total value I am more interested in my monthly or weekly water consumption. Home Assistant offers Utility Meter for that use case. It allows to "group" a sensor by a given cycle. e.g. monthly. In this case it would display the amount of water I have used in the current month based on the total value. I configured this in my configuration.yaml:

# configuration.yaml
  - platform: template
        friendly_name: "Warmwasser Bad"
        unit_of_measurement: "m3"
        value_template: "{{ states.input_number.watermeter_bath_warm.state | round(3) }}"
    source: sensor.watermeter_bath_warm
    cycle: yearly
    name: Bad Warmwasser Jahr
    source: sensor.watermeter_bath_warm
    cycle: monthly
    name: Bad Warmwasser Monat
    source: sensor.watermeter_bath_warm
    cycle: weekly
    name: Bad Warmwasser Woche

The input_number values cannot be used directly inside an utility_meter because it only accepts sensors. Therefore we need to transform the input_number entity into a sensor which is done by the template sensor. The rest should be straight forward.

After a restart the utility meter sensors can be used. e.g. I now can use the entity sensor.bad_warmwasser_monat to display the amount of water that was used in the current month in the UI. This value is reset every month.

So now I have all values in the required formats. I can display them wherever I want and use them in reports in the same way as my energy meters.

3. Remind me to enter values

To be sure that I am not too lazy with entering new records, I added a notification that is sent once a week. It displays a message: "Please enter a new water meter record" and also provides an action directly inside the notification which opens the "meters" dashboard which is the view that contains all input fields. Remember, we set the specific url when creating the Dashboard.

For notifications like this the notify service can be used. e.g. following data will create a notification which contains an action, which will open the correct dashboard.

# try it out http://homeassistant.local:8123/developer-tools/service

service: notify.notify
data: {
    "title": "Read water meter",
    "message": "",
    "data": {
        "tag": "water-meter-notification",
        "actions": [
                "action": "URI",
                "title": "Enter values now",
                "uri": "/lovelace/meters"

The notification looks like this on my phone. The blue link on the bottom opens the dashboard
The notification looks like this on my phone. The blue link on the bottom opens the dashboard

All that is left is to trigger this notification every week. I implemented it using NodeRed using an Injection node. But it also could be done directly in Home Assistant using the scheduler integration.

Good enough 🤷‍♂️

As I said it's good enough for me. Before this, I got a water meter record every year with my billing. So everything more frequently then yearly is an improvement and it is a good start. Maybe it is also a weekly reminder for me to implement some automatic solution to read the water meters. 😉

Do you have a simple solution for tracking water meters automatically? or other input? Feel free to reach out to me on twitter.