Little help with script for CO2
Posted: Sunday 18 August 2019 20:53
Hi
I am no progammer and can use a little help with this script
The idea is that my ikea lamp turns red when co2 is to high.
I have made this script
But i get errors in the log.
What is wrong in the script?
Greets Gijs
I am no progammer and can use a little help with this script
The idea is that my ikea lamp turns red when co2 is to high.
I have made this script
Code: Select all
return {
on = { devices = { "CO2" }},
execute = function(domoticz, device)
Ikea = domoticz.devices(792)
if (domoticz.devices('CO2').CO2 > 800) then
Ikea.setColorBrightness(100, 100, 5)
else
Ikea.switchOff()
end
end
}
Code: Select all
2019-08-18 20:42:35.413 (Netatmo) Air Quality (CO2)
2019-08-18 20:42:35.419 (Netatmo) General/Sound Level (DB)
2019-08-18 20:42:35.773 Status: dzVents: Info: Handling events for: "CO2", value: "617"
2019-08-18 20:42:35.773 Status: dzVents: Info: ------ Start internal script: CO2: Device: "CO2 (Netatmo)", Index: 854
2019-08-18 20:42:35.775 Status: dzVents: Info: ------ Finished CO2
2019-08-18 20:42:35.775 Error: dzVents: Error: (2.4.28) An error occurred when calling event handler CO2
2019-08-18 20:42:35.775 Error: dzVents: Error: (2.4.28) /home/pi/domoticz/scripts/dzVents/generated_scripts/CO2.lua:8: attempt to compare number with nil
Greets Gijs