Water Meter in Energy Dashboard Not Available

Looks like water usage data is now showing up in my Energy Dashboard… Hopefully it sticks and will be accurate… I’ll update this message when not…

I started all over in ESPHome (ESP8266 Wemos D1 Mini with a simple NPN sensor) based on parts in this thread. I used all new names / IDs. I removed everything from configuration.yaml. The following is what I now have in ESPHome:

The Water Consumption ‘metric’ was immediately visible in the drop down list. No error messages appeared in the following hours. Data started to flow in in next hours.

I’ve manually added the water usage earlier today (by changing 1 value from 0.0 to 0.17m3 in the statistics via Developer → Statistics)

1 Like

Good, also @PatBat solution was the only one that worked for me. Why is it needed and for some isn’t? Beats me.

136 L	€11.70 

now it just gives the wrong cost calculation, i think it should be 0.117 cent. Even though liters seems ok.

OK, I found my issue after a few hours! The sensor must also be available in de recorder settings that are defined in the configuration.yaml:

recorder:
  include:
    entity_globs:
     - sensor.water_*

My ESPHome config:

sensor:
- platform: pulse_meter
  pin: GPIO04
  name: "Water Pulse Meter"
  unit_of_measurement: "liter/min"
  icon: "mdi:water"
  total:
    name: "Water Total"
    unit_of_measurement: "m³"
    accuracy_decimals: 3
    state_class: total_increasing
    device_class: water
    filters:
      - multiply: 0.001

Tip: please take a look under Developer Tools and look up your sensor, to see the value and attributes that comes with that sensor.

Mine seems to report always in L, no matter the units I set.
My flow meter returns value in gal/m

Please advise?

utility_meter:
  hourly_water:
    source: sensor.water_softener_water_current_flow
    name: Water Usage Hourly Utility Config
    cycle: hourly

template:
#Water consumption utility -> sensor for Dashboard
    - sensor:
        - name: "Water Usage Hourly"
          unique_id: water_usage_hourly
          unit_of_measurement: "gal"
          device_class: water
          state_class: total_increasing
          state: >-
            {{states('sensor.water_usage_hourly_utility_config')}} 

How in the world can i translate

Configuration.yaml

template:
  - sensor:
      - name: "consumi"
        state: "{{ states('sensor.total_water_used')|float * 0.001 }}"
        unit_of_measurement: m³
        device_class: water
        state_class: total_increasing

into:

Sensors.yaml

- platform: template
    sensors:
      consumi:
        friendly_name: "Water Consumption"
        unit_of_measurement: "m³"
        device_class: "water"
        state_class: "total_increasing"
        value_template: "{{ states('sensor.total_water_used')|float * 0.001 }}"

first of all… THANX for this integration!!!

I’m in Canada, and needed to make a few changes to get it to work. Had to modify eow.py and sensor.py and customize.yaml as follows

eow.py

change to canadian website
BASE_HOSTNAME = “eyeonwater.ca”

add
MEASUREMENT_CUBICMETERS = “CM”

replace
elif read_unit.upper() == MEASUREMENT_GALLONS:
with
elif read_unit.upper() == MEASUREMENT_CUBICMETERS:

this got me in and working, but homeassistant energy would not see the entity.

sensor.py

change
_attr_native_unit_of_measurement = ‘m\u00b3’

to allow display of units as cubic meters m^3. this alone would still not show the sensor in the energy dashboard.

after doing some reading, it appears home assistant wants to see this as a DEVICE_CLASS_WATER. to make this change, I updated my customize.yaml file in the HA root directory with the following entry.

  sensor.water_meter_12345678:
    device_class: water

