Page 1 of 1

dummy incremental counter for time

Posted: Tuesday 09 April 2024 12:23
by mancide
Hi,

I'm trying to measure the uptime/runtime of a device.

I have found this one: https://www.domoticz.com/forum/viewtopic.php?t=23713
which is close but it still not good enough.
The above script has:
- a resolution of hours. I would like to keep my seconds resolution.
- I use the power updates to calculate the uptime (I can differentiate between standby-power en running power)


1) my device has a wallplug with a switch and a power meter.
2) the device switches itself on/off from time to time
3) I monitor the power updates from the wallplug to measure the time the device is running
power: 0=>200Watt device start
power: 200=>205Watt
power: 205=>203 Watt
power: 203=>0 Watt device stopped after x seconds...
so I already have the runtime in seconds now.
I store this in an virtual incremental counter.
This works well but I get very big values.
I tried:
A) setting the divider to 3600. This displays the time in hours but I get a number with 8 decimal digits...
2024-04-09 uptime counter.png
2024-04-09 uptime counter.png (30.98 KiB) Viewed 291 times
Is there a way to round this?

B) Is there a way to let the incremental counter display the seconds as HH:MM:SS?

C) I tried setting the incremental counter "Type" to "Time", but then I only get a "?"

D) Is it possible to reset an incremental counter to 0 when I replace my UV bulb?

Re: dummy incremental counter for time

Posted: Tuesday 09 April 2024 14:26
by waltervl
In that same topic there is another script that has the ability to switch between seconds, minutes and hours: https://www.domoticz.com/forum/viewtopi ... 39#p221939