Actually I want to use a gas sensor (or a RFX sensor). I tried to update these sensors with
Code: Select all
domoticz.devices('Gas per graaddag').updateGas(GasUsageperDegreesday)
Can anyone help me to update the daily usage?
Code: Select all
return {
on = { timer = { "at 23:58"}},
execute = function(domoticz)
local Date = domoticz.time.year..domoticz.time.month..domoticz.time.day
local meantempOutside = domoticz.devices('Gemiddelde Temp buiten').temperature
local baseTemp = 18
local factor = 1
local degreesday = baseTemp - meantempOutside
if (domoticz.time.month >= 4 and domoticz.time.month <= 9) then factor = 0.8 end
if (domoticz.time.month >= 11 or domoticz.time.month <= 2) then factor = 1.1 end
degreesdays = degreesday * factor
local GasUsage = domoticz.devices('Gas').counterToday
local GasUsageperDegreesday = domoticz.round((GasUsage / degreesdays),3)
if (degreesday <= 0) then
degreesdays = 0
GasUsageperDegreesday = 0
end
domoticz.log('Gemiddelde temperatuur buiten (laatste 24u): '..meantempOutside)
domoticz.log('Gasverbruik vandaag: '..GasUsage..' m3')
domoticz.log('Aantal graaddagen: '..degreesdays)
domoticz.log('Gasverbruik: '..GasUsageperDegreesday..' m3 per graaddag')
domoticz.devices('Gas per graaddag').updateCustomSensor(GasUsageperDegreesday)
end
}