rs485-lpc/lpc_serial_lx2.lua

23 lines
491 B
Lua
Raw Permalink Normal View History

local tv = get_trigger_variable(1)
if tv == nil then return end
local lux = tv.integer
if lux == nil then return end
if lux < 0 then lux = 0 end
if lux > 200000 then lux = 200000 end
local level = 0
if lux > 0 then
level = math.log(lux + 1) / math.log(200001)
end
if level > 1 then level = 1 end
local ok, grp = pcall(get_group, 0)
if not ok or grp == nil then
ok, grp = pcall(get_group, 'All Fixtures')
end
if ok and grp ~= nil then
grp:set_master_intensity(level, 0.5)
end