This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

DALI DT8 Dimmer
#11
Use this, change gateway number and short address as needed:
Code:
gateway = 'internal'
addr = 12

require('user.dali')
value = event.getvalue()

function setRGBWAF(gateway, addr, r, g, b, w, a, f)
    if r == nil then r = 0 end
    if g == nil then g = 0 end
    if b == nil then b = 0 end
    if w == nil then w = 0 end
    if a == nil then a = 0 end
    if f == nil then f = 0 end
    res, err = dalicmd(gateway, 'setdtr0', { addrtype = 'short', address = addr, value = math.min(r, 254) })
    if err then return nil, 'setdtr0 error: ' .. err end
    res, err = dalicmd(gateway, 'setdtr1', { addrtype = 'short', address = addr, value = math.min(g, 254) })
    if err then return nil, 'setdtr1 error: ' .. err end
    res, err = dalicmd(gateway, 'setdtr2', { addrtype = 'short', address = addr, value = math.min(b, 254) })
    if err then return nil, 'setdtr2 error: ' .. err end
    res, err = dalicmd(gateway, 'enabledevicetype', { addrtype = 'short', address = addr, value = 8 })
    if err then return nil, 'enabledevicetype error: ' .. err end
    res, err = dalicmd(gateway, 'setrgbdimlevel', { addrtype = 'short', address = addr })
    if err then return nil, 'setrgbdimlevel error: ' .. err end
    res, err = dalicmd(gateway, 'setdtr0', { addrtype = 'short', address = addr, value = math.min(w, 254) })
    if err then return nil, 'setdtr0 error: ' .. err end
    res, err = dalicmd(gateway, 'setdtr1', { addrtype = 'short', address = addr, value = math.min(a, 254) })
    if err then return nil, 'setdtr1 error: ' .. err end
    res, err = dalicmd(gateway, 'setdtr2', { addrtype = 'short', address = addr, value = math.min(f, 254) })
    if err then return nil, 'setdtr2 error: ' .. err end
    res, err = dalicmd(gateway, 'enabledevicetype', { addrtype = 'short', address = addr, value = 8 })
    if err then return nil, 'enabledevicetype error: ' .. err end
    res, err = dalicmd(gateway, 'setwafdimlevel', { addrtype = 'short', address = addr })
    if err then return nil, 'setwafdimlevel error: ' .. err end
    res, err = dalicmd(gateway, 'enabledevicetype', { addrtype = 'short', address = addr, value = 8 })
    if err then return nil, 'enabledevicetype error: ' .. err end
    res, err = dalicmd(gateway, 'activate', { addrtype = 'short', address = addr })
    return res, err
end

setRGBWAF(gateway, addr, value.red, value.green, value.blue, value.white)
Reply


Messages In This Thread
DALI DT8 Dimmer - by managementboy - 06.11.2018, 15:55
RE: DALI DT8 Dimmer - by admin - 08.11.2018, 08:07
RE: DALI DT8 Dimmer - by managementboy - 17.11.2018, 13:39
RE: DALI DT8 Dimmer - by AEK - 28.11.2018, 09:19
RE: DALI DT8 Dimmer - by Daniel - 28.11.2018, 10:12
RE: DALI DT8 Dimmer - by AEK - 28.11.2018, 10:28
RE: DALI DT8 Dimmer - by Snoolik - 19.12.2018, 12:16
RE: DALI DT8 Dimmer - by Snoolik - 26.12.2018, 12:22
RE: DALI DT8 Dimmer - by khalil - 06.07.2021, 09:58
RE: DALI DT8 Dimmer - by Snoolik - 08.05.2019, 09:48
RE: DALI DT8 Dimmer - by admin - 06.07.2021, 10:58
RE: DALI DT8 Dimmer - by khalil - 06.07.2021, 11:25
RE: DALI DT8 Dimmer - by admin - 06.07.2021, 11:35
RE: DALI DT8 Dimmer - by khalil - 07.07.2021, 14:37
RE: DALI DT8 Dimmer - by admin - 07.07.2021, 14:39
RE: DALI DT8 Dimmer - by khalil - 08.07.2021, 10:52
RE: DALI DT8 Dimmer - by admin - 08.07.2021, 10:57
RE: DALI DT8 Dimmer - by khalil - 08.07.2021, 11:23

Forum Jump: