WLED+ Node Red + Zigbee Fernbedienung

Moin,
Ich mal wieder
Versuche gerade die WLED mit einer Paulmann 501.40 Fernbedienung über Node Red zu steuern (Farbänderung) Das An und aus geht schon ganz gut. aber ich komme nicht weiter. Ich lasse die Hue und trans umrechnen zu RGB aber mehr als mal kurz auf zu blinken aber keine Farbe wechsel passiert nichts
Hier der Flow :

[{"id":"264f65496ba97177","type":"tab","label":"22:01 11.01.2025","disabled":false,"info":"","env":[]},{"id":"b14c06740554e8f4","type":"zigbee2mqtt-in","z":"264f65496ba97177","name":"","server":"7fb5c27f6bb8fb7b","friendly_name":"RGB (501.40)","device_id":"0xb4e3f9fffeef96e3","state":"0","outputAtStartup":true,"filterChanges":false,"enableMultiple":false,"x":150,"y":300,"wires":[["c7663bcc11e359b4"]]},{"id":"c7663bcc11e359b4","type":"function","z":"264f65496ba97177","name":"Farbzuweisung und Ein/Aus","func":"function hslToRgb(h, s, l) {\n    let r, g, b;\n    h /= 360; // Normalisiere den Hue-Wert\n    s /= 100; // Normalisiere den Saturation-Wert\n    l /= 100; // Normalisiere den Lightness-Wert\n\n    if (s === 0) {\n        r = g = b = l; // Grau\n    } else {\n        const hue2rgb = function(p, q, t) {\n            if (t < 0) t += 1;\n            if (t > 1) t -= 1;\n            if (t < 1 / 6) return p + (q - p) * 6 * t;\n            if (t < 1 / 2) return q;\n            if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n            return p;\n        };\n\n        const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n        const p = 2 * l - q;\n\n        // Berechnung der RGB-Werte\n        r = hue2rgb(p, q, h + 1 / 3);\n        g = hue2rgb(p, q, h);\n        b = hue2rgb(p, q, h - 1 / 3);\n    }\n\n    return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];\n}\n\nif (msg.payload.action === 'on_1') {\n    msg.payload = { \"on\": true }; // Einschalten\n} else if (msg.payload.action === 'off_1') {\n    msg.payload = { \"on\": false }; // Ausschalten\n} else if (msg.payload.action === 'move_to_hue_and_saturation_1') {\n    const hue = msg.payload.action_hue;\n    const saturation = Math.min(msg.payload.action_saturation, 100); // Maximal 100%\n    const transitionTime = msg.payload.action_transition_time;\n\n    // Setze Lightness auf 50% für sichtbare Farben\n    const lightness = 50; \n    const [r, g, b] = hslToRgb(hue, saturation, lightness);\n\n    // Debug-Ausgaben hinzufügen\n    node.warn(`HSL: ${hue}, ${saturation}, ${lightness}`);\n    node.warn(`RGB: ${r}, ${g}, ${b}`);\n\n    msg.payload = {\n        \"on\": true,\n        \"bri\": 255, // Setze die Helligkeit\n        \"seg\": [{\n            \"id\": 0,\n            \"r\": r, // Rot\n            \"g\": g, // Grün\n            \"b\": b, // Blau\n            \"transition\": transitionTime * 2000 // Übergangszeit in Millisekunden\n        }]\n    };\n} else {\n    return null; // Ignoriere unbekannte Aktionen\n}\nreturn msg;\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":300,"wires":[["682257f36b229443","7b9ddbfb16fd0761"]]},{"id":"682257f36b229443","type":"debug","z":"264f65496ba97177","name":"Debug Payload","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":440,"wires":[],"info":"msg.payload = { color: msg.payload.colors }; // Zeigt nur die Farbänderungen an\r\nreturn msg;\r\n"},{"id":"202f7cb9d030bc38","type":"debug","z":"264f65496ba97177","name":"HTTP Antwort","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":true,"statusVal":"","statusType":"auto","x":1080,"y":500,"wires":[]},{"id":"937e19bc5a2fad3b","type":"debug","z":"264f65496ba97177","name":"Debug Ausgabe","active":false,"tosidebar":true,"console":false,"complete":true,"statusVal":"","statusType":"auto","x":1080,"y":600,"wires":[]},{"id":"7b9ddbfb16fd0761","type":"wled2","z":"264f65496ba97177","address":"192.168.178.161/json","brightness":128,"delay":0,"color1":"#ffffff","color2":"#fd1212","color3":"#351fdb","effect":0,"effectIntensity":128,"effectSpeed":128,"name":"","palette":"0","preset":0,"state":"toggle","x":970,"y":220,"wires":[["202f7cb9d030bc38","937e19bc5a2fad3b"]]},{"id":"7fb5c27f6bb8fb7b","type":"zigbee2mqtt-server","name":"","host":"192.168.178.150","mqtt_port":"1883","mqtt_username":"","mqtt_password":"","mqtt_qos":"0","tls":"4230868a2749a2ba","usetls":false,"base_topic":"zigbee2mqtt"},{"id":"4230868a2749a2ba","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false,"alpnprotocol":""}]
type or paste code here

Und hier die Debug Ausgabe:

12.1.2025, 00:42:30node: Farbzuweisung und Ein/Aus
function : (warn)
"HSL: 240, 100, 50"
12.1.2025, 00:42:30node: Farbzuweisung und Ein/Aus
function : (warn)
"RGB: 0, 0, 255"
12.1.2025, 00:42:30node: HTTP Antwort
zigbee2mqtt/RGB : msg : Object
{ topic: "zigbee2mqtt/RGB ", changed: object, payload: object, payload_raw: object, homekit: object … }
12.1.2025, 00:42:30node: Farbzuweisung und Ein/Aus
function : (warn)
"HSL: 246, 100, 50"
12.1.2025, 00:42:30node: Farbzuweisung und Ein/Aus
function : (warn)
"RGB: 25, 0, 255"
12.1.2025, 00:42:31node: HTTP Antwort
zigbee2mqtt/RGB : msg : Object
object
topic: "zigbee2mqtt/RGB "
changed: object
old: object
action: "move_to_hue_and_saturation_1"
action_hue: 240
action_saturation: 254
action_transition_time: 6
battery: 100
linkquality: 72
new: object
action: "move_to_hue_and_saturation_1"
action_hue: 246
action_saturation: 254
action_transition_time: 0
battery: 100
linkquality: 76
payload: object
on: true
bri: 255
seg: array[1]
0: object
id: 0
r: 25
g: 0
b: 255
transition: 0
payload_raw: object
action: "move_to_hue_and_saturation_1"
action_hue: 246
action_saturation: 254
action_transition_time: 0
battery: 100
linkquality: 76
homekit: object
Battery: object
BatteryLevel: 100
StatusLowBattery: 0
format: object
empty
selector: "zigbee2mqtt_RGB"
item: object
date_code: "NULL"
definition: object
description: "RGB remote control"
exposes: array[3]
0: object
access: 5
category: "diagnostic"
description: "Remaining battery in %"
label: "Battery"
name: "battery"
property: "battery"
type: "numeric"
unit: "%"
value_max: 100
value_min: 0
1: object
access: 1
category: "diagnostic"
description: "Triggered action (e.g. a button click)"
label: "Action"
name: "action"
property: "action"
type: "enum"
values: array[32]
[0 … 9]
0: "on"
1: "off"
2: "toggle"
3: "brightness_move_to_level"
4: "brightness_move_up"
5: "brightness_move_down"
6: "brightness_step_up"
7: "brightness_step_down"
8: "brightness_stop"
9: "color_temperature_move_stop"
[10 … 19]
10: "color_temperature_move_up"
11: "color_temperature_move_down"
12: "color_temperature_step_up"
13: "color_temperature_step_down"
14: "enhanced_move_to_hue_and_saturation"
15: "move_to_hue_and_saturation"
16: "color_hue_step_up"
17: "color_hue_step_down"
18: "color_saturation_step_up"
19: "color_saturation_step_down"
[20 … 29]
20: "color_loop_set"
21: "color_temperature_move"
22: "color_move"
23: "hue_move"
24: "hue_stop"
25: "move_to_saturation"
26: "move_to_hue"
27: "recall"
28: "store"
29: "add"
[30 … 31]
30: "remove"
31: "remove_all"
2: object
access: 1
category: "diagnostic"
description: "Link quality (signal strength)"
label: "Linkquality"
name: "linkquality"
property: "linkquality"
type: "numeric"
unit: "lqi"
value_max: 255
value_min: 0
model: "501.40"
options: array[1]
0: object
access: 2
description: "Simulate a brightness value. If this device provides a brightness_move_up or brightness_move_down action it is possible to specify the update interval and delta. The action_brightness_delta indicates the delta for each interval. "
features: array[2]
label: "Simulated brightness"
name: "simulated_brightness"
property: "simulated_brightness"
type: "composite"
supports_ota: false
vendor: "Paulmann"
disabled: false
endpoints: object
1: object
bindings: array[5]
0: object
cluster: "genPowerCfg"
target: object
endpoint: 1
ieee_address: "0x0ceff6fffecdfa7c"
type: "endpoint"
1: object
cluster: "genOnOff"
target: object
endpoint: 1
ieee_address: "0x0ceff6fffecdfa7c"
type: "endpoint"
2: object
cluster: "genLevelCtrl"
target: object
endpoint: 1
ieee_address: "0x0ceff6fffecdfa7c"
type: "endpoint"
3: object
cluster: "lightingColorCtrl"
target: object
endpoint: 1
ieee_address: "0x0ceff6fffecdfa7c"
type: "endpoint"
4: object
cluster: "genScenes"
target: object
endpoint: 1
ieee_address: "0x0ceff6fffecdfa7c"
type: "endpoint"
clusters: object
input: array[5]
0: "genBasic"
1: "genPowerCfg"
2: "genIdentify"
3: "haDiagnostic"
4: "touchlink"
output: array[8]
0: "genIdentify"
1: "genGroups"
2: "genScenes"
3: "genOnOff"
4: "genLevelCtrl"
5: "genOta"
6: "lightingColorCtrl"
7: "touchlink"
configured_reportings: array[2]
0: object
attribute: "batteryPercentageRemaining"
cluster: "genPowerCfg"
maximum_report_interval: 65000
minimum_report_interval: 3600
reportable_change: 10
1: object
attribute: "batteryPercentageRemaining"
cluster: "genPowerCfg"
maximum_report_interval: 65000
minimum_report_interval: 3600
reportable_change: 10
scenes: array[0]
2: object
bindings: array[5]
0: object
cluster: "genPowerCfg"
target: object
1: object
cluster: "genOnOff"
target: object
2: object
cluster: "genLevelCtrl"
target: object
endpoint: 1
ieee_address: "0x0ceff6fffecdfa7c"
type: "endpoint"
3: object
cluster: "lightingColorCtrl"
target: object
4: object
clusters: object
configured_reportings: array[2]
scenes: array[0]
3: object
4: object
friendly_name: "RGB "
ieee_address: "0xb4e3f9fffeef96e3"
interview_completed: true
interviewing: false
manufacturer: "Paulmann Licht GmbH"
model_id: "501.40"
network_address: 28115
power_source: "Battery"
software_build_id: "2.7.6_r22"
supported: true
type: "EndDevice"
current_values: object
homekit: object
format: object
_msgid: "b41e13d297d28dfe"
12.1.2025, 00:47:24node: HTTP Antwort
zigbee2mqtt/RGB : msg : Object
{ topic: "zigbee2mqtt/RGB ", changed: object, payload: object, payload_raw: object, homekit: object … }

Wenn mir jemand helfen könnte wäre ich echt Dankbar

Liebe Grüße
Roy

Guten Morgen Roy
ich weiß nicht wie das bei der Hue ist.
ich übermittele die Daten zu einem Wled controller so:

msg.payload = {
    "on":true,
    "bri":255,
    "seg": [{
      "start": 0,
      "stop": 150,
      "len": 150,
      "col": [
        [255, 160, 0, 0], //orange
        [0, 0, 0, 0],
        [0, 0, 0, 0]
      ],
      "fx": 0,
      "sx": 127,
      "ix": 255,
      "pal": 0,
      "sel": true,
      "rev": false,
      "cln": -1
    }]
}
return msg;

Da gab es vor langer Zeit mal ein Tutorial.
da habe ich das raus.

[
    {
        "id": "c4252ec08c6a0607",
        "type": "inject",
        "z": "31d57a66a838edf5",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 900,
        "y": 80,
        "wires": [
            [
                "1e2d6734043420e1"
            ]
        ]
    },
    {
        "id": "68508f0535b00b65",
        "type": "inject",
        "z": "31d57a66a838edf5",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 900,
        "y": 120,
        "wires": [
            [
                "d60b096d792bafef"
            ]
        ]
    },
    {
        "id": "b449128f202d6393",
        "type": "inject",
        "z": "31d57a66a838edf5",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 900,
        "y": 160,
        "wires": [
            [
                "e412f5660db36fa1"
            ]
        ]
    },
    {
        "id": "aa12395e2f4181a3",
        "type": "inject",
        "z": "31d57a66a838edf5",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 900,
        "y": 200,
        "wires": [
            [
                "385135564196d5fa"
            ]
        ]
    },
    {
        "id": "1e2d6734043420e1",
        "type": "function",
        "z": "31d57a66a838edf5",
        "name": "on:255",
        "func": "msg.payload = {\"on\":true,\"bri\":255}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1070,
        "y": 80,
        "wires": [
            [
                "18eff2c97467eab7",
                "06e389c3d3dd1195"
            ]
        ]
    },
    {
        "id": "d60b096d792bafef",
        "type": "function",
        "z": "31d57a66a838edf5",
        "name": "off:0",
        "func": "msg.payload = {\"on\":false}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1070,
        "y": 120,
        "wires": [
            [
                "18eff2c97467eab7",
                "06e389c3d3dd1195"
            ]
        ]
    },
    {
        "id": "e412f5660db36fa1",
        "type": "function",
        "z": "31d57a66a838edf5",
        "name": "on: orange",
        "func": "msg.payload = {\n    \"on\":true,\n    \"bri\":255,\n    \"seg\": [{\n      \"start\": 0,\n      \"stop\": 150,\n      \"len\": 150,\n      \"col\": [\n        [255, 160, 0, 0],\n        [0, 0, 0, 0],\n        [0, 0, 0, 0]\n      ],\n      \"fx\": 0,\n      \"sx\": 127,\n      \"ix\": 255,\n      \"pal\": 0,\n      \"sel\": true,\n      \"rev\": false,\n      \"cln\": -1\n    }]\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1090,
        "y": 160,
        "wires": [
            [
                "18eff2c97467eab7",
                "06e389c3d3dd1195"
            ]
        ]
    },
    {
        "id": "385135564196d5fa",
        "type": "function",
        "z": "31d57a66a838edf5",
        "name": "on: blue",
        "func": "msg.payload = {\n    \"on\":true,\n    \"bri\":255,\n    \"seg\": [{\n      \"start\": 0,\n      \"stop\": 150,\n      \"len\": 150,\n      \"col\": [\n        [0, 0, 255, 0],\n        [0, 0, 0, 0],\n        [0, 0, 0, 0]\n      ],\n      \"fx\": 0,\n      \"sx\": 127,\n      \"ix\": 255,\n      \"pal\": 0,\n      \"sel\": true,\n      \"rev\": false,\n      \"cln\": -1\n    }]\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1080,
        "y": 200,
        "wires": [
            [
                "18eff2c97467eab7",
                "06e389c3d3dd1195"
            ]
        ]
    },
    {
        "id": "18eff2c97467eab7",
        "type": "debug",
        "z": "31d57a66a838edf5",
        "name": "Effects",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1330,
        "y": 160,
        "wires": []
    },
    {
        "id": "06e389c3d3dd1195",
        "type": "http request",
        "z": "31d57a66a838edf5",
        "name": "POST to WLED",
        "method": "POST",
        "ret": "obj",
        "paytoqs": "query",
        "url": "http://wled-41367a.local/json/state",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 1360,
        "y": 120,
        "wires": [
            [
                "59bae8e6f1d05fa7"
            ]
        ]
    },
    {
        "id": "59bae8e6f1d05fa7",
        "type": "debug",
        "z": "31d57a66a838edf5",
        "name": "response",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1520,
        "y": 120,
        "wires": []
    },
    {
        "id": "8c0a214bf84b079d",
        "type": "inject",
        "z": "31d57a66a838edf5",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 900,
        "y": 240,
        "wires": [
            [
                "cb4ea2e50fa5398d"
            ]
        ]
    },
    {
        "id": "cb4ea2e50fa5398d",
        "type": "function",
        "z": "31d57a66a838edf5",
        "name": "effect increment",
        "func": "msg.payload = {\n    \"on\":true,\n    \"bri\":255,\n    \"seg\": [{\n      \"start\": 0,\n      \"stop\": 150,\n      \"len\": 150,\n      \"fx\":\"~\",\n      \"sx\": 127,\n      \"ix\": 255,\n      \"pal\": 0,\n      \"sel\": true,\n      \"rev\": false,\n      \"cln\": -1\n    }]\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1100,
        "y": 240,
        "wires": [
            [
                "06e389c3d3dd1195",
                "18eff2c97467eab7"
            ]
        ]
    },
    {
        "id": "30c162f3c6d0b25e",
        "type": "inject",
        "z": "31d57a66a838edf5",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 900,
        "y": 280,
        "wires": [
            [
                "5c8a45b0095aaabe"
            ]
        ]
    },
    {
        "id": "5c8a45b0095aaabe",
        "type": "function",
        "z": "31d57a66a838edf5",
        "name": "effect increment 30",
        "func": "msg.payload = {\n    \"on\":true,\n    \"bri\":255,\n    \"seg\": [{\n      \"start\": 0,\n      \"stop\": 30,\n      \"len\": 30,\n      \"fx\":\"~\",\n      \"sx\": 127,\n      \"ix\": 255,\n      \"pal\": 0,\n      \"sel\": true,\n      \"rev\": false,\n      \"cln\": -1\n    }]\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1110,
        "y": 280,
        "wires": [
            [
                "06e389c3d3dd1195"
            ]
        ]
    },
    {
        "id": "cbdd31c62737a946",
        "type": "comment",
        "z": "31d57a66a838edf5",
        "name": "Einfache Beispiele",
        "info": "",
        "x": 910,
        "y": 40,
        "wires": []
    },
    {
        "id": "b7bcde64e5d19765",
        "type": "inject",
        "z": "31d57a66a838edf5",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 900,
        "y": 320,
        "wires": [
            [
                "0d68edfecf7258cc"
            ]
        ]
    },
    {
        "id": "0d68edfecf7258cc",
        "type": "function",
        "z": "31d57a66a838edf5",
        "name": "on: WW",
        "func": "msg.payload = {\n    \"on\":true,\n    \"bri\":255,\n    \"seg\": [{\n      \"start\": 0,\n      \"stop\": 150,\n      \"len\": 150,\n      \"col\": [\n        [210, 150, 100,0],\n        [0, 0, 0, 0],\n        [0, 0, 0, 0]\n      ],\n      \"fx\": 0,\n      \"sx\": 127,\n      \"ix\": 255,\n      \"pal\": 0,\n      \"sel\": true,\n      \"rev\": false,\n      \"cln\": -1\n    }]\n}\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1080,
        "y": 320,
        "wires": [
            [
                "06e389c3d3dd1195",
                "18eff2c97467eab7"
            ]
        ]
    }
]

auf diese Art habe ich meine Status LED gebaut, und das funktioniert zu ~ 98% :wink:
hoffe das hilft dir weiter
Gruß Arno

Das werde ich gleich mal ausprobieren
Vielen Dank

Das ging aber schnell :slight_smile:
übrigens, das war in deinem code zuviel

type or paste code here

das sind die letzten zeichen :wink:

hatte zufällig gerade mal reingeschaut :grinning:

Nur zur Erklärung
Meine Idee ist es die Hue and sataration von der Fernbedienung um zurechnen in Rgb
Da die Fernbedienung eine schönen Slide Kontakt hat

Es sieht laut Debug Nachricht danach aus als wenn er meine Funktions node nur Teilweise umsetzt da im Debug Node Http Antwort der Zigbee2mqtt/RGB aufgeführt wird

12.1.2025, 18:34:11node: Farbzuweisung und Ein/Aus
function : (warn)
"RGB: 255, 9, 0"
12.1.2025, 18:34:11node: HTTP Antwort
zigbee2mqtt/RGB : msg : Object
object
topic: "zigbee2mqtt/RGB "
changed: object
old: null
new: object
action: "move_to_hue_and_saturation_1"
action_hue: 2
action_saturation: 254
action_transition_time: 6
battery: 100
linkquality: 100
payload: object
error: 4
payload_raw: object
action: "move_to_hue_and_saturation_1"
action_hue: 2
action_saturation: 254
action_transition_time: 6
battery: 100
linkquality: 100
homekit: object
Battery: object
BatteryLevel: 100
StatusLowBattery: 0
format: object
empty
selector: "zigbee2mqtt_RGB"
item: object
date_code: "NULL"
definition: object
description: "RGB remote control"
exposes: array[3]
0: object
access: 5
category: "diagnostic"
description: "Remaining battery in %"
label: "Battery"
name: "battery"
property: "battery"
type: "numeric"
unit: "%"
value_max: 100
value_min: 0
1: object
access: 1
category: "diagnostic"
description: "Triggered action (e.g. a button click)"
label: "Action"
name: "action"
property: "action"
type: "enum"
values: array[32]
[0 … 9]
[10 … 19]
[20 … 29]
[30 … 31]
2: object
access: 1
category: "diagnostic"
description: "Link quality (signal strength)"
label: "Linkquality"
name: "linkquality"
property: "linkquality"
type: "numeric"
unit: "lqi"
value_max: 255
value_min: 0
model: "501.40"
options: array[1]
0: object
supports_ota: false
vendor: "Paulmann"
disabled: false
endpoints: object
1: object
2: object
3: object
4: object
friendly_name: "RGB "
ieee_address: "0xb4e3f9fffeef96e3"
interview_completed: true
interviewing: false
manufacturer: "Paulmann Licht GmbH"
model_id: "501.40"
network_address: 28115
power_source: "Battery"
software_build_id: "2.7.6_r22"
supported: true
type: "EndDevice"
current_values: object
action: "move_to_hue_and_saturation_1"
action_hue: 2
action_saturation: 254
action_transition_time: 6
battery: 100
linkquality: 100
homekit: object
Battery: object
BatteryLevel: 100
StatusLowBattery: 0
format: object
empty
_msgid: "22e7a15f9e6376ce"
statusCode: 501
headers: object
content-length: "11"
content-type: "application/json"
access-control-allow-origin: "*"
access-control-allow-methods: "*"
access-control-allow-headers: "*"
connection: "close"
accept-ranges: "none"
x-node-red-request-node: "d18b9dfa"
responseUrl: "http://192.168.178.161/json/stat"
redirectList: array[0]
retry: 0
Irgendwie komme ich nicht weiter :confused: :confused:

So ich habe es endlich so einigermaßen zum Laufen bekommen.
Das einzige ist das der Farbkreis nicht richtig umgesetzt wird leider.
Aber falls jemand Interesse daran hat hier der Flow :slight_smile:

[{"id":"ddc5b8fbbcb1dde5","type":"tab","label":"16.01.2025 v2.ter Versuch funktioniert","disabled":false,"info":"","env":[]},{"id":"3a7f1420d88a1820","type":"zigbee2mqtt-in","z":"ddc5b8fbbcb1dde5","name":"","server":"a305d2c36821d856","friendly_name":"RGB (501.40)","device_id":"0xb4e3f9fffeef96e3","state":"0","outputAtStartup":true,"filterChanges":false,"enableMultiple":false,"x":110,"y":240,"wires":[["729ceb746d681e79","51ae5bbf5c32b6ba"]]},{"id":"51ae5bbf5c32b6ba","type":"function","z":"ddc5b8fbbcb1dde5","name":"Farbzuweisung und Ein/Aus","func":"function hslToRgb(h, s, l) {\n    let r, g, b;\n    h /= 360; // Normalisiere den Hue-Wert\n    s /= 100; // Normalisiere den Saturation-Wert\n    l /= 100; // Normalisiere den Lightness-Wert\n\n    if (s === 0) {\n        r = g = b = l; // Grau\n    } else {\n        const hue2rgb = function(p, q, t) {\n            if (t < 0) t += 1;\n            if (t > 1) t -= 1;\n            if (t < 1 / 6) return p + (q - p) * 6 * t;\n            if (t < 1 / 2) return q;\n            if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n            return p;\n        };\n\n        const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n        const p = 2 * l - q;\n\n        r = hue2rgb(p, q, h + 1 / 3);\n        g = hue2rgb(p, q, h);\n        b = hue2rgb(p, q, h - 1 / 3);\n    }\n\n    return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];\n}\n\n// Initialisierung des aktuellen Helligkeitswerts\nlet currentBrightness = context.get('current_brightness') || 255; // Setze Standardwert auf 255\n\nif (msg.payload.action === 'on_1' || msg.payload.action === 'off_1') {\n    msg.payload = {\n        \"on\": !(msg.payload.action === 'off_1')\n    };\n} else if (msg.payload.action === 'move_to_hue_and_saturation_1') {\n    const hue = msg.payload.action_hue;\n    const saturation = Math.min(msg.payload.action_saturation, 100);\n    const transitionTime = msg.payload.action_transition_time;\n    const lightness = 50;\n    const [r, g, b] = hslToRgb(hue, saturation, lightness);\n\n    msg.payload = {\n        \"on\": true,\n        \"bri\": 255,\n        \"seg\": [{\n            \"id\": 0,\n            \"col\": [[r, g, b], [0, 0, 0], [64, 64, 64]],\n            \"transition\": transitionTime * 2000\n        }]\n    };\n} else if (msg.payload.action === 'recall_1_1') {\n    msg.payload = {\n        \"on\": true,\n        \"bri\": 255,\n        \"seg\": [{\n            \"id\": 0,\n            \"col\": [[255, 255, 255]],\n            \"transition\": 0\n        }]\n    };\n} else if (msg.payload.action === 'recall_2_1') {\n    msg.payload = {\n        \"on\": true,\n        \"bri\": 255,\n        \"seg\": [{\n            \"id\": 0,\n            \"col\": [[255, 0, 157]],\n            \"transition\": 0\n        }]\n    };\n} else if (msg.payload.action === 'brightness_step_down_1') {\n    // Helligkeit schrittweise verringern\n    const stepSize = msg.payload.action_step_size || 25; // Schrittgröße\n    currentBrightness = Math.max(0, currentBrightness - stepSize); // Verringert die Helligkeit\n    msg.payload = {\n        \"on\": true,\n        \"bri\": currentBrightness // Setze die neue Helligkeit\n    };\n} else if (msg.payload.action === 'brightness_step_up_1') {\n    // Helligkeit schrittweise erhöhen\n    const stepSize = msg.payload.action_step_size || 25; // Schrittgröße\n    currentBrightness = Math.min(255, currentBrightness + stepSize); // Erhöht die Helligkeit\n    msg.payload = {\n        \"on\": true,\n        \"bri\": currentBrightness // Setze die neue Helligkeit\n    };\n} else {\n    return null;\n}\n\n// Speichere den aktuellen Helligkeitswert im Kontext\ncontext.set('current_brightness', currentBrightness);\nreturn msg;\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":160,"wires":[["7adac3c1e50aab13","3f483d3137b3cc1b"]]},{"id":"7adac3c1e50aab13","type":"http request","z":"ddc5b8fbbcb1dde5","name":"WLED API Request","method":"POST","ret":"obj","url":"http://192.168.178.161/json/state","tls":"","headers":{"Content-Type":"application/json"},"x":730,"y":100,"wires":[["48b4745d39242ec2"]]},{"id":"48b4745d39242ec2","type":"debug","z":"ddc5b8fbbcb1dde5","name":"WLED Response","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":930,"y":140,"wires":[]},{"id":"3f483d3137b3cc1b","type":"debug","z":"ddc5b8fbbcb1dde5","name":"debug Farbe","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":730,"y":260,"wires":[]},{"id":"729ceb746d681e79","type":"debug","z":"ddc5b8fbbcb1dde5","name":"Fernbedienung","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":400,"y":300,"wires":[]},{"id":"a305d2c36821d856","type":"zigbee2mqtt-server","name":"","host":"192.168.178.150","mqtt_port":"1883","mqtt_username":"","mqtt_password":"","mqtt_qos":"0","tls":"4230868a2749a2ba","usetls":false,"base_topic":"zigbee2mqtt"},{"id":"4230868a2749a2ba","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false,"alpnprotocol":""}]