Water Meter in Energy Dashboard Not Available

I’ve been tracking water data for some time, and had an existing sensor with gallons as my unit. When switching to this energy dashboard method, I changed the units to gal, and set the appropriate device_class and state_class, but the sensor still wasn’t showing in the dropdown.

It looks like I also had to update the units for previously stored datapoints. In DeveloperStatistics I performed the following, and was able to select my sensor:

2 Likes

Waw, I just found that panel and wanted to share it here! But you beat me to it.

This fixed it for me.

@dantidote , what did you set as the appropriate device_class and state_class?

interesting… no issues, nothing to fix… even after a day or so… still no data…

Hi everybody,
same problem, no water consumption showing in energy panel.
6 times checked configuration.yaml. Finally, I check the stats in the developer tools. There was some problem with my water entity and I fixed it.
Since then, my water and energy consumption have appeared immediately.

@Duky , could you share your configuration?

He He Erik-Jan, how are things?
I have used @PatBat it’s proposal, the 5th in this thread.
Added into the configuration yaml file. The water meter came up.
The issue with the m³ instead of L is not solved yet.

I do agree with others, why is it so hard to add this energy sensor. All the others came up, no issue!

I also want to know about @Duky his solutions and more guideline to understand what needs to be fixed?!

I tried several suggestions in this thread, only @PatBat solution with the template sensor seems to work. I have an MQTT sensor having the water usage data:

  - name: Water Total
    state_topic: iobroker/gruenbeck/0/calculated/Wasserzaehler
    unique_id: "gruenbeck-wasserverbrauch"
    icon: "mdi:water-pump"
    unit_of_measurement: m³
    device_class: volume
    state_class: total_increasing

for which I need to create the same template sensor to have the entity in the energy dashboard shown up:

template:
  - sensor:
      - name: "water counter"
        state: "{{ states('sensor.water_total') }}"
        unit_of_measurement: m³
        device_class: water
        state_class: total_increasing

This does not seem right, I probably miss here something obvious. My MQTT sensor shows up properly in the Developer Tools/Statistics tab without any problems to be fixed. I also tried different device_class values.

Can someone point me to the source code which suppose to handle this case?

2 Likes

Can’t you change your MQTT sensor’s device_class to water?

  - name: Water Total
    state_topic: iobroker/gruenbeck/0/calculated/Wasserzaehler
    unique_id: "gruenbeck-wasserverbrauch"
    icon: "mdi:water-pump"
    unit_of_measurement: m³
    device_class: water
    state_class: total_increasing

I tried that too.

Edit: funnily it now shows up after I changed it to water. I had water there initially without success and after that I tried different device_class values. Whatever, it seems to work now, black magic :slight_smile:

Edit2: I have removed the Template sensor rebooted and now the MQTT is gone again. This really drives me crazy.

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?