I need some help with my script.
I have a co2 meter and if the value is to high i want a lamp to turn red for 2 seconds. This lamp can be already on (white) or off. After the 2 sec i want the lamp back on his original state.
I tried this with this script:
Code: Select all
return {
on = { devices = { "CO2" }},
execute = function(domoticz, device)
Ikea = domoticz.devices(792)
if (domoticz.devices('CO2').co2 > 1250) then
Ikea.setColorBrightness(255, 0, 0).forSec(2)
end
end
}
Code: Select all
2019-11-03 10:53:31.897 Status: setcolbrightnessvalue: ID: 318, bri: 100, color: '{m: 3, RGB: ff0000, CWWW: 0000, CT: 0}'
2019-11-03 10:53:31.880 Error: dzVents: Error: (2.4.29) An error occurred when calling event handler Co2 test
2019-11-03 10:53:31.880 Error: dzVents: Error: (2.4.29) .../domoticz/scripts/dzVents/generated_scripts/Co2 test.lua:10: attempt to call field 'forSec' (a nil value)
Greets Gijs