I currently have a string item that holds a “runtime” from my APC UPS and it looks something like this…
Can anyone suggest how I could convert this into something that could be visualised on a chart? I’m guessing I’d need to convert it into some sort of hours and decimals?
Change the Item to store the total minutes or seconds
Add a JS transformation to convert the total to the more readable hours minutes seconds
Persist and chart the total value
Here is a transform I use to convert minutes to dd:hh:mm
(function(i) {
if(isNaN(i)) return "NAN";
var mins = i%60
var totalhours = Math.floor(i/60)
var hours = totalhours%24
var days = Math.floor(totalhours/24)
var pad = "00";
return days+":"+(pad+hours).slice(-pad.length)+":"+(pad+mins).slice(-pad.length)+":00";
})(input)
Thanks guys, the UPS provides this data via the SNMP binding and from what I can see I can’t get the runtime in minutes… It just provides it as something like “6:02:00:00”.