Collecting usage time

I have a machine that goes on and off on an irregular basis.
I want to collect the accumulated time it’s on and I can see a few ways of doing that.
Any recommendations?

Hi Lars,

The best thing to do would be to use this API:

Then, you can use it to calculate the total time your device was online.

It’s not when it was on line or not. It’s the accumulated time a pressure sensor sees a certain pressure.
Electrically and connectivity wise it’s always on.

Hi @Lars_Andersson,

The way I would solve this is to first store the time once the value is above the threshold you set; you can store this time in workflow storage or within an attribute, whichever you prefer. Then, once the time has dipped back below the threshold, do a comparison of these times and get the difference. You can then store this time value in a device attribute, individually as one single time, or you could do a cumulative count within the attribute.

Let me know if this meets your requirements!
Julia

I’ve done it that way now.
Sure would be nice to have a “run time counter” as a workflow node…