This allows the entity to be added to the energy dashboard. Not sure if the numbers are displayed correctly (due to me reading cubic meters, but, I do get a number that corresponds to what is actually on the eyeonwater.ca page.

I hope this helps going forward, and again, thanx for writing this integration!!!

Just wanted to add, that after configuring my ESPHome based Pulse Meter sensor like this

sensor:
  - platform: pulse_meter
    pin: D1
    unit_of_measurement: 'l/min'
    name: 'Wasser Durchfluss'
    total:
      name: "Wasser Gesamt"
      unit_of_measurement: "m³"
      device_class: water
      state_class: total_increasing
      accuracy_decimals: 3
      filters:
        - multiply: 0.01

the Energy Dashboard immidiately showed my usage for the whole history of more then a year, but without cost associated (which I added as fixed price).

After digging around, looks like the Energy dashboard displays in units setup in Settings\System\General under unit system:

If I set it to metric, the dashboard always defaults to L, even if the entity units are gal. When I change to US, it displays correctly in gal.

If anybody knows how to override just the water units in the dashboard, that would be appreciated,

I`m using a watermeter based on ESPEasy and have the following config in HomeAssistant

root@knopjes02:/home/homeassistant/.homeassistant/mqtt/sensor# cat watermeter.yaml 
  - name: "Sensus 620 Count"
    state_topic: "/watermeter01/sensus620/Count"
    qos: 0
    unit_of_measurement: Liter Count

  - name: "Sensus 620 Total"
    state_topic: "/watermeter01/sensus620/Total"
    qos: 0
    unit_of_measurement: Liter Total

root@knopjes02:/home/homeassistant/.homeassistant/mqtt/sensor# 
utility_meter:  
  waterverbruik_kwartier:
    source: sensor.sensus_620_total
    cycle: quarter-hourly
  waterverbruik_per_uur:
    source: sensor.sensus_620_total
    cycle: hourly
  waterverbruik_per_dag:
    source: sensor.sensus_620_total
    cycle: daily    
  waterverbruik_per_week:
    source: sensor.sensus_620_total
    cycle: weekly
  waterverbruik_per_maand:
    source: sensor.sensus_620_total
    cycle: monthly
  waterverbruik_per_kwartaal:
    source: sensor.sensus_620_total
    cycle: quarterly
  waterverbruik_per_jaar:
    source: sensor.sensus_620_total
    cycle: yearly   

How do i get this sensor in Energy dashboard, i think i need to add something but where?

Thanks for this, fixed my problem by comparing configs.

My ESP config was missing device_class and state_class.

I changed the measurement unit from M3 to m³ also, although I don’t think that was part of the problem.
After changing measurement unit, don’t forget to ‘Fix’ statistics too as described here above.

Dont understand how to set this up
i have a flow sensor which gives me the current flow rate, not accumlating usage.
do i need to put it through utility meter first to get it to count ? and then set it up for energy dashboard?

Hi,
if you only have a flow-rate you first must calculate the absolute value. If you have the flow every 5 minutes, you must add every 5 minutes your value to a counter. You need a always increasing value.

I also tried for hours to add the water consumption to the energy dashboard.

Finally a template sensor works.

Here is the configuration:

sensor water_meter_total_m3:   
  platform: template
  sensors:
    water_meter_total_m3:
      device_class: water
      unit_of_measurement: m³
      value_template: "{{ ((states('sensor.n_ergie_watermeter_m3') | float)) | round(2) }}"
      attribute_templates:
          state_class: total_increasing

This is the configuration of the MQTT Sensor:`

    - name: "n_ergie_watermeter_m3"
      state_topic: "kg/wasser/main/value"
      device_class: water
      unit_of_measurement: "m³"
      state_class: total_increasing
      value_template: '{{value | round(2) }}'
      icon: "mdi:water"

In the dashboard I only see the template-Sensor.

I am currently trying to build a water sensor to display it in the dashboard. I get the following information from my water system:

  • Daily water consumption in liters
  • Total consumption in liters

How exactly do I have to set up the sensors so that I can use them?

I currently have these 3rd sensors

    ...
      - name: "bwt_water_consumption_yesterday"
        value_template: "{{ value_json.totalWaterConsumption | float(default=0) }}"
        unit_of_measurement: "L"
        device_class: water
        state_class: measurement
        icon: mdi:water
      - name: "bwt_water_treated_total"
        value_template: "{{ value_json.waterTreatedTotal }}"
        unit_of_measurement: "L"
        device_class: water
        state_class: total_increasing
        icon: "mdi:water"
    ...
    - name: "bwt_water_treated_total_m3"
      unit_of_measurement: "m³"
      state: "{{ ( states('sensor.bwt_water_treated_total') | float / 1000 ) | round(3) }}"
      icon: "mdi:water"
      device_class: water
      state_class: total_increasing

Schauen sie da mal vielleicht ist das hilfreich.

Danke, sieht so ähnlich aus, was ich aktuell versuche

template:
  sensor:
  - name: "Watermeter Value from JSON"
    unique_id: water_meter_value_from_json
     state: >-
            {{ state_attr('sensor.watermeter_json','main')['value'] | float }}
     unit_of_measurement: 'm³'
     device_class: water
     state_class: total_increasing
     icon: mdi:gauge

Jedoch werden bei mir leider keine Werte angezeigt, egal welchen sensor ich nehme.

Ich habe an meinem Wasserzähler ein “KY-033 Linien Folger Line Tracking Sensor Modul TCRT5000”, das ich über den Analogport an einem ESP8266 angeschlossen ist, der in ESPHome eingebunden ist. Mit den Digitalen Ausgang habe ich an manchen Stellungen des Liter-Zeigers falsche Impulse bekommen, wenn der Zeiger an bestimmten Stellen stehenblieb.
Mit dem analogen Auslesen gibt es kein Problem mehr. Ich habe den A0 Port direkt mit dem Kollektor des IR-Transistors verbunden. Die Schwellwerte habe ich so gesetzt, dass genügend Hysterese zwischen ON und OFF ist.
Für das Energie-Dashboard habe ich einen Template-Sensor angelegt, dieser muss die Einheit m³ haben.

ESPHome:

#Helper that is Switched on and off by Analog Value
switch:
  - platform: gpio
    id: ipin
    pin: 13


# Analogsensor connected to IR-Transistor
sensor:
  - platform: adc
    id: ntc_source
    name: 'Water Meter Analog IN'
    #internal: true
    disabled_by_default: true
    pin: A0
    update_interval: 0.2s
    filters:
    - or:
      - throttle: 10s
      - delta: 0.01
    on_value_range:
      - below: 0.17
        then:
          - switch.turn_off: ipin
      - above: 0.20
        then:
          - switch.turn_on: ipin

      
  - platform: pulse_counter
    pin: 15 #verbunden mit Pin 13
    unit_of_measurement: 'l'
    name: 'Water Meter House'
    id: pulse_water_counter
    update_interval: 60 s
    internal_filter: 50ms
    count_mode:
      rising_edge:  DISABLE
      falling_edge: INCREMENT

    total:
      unit_of_measurement: 'm3'
      name: 'Water Meter Total House'
      state_class: total_increasing
      id: m3_Total
      filters:
        - multiply: 0.001  # (1/1000 pulses per m3)      
      accuracy_decimals: 3

Templatesensor:

sensor water_meter_total_m3:   
  platform: template
  sensors:
    water_meter_total_m3:
      device_class: water
      unit_of_measurement: m³
      value_template: "{{ ((states('sensor.energy_water_m3_total') | float)) | round(3) }}"
      attribute_templates:
          state_class: total_increasing

Alterntiv, hoffe das passt so:

template:
  - sensor:
      - name: water_meter_total_m3
        unit_of_measurement: m³
        value_template: "{{ ((states('sensor.energy_water_m3_total') | float)) | round(3) }}"
        device_class: water
        attribute_templates:
            state_class: total_increasing
      

So that’s what it looks like with AI-on-the-edge, maybe that will help you a bit.

How do you read out your sensus 620?

Recently I came across the same problem: all three config params are correct but no sensor in Energy dashboard settings. It appeared that another one precondition must have been met - the sensor’s data must be recorded to DB, and this is not quite obvious. I have custom settings for recorder, not to overload the DB with hundreds unneeded sensors, so after I manually added my water meters sensors to recorder config and restarted HASS - all works.