[Solved] Need some help with a script [Solved]
Posted: Friday 30 October 2020 20:48
Hello,
I need some help in finding a mistake in this script:
It's purpose is to determine if a gas heater is working, based on differences in temperature readings. A sensor is updated every 10 seconds and the script is called. On first run it should put a reading into temperature variable. On second run it should only increase run counter. On the third run it should cmpare past reading to present one, change a variable and reset run counter.
It runs OK, does not report any errors but for some reason noting printed to log apart from information about script being processed. And variable is not updated.
Regards,
I need some help in finding a mistake in this script:
Code: Select all
return
{
on =
{
devices =
{
"Bufor - GÓRA",
},
},
data =
{
count =
{
initial = 0,
},
temp =
{
initial = 0,
},
},
logging =
{
level = domoticz.LOG_DEBUG,
marker = 'nagrzewaniePiecem',
},
execute = function(domoticz)
if domoticz.data.count == 0 then
domoticz.data.temp = domoticz.devices("Bufor - GÓRA").temperature
domoticz.data.count = domoticz.data.count + 1
domoticz.notify('0')
elseif domoticz.data.count > 0 and domoticz.data.count < 2 then
domoticz.data.count = domoticz.data.count + 1
domoticz.notify('1')
elseif domoticz.data.count == 2 then
local ratio = domoticz.devices("Bufor - GÓRA").temperature - domoticz.data.temp
domoticz.notify('2')
if ratio > 0.3 and ratio < 5 then
domoticz.variables("nagrzewanie_piecem").set(1)
else
domoticz.variables("nagrzewanie_piecem").set(0)
end
domoticz.data.count = 0
end
end
}
It runs OK, does not report any errors but for some reason noting printed to log apart from information about script being processed. And variable is not updated.
Regards,