Gå videre til hovedindholdet

Perfecting RGBW Control: A Custom Node-RED Dashboard 2.0 Color Picker for KNX Ultimate (DALI2 DT8)


If you work with modern building automation, you know that bridging the gap between a technical backend and a sleek, user-friendly frontend can sometimes require a little bit of custom engineering.

Recently, I was looking for a flawless way to control DALI2 DT8 RGBW luminaires through a graphical interface. Specifically, I needed a solution for Node-RED Dashboard 2.0 that communicates directly with the KNX Ultimate node using the 6-byte combined group object (DPT 251.600 Color Triplet).

Standard dashboard color pickers often struggle with the separate white channel or don't format the payload exactly as the KNX bus expects. To solve this, I built a custom Template node utilizing Vuetify, and I’m sharing the code so you can drop it straight into your own projects.



The ETS 6 Setup

Before diving into Node-RED, ensure your actuator (or DALI gateway) is properly configured in ETS 6. You want to use the combined 6-byte group object for RGBW. This allows us to send the red, green, blue, and white values—along with their validity masks—in a single telegram, keeping bus traffic incredibly efficient.



The Node-RED Flow

The beauty of this setup is its simplicity. You only need two nodes:


A Dashboard 2.0 Template Node (Where our custom UI lives).

The KNX Ultimate Device Node (Set to your group address and DPT 251.600).


You just wire the Template node directly into the KNX Ultimate node. No intermediate function nodes or payload formatting are required—the template handles all the logic.

The Custom Code

Inside your Dashboard 2.0 Template node, paste the following code. It utilizes a standard Vuetify RGB color picker alongside a dedicated slider for the White (W) channel.

<template>
    <v-card flat class="bg-transparent pa-2">
        <!-- Vuetify RGB Color Picker -->
        <v-color-picker
            v-model="color"
            mode="rgb"
            hide-inputs
            elevation="0"
            width="100%"
        ></v-color-picker>

        <!-- Separate White Channel (W) -->
        <div class="pt-4">
            <div class="text-caption mb-1">Hvid Kanal (W)</div>
            <v-slider
                v-model="white"
                min="0"
                max="255"
                step="1"
                thumb-label
                color="blue-grey-darken-1"
            ></v-slider>
        </div>
    </v-card>
</template>

<script>
export default {
    data() {
        return {
            // Start with a HEX string, as it is most stable for Vuetify 3
            color: '#ffffff',
            white: 0
        }
    },
    watch: {
        // Watchers keep an eye with the changes in our data
        color(newVal) {
            this.sendToKNX();
        },
        white(newVal) {
            this.sendToKNX();
        }
    },
    methods: {
        // This function makes sure we always get R,G,B no matter the format Vuetify delivers
        parseColor(c) {
            if (typeof c === 'object') {
                return { r: c.r || 0, g: c.g || 0, b: c.b || 0 };
            }
            if (typeof c === 'string') {
                if (c.startsWith('#')) {
                    let hex = c.substring(1);
                    if (hex.length === 3) hex = hex.split('').map(x => x + x).join('');
                    return {
                        r: parseInt(hex.substring(0, 2), 16) || 0,
                        g: parseInt(hex.substring(2, 4), 16) || 0,
                        b: parseInt(hex.substring(4, 6), 16) || 0
                    };
                } else if (c.startsWith('rgb')) {
                    const vals = c.match(/\d+/g);
                    if (vals && vals.length >= 3) {
                        return {
                            r: parseInt(vals[0]),
                            g: parseInt(vals[1]),
                            b: parseInt(vals[2])
                        };
                    }
                }
            }
            return { r: 0, g: 0, b: 0 }; // Fallback if anything goes wrong
        },
        sendToKNX() {
            const rgb = this.parseColor(this.color);

            const knxPayload = {
                red: Math.floor(rgb.r),
                green: Math.floor(rgb.g),
                blue: Math.floor(rgb.b),
                white: Math.floor(this.white),
                mR: 1,
                mG: 1,
                mB: 1,
                mW: 1
            };

            // Sends directly to the next node
            this.send({ 
                payload: knxPayload
            });
        }
    }
}
</script>

