Code: Select all
local sensorBuiten = "Temperatuur buiten"
local sensorBuitenBackup = "Temperatuur buiten tuin"
local sensorExtern = "KNMI - Temperatuur"
local sensorExternWind = "KNMI - Wind"
local sensorExternAlarm = "KNMI - Weeralarm"
return {
on = {
--timer = {'at 6:00'},
devices = { sensorExternAlarm },
timer = {'every minute'},
},
execute = function(domoticz)
local lastUpdate = domoticz.devices(sensorBuiten).lastUpdate.minutesAgo
local lastUpdateBackup = domoticz.devices(sensorBuitenBackup).lastUpdate.minutesAgo
local tempLokaal = -999
if (lastUpdate < lastUpdateBackup) then
if (lastUpdate < 30) then
tempLokaal = domoticz.helpers.round(domoticz.devices(sensorBuiten).temperature, 1)
end
else
if (lastUpdateBackup < 30) then
tempLokaal = domoticz.helpers.round(domoticz.devices(sensorBuitenBackup).temperature,1)
end
end
local tempExtern = domoticz.helpers.round(domoticz.devices(sensorExtern).temperature,1)
local tempExternGevoel = domoticz.helpers.round(domoticz.devices(sensorExternWind).chill,1)
local alarm = domoticz.devices(sensorExternAlarm).text
if (tempLokaal > -50) then
domoticz.notify(tempExtern.."C ("..tempExternGevoel.."), lokaal "..tempLokaal.."C", alarm, domoticz.PRIORITY_LOW, nil, nil, domoticz.NSS_FIREBASE_CLOUD_MESSAGING)
else
domoticz.notify(tempExtern.."C ("..tempExternGevoel..")", alarm, domoticz.PRIORITY_LOW, nil, nil, domoticz.NSS_FIREBASE_CLOUD_MESSAGING)
end
end
}
Code: Select all
2022-11-20 09:04:00.668 Error: dzVents: Error: (3.1.8) There is no device with that name or id: 761
2022-11-20 09:04:00.668 Error: dzVents: Error: (3.1.8) An error occurred when calling event handler ochtend
2022-11-20 09:04:00.668 Error: dzVents: Error: (3.1.8) /home/pi/domoticz/scripts/dzVents/scripts/ochtend.lua:32: attempt to index a nil value
2022-11-20 08:55:01.213 Error: dzVents: Error: (3.1.8) There is no device with that name or id: KNMI - Weeralarm
2022-11-20 08:55:01.213 Error: dzVents: Error: (3.1.8) An error occurred when calling event handler ochtend
2022-11-20 08:55:01.213 Error: dzVents: Error: (3.1.8) /home/pi/domoticz/scripts/dzVents/scripts/ochtend.lua:32: attempt to index a nil value
How is this possible?