Code: Select all
return {
on = {
timer ={
"every minute"
}
},
execute = function(dz, device)
local sensor = dz.devices("Grondvochtigheid voortuin")
local nachtmodus = dz.devices("nachtmodus")
local programma = dz.devices("Sproeier programma")
local forecast = dz.devices("Buienradar - Rain forecast [0-255]")
if sensor < 50 and nachtmodus == "On" and forecast < 15 then
programma.dimTo(20)
end
end
}nachtmodus switches on when everyone gets to bed so no one is walking outside and can get potentially wet. and forecast is an buienradar sensor which seems to say how likely it is to be raining soon and how much. my sensor is a inductive water sensor connected to an nodemcu analog pin and it feeds to a custom sensor:

well it is not perfect with the percentage but it gives a good indication.
only i get this error in my log, am i doing something wrong?
Code: Select all
2019-06-07 19:00:00.294 Status: dzVents: Info: ------ Start internal script: Automate Irrigatie:, trigger: every minute
2019-06-07 19:00:00.300 Status: dzVents: Error (2.4.19): An error occured when calling event handler Automate Irrigatie
2019-06-07 19:00:00.300 Status: dzVents: Error (2.4.19): ...scripts/dzVents/generated_scripts/Automate Irrigatie.lua:14: attempt to compare table with number
2019-06-07 19:00:00.300 Status: dzVents: Info: ------ Finished Automate Irrigatie