Here are the calculations for each byte.
Byte1: Color
hue wheel - Set in byte 4 (colors ranging from 0 to 360)
Click here to pick your color, look at the HSL field and pull the first number.
calculation:
byte1 = h / 360 * 255
color temp - Set in byte 4 (temps range from 2700 to 6500)
calculation:
byte1 = (temp - 2700) / (6500-2700) * 255
Byte2: Color Level (brightness)
Brightness in increments of 10% (levels 1 - 10)
calculation:
byte2 = level * 256
If you want to set this between 0 and 99, it gets tricky, but this is the calcuation:
byte2 = 32768 + level * 256
Byte3: Duration
This can only be set in increments of 0 - 60 seconds, 0 to 60 minutes, 0 to 60 hours, or forever. You cannot mix and match minutes, seconds, or hours. They are mutually exclusive.
0 - 60 seconds
byte3 = 65536 * seconds
0 - 60 minutes
byte3 = 65536 * (minutes + 60)
0 - 60 hours
byte3 = 65536 * (hours + 120)
forever
byte3 = 16711680
Byte4: Effect & Color Type
This byte also effects Byte1. Use the appropriate calculation. If color type is set to 0
, use the hue wheel equation. If color type is set to 1073741824
, use color temp equation.
This one can seem complicated but it’s really not. If you’re using color temp, add 1073741824
to every value. If you’re not using color temp, add 0
to every value.
hue wheel color
color_type = 0
color temp color
color_type = 1073741824
Off
byte4 = color_type + 0
Solid
byte4 = color_type + 16777216
Chase
byte4 = color_type + 33554432
Fast Blink
byte4 = color_type + 50331648
Slow Blink
byte4 = color_type + 67108864
Fast Fade
byte4 = color_type + 83886080
Slow Fade
byte4 = color_type + 100663296
Finalizing your result
config_value = byte4 + byte3 + byte2 + byte1