Logic Machine Forum
DALI DT8 Dimmer - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Hardware (https://forum.logicmachine.net/forumdisplay.php?fid=12)
+--- Thread: DALI DT8 Dimmer (/showthread.php?tid=1698)



DALI DT8 Dimmer - managementboy - 06.11.2018

Hi everyone!

I want to buy this DALI device: http://www.lunatone.com/produkt/dali-2xcw-ww-led-dimmer-cv/ 
to dimm Tunable White LEDs strips.

it uses the DT8 protocol. Is it possible to run it with the new pre-release firmware of August?

How?

Cheers!

Elkin


RE: DALI DT8 Dimmer - admin - 08.11.2018

We don't have ballasts to test new DALI features, but the latest FW has support for raw telegrams which can be used to send any kind of DALI telegram. There's also an updated DALI package in the works which has new commands supported. We can provide it for you if you are willing to test it.


RE: DALI DT8 Dimmer - managementboy - 17.11.2018

(08.11.2018, 08:07)admin Wrote: We don't have ballasts to test new DALI features, but the latest FW has support for raw telegrams which can be used to send any kind of DALI telegram. There's also an updated DALI package in the works which has new commands supported. We can provide it for you if you are willing to test it.

OK, will buy the latest ballasts and we can test them together  Big Grin


RE: DALI DT8 Dimmer - AEK - 28.11.2018

Hi everyone!
i've made tests with Easydim DALI-MIX-DT8 dimmer and its work
you will need to install new dali package (Admin will provide soon)

to set color temp use following script
Code:
require('user.dali')
colortemp = 7000 -- in kelvin
address = 47
mirek = math.floor(1000000 / colortemp)
dtr0 = bit.band(mirek, 0xFF)
dtr1 = bit.band(bit.rshift(mirek, 8), 0xFF)


dalicmd(1, 'setdtr1', { value = dtr1 })
dalicmd(1, 'setdtr0', { value = dtr0 })
dalicmd(1, 'enabledevicetype', { value = 8 })
dalicmd(1, 'setcolortemp', { addrtype = 'short', address = address  })
dalicmd(1, 'enabledevicetype', { value = 8 })
dalicmd(1, 'activate', { addrtype = 'short', address = address })
to make light warmer use this
Code:
require('user.dali')
dalicmd(1, 'enabledevicetype', { value = 8 })
dalicmd(1, 'colortempwarmer', { addrtype = 'short', address = 47  })
cooler
Code:
require('user.dali')
dalicmd(1, 'enabledevicetype', { value = 8 })
dalicmd(1, 'colortempcooler', { addrtype = 'short', address = 47  })



RE: DALI DT8 Dimmer - Daniel. - 28.11.2018

Hi
Which DT8 control type did you use? As far I remember there are:
- color temperature in Kelvin
- XY coordinate
- RGBW
I'm guessing it is the color temperature.
BR


RE: DALI DT8 Dimmer - AEK - 28.11.2018

(28.11.2018, 10:12)Daniel. Wrote: Hi
Which DT8 control type did you use?  As far I remember there are:
- color temperature in Kelvin
- XY coordinate
- RGBW
I'm guessing it is the color temperature.
BR

this dimmer has cold white and warm white output only. so I use only temp color comands
I have another device DALI-ST-DT8 (RGBW dimmer) and I will try other comands with it.

before this I will try to set color limits


RE: DALI DT8 Dimmer - Snoolik - 19.12.2018

Some functions for Type 8 temperature control

Code:
function getCurrentTc(gateway, addr)
   code = 2 -- parameter code to get current Tc
   res, err = dalicmd(gateway, 'setdtr0', { addrtype = 'short', address = addr, value = code })
   if err then return nil, 'setdtr0 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, 'querycolorvalue', { addrtype = 'short', address = addr })
   if err then return nil, 'querycolorvalue error: ' .. err end
   hb = res:byte()
   res, err = dalicmd(gateway, 'querydtr0', { addrtype = 'short', address = addr })
   if err then return nil, 'querydtr0 error: ' .. err end
   lb = res:byte()
   mirek = bit.lshift(hb, 8) + lb
   tc = 1000000 / mirek
   return tc
end

function getCoolestTcLimit(gateway, addr)
   code = 128 -- parameter code to get coolest Tc limit
   res, err = dalicmd(gateway, 'setdtr0', { addrtype = 'short', address = addr, value = code })
   if err then return nil, 'setdtr0 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, 'querycolorvalue', { addrtype = 'short', address = addr })
   if err then return nil, 'querycolorvalue error: ' .. err end
   hb = res:byte()
   res, err = dalicmd(gateway, 'querydtr0', { addrtype = 'short', address = addr })
   if err then return nil, 'querydtr0 error: ' .. err end
   lb = res:byte()
   mirek = bit.lshift(hb, 8) + lb
   tc = 1000000 / mirek
   return tc
end

function getCoolestTcLimitPhys(gateway, addr)
   code = 129 -- parameter code to get coolest Tc physical limit
   res, err = dalicmd(gateway, 'setdtr0', { addrtype = 'short', address = addr, value = code })
   if err then return nil, 'setdtr0 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, 'querycolorvalue', { addrtype = 'short', address = addr })
   if err then return nil, 'querycolorvalue error: ' .. err end
   hb = res:byte()
   res, err = dalicmd(gateway, 'querydtr0', { addrtype = 'short', address = addr })
   if err then return nil, 'querydtr0 error: ' .. err end
   lb = res:byte()
   mirek = bit.lshift(hb, 8) + lb
   tc = 1000000 / mirek
   return tc
end

function getWarmestTcLimit(gateway, addr)
   code = 130 -- parameter code to get warmest Tc limit
   res, err = dalicmd(gateway, 'setdtr0', { addrtype = 'short', address = addr, value = code })
   if err then return nil, 'setdtr0 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, 'querycolorvalue', { addrtype = 'short', address = addr })
   if err then return nil, 'querycolorvalue error: ' .. err end
   hb = res:byte()
   res, err = dalicmd(gateway, 'querydtr0', { addrtype = 'short', address = addr })
   if err then return nil, 'querydtr0 error: ' .. err end
   lb = res:byte()
   mirek = bit.lshift(hb, 8) + lb
   tc = 1000000 / mirek
   return tc
end

function getWarmestTcLimitPhys(gateway, addr)
   code = 131 -- parameter code to get warmest Tc physical limit
   res, err = dalicmd(gateway, 'setdtr0', { addrtype = 'short', address = addr, value = code })
   if err then return nil, 'setdtr0 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, 'querycolorvalue', { addrtype = 'short', address = addr })
   if err then return nil, 'querycolorvalue error: ' .. err end
   hb = res:byte()
   res, err = dalicmd(gateway, 'querydtr0', { addrtype = 'short', address = addr })
   if err then return nil, 'querydtr0 error: ' .. err end
   lb = res:byte()
   mirek = bit.lshift(hb, 8) + lb
   tc = 1000000 / mirek
   return tc
end

function setWarmestTcLimit(gateway, addr, tc)
   code = 1 -- parameter code to set warmest Tc limit
   res, err = dalicmd(gateway, 'setdtr2', { addrtype = 'short', address = addr, value = code })
   if err then return nil, 'setdtr2 error: ' .. err end
   mirek = math.floor(1000000 / tc)
   dtr0 = bit.band(mirek, 0xff)
   dtr1 = bit.rshift(bit.band(mirek, 0xff00), 8)
   res, err = dalicmd(gateway, 'setdtr0', { addrtype = 'short', address = addr, value = dtr0 })
   if err then return nil, 'setdtr2 error: ' .. err end
   res, err = dalicmd(gateway, 'setdtr1', { addrtype = 'short', address = addr, value = dtr1 })
   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, 'storecolortemplimit', { addrtype = 'short', address = addr })
   if err then return nil, 'storecolortemplimit error: ' .. err end
   res, err = dalicmd(gateway, 'storecolortemplimit', { addrtype = 'short', address = addr })
   return res, err
