Hello and sorry about my english.How can i do (in Esphome , not HA automation) a sensor(counter),witch counts pellet consumption .My esp device turns auger on and off,so it knows,when and how long auger works.And i know pellet consumption for 3 minutes of continiously work-it is 210 grams.So i need some lambda i think?
Something like:
number:
- platform: template
name: "Pellets"
id: pellet_counter
step: 3.5 # grams per 3 sec (interval in on_time: below)
device_class: weight
units_of_measurement: "g"
time:
- platform: homeassistant
id: homeassistant_time
on_time:
- seconds: /3
then:
- if:
condition:
switch.is_on: auger_switch # id of the auger control
then:
- number.increment:
id: pellet_counter
cycle: false
Untested but should be a start. Didn’t need lambda - sorry.
You will need something to set the value to zero if you refill pellets. Have a look at Number Components in the doco.