filled in %
how many liters
I get the distance and percentage in domoticz, but i am not able to see the amount of liters.
i am using the following script
Code: Select all
return {
on = {
devices = {
'Niveau Regenwater'
},
},
logging = {
level = domoticz.LOG_INFO,
marker = "Converter"
},
execute = function(dz, item)
local inverted = false -- if max value of sensor should be reflected in 0% and minValue in 100%
local dataFromSensor = item.rawData[1]
local maxValue = 920
local minValue = 0
local decimals = 0
local percentage = ( dataFromSensor - minValue ) / ( maxValue - minValue ) * 1000
local liters = ( dataFromSensor * 0.92 )
if inverted then
percentage = 100 - percentage
end
local roundedPercentage = dz.utils.round(percentage,decimals )
local percentageDevice = dz.devices('Percentage IBC gevuld')
local roundedLiters = dz.utils.round(liters,decimals )
local litersDevice = dz.devices('Liters')
dz.log("Rounded percentage is " .. roundedPercentage .. "%")
percentageDevice.updatePercentage(roundedPercentage)
dz.log("Rounded liters is " .. roundedLiters .. "Ltr")
litersDevice.update(roundedLiters)
end
}
and that the amount of liters is: 19 Liter
but the value is not writen in the custom sensor
I hope somebody can help