Here is a handy utility app that is written very very basically: "Track Power On Time".
This application uses a device with the PowerMeter capability (smart plugs, HEM's etc) and a threshold (for devices that have a low power sleep mode) to track "on" time, really on/off cycles.
Example usage: My gas water heater is power vented, when "power" usage goes above 2 watts it's running, always. I set this up to track when it's on heating, and specifically how long each run is.
Output currently is limited to some very basic stats:
You can create new events for each power on/ power off cycle if you want to use it as a crude virtual switch or grab those events into another platform (graphana, nodered etc) but even with that off you get a running total runtime, total number of on/off cycles, and average length of cycle.
My intent is to set up 24/36/48 hour & 7 day timechecks where it uses the hutbitat scheduler to populate averages for those time periods vs just lifetime.
This is my initial sit down and write it upload, thus the [ALPHA] tag but it's so simplistic not having a parent/child app setup or anything complicated that it is pretty solid. I've got it tracking my gas fired boiler and my gas fired water heater, both reliably for the past few days.
Hope it helps someone, if you see any way to improve the code let me know, I appreciate all suggestions.