Hey.
Can someone help me with my understanding of this and why my - pulse_meter.set_total_pulses
doesnt seem to work
button:
- platform: template
name: flow_meter_reset
id: button_reset_total
on_press:
- pulse_meter.set_total_pulses:
id: sensor_flow_pulse_meter_3
value: 0
sensor:
- platform: pulse_meter
name: flow_meter_total_consumption_3
id: sensor_flow_pulse_meter_3
unit_of_measurement: 'L'
state_class: measurement
icon: mdi:flash-outline
accuracy_decimals: 2
pin:
number: GPIO13
mode:
input: true
pullup: true
total:
name: flow_meter_total_litres_3
unit_of_measurement: 'L'
state_class: total_increasing
accuracy_decimals: 2
filters:
- lambda: return x * (1.0 / id(select_pulse_rate).state);
Neither flow_meter_total_litres_3
or flow_meter_total_consumption_3
reset when the button is pushed. So im obviously missing something very fundamental.
Thx
It looks like you are missing the then:
statement in the button code, and there are some indent mistakes as well. See: (Re)Setting the total pulse count.
Try this:
button:
- platform: template
name: flow_meter_reset
id: button_reset_total
on_press:
then:
- pulse_meter.set_total_pulses:
id: sensor_flow_pulse_meter_3
value: 0
sensor:
- platform: pulse_meter
name: flow_meter_total_consumption_3
id: sensor_flow_pulse_meter_3
unit_of_measurement: 'L'
state_class: measurement
icon: mdi:flash-outline
accuracy_decimals: 2
pin:
number: GPIO13
mode:
input: true
pullup: true
total:
name: flow_meter_total_litres_3
unit_of_measurement: 'L'
state_class: total_increasing
accuracy_decimals: 2
filters:
- lambda: return x * (1.0 / id(select_pulse_rate).state);
Hey Thanks Ed.
I knew it would be something as stupid as that.
The indents were just a ramification of losing them to “cut and paste” from the UI to the forum.
The only part that doesnt seem to work is that when the button is pressed, the sensor gets reset, but does not send an update to HA on the new value until the ACTUAL sensor changes (GPIO13) at which point the count starts at 0.
Do you know of any way of updating the sensor when the button is pushed. I have tried force_update: true
in the sensor config to no avail.
I am not sure it will work, but did you already try to add the timeout option?
This defaults to 5 minutes when not set specifically, so does the sensor reset to zero 5 minutes after pressing the button, or not at all?
If it does you can try to set it to a short time.