Below is the error and script.
It looks likes the if then statement is comparing a number with a string. But according to the documentation the Device.lux is a number and not a string.
Appreciate any help.
<br/>
2017-09-28 08:18:00.322 dzVents: Info: ------ Start internal script: Lux_Meter:, trigger: every 1 minutes<br/>
2017-09-28 08:18:00.347 dzVents: Info: 3.62<br/>
2017-09-28 08:18:00.348 dzVents: Info: On<br/>
2017-09-28 08:18:00.348 Error: dzVents: Error: An error occured when calling event handler Lux_Meter<br/>
2017-09-28 08:18:00.348 Error: dzVents: Error: ...m Files (x86)\Domoticz\scripts\dzVents\runtime/Utils.lua:61: attempt to compare string with number<br/>
2017-09-28 08:18:00.348 dzVents: Info: ------ Finished Lux_Meter<br/>
2017-09-28 08:18:00.349 EventSystem: Script event triggered: y:\Program Files (x86)\Domoticz\scripts\dzVents\runtime\dzVents.lua</r>
Code: Select all
</s>return {
-- 'active' controls if this entire script is considered or not
active = true, -- set to false to disable this script
-- trigger
-- can be a combination:
on = {
timer = {
-- timer triggers.. if one matches with the current time then the script is executed
'every 1 minutes'
}
},
-- actual event code
-- in case of a timer event or security event, device == nil
execute = function(domoticz, device)
local myDevice1 = domoticz.devices('LUX Meter')
local myDevice2 = domoticz.devices('ALLES AAN REMOTE')
domoticz.log(myDevice1.lux)
domoticz.log(myDevice2.state)
if (myDevice1.lux < 21 ) then
myDevice2.switchOn()
domoticz.log('Light info', 'The light ' .. myDevice2.name .. ' will be switched on due to LUX')
end
end
}