i tried making a script which allows a dimmer switch control and dim a group.
simple on/off worked but i tried reading this script and use some things to let the group dim: https://www.domoticz.com/forum/viewtopi ... 28&t=23568
but unfortunately i get this error and i have no clue:
Code: Select all
2019-11-27 16:51:02.266 Error: dzVents: Error: (2.5.0) An error occurred when calling event handler knop group tk
2019-11-27 16:51:02.266 Error: dzVents: Error: (2.5.0) ...ticz/scripts/dzVents/generated_scripts/knop group tk.lua:14: attempt to index a nil value (field 'data')Code: Select all
return {
on = {
devices = {
'Tuinkamer licht'
}
},
execute = function(dz, device)
dz.log('Device ' .. device.name .. ' was changed', dz.LOG_INFO)
local switch = dz.devices("Tuinkamer licht")
local group = dz.groups("Tuinkamer licht")
if switch.state == "On" and switch.level > 0 then
dz.data.dimLevel = switch.level
group.switchOn()
group.dimTo(tonumber(dz.data.dimLevel))
elseif switch.state == "Off" then
group.switchOff()
end
end
}