Energy Dashboard does not accept water meter that reports total_increasing in m^3

I built a water meter sensor based on ESPhome, an ESP32 and the LJ18A3-8Z/BX sensor. The device works flawlessly, and it reports the total water usage in m^3 as expected. Now, I’m trying to add that sensor to the Energy Dashboard.

I expected it to show me the “sensor.water_consumption_total” sensor as it reports in m^3, for example “848,862 m³”, but the water sensor does not show up in the Energy Dashboard dropdown list.

I’m not sure how to debug this any further. The documentation did not point me in the right direction - perhaps someone more experienced can? Here is the ESPhome config I use:

sensor:
  # Uptime in seconds
  - platform: uptime
    name: Uptime since boot
    id: uptime_seconds
    update_interval: 10s
  # Pulse COUNTER reports water usage in absolute liters
  - platform: pulse_counter
    pin:
      number: GPIO34
      inverted: true    # Active LOW input, does not really matter since we're counting pulses
      mode:
        input: true
        # pullup: true    # GPIO 34/35/36/39 are input only, no internal pull-up - use external resistor
    #
    id: water_consumption
    name: "Water consumption"
    unit_of_measurement: 'liter'
    device_class: water
    state_class: total_increasing
    #
    icon: "mdi:water"
    update_interval: 6s
    #
    total:
      id: water_consumption_total
      name: "Water consumption total"
      unit_of_measurement: "m³"
      icon: "mdi:water"
      #
      accuracy_decimals: 3
      device_class: water
      state_class: total_increasing
      filters:
        - multiply: 0.001

Is it possible to add under total?

  last_state: '1970-01-01T00:00:00+00:00'

If not, then you can use customize.yaml to add the last_state to the sensor

Hi, thanks for the suggestion but ESPhome does not accept that option, unfortunately. So I’m still wondering what other requirement (apart from reporting in m^3) is expected before the sensor is shown in the UI…

My watermeters unit_of_measurement is m³ and not liter. The attributes of my water_sensor are:

state_class: total_increasing
unit_of_measurement: m³
device_class: water
icon: mdi:gauge
friendly_name: Value
last_state: 1970-01-01T00:00:00+00:00

You can only add water sensors with m³ or gl as unit_of_measurement and you need a last_state for total_increasing

If your esphome sensor doesn’t provide the right attributes, you can add last_state (with the above fixed value) in customize.yaml

1 Like

Thanks, I will try that and report back