Utility meter calculates wrong? water meter

Hello,

please excuse my english :wink:

I have been using HA for a few weeks now and am currently expanding my SmartHome with various sensors.
But I despair of the integration of the WaterMeter in combination with the UtilityMeter (Energy and Gas seems working fineā€¦)

the problem:

  • the sensor (ESPHome) gets one pulse per liter
  • HA also receives the correct number of impulses via ESPHome integration
  • UtilityMeter seems to arbitrarily not count all data (for example, the daily consumption is 21 liters, 4 liters are newly transmitted, the new daily consumption is 24 liters)

Am I too stupid for the config? Am I thinking wrong?

My ESPHome config (works):

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
    name: "pulse input"
    filters:
      - delayed_on: 10ms
      - delayed_off: 10ms
    on_press:
      then:
        output.turn_on: GPIO13
    on_release:
      then:
        output.turn_off: GPIO13
output:
  - platform: gpio
    pin:
      number: GPIO13
    id: GPIO13

sensor:
  - platform: pulse_counter
    update_interval: 60s
    internal_filter: 13us
    pin:
      number: GPIO15
      mode: INPUT_PULLUP
    unit_of_measurement: "l"
    name: 'water_liter'
    accuracy_decimals: 0

Utility meter config:

daily_water_l:
  source: sensor.water_liter
  cycle: daily
weekly_water_l:
  source: sensor.water_liter
  cycle: weekly
monthly_water_l:
  source: sensor.water_liter
  cycle: monthly
quarterly_water_l:
  source: sensor.water_liter
  cycle: quarterly
yearly_water_l:
  source: sensor.water_liter
  cycle: yearly

Donā€™t forget rounding. eg

20.8 L consumed by the end of Tuesday - displayed as 21 L
3.6 L consumed on Wednesday - displayed as 4 L
Total is now 20.8+3.6 = 24.4 - displayed as 24 L

thanks for your answer!

And good point!!
but there should no decimals.
the pulse-counter only have on pulse per liter, so (in my opinion) there can be no rounding errors.?

yes thatā€™s trueā€¦

how can I sum the liter for today manually?
all the data is in the history of the sensor, but I still havenā€™t figured out how to sum up these valuesā€¦
so I can compare these values with the utility meterā€¦

is there a log, where I can see what the utility meter do? what values it uses for the Calculation ?

The utility meter platform expects as input a number that goes up over time, much like the number visible on the meter does.

What you are providing it is a number that indicates a count of liters in the last minute.

The reason this seems to almost work, is that if the utility meter platform sees its input value go down, it assumes the input must have wrapped around, or otherwise been reset. It assumes the maximum value reached was whatever it last saw. It then adds in the new lower value.

But what happens if the number reported is 1 for one minute, and 2 the next? Well that would actually be a total of three liters, but the utility meter platform would count it as only two, because the number only went up.

What you want to do here is in the esphome config, you want to add the Total daily energy sensor using your pulse counter as the input, along with configuring the time component to enable its auto-reset. Despite the name, this sensor works just fine for non-energy inputs like water.

The result of that new esphome ā€œsensorā€ output would be a value that only counts upward over time, except when it resets each day at midnight. That fits the model that the utility meter platform expects for its input just fine.

Hope this helps.

1 Like

hi Kevin, fell thanks!!!
Now I understand the ā€œissueā€ :slight_smile:

I try with the ESPHome Total config.