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.
Here is a screen shot with the new pieces on it, if anyone is wondering what an example use case is, I'm monitoring how often my boiler is heating water for our house's heating system. I'm going to eventually contrast that with how often the circulation pump is running etc to make adjustments to things. Next up is running 24/48/7 day averages.
Anything that reports power, so for me that is some old centralite plugs that came with my original SmartThings hub, a Zen15 heavy duty power plug, and even a AEON Gen5 Home Energy Monitor with amp clamps. I believe nearly all my plug in controllers do this to some degree. Depending on what you're tyring to monitor you may want more or less sensitive power reporting (many are configurable) so you reduce chatter... Sorry that sounds complicated but it's not too bad, basically any smart plug with power reporting will get you there