Till recently the 2 lua-functions below helped me
Code: Select all
local function Round(num, idp)
return tonumber(string.format("%." ..(idp or 0).. "f", num))
end
function round(num, dec)
if num == 0 then
return 0
else
local mult = 10^(dec or 0)
return math.floor(num * mult + 0.5) / mult
end
end
Now these scripts react differently.
For the fresh install the Round-functions get confronted with num = nil => error-report
Obviously a nil-check should proceed the calling of the Round-function, but in the fresh install that does not happen for unknown reasons.
If calling the Round-function with a valid value num, for idp=0 or for dec=0 still 1 decimal appears.
Checking with slightly earlier versions of Buster+Domoticz, the same effect visible for the decimals.
Somebody knowing a solution?
Something related with the upgrade of lua?