Logic Machine Forum
RGB 3 x 1 byte absolute % dimming from KNX - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: RGB 3 x 1 byte absolute % dimming from KNX (/showthread.php?tid=4052)



RGB 3 x 1 byte absolute % dimming from KNX - alexll - 21.05.2022

Hi there! 

I'm trying to absolute % dimming a RGB LED strip connected to a DALCNET DALI controller from a KNX Schneider Multitouch Pro device. I'm using an ABB DALI-KNX gateway to control it.

Every colour is in 1 byte KNX object (R 1byte - G 1byte - B 1byte) and I understand that, at first, I should have convert it to HSV just to modify the "V" value, isn't it? And well, obviously I should have convert it back again to RGB.

I'm trying to do it but I can't find the exact script in the forum. Can you help me, please? Thanks in advance!  [Image: rolleyes.png]


RE: RGB 3 x 1 byte absolute % dimming from KNX - Sral1987 - 22.05.2022

Use Scenes in your ABB DALI Gateway

Multitouch pro use Scene Adress to set Color. No need for LM. Absolut dimming won´t Work.


RE: RGB 3 x 1 byte absolute % dimming from KNX - alexll - 22.05.2022

I’m just using that and it works well. But what I’m looking for is a way to dimmimg the intensity of the selected colour sending an absolute % value.


RE: RGB 3 x 1 byte absolute % dimming from KNX - Sral1987 - 22.05.2022

Change to HSV mode on your Gateway. User V to Dimm your Color 0-100 %


RE: RGB 3 x 1 byte absolute % dimming from KNX - alexll - 22.05.2022

(22.05.2022, 11:24)Sral1987 Wrote: Change to HSV mode on your Gateway. User V to Dimm your Color 0-100 %

As I said in the main post, I can't do that because the DALI controller identifies every RGB color as an individual channel. At the KNX side I have 3 x 1 byte object which I'm mixing in my LogicMachine.


RE: RGB 3 x 1 byte absolute % dimming from KNX - Sral1987 - 23.05.2022

Have you done the Latest update to your DALI Gateway ? It´s V2.0. From there you are able to select the template Color control in RGB or then HSV. Is your RGB/Dali Controller able to do DT8 ?


RE: RGB 3 x 1 byte absolute % dimming from KNX - alexll - 23.05.2022

(23.05.2022, 05:18)Sral1987 Wrote: Have you done the Latest update to your DALI Gateway ? It´s V2.0. From there you are able to select the template Color control in RGB or then HSV.  Is your RGB/Dali Controller able to do DT8 ?

That's the problem. That RGB Controller only shows the R, G and B colours as individual ballasts, so my ABB DALI gateway detects them in this way  Undecided .


RE: RGB 3 x 1 byte absolute % dimming from KNX - admin - 23.05.2022

Attach an event script to a 251.600 6 byte DALI RGBW object. The RGB part will control the color, W part will be the output brightness. Change R/G/B output addresses as needed.

Code:
value = event.getvalue()

max = math.max(1, value.red, value.green, value.blue)
mult = value.white / max

red = math.round(value.red * mult)
green = math.round(value.green * mult)
blue = math.round(value.blue * mult)

grp.write('1/1/3', red, dt.uint8)
grp.write('1/1/4', green, dt.uint8)
grp.write('1/1/5', blue, dt.uint8)



RE: RGB 3 x 1 byte absolute % dimming from KNX - alexll - 23.05.2022

(23.05.2022, 07:00)admin Wrote: Attach an event script to a 251.600 6 byte DALI RGBW object. The RGB part will control the color, W part will be the output brightness. Change R/G/B output addresses as needed.

Code:
value = event.getvalue()

max = math.max(1, value.red, value.green, value.blue)
mult = value.white / max

red = math.round(value.red * mult)
green = math.round(value.green * mult)
blue = math.round(value.blue * mult)

grp.write('1/1/3', red, dt.uint8)
grp.write('1/1/4', green, dt.uint8)
grp.write('1/1/5', blue, dt.uint8)

So I understand that, first, I have to convert/combine my 3 x 1 byte RGB objects + 1 byte dimming value into a 6 bytes object just to run this script, isn't it? Can you help me to do it? Thank you!


RE: RGB 3 x 1 byte absolute % dimming from KNX - admin - 23.05.2022

You can simply create new 6 byte object and use it in the visualization.


RE: RGB 3 x 1 byte absolute % dimming from KNX - alexll - 23.05.2022

(23.05.2022, 09:11)admin Wrote: You can simply create new 6 byte object and use it in the visualization.

Sorry admin, but my problem is that my client has a KNX touch panel (Multitouch KNX Pro by Schneider) that only admits absolute % dimming, so I need to send % 1 byte value to LogicMachine and "insert" it into your 6 byte RGBW object  Sad


RE: RGB 3 x 1 byte absolute % dimming from KNX - admin - 23.05.2022

Add to common functions:
Code:
function rgbdim(config)
  local red = grp.getvalue(config.in_red)
  local green = grp.getvalue(config.in_green)
  local blue = grp.getvalue(config.in_blue)
  local level = grp.getvalue(config.in_level)

  local max = math.max(1, red, green, blue)
  local mult = level / max

  red = math.round(red * mult)
  green = math.round(green * mult)
  blue = math.round(blue * mult)
    
  grp.write(config.out_red, red, dt.scale)
  grp.write(config.out_green, green, dt.scale)
  grp.write(config.out_blue, blue, dt.scale)
end

Add a common tag to 4 input objects (red, green, blue, level) and attach event script to this tag. Change group addresses as needed. Make sure that output objects are not tagged with the same tag or you will get an infinite loop. All objects should have 1 byte scaled data type.
Code:
rgbdim({
  in_red = '32/1/12',
  in_green = '32/1/13',
  in_blue = '32/1/14',
  in_level = '32/1/15',
  out_red = '32/1/16',
  out_green = '32/1/17',
  out_blue = '32/1/18',
})



RE: RGB 3 x 1 byte absolute % dimming from KNX - alexll - 23.05.2022

(23.05.2022, 09:51)admin Wrote: Add to common functions:
Code:
function rgbdim(config)
  local red = grp.getvalue(config.in_red)
  local green = grp.getvalue(config.in_green)
  local blue = grp.getvalue(config.in_blue)
  local level = grp.getvalue(config.in_level)

  local max = math.max(1, red, green, blue)
  local mult = level / max

  red = math.round(red * mult)
  green = math.round(green * mult)
  blue = math.round(blue * mult)
    
  grp.write(config.out_red, red, dt.scale)
  grp.write(config.out_green, green, dt.scale)
  grp.write(config.out_blue, blue, dt.scale)
end

Add a common tag to 4 input objects (red, green, blue, level) and attach event script to this tag. Change group addresses as needed. Make sure that output objects are not tagged with the same tag or you will get an infinite loop. All objects should have 1 byte scaled data type.
Code:
rgbdim({
  in_red = '32/1/12',
  in_green = '32/1/13',
  in_blue = '32/1/14',
  in_level = '32/1/15',
  out_red = '32/1/16',
  out_green = '32/1/17',
  out_blue = '32/1/18',
})

Incredible! Thank you so much!  Heart