Dim KNX Light in HA With Alexa Node-Red

Hi everyone,

I’ve now integrated my entire KNX system into HA, and everything is working perfectly. Now I want to set up Alexa integration using Node-RED. Turning lights on and off via Alexa worked right away. However, I now want to be able to turn my living room lights on and off and dim them using Alexa — for example, “brighter,” “darker,” or “set to 100%.”

I’m using node-red-contrib-alexa-home-skill. I spent all of Sunday working on this with ChatGPT, but I just can’t get it to work. I’m sure there’s a simple solution for this since it’s such a basic function.

I’ve already tried setting it up with an Alexa Home → Switch node, but it didn’t work. Can anyone here help me out? I’d be really grateful!

If you need more details, just let me know. I’m not exactly sure what information is necessary, so please bear with me — I’m still a beginner :joy:

Thanks in advance,

Marc

[
{
“id”: “a4dc7f3e5ee6459c”,
“type”: “tab”,
“label”: “Alexa Licht Wohnzimmer Flow”,
“disabled”: false,
“info”: “”,
“env”:
},
{
“id”: “090d7d09b2084358”,
“type”: “alexa-home”,
“z”: “a4dc7f3e5ee6459c”,
“conf”: “6c979a38764fb19f”,
“device”: “238588”,
“acknoledge”: true,
“name”: “Licht Wohnzimmer”,
“topic”: “”,
“x”: 290,
“y”: 320,
“wires”: [
[
“0792a4416252465b”
]
]
},
{
“id”: “0792a4416252465b”,
“type”: “switch”,
“z”: “a4dc7f3e5ee6459c”,
“name”: “Alexa Licht Wohnzimmer Switch”,
“property”: “command”,
“propertyType”: “msg”,
“rules”: [
{
“t”: “eq”,
“v”: “TurnOnRequest”,
“vt”: “str”
},
{
“t”: “eq”,
“v”: “TurnOffRequest”,
“vt”: “str”
},
{
“t”: “eq”,
“v”: “SetPercentageRequest”,
“vt”: “str”
},
{
“t”: “eq”,
“v”: “IncrementPercentageRequest”,
“vt”: “str”
},
{
“t”: “eq”,
“v”: “DecrementPercentageRequest”,
“vt”: “str”
}
],
“checkall”: “true”,
“repair”: false,
“outputs”: 5,
“x”: 590,
“y”: 320,
“wires”: [
[
“ba9eb0b3c9564624”
],
[
“c1598b8a7e1a4886”
],
[
“578b9a4479044a58”,
“79d69afad6e64cbc”
],
[
“65a8ccd894ce4aaa”
],
[
“65a8ccd894ce4aaa”
]
]
},
{
“id”: “578b9a4479044a58”,
“type”: “function”,
“z”: “a4dc7f3e5ee6459c”,
“name”: “Set Brightness Percentage”,
“func”: “// Handle Alexa SetPercentageRequest\nvar pct = parseFloat(msg.payload);\nif (!isNaN(pct)) {\n msg.payload = { brightness_pct: pct };\n // Turn on light to specified brightness\n flow.set("wohnzimmer_brightness", pct);\n flow.set("wohnzimmer_lightOn", true);\n return msg;\n} else {\n return null;\n}”,
“outputs”: 1,
“noerr”: 0,
“initialize”: “”,
“finalize”: “”,
“libs”: ,
“x”: 940,
“y”: 360,
“wires”: [
[
“1dafc542489c41be”,
“72670835bc164e94”
]
]
},
{
“id”: “65a8ccd894ce4aaa”,
“type”: “function”,
“z”: “a4dc7f3e5ee6459c”,
“name”: “Adjust Brightness by 10%”,
“func”: “// Handle Alexa IncrementPercentageRequest / DecrementPercentageRequest\nvar current = flow.get("wohnzimmer_brightness");\nvar lightOn = flow.get("wohnzimmer_lightOn");\nvar base;\nif (!lightOn) {\n // If light is off or brightness not set, start at 50%\n base = 50;\n} else {\n var currVal = parseFloat(current);\n base = !isNaN(currVal) ? currVal : 0;\n}\nvar adjust = parseFloat(msg.payload);\nif (isNaN(adjust)) {\n return null;\n}\nvar newBright;\nif (msg.command === "IncrementPercentageRequest") {\n newBright = base + adjust;\n} else if (msg.command === "DecrementPercentageRequest") {\n newBright = base - adjust;\n} else {\n return null;\n}\n// Limit brightness between 0 and 100\nif (newBright > 100) {\n newBright = 100;\n}\nif (newBright <= 0) {\n // Turn off light if brightness is 0 or below\n flow.set("wohnzimmer_lightOn", false);\n flow.set("wohnzimmer_brightness", 0);\n // Send message on second output (turn off)\n return [ null, {} ];\n} else {\n flow.set("wohnzimmer_brightness", newBright);\n flow.set("wohnzimmer_lightOn", true);\n msg.payload = { brightness_pct: newBright };\n return [ msg, null ];\n}”,
“outputs”: 2,
“noerr”: 0,
“initialize”: “”,
“finalize”: “”,
“libs”: ,
“x”: 930,
“y”: 400,
“wires”: [
[
“1dafc542489c41be”,
“8cfcee0865964196”
],
[
“c1598b8a7e1a4886”
]
]
},
{
“id”: “ba9eb0b3c9564624”,
“type”: “api-call-service”,
“z”: “a4dc7f3e5ee6459c”,
“name”: “Wohnzimmerlicht An”,
“server”: “7df4e77bed9d4f6e”,
“version”: 7,
“debugenabled”: false,
“action”: “light.turn_on”,
“floorId”: ,
“areaId”: ,
“deviceId”: ,
“entityId”: [
“light.wohnzimmer_licht_neu”
],
“data”: “”,
“dataType”: “json”,
“mergeContext”: “”,
“mustacheAltTags”: false,
“outputProperties”: ,
“queue”: “none”,
“blockInputOverrides”: true,
“domain”: “light”,
“service”: “turn_on”,
“x”: 1320,
“y”: 260,
“wires”: [

]
},
{
“id”: “c1598b8a7e1a4886”,
“type”: “api-call-service”,
“z”: “a4dc7f3e5ee6459c”,
“name”: “Wohnzimmerlicht Aus”,
“server”: “7df4e77bed9d4f6e”,
“version”: 7,
“debugenabled”: false,
“action”: “light.turn_off”,
“floorId”: ,
“areaId”: ,
“deviceId”: ,
“entityId”: [
“light.wohnzimmer_licht_neu”
],
“data”: “”,
“dataType”: “json”,
“mergeContext”: “”,
“mustacheAltTags”: false,
“outputProperties”: ,
“queue”: “none”,
“blockInputOverrides”: true,
“domain”: “light”,
“service”: “turn_off”,
“x”: 1320,
“y”: 320,
“wires”: [

]
},
{
“id”: “1dafc542489c41be”,
“type”: “api-call-service”,
“z”: “a4dc7f3e5ee6459c”,
“name”: “Wohnzimmerlicht Helligkeit”,
“server”: “7df4e77bed9d4f6e”,
“version”: 7,
“debugenabled”: false,
“action”: “light.turn_on”,
“floorId”: ,
“areaId”: ,
“deviceId”: ,
“entityId”: [
“light.wohnzimmer_licht_neu”
],
“data”: “{ "brightness_pct": "{{ payload.brightness_pct | float }}" }”,
“dataType”: “json”,
“mustacheAltTags”: false,
“outputProperties”: ,
“queue”: “none”,
“blockInputOverrides”: true,
“domain”: “light”,
“service”: “turn_on”,
“x”: 1340,
“y”: 420,
“wires”: [

]
},
{
“id”: “72670835bc164e94”,
“type”: “debug”,
“z”: “a4dc7f3e5ee6459c”,
“name”: “Debug SetPercentage Output”,
“active”: true,
“tosidebar”: true,
“console”: false,
“tostatus”: false,
“complete”: “payload”,
“targetType”: “msg”,
“statusVal”: “”,
“statusType”: “auto”,
“x”: 1350,
“y”: 380,
“wires”:
},
{
“id”: “8cfcee0865964196”,
“type”: “debug”,
“z”: “a4dc7f3e5ee6459c”,
“name”: “Debug Increment/Decrement Output”,
“active”: true,
“tosidebar”: true,
“console”: false,
“tostatus”: false,
“complete”: “payload”,
“targetType”: “msg”,
“statusVal”: “”,
“statusType”: “auto”,
“x”: 1370,
“y”: 500,
“wires”:
},
{
“id”: “79d69afad6e64cbc”,
“type”: “debug”,
“z”: “a4dc7f3e5ee6459c”,
“name”: “Debug Alexa Input”,
“active”: true,
“tosidebar”: true,
“console”: false,
“tostatus”: false,
“complete”: “true”,
“targetType”: “full”,
“statusVal”: “”,
“statusType”: “auto”,
“x”: 910,
“y”: 460,
“wires”:
},
{
“id”: “6c979a38764fb19f”,
“type”: “alexa-home-conf”,
“username”: “momue7774”
},
{
“id”: “7df4e77bed9d4f6e”,
“type”: “server”,
“name”: “Home Assistant”,
“version”: 5,
“addon”: true,
“rejectUnauthorizedCerts”: true,
“ha_boolean”: “y|yes|true|on|home|open”,
“connectionDelay”: true,
“cacheJson”: true,
“heartbeat”: false,
“heartbeatInterval”: 30,
“areaSelector”: “friendlyName”,
“deviceSelector”: “friendlyName”,
“entitySelector”: “friendlyName”,
“statusSeparator”: ": ",
“statusYear”: “hidden”,
“statusMonth”: “short”,
“statusDay”: “numeric”,
“statusHourCycle”: “default”
}
]

Hi,

I solved it in a different way. I used the MatterHub add-on. Everything works perfectly. Alexa can switch and dim lights, and the blinds can also be controlled. I used the tutorial video from Simon42. No cloud, no direct KNX connection. Everything is nicely managed through the Home Assistant interface and the Alexa app. The entities are even recognized automatically. Changes are also easily applied. :+1::+1::+1: