I have a CO2 laser and I use an ESP32 running ESPHome to track coolant and ambient temperature, logging to HA as well as displaying on an OLED screen. The laser tubes are a consumable product and generally have a range of expected hours that they should last. What I would like to do is use HA+ESPHome to track the cumulative number of hours of laser time for 2+ years. Expanding the database to track 2+ years doesn’t seem like a viable option. The laser has an air assist pump that runs on 12V. I am going to use an ADC or digital sensor either with a current sensor, or just a voltage divider so the ESPHome can track when the air assist is on. I was thinking that maybe a counter with restore=true might be a good way to keep track of this total laser time over an extended period of time. What I can’t figure out is the best way to make it increment. Maybe an automation that fired once for every 10 seconds the sensor is high and either increments by 10. This seems like it would give me a pretty good estimation of total run time since the laser itself doesn’t track this.
I’ve looked but haven’t been able to find any examples of this. Would this be a good way to track this over a long period and does anyone have any examples?
Thanks