Why This Works So Well

The magic here happens in the sendToKNX() method. KNX Ultimate requires a very specific JSON object for the 251.600 datapoint. It doesn't just need the color values (red, green, blue, white); it also requires the mask bits (mR, mG, mB, mW).

By setting these mask bits to 1, we are explicitly telling the KNX bus: "Yes, these color channel values are valid, please apply them." The Vue.js watcher functions ensure that the moment a user drags a color hue or adjusts the white slider, the parsed values are instantly packaged and fired off to the bus.

It provides an incredibly responsive, tactile experience for end-users, while remaining lightweight and reliable under the hood.

Kommentarer

Populære opslag fra denne blog

Bound in Ash and Bone: Unearthing 'The Ghouls Almanac'

I am thrilled to finally unveil my latest passion project: The Ghouls Almanac: A Grim Chronicle of the Wasteland . Created with the help of my loving wife and son  —with dark, intricate illustrations conjured alongside Google Gemini —this isn't just an art book. It is a forbidden scripture of the atomic age, written in the style of a post-apocalyptic Necronomicon . If you are a fan of the Fallout universe, you know the stories. But you have never seen them told like this. The Ghouls Almanac is a visceral, mythic retelling of the events of Fallout 1 , Fallout 2 , and Fallout 3 , chronicled by the one soul who lived to see it all: Harold . Before he became the Oasis—a living cathedral of timber and vine —he was the ancient wanderer who witnessed the fall of the Master and the flight of the Enclave . Through Harold's rotting, immortal eyes, the history of the wasteland is documented not as a sci-fi adventure, but as a dark, twisted gospel of flesh, steel, and survival: The Iron ...

Udgivelse: Time Traveler's Dilemmas – Kan du redde tidslinjen (eller vil du smadre den fuldstændig)?

Har du nogensinde tænkt over, hvad der ville ske, hvis du gav Julius Cæsar en skudsikker vest? Eller hvis du "kom til" at overbevise Leonardo da Vinci om at bygge et masseødelæggelsesvåben i renæssancen? Jeg har netop lagt sidste hånd på mit nyeste projekt: Time Traveler's Dilemmas – et tekstbaseret sci-fi eventyr bygget fra bunden i HTML, CSS og JavaScript, hvor dine valg giver genlyd gennem 13 historiske epoker. Spillet kaster dig ind i rollen som den sidste Temporale Agent. Tidslinjen er ved at kollapse, og det er din opgave at rejse fra de første brutale stammekonflikter i Stenalderen og hele vejen frem til dommedagsprofetierne under Y2K-krisen for at holde trådene samlet. Sommerfugleeffekten er ægte Kernen i spillet er det dynamiske "Temporal Ekko"-system. De valg, du træffer i Bronzealderen eller under Romerrigets storhedstid, sætter usynlige flag, der fundamentalt kan ændre (eller låse op for) dine muligheder i skyttegravene under 1. Verdenskrig. Hvert ...

A Peek Behind the Scenes of the Wasteland: Download the Unique Fallout Story 'The Stranger Is Not Real'

Have you ever wondered who the man in the trench coat really is? Every time you're in a pinch in Fallout, he appears out of the blue, fires his .44 Magnum, and vanishes into thin air. But where does he go? And what does he actually think about the bizarre things you do in the wasteland? Now you have the chance to find out. In the recently released, fan-made book "The Stranger Is Not Real," we have created a completely unique and entertaining take on the Fallout universe. And the best part? You can download it right now. A Noir Diary from the Edge of Reality "The Stranger Is Not Real" is a brilliant deconstruction of video game logic, told as a hardboiled and cynical noir detective story. We follow the game's most iconic guardian angel—The Mysterious Stranger—through his personal, worn-out logbook entries. Through a series of "cases," our tired narrator slowly begins to realize that he is stuck in an absurd, digital loop. He is forced by a humming i...