Hello. I’m trying to make a sensor in ESPHome, that resets when there has been no water flowing for 5 minuts. I managed to get the sensor below work, but I cant figure out how to reset the integration when there has been no pulse from the pulse_counter for 5 minuts.
Try getting rid of this whole line below.
The example provides two examples and you prob want the second one which fallsback to 0 rather than nan.
If the pulse counter is providing values every one second even if they don’t change (I’m not so familiar with that) , you might also need to put a delta filters before the one above so that the repeat values which aren’t changing don’t prevent the timeout from happening. Although you may need to assess the impact of that on your calcs too.
Posting some logs as you go will help to debug /optioneer.
So I have changed the names of the sensors slightly in order to make it easier to understand the purposes.
Pulse_counter is changed to pulse_meter, and I have added the timeout section in the last integration. This one actually resets now after the timeout, but when I start using water again it starts from where it was before reset.
Excuse me for beeing such a stupid newbee :-
sensor:
- platform: pulse_meter
state_class: measurement
name: "water flow"
id: flow_vand
pin: GPIO12
filters:
- lambda: return (x / 400.0); #Flow pulse: F=(6.68Q)±5% with Q=L/min
unit_of_measurement: "L/min"
- platform: integration
device_class: water
state_class: total_increasing
name: "water used in m³"
unit_of_measurement: 'm³'
accuracy_decimals: 4
sensor: flow_vand
time_unit: min
icon: "mdi:water"
filters:
- lambda: return (x / 1000);
- platform: integration
device_class: water
state_class: total_increasing
name: "Long time water used"
unit_of_measurement: 'L'
accuracy_decimals: 2
sensor: flow_vand
time_unit: min
icon: "mdi:water"
- platform: integration
device_class: water
state_class: total
name: "Short time water used"
unit_of_measurement: 'L'
accuracy_decimals: 2
sensor: flow_vand
time_unit: min
icon: "mdi:water"
filters:
- timeout:
timeout: 30s
value: 0