Skip to content

Monitor water consumption and more with Home Assistant

Hanoh Haim edited this page May 24, 2019 · 5 revisions

Features

  1. Monitor total water consumption per day/week/month

  2. Realtime Notification in case of usage irregularity like

    1. Small leakage – e.g. 1 litter/hour

    2. Big leakage – e.g. you child forgot the water opened

58244093 96ad9e00 7d5a 11e9 81cf da9e28fecc29
Figure 1. per day report

Ingredients

  1. HA

  2. Appdaemon

  3. EV Pulse water meter for example water meter with pulse I’m using Arad with EV

58243664 bdb7a000 7d59 11e9 8d49 a9e39e34679e
Figure 2. water meter ev
  1. Wemo D1 mini with Tasmota firmware

Tasmota configuration

Configure the one of the GPIO to be Counter . Each pulse will increment the counter. However, power cycle will reset the counter. Because of that there is a need for a custom component

Tasmota configuration (once)
CounterDebounce 1000
TelePeriod 60
SetOption36 20
counter"

Install HA custom component

Copy this project <config directory>/custom_components/ folder to your <config directory> directory make sure you are in sync with the the right version of hass (see above) after you copy the data you should reboot/restart HA

Enable counter component

Add this to your configuration file.

HA Custom Component
sensor:
  - platform: tasmota
    name: water_total
    stopic: water_out
    id: 1
    unit_of_measurement: 'l'
    icon: mdi:water-pump
    expire_after: 300
    value_template: "{{ (45497 + (value))|int }}"

 - platform: tasmota
    name: water_total_norm
    stopic: water_out
    id: 1
    unit_of_measurement: 'l'
    icon: mdi:water-pump
    expire_after: 300
    value_template: "{{ (37950 + (value/1.21))|int }}"

This will create two sensors, one counting native pulses and one with normalization to litter. My meter should give one pulse to each litter, but due to denounce (hardware) issues I found that there are 20% more pulses that it should be. So I defined two sensors. It would be important for the Appdaemon apps stage.

Appdaemon script

This app is responsible to notify of a real-time irregularity events. The app should get event from another app when there is somebody at home. Using this information the watermarks could be more sensitive to leakage when nobody at home.

This is an example for 2 taps

Appdaemon Irrigation configuration
water_monitor:
  module: heat_app
  class: CWaterMonitor
  sensor_water_total: sensor.water_total # input: sensor of water in pulses (not litter)
  sensor_water_leak_detector: variable.water_leak_detector # output: filter one pulse
  sensor_water_bursts: variable.water_bursts # output: filter burst in litters
  watchdog_duration_min: 50 # input: high watermark  in minutes to open a tap
  watchdog_leakage_ticks: 3 # input: how many pulses is a leakage?
  max_day: 2000 # input: max consumption a day
  max_burst_l0: 400  # input: max burst in litters
  max_burst_l1: 600  # input: max burst in litters  when garden taps are open
  taps_switchs: [ switch.wbi_p1, switch.wbi_p2] # when one of them is enabled move to burstl1

Grafana/Influx configuration

First, you should add influxDb and install Grafana. There are some good tutorials how to do that.

Per day consumption (l) for the last 30 days

58244093 96ad9e00 7d5a 11e9 81cf da9e28fecc29
Figure 3. per day report
58245912 88618100 7d5e 11e9 8363 f8a2de2de29e
Figure 4. query
58245995 b2b33e80 7d5e 11e9 99e5 d8b5a5d7ed17
Figure 5. change the time range

Water bursts (l)

This will shows how much water was consumed in one single burst without closing the water. remember that the Wemo D1 has resolution of 60sec so we can know that there is no water flowing only after 60sec and minimum water pulse it 1 pulse in 60sec.

This is good to identify the guys that like very long shower. The AppDaemon is updating a variable that now you can use

58246232 32410d80 7d5f 11e9 8c58 a4d7a94e4b8f
Figure 6. water bursts

This is simple query

58246279 4e44af00 7d5f 11e9 9036 6a04f48c981a
Figure 7. query

Water leakage (l)

Identity a lonely single pulses of water (not litter) while you are not at home. This is a signal of a small leakage

58246379 95cb3b00 7d5f 11e9 9aab d5bc0d32ac14
Figure 8. water leakage

The query is the same as above but on the leakage variable

58246443 c27f5280 7d5f 11e9 9035 6b2995c30c77
Figure 9. query

It is calculated using AppDaemon app

Water flow speed (l/m)

58246660 551ff180 7d60 11e9 8779 a815fffbd028
Figure 10. water speed
58246718 7a146480 7d60 11e9 93ae 37b13eb543cd
Figure 11. query