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.

Convert RGBW 1byte in to DT8 object
#1
Hello Dears,
I want to create a script that convert 4x1byte objects in to 1 DT8 object.
but how to avoid multiple write to the DALI: like if the 4 RGBW objects changed this will trigger 4 DT8 Commands to the DALI Bus!

Could you share a script considering this case.
Best Regards,
Reply
#2
Use a single event script for all 4 objects via a common tag. Set execution mode to "Last instance only". Add a small delay before writing to the RGBW object.
Reply
#3
thanks 
could you share a starting example
also how to read the GA name from script?
Best Regards,
Reply
#4
Adjust sleep time as needed. Higher value will prevent duplicate messages but will add a visible delay to the light changes. Separate script is needed for each R/G/B/W + RGBW objects.
Code for 6 byte DALI RGBW output object:
Code:
os.sleep(0.5)

value = {
  red = grp.getvalue('1/1/1') * 2.55,
  green = grp.getvalue('1/1/2') * 2.55,
  blue = grp.getvalue('1/1/3') * 2.55,
  white = grp.getvalue('1/1/4') * 2.55,
}

grp.write('1/1/5', value)

Use this to find the source object name:
Code:
obj = grp.find(event.dst)
log(obj.name)
Reply
#5
Thank you admin
Very helpful
Best Regards,
Reply
#6
Dear admin
If I want to convert from DT8 to R,G,B,W 1byte for status feedback, Should I divide by 2.55?
Best Regards,
Reply
#7
Yes, if 1 byte objects use scale (0..100) data type.
Reply
#8
(19.04.2023, 07:41)admin Wrote: Yes, if 1 byte objects use scale (0..100) data type.

I use 1byte unsigned integer not scale, so do I need to multiple and divide by 2.55 in both Control and status scripts?
or should I use the scale object instead?
Best Regards,
Reply
#9
DALI RGBW data type uses 0..255 range for each channel. If you 1 byte objects use the same range then you don't have to divide or multiply.
Reply


Forum Jump: