The “bad” part is, that I am not using those numbers at all in HomeHabit, so it is requesting them and then probably storing the value in the internal database (the database that really should not be updated for openHAB values in the first place, it causes soo much disk/flash I/O for items that aren’t even used in HomeHabit, while the value could be requested when it’s needed, for example when a new item is used/added). I have more than 2000 items (and I expect to add a few more hundreds soon that are frequently updating), fortunately only a few use the transformedState
, otherwise the traffic would be huge and HomeHabit would probably start lagging again…
It is a javascript transformation used to turn seconds into hh:mm:ss, looks like this:
Number OperatingSeconds "Duration [JS(seconds_to_time.js):%s]" {channel="XXXXX"}
and the JS for transformation is this;
(function(seconds) {
var retval = "";
var hours = Math.floor(seconds / (60 * 60));
seconds = seconds % (60 * 60);
var minutes = Math.floor(seconds / (60));
seconds = seconds % (60);
if (hours > 0) {
retval = hours + ":";
}
if (minutes < 10 && retval != "") {
retval = retval + "0" + minutes + ":";
}
else {
if(retval != "" || minutes > 0) {
retval = retval + minutes + ":";
}
}
if (seconds < 10 && retval != "") {
retval = retval + "0" + seconds;
}
else {
if(retval != "") {
retval = retval + seconds;
} else {
retval = retval + seconds + "s";
}
}
return retval;
})(input)