Skip to content

Instantly share code, notes, and snippets.

@elpaso666

elpaso666/README.md Secret

Last active Mar 18, 2020
Embed
What would you like to do?
Loxone 2 Conbee HUE

This flow connects Loxone Light Controller version 2 using web socket to HUE bulb connected using Conbee v2 USB stick on RPI

You need to install following contrib to be able to connect NodeRed with Loxone miniserver version 1. Miniserver version 2 is not yet supported, because of HTTPS communication by the node-red-contrib-loxone forked from node-lox-ws-api

In Loxone: just configure a LightControllerV2 and set the outputs to RGB format In Node-RED :

  1. configure Loxone Control-IN to connect to LightControllerV2 you set up
  2. configure Deconz-OUT and set input to JSON object msg.payload

thx to @sstroot on https://gist.github.com/sstroot/a2be61a889a6e6712fa0591ab1a69e35 for inspiration! :)

[
{
"id": "7be55345.48bebc",
"type": "subflow",
"name": "Loxone2HUE",
"info": "",
"category": "",
"in": [
{
"x": 327.5,
"y": 307,
"wires": [
{
"id": "525c492b.7ab478"
}
]
}
],
"out": [
{
"x": 1237.5,
"y": 319,
"wires": [
{
"id": "ebbc239d.76c84",
"port": 0
},
{
"id": "467ba87f.00d8e8",
"port": 0
}
]
}
],
"env": [],
"color": "#DDAA99"
},
{
"id": "ebbc239d.76c84",
"type": "function",
"z": "7be55345.48bebc",
"name": "COLOR",
"func": "msg.payload = msg.payload.replace(\"hsv(\", \"\").replace(\")\", \"\").split(\",\");\n\nvar hue = Number(msg.payload[0]) * 65500 / 360;\nvar sat = Number(msg.payload[1]) * 255 /100;\nvar bri = Number(msg.payload[2]) * 255 /100 ;\nvar time = 5; \n\nif (bri == '0') {\n return { payload: { on: false } };\n}\n\nmsg.payload = {\"on\":true,\"bri\":bri,\"hue\":hue,\"sat\":sat,\"transitiontime\":time};\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 740,
"y": 220,
"wires": [
[]
]
},
{
"id": "525c492b.7ab478",
"type": "switch",
"z": "7be55345.48bebc",
"name": "White or Color",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "cont",
"v": "hsv(",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 520,
"y": 300,
"wires": [
[
"ebbc239d.76c84"
],
[
"467ba87f.00d8e8"
]
]
},
{
"id": "467ba87f.00d8e8",
"type": "function",
"z": "7be55345.48bebc",
"name": "WHITE",
"func": "var bri = msg.payload * 255 /100 ;\nvar time = 5;\n\nif (bri == '0') {\n return { payload: { on: false } };\n}\n\nmsg.payload = {\"on\":true,\"bri\":bri,\"transitiontime\":time};\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 740,
"y": 340,
"wires": [
[]
]
},
{
"id": "8616366c.b009a8",
"type": "subflow:7be55345.48bebc",
"z": "a3b8df88.2aea9",
"name": "",
"env": [],
"x": 350,
"y": 60,
"wires": [
[
"2e5982c5.68504e"
]
]
}
]
@elpaso666

This comment has been minimized.

Copy link
Owner Author

@elpaso666 elpaso666 commented Jan 3, 2020

image

@elpaso666

This comment has been minimized.

Copy link
Owner Author

@elpaso666 elpaso666 commented Jan 3, 2020

13

@guewii

This comment has been minimized.

Copy link

@guewii guewii commented Feb 12, 2020

Hi,
this subflow looks very nice! :-)

but, are you sure that the "WHITE" way works correctly?

grafik

@guewii

This comment has been minimized.

Copy link

@guewii guewii commented Mar 18, 2020

image

i have changed the "WHITE" way.

msg.payload = msg.payload.replace("temp(", "").replace(")", "").split(",");

var bri = Number(msg.payload[0]) * 255 /100;
var ct = Number((1-((msg.payload[1]-2700)/3800))*347)+153;
var time = 5;

if (bri == '0') {
return { payload: { on: false } };
}

msg.payload = {"on":true,"bri":bri,"ct":ct,"transitiontime":time};
return [msg ]

@guewii

This comment has been minimized.

Copy link

@guewii guewii commented Mar 18, 2020

[{"id":"7a566797.06a6d8","type":"tab","label":"Loxone to deCONZ","disabled":false,"info":""},{"id":"ef8004c2.144c58","type":"function","z":"7a566797.06a6d8","name":"COLOR","func":"msg.payload = msg.payload.replace(\"hsv(\", \"\").replace(\")\", \"\").split(\",\");\n\nvar hue = Number(msg.payload[0]) * 65500 / 360;\nvar sat = Number(msg.payload[1]) * 255 /100;\nvar bri = Number(msg.payload[2]) * 255 /100 ;\nvar time = 5; \n\nif (bri == '0') {\n return { payload: { on: false } };\n}\n\nmsg.payload = {\"on\":true,\"bri\":bri,\"hue\":hue,\"sat\":sat,\"transitiontime\":time};\nreturn msg;","outputs":1,"noerr":0,"x":500,"y":100,"wires":[[]]},{"id":"dd709091.70019","type":"switch","z":"7a566797.06a6d8","name":"White or Color","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"hsv(","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":340,"y":120,"wires":[["ef8004c2.144c58"],["ad69473f.862af8"]]},{"id":"ad69473f.862af8","type":"function","z":"7a566797.06a6d8","name":"WHITE (Lichtsteuerung)","func":"msg.payload = msg.payload.replace(\"temp(\", \"\").replace(\")\", \"\").split(\",\");\n\nvar bri = Number(msg.payload[0]) * 255 /100;\nvar ct = Number((1-((msg.payload[1]-2700)/3800))*347)+153;\nvar time = 5; \n\nif (bri == '0') {\n return { payload: { on: false } };\n}\n\nmsg.payload = {\"on\":true,\"bri\":bri,\"ct\":ct,\"transitiontime\":time};\nreturn [msg ]","outputs":1,"noerr":0,"x":550,"y":144,"wires":[[]]}]

@elpaso666

This comment has been minimized.

Copy link
Owner Author

@elpaso666 elpaso666 commented Mar 18, 2020

Hi,
thx a lot! i am totally busy these days. I appreciate the help. I test and update the source?

Jakub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.