Initial testing of controllable LED downlights.
I've replaced the standard LED drivers with 3-channel DMX decoders (typically R,G,B) but using only two of the channels to drive a tri-colour LED downlight: Warm white, cool white, natural white (mix of the first two).
HomeKit provides two values for this: ColorTemperature and Brightness. DMX accepts a single value per channel: 0-255 (0-100% of each channel). A friend helped with the maths required to convert colour-temperature & brightness into the two dmx channels: White & Yellow per downlight.
Using MQTT from Node-RED to the arduino with a DMX shield acting as DMX master controller, I pass three values: destination channel, white channel value, yellow channel value (destination plus one). Each DMX decoder has it's own unique address per channel. Ranging from 1 to 512 per system ("universe"). Giving you 170 available unique downlights of 3 addresses/channels each.