round function does not seem to work
Posted: Thursday 29 September 2022 18:34
i have a simple program which checks certain temperature devices
somehow the round function does not work
instead of rounding the numbers they seem to be floating (13 digits)
so instead of 10,25 i get 10,2500012334467
somehow the round function does not work
instead of rounding the numbers they seem to be floating (13 digits)
so instead of 10,25 i get 10,2500012334467
Code: Select all
return {
on = {
devices = {'CV Status','CV Aanvoer', 'test'},
timer = {},
variables = {},
scenes = {},
groups = {},
security = {},
httpResponses = {},
shellCommandResponses = {},
customEvents = {},
system = {},
},
data = {},
logging = {},
execute = function(domoticz, device)
--local text = domoticz.devices('CV Status').text
local starttemp = domoticz.devices('Thermostaat-Temperatuur').temperature
local doeltemp = domoticz.devices('Thermostaat-Setpoint').temperature
local CVdelta = domoticz.devices('CV Delta').temperature
domoticz.utils.round(starttemp,2)
domoticz.utils.round(doeltemp,2)
domoticz.utils.round(CVdelta,2)
if (device.name == 'CV Status' and device.text == 'OpenTherm') then
domoticz.notify("Domoticz", "CV Aan".."\r\n".."Start Temperatuur:"..(starttemp).."˚C".."\r\n".."Doel Temperatuur :"..(doeltemp).."˚C", "telegram")
end
--if (device.name == 'CV Aanvoer' and device.temperature >= 45) then
if (device.name == 'test') then
domoticz.notify("Domoticz", "CV Delta:"..(CVdelta).."˚C", "telegram")
end
end
}