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
#1
Hi everyone!

I want to buy this DALI device: http://www.lunatone.com/produkt/dali-2xc...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
Reply
#2
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.
Reply
#3
(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
Reply
#4
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  })
Reply
#5
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
------------------------------
Ctrl+F5
Reply
#6
(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
Reply
#7
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
Reply
#8
Function for RGBW/RGBWAF Type 8 dimmer
Code:
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

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
Reply
#9
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
Reply
#10
(26.12.2018, 12:22)Snoolik Wrote: Function for RGBW/RGBWAF Type 8 dimmer
Code:
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

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

Hello and thanks for your efforts.
first in the setRGBWAF function what are (gateway, addr), and how to convert the 251.600 6 byte DALI RGBW data type to fit the function (r,g,b,w,a,f)

regards,
Best Regards,
Reply
#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
#12
(06.07.2021, 10:58)admin Wrote: 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)

thank you, admin 
Great
can I read the RGBW Status?
Best Regards,
Reply
#13
See this example: https://forum.logicmachine.net/showthrea...2#pid12902
Reply
#14
(06.07.2021, 11:35)admin Wrote: See this example: https://forum.logicmachine.net/showthrea...2#pid12902

thank you admin for your great help and effort.
I do it like this and its wok
if you have any comments Smile

RgbwSts = getRGBWAF(gateway, addr)

WriteValue = {}
WriteValue["red"] = RgbwSts[1]
WriteValue["white"] = RgbwSts[4]
WriteValue["blue"] = RgbwSts[3]
WriteValue["green"] = RgbwSts[2]


Also, I need the feedback for the on/off object and scale(0-100%)

regards,
Best Regards,
Reply
#15
See this: https://forum.logicmachine.net/showthrea...8#pid19988
Reply
#16
(07.07.2021, 14:39)admin Wrote: See this: https://forum.logicmachine.net/showthrea...8#pid19988

thank you, admin 

What is the right way to control a group of DALI Lights/short addresses at the same time?
Best Regards,
Reply
#17
See this: https://forum.logicmachine.net/showthread.php?tid=133
I also recommend looking into our CANx-DALI gateway. It provides most of the features you need via UI instead of scripts.
Reply
#18
(08.07.2021, 10:57)admin Wrote: See this: https://forum.logicmachine.net/showthread.php?tid=133
I also recommend looking into our CANx-DALI gateway. It provides most of the features you need via UI instead of scripts.

Thank you, admin 
I will, but for this project, we already bought the products and give a price for the customer, unfortunately we didn't test everything before Sad
Best Regards,
Reply


Forum Jump: