Water consumption - using exisitng water softner flow meter - $0 cost. Data not showing in Energy dashboard

I have created a flow meter and integration sensor using ESPHome and it is giving pretty accurate values of both flow rate (gal/min) and consumption (gal). The setup uses the existing flow meter of water softner and taps into the 3 wires (VCC, GND, DATA). The 3 wires are then connected to ESPHome using a pulse_counter. Code below. Took multiple readings and so far have about 95% accuracy when using 130 pulse per gallon of water. Use this link for reference Using ESPhome to build a water flow rate meter - #5 by DeeBeeKay

Questions and Problems
I have also created multiple Utility Meters to be able to track this in Energy dashboard. However, after having this run for over a week, the Utility Meter entities are not showing up in Water Consumption dashboard and it continues to show “No matching statistics found”. Input Sensor for Utility Meters is “Water Consumption” (for all). I see stats on the Developer → Statistics page and can modify values.

What am I missing?

image

sensor:
  - platform: pulse_counter
    device_class: water
    id: water_flow_meter
    name: "Water Flow Rate"
    pin: 2
    update_interval: 3s
    filters:
    - lambda: return (x / 130.0);
    unit_of_measurement: "gal/min"
    accuracy_decimals: 2

  - platform: integration
    device_class: water
    name: "Water Consumption"
    sensor: water_flow_meter
    time_unit: min
    unit_of_measurement: "gal"
    accuracy_decimals: 2

image

Corrected: try adding a unique_id.

Also, suggest to add: method: left, this gives a more accurate results when the sensor is only increasing over time.

How do I add unique_id or method: left? I cant find this being part of esphome templates. Any samples or further guidance you can provide?

remember reading somewhere about

adding a

last_reset: 2021-07-30T00:00:00+00:00

in you customize.yaml

sensor.utility_water_usage_daily
   last_reset: 2021-07-30T00:00:00+00:00

do the Yaml check thing and restart

Update: I see that ESPHOME does support adding a state_class attribute, so you could add state_class: "total_increasing", similar as shown here: Sensor Component — ESPHome


Oh it’s an ESPHOME sensor, then I would recommend making the waterconsumption sensor a home assistant sensor using this Integration: Integration - Riemann sum integral - Home Assistant

What the ESPHOME sensor is missing is the state_class attribute. This attribute is automatically added when creating the sensor using the linked integration.

No, that is no longer needed, see Sensor Entity | Home Assistant Developer Docs

Didnt work. What could be wrong? I still dont have any stats. Whats the best way to do a clean start… Indont mind wiping historical data for all sensors

Yes, correct. You have followed the wrong advice. Adding or having the state_class attribute is the key to make it work.

What type of sensor is that?
Is this little plastic your sitting in the water stream or is that connected to xyz?