end

function setCoolestTcLimit(gateway, addr, tc)
   code = 0 -- parameter code to set coolest Tc limit
   res, err = dalicmd(gateway, 'setdtr2', { addrtype = 'short', address = addr, value = code })
   if err then return nil, 'setdtr2 error: ' .. err end
   mirek = math.floor(1000000 / tc)
   dtr0 = bit.band(mirek, 0xff)
   dtr1 = bit.rshift(bit.band(mirek, 0xff00), 8)
   res, err = dalicmd(gateway, 'setdtr0', { addrtype = 'short', address = addr, value = dtr0 })
   if err then return nil, 'setdtr2 error: ' .. err end
   res, err = dalicmd(gateway, 'setdtr1', { addrtype = 'short', address = addr, value = dtr1 })
   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, 'storecolortemplimit', { addrtype = 'short', address = addr })
   if err then return nil, 'storecolortemplimit error: ' .. err end
   res, err = dalicmd(gateway, 'storecolortemplimit', { addrtype = 'short', address = addr })
   return res, err
end

function saveSceneTc(gateway, addr, tc, arc_level, scene)
   -- Save scene with saved Tc and Arc level
   mirek = math.floor(1000000/tc)
   dtr0 = bit.band(mirek, 0xff)
   dtr1 = bit.rshift(bit.band(mirek, 0xff00), 8)
   res, err = dalicmd(gateway, 'setdtr1', { addrtype = 'short', address = addr, value = dtr1 })
   if err then return nil, 'setdtr1 tc error: ' .. err end
   res, err = dalicmd(gateway, 'setdtr0', { addrtype = 'short', address = addr, value = dtr0 })
   if err then return nil, 'setdtr0 tc 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, 'setcolortemp', { addrtype = 'short', address = addr })
   if err then return nil, 'setcolortemp error: ' .. err end
   res, err = dalicmd(gateway, 'setdtr0', { addrtype = 'short', address = addr, value = arc_level })
   if err then return nil, 'setdtr0 arc_level error: ' .. err end
   res, err = dalicmd(gateway, 'storescene', { addrtype = 'short', address = addr, value = scene })
   if err then return nil, 'storescene error: ' .. err end
   res, err = dalicmd(gateway, 'storescene', { addrtype = 'short', address = addr, value = scene })
   if err then return nil, 'storescene error: ' .. err end
   return res, err
end

function getSupportedColorTypeFeatures(gateway, addr)
   -- Get supported color type features
   -- Return pattern:
   -- If successful:
   -- xy - 0/1, unsupported/supported
   -- tc - 0/1, unsupported/supported
   -- direct - 0-5, how much channels support direct control
   -- rgbwaf - 0-5, how much rgbwaf channels
   -- else: nil, Command name with error
   res, err = dalicmd(gateway, 'enabledevicetype', { addrtype = 'short', address = addr, value = 8 })
   if err then return nil, 'enabledevicetype error: ' .. err end
   res, err = dalicmd(gateway, 'querycolorfeatures', { addrtype = 'short', address = addr })
   if err then return nil, 'querycolorfeatures error: ' .. err end
   res = res:byte()
   xy = bit.band(res, 0x01)
   tc = bit.rshift(bit.band(res, 0x02), 1)
   direct = bit.rshift(bit.band(res, 0x1c), 2)
   rgbwaf = bit.rshift(bit.band(res, 0xe0), 5)
   return xy, tc, direct, rgbwaf
end

function getSceneTc(gateway, addr, scene)
   res, err = dalicmd(gateway, 'queryscene', { addrtype = 'short', address = addr, value = scene })
   if err then return nil, 'queryscene error: ' .. err end
   arc_level = res:byte()
   code = 226 -- parameter code to get scene Tc
   res, err = dalicmd(gateway, 'setdtr0', { addrtype = 'short', address = addr, value = code })
   if err then return nil, 'setdtr0 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, 'querycolorvalue', { addrtype = 'short', address = addr })
   if err then return nil, 'querycolorvalue error: ' .. err end
   hb = res:byte()
   res, err = dalicmd(gateway, 'querydtr0', { addrtype = 'short', address = addr })
   if err then return nil, 'querydtr0 error: ' .. err end
   lb = res:byte()
   mirek = bit.lshift(hb, 8) + lb
   tc = 1000000 / mirek
   return arc_level, tc
end



RE: DALI DT8 Dimmer - Snoolik - 26.12.2018

Function for RGBW/RGBWAF Type 8 dimmer
Code:
function setRGBWAF(gateway, addr, r, g, b, w, a, f)
   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

function saveSceneRGBWAF(gateway, addr, scene, arc_level, 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
    if arc_level == nil then arc_level = 254 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, 'setdtr0', { addrtype = 'short', address = addr, value = arc_level })
    if err then return nil, 'setdtr0 error: ' .. err end
    res, err = dalicmd(gateway, 'storescene', { addrtype = 'short', address = addr, value = scene })
    if err then return nil, 'storescene error: ' .. err end
    res, err = dalicmd(gateway, 'storescene', { addrtype = 'short', address = addr, value = scene })
    return res, err
end



RE: DALI DT8 Dimmer - Snoolik - 08.05.2019

Functions to get current RGBWAF:

Code:
function getChannel(gateway, addr, code)
 res, err = dalicmd(gateway, 'setdtr0', { addrtype = 'short', address = addr, value = code })
 if err then return nil, 'setdtr0 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, 'querycolorvalue', { addrtype = 'short', address = addr })
 return res, err
end

function getRGBWAF(gateway, addr)
 -- codes for RGBWAF could be 233-237 or 227-232
 res_t = {}
 for i = 233, 237, 1 do
   res, err = getChannel(gateway, addr, i)
   if res then table.insert(res_t, res:byte()) end
 end
 return res_t
end