dummy incremental counter for time

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
mancide
Posts: 29
Joined: Wednesday 17 May 2017 0:18
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.6
Location: Belgium - Ghent
Contact:

dummy incremental counter for time

Post 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 290 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?
Raspberry Pi 3B v1.3 - 16GB SDcard - Raspbian Bullseye
Aeotec Z-Stick Gen5 (ZW090) -> Z-Wave JS UI -> mosquitto
RFXCOM RFXtrx433E
Unifi controller -> Domoticz-Unifi-Presence plugin
Nest thermostat
SAJ solar convertor
Smart Gateway Gas/water meter
User avatar
waltervl
Posts: 5846
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: dummy incremental counter for time

Post 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
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest