Reset value of pulse_meter

Im new to esphome so at the moment Im cutting and pasting stuff and then just playing around with it.

Ive created a water flow meter based off the home assistant glow project and it works from the way I need it to, but for some reason I cant seem to get the total flow id: sensor_flow_meter_total_litres_3 to reset and update the value in home assistant on the button push.

It does reset until there is a new pulse from the physical sensor.

Could someone offer some guidance as to where I should be looking to reset the flow_meter_total_litres_3???

  - platform: template
    name: flow_meter_reset
    id: button_reset_total
        - pulse_meter.set_total_pulses:
            id: sensor_flow_pulse_meter_3
            value: !lambda "return id(select_reset_total).state * id(select_pulse_rate).state;"

  - platform: pulse_meter
    name: flow_meter_total_consumption_3
    id: sensor_flow_pulse_meter_3
    force_update: true
    unit_of_measurement: 'L'
    state_class: measurement
    icon: mdi:flash-outline
    accuracy_decimals: 0
    internal_filter: 20us
    internal_filter_mode: pulse
      number: GPIO13
        input: true
        pullup: true
      name: flow_meter_total_litres_3
      id: sensor_flow_meter_total_litres_3
      force_update: true
      unit_of_measurement: 'L'
      state_class: total_increasing
      accuracy_decimals: 0
      - lambda: return x * (1.0 / id(select_pulse_rate).state);

doesn’t ?

It does reset but it does not update HA until the sensor moves again. At which point it starts counting from zero.

The serial monitor also confirms this. The reset never sends the zero state.

I’d really like it to reset and update HA as soon as the button is pressed.

What do you want it to reset to?
What is select_pulse_rate ?

pulse rate is just a multiplier eg: 1400 pulses = 1 litre

Regardless of the lambda, Ive tried value: 0 and it only resets on the NEXT subsequent count of the physical sensor, NOT when the button is pushed.

You could try adding a component.update action to your button after the reset action?

Unfortunately not. Sensors are not a polling component and therefore result in a compilation error.

1 Like