I am setting up a fuel oil tank meter to keep track of the amount of oil in the tank based on top-ups and furnace burns.
I have everything working with except for:
I need to zero out the pulse count total after each furnace burn cycle. The setup works like this:
- Furnace burner is on and oil flows
- Sensor displays liters per minute and total liters.
- When supply water reaches 80oC burner shuts off.
- After 5 minutes, the pulse meter sensor sets the burn rate to 00.000 liters/minutes.
- An automation watches for the change to 00.00 l/m and triggers an action to subtract the total liters from the previous oil volume and then resets the total pulse count to zero so that the next furnace run records the volume of oil consumed only on that run.
The part I can’t get is the “resets total pulse count to zero”. ESPHome docs show the code below but I just can’t figure out where to put it and how to introduce the zero value
api:
actions:
- action: set_total
variables:
new_total: int
then:
- pulse_meter.set_total_pulses:
id: sensor_pulse_meter
value: !lambda 'return new_total;'
Current Yaml
substitutions:
name: esphome-web-6e2e98
friendly_name: D1mini10
esphome:
name: ${name}
friendly_name: ${friendly_name}
min_version: 2024.6.0
name_add_mac_suffix: false
project:
name: esphome.web
version: dev
esp8266:
board: esp01_1m
Enable logging
logger:
Enable Home Assistant API
api:
encryption:
key: "kJNrzVLTn9tXlO45RbwtCP2gAKRstlcqHB4WFYeCVo4="
Allow Over-The-Air updates
ota:
- platform: esphome
Allow provisioning Wi-Fi via serial
improv_serial:
wifi:
Set up a wifi access point
ap: {}
In combination with the `ap` this allows the user
to provision wifi credentials to the device via WiFi AP.
captive_portal:
dashboard_import:
package_import_url: github://esphome/example-configs/esphome-web/esp8266.yaml@main
import_full_config: true
To have a "next url" for improv serial
web_server:
sensor:
- platform: pulse_meter
name: 'Fuel Oil Useage'
id: sensor_pulse_meter_fuel_oil # Optional ID, necessary if you want to calculate the total number of pulses.
unit_of_measurement: 'L/min'
device_class: volume_flow_rate
state_class: measurement
internal_filter: 100ms # Assuming maximum load of 16 kW and 10000 impulses per kWh, any pulses faster than 22.5 ms would exceed load. -10% ~= 20 ms.
accuracy_decimals: 3
pin: GPIO13
filters:
- lambda: return (float) x * 7.2985/1000.00 ;
total:
name: "Total Liters"
filters:
- lambda: return (float) x * 7.2985/1000.00;
accuracy_decimals: 3
unit_of_measurement: 'L'```