That’s truly fabulous
Thank you so much
I’ll post my working statement for others to work from.
Cheers
Stuart
UPDATE
So the && (AND Condition) in the IF statements didn’t work for me, but with a switch node after the IF Function, I can see the three different states from the Velbus buttons.
The premis is that there are Virtual switches in openHAB2 that can be set in the UI or Voice Commands etc
Each Scene switches OFF the other scene switches and set out ITEM states.
There are Feedback LEDs that can have their state changed.
Here is the Flow code for anyone that is interested.
(I’ve removed the actual items and openHAB controller, so you’ll need to tweak each node to suit your installation)
Please feel free to advise / revise this flow, as this is my First venture into NodeRed
[
{
"id": "3bd26249.fa856e",
"type": "tab",
"label": "Velbus & openHAB scenes",
"disabled": false,
"info": ""
},
{
"id": "d4171d96.09e3e",
"type": "openhab2-monitor",
"z": "3bd26249.fa856e",
"name": "",
"controller": "",
"x": 95,
"y": 227,
"wires": [
[
"519f6dbd.de7df4",
"b03b8858.d72388",
"6dc830ab.a3108",
"a5f10519.bd8088"
],
[],
[]
]
},
{
"id": "6a30bf0c.813d4",
"type": "openhab2-in",
"z": "3bd26249.fa856e",
"name": "Scene 1 V Switch",
"controller": "",
"itemname": "",
"x": 100,
"y": 840,
"wires": [
[
"e8a7483a.e1d818"
],
[]
]
},
{
"id": "e04e1b51.932588",
"type": "openhab2-out",
"z": "3bd26249.fa856e",
"name": "Scene 2 V Switch OFF",
"controller": "",
"itemname": "",
"topic": "ItemCommand",
"payload": "OFF",
"x": 581,
"y": 545,
"wires": [
[]
]
},
{
"id": "b8b1baa2.51c0d8",
"type": "openhab2-out",
"z": "3bd26249.fa856e",
"name": "Scene 3 V Switch OFF",
"controller": "",
"itemname": "",
"topic": "ItemCommand",
"payload": "OFF",
"x": 581,
"y": 585,
"wires": [
[]
]
},
{
"id": "e8a7483a.e1d818",
"type": "switch",
"z": "3bd26249.fa856e",
"name": "ON / OFF Switch",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "ON",
"vt": "str"
},
{
"t": "eq",
"v": "OFF",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 330,
"y": 840,
"wires": [
[
"e04e1b51.932588",
"b8b1baa2.51c0d8",
"cecb8f93.c7612",
"482b6f0f.0a833",
"2de6dc8.bbf8824",
"b468b32c.46814",
"cec7acb3.fb163",
"876c9cf0.a3cb6"
],
[
"9f43f427.be4d68"
]
],
"outputLabels": [
"ON",
"OFF"
]
},
{
"id": "cecb8f93.c7612",
"type": "openhab2-out",
"z": "3bd26249.fa856e",
"name": "Scene 4 V Switch OFF",
"controller": "",
"itemname": "",
"topic": "ItemCommand",
"payload": "OFF",
"x": 581,
"y": 625,
"wires": [
[]
]
},
{
"id": "482b6f0f.0a833",
"type": "delay",
"z": "3bd26249.fa856e",
"name": "",
"pauseType": "delay",
"timeout": "10",
"timeoutUnits": "milliseconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 551,
"y": 665,
"wires": [
[
"72336934.5c1e48"
]
],
"outputLabels": [
"Delayed event"
]
},
{
"id": "2de6dc8.bbf8824",
"type": "delay",
"z": "3bd26249.fa856e",
"name": "",
"pauseType": "delay",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 541,
"y": 705,
"wires": [
[
"4a438d0c.306bc4"
]
]
},
{
"id": "b468b32c.46814",
"type": "delay",
"z": "3bd26249.fa856e",
"name": "",
"pauseType": "delay",
"timeout": "15",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 541,
"y": 745,
"wires": [
[
"4e5b7b05.125154"
]
]
},
{
"id": "cec7acb3.fb163",
"type": "delay",
"z": "3bd26249.fa856e",
"name": "",
"pauseType": "delay",
"timeout": "25",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 541,
"y": 785,
"wires": [
[
"9a098269.04ed2"
]
]
},
{
"id": "72336934.5c1e48",
"type": "openhab2-out",
"z": "3bd26249.fa856e",
"name": "Dimmer 1",
"controller": "",
"itemname": "",
"topic": "ItemCommand",
"payload": "25",
"x": 800,
"y": 660,
"wires": [
[]
]
},
{
"id": "4a438d0c.306bc4",
"type": "openhab2-out",
"z": "3bd26249.fa856e",
"name": "Dimmer 2",
"controller": "",
"itemname": "",
"topic": "ItemCommand",
"payload": "50",
"x": 800,
"y": 700,
"wires": [
[]
]
},
{
"id": "4e5b7b05.125154",
"type": "openhab2-out",
"z": "3bd26249.fa856e",
"name": "Dimmer 3",
"controller": "",
"itemname": "",
"topic": "ItemCommand",
"payload": "75",
"x": 800,
"y": 740,
"wires": [
[]
]
},
{
"id": "9a098269.04ed2",
"type": "openhab2-out",
"z": "3bd26249.fa856e",
"name": "Dimmer 4",
"controller": "",
"itemname": "",
"topic": "ItemCommand",
"payload": "100",
"x": 800,
"y": 780,
"wires": [
[]
]
},
{
"id": "876c9cf0.a3cb6",
"type": "openhab2-out",
"z": "3bd26249.fa856e",
"name": "Scene 1 LED ON",
"controller": "",
"itemname": "",
"topic": "ItemCommand",
"payload": "SET_LED",
"x": 561,
"y": 465,
"wires": [
[]
]
},
{
"id": "9f43f427.be4d68",
"type": "openhab2-out",
"z": "3bd26249.fa856e",
"name": "Scene 1 LED OFF",
"controller": "",
"itemname": "",
"topic": "ItemCommand",
"payload": "CLEAR_LED",
"x": 570,
"y": 880,
"wires": [
[]
]
},
{
"id": "519f6dbd.de7df4",
"type": "function",
"z": "3bd26249.fa856e",
"name": "Velbus Scene Button 1",
"func": "// var event = msg.payload.event;\nvar channel = msg.payload.channel;\nvar button = \"velbus:vmbgp2:c5053467:24:input#CH1\";\n\nif (channel === button) {\n return [msg, null];\n}\n\nreturn null;",
"outputs": 1,
"noerr": 0,
"x": 325,
"y": 127,
"wires": [
[
"843327ca.9cbda8"
]
]
},
{
"id": "843327ca.9cbda8",
"type": "switch",
"z": "3bd26249.fa856e",
"name": "Button Status",
"property": "payload.event",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "PRESSED",
"vt": "str"
},
{
"t": "eq",
"v": "RELEASED",
"vt": "str"
},
{
"t": "eq",
"v": "LONG_PRESSED",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 585,
"y": 127,
"wires": [
[
"f25b4ad3.e2f568"
],
[
"cfbf49f9.4fd118",
"9827ea7b.5953f8",
"a83f4652.7c5a58",
"3a87e605.a805ea"
],
[]
],
"outputLabels": [
"Pressed",
"Long Pressed",
"Released"
]
},
{
"id": "f25b4ad3.e2f568",
"type": "openhab2-out",
"z": "3bd26249.fa856e",
"name": "Scene 1 V Switch ON",
"controller": "",
"itemname": "",
"topic": "ItemCommand",
"payload": "ON",
"x": 825,
"y": 87,
"wires": [
[]
]
},
{
"id": "59a2c940.9a26b8",
"type": "openhab2-out",
"z": "3bd26249.fa856e",
"name": "Scene 2 V Switch ON",
"controller": "",
"itemname": "",
"topic": "ItemCommand",
"payload": "ON",
"x": 825,
"y": 187,
"wires": [
[]
]
},
{
"id": "c5daa0e7.8179a",
"type": "switch",
"z": "3bd26249.fa856e",
"name": "Button Status",
"property": "payload.event",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "PRESSED",
"vt": "str"
},
{
"t": "eq",
"v": "RELEASED",
"vt": "str"
},
{
"t": "eq",
"v": "LONG_PRESSED",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 585,
"y": 187,
"wires": [
[
"59a2c940.9a26b8"
],
[],
[]
],
"outputLabels": [
"Pressed",
"Long Pressed",
"Released"
]
},
{
"id": "b03b8858.d72388",
"type": "function",
"z": "3bd26249.fa856e",
"name": "Velbus Scene Button 2",
"func": "// var event = msg.payload.event;\nvar channel = msg.payload.channel;\nvar button = \"velbus:vmbgp2:c5053467:24:input#CH2\";\n\nif (channel === button) {\n return [msg, null];\n}\n\nreturn null;",
"outputs": 1,
"noerr": 0,
"x": 325,
"y": 187,
"wires": [
[
"c5daa0e7.8179a"
]
]
},
{
"id": "54a238dc.c100b8",
"type": "openhab2-out",
"z": "3bd26249.fa856e",
"name": "Scene 3 V Switch ON",
"controller": "",
"itemname": "",
"topic": "ItemCommand",
"payload": "ON",
"x": 825,
"y": 247,
"wires": [
[]
]
},
{
"id": "6ce27812.ac3c48",
"type": "switch",
"z": "3bd26249.fa856e",
"name": "Button Status",
"property": "payload.event",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "PRESSED",
"vt": "str"
},
{
"t": "eq",
"v": "RELEASED",
"vt": "str"
},
{
"t": "eq",
"v": "LONG_PRESSED",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 585,
"y": 247,
"wires": [
[
"54a238dc.c100b8"
],
[],
[]
],
"outputLabels": [
"Pressed",
"Long Pressed",
"Released"
]
},
{
"id": "6dc830ab.a3108",
"type": "function",
"z": "3bd26249.fa856e",
"name": "Velbus Scene Button 3",
"func": "// var event = msg.payload.event;\nvar channel = msg.payload.channel;\nvar button = \"velbus:vmbgp2:c5053467:24:input#CH3\";\n\nif (channel === button) {\n return [msg, null];\n}\n\nreturn null;",
"outputs": 1,
"noerr": 0,
"x": 325,
"y": 247,
"wires": [
[
"6ce27812.ac3c48"
]
]
},
{
"id": "29febe0.008da42",
"type": "openhab2-out",
"z": "3bd26249.fa856e",
"name": "Scene 4 V Switch ON",
"controller": "",
"itemname": "",
"topic": "ItemCommand",
"payload": "ON",
"x": 825,
"y": 307,
"wires": [
[]
]
},
{
"id": "2bdf42a2.b8873e",
"type": "switch",
"z": "3bd26249.fa856e",
"name": "Button Status",
"property": "payload.event",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "PRESSED",
"vt": "str"
},
{
"t": "eq",
"v": "RELEASED",
"vt": "str"
},
{
"t": "eq",
"v": "LONG_PRESSED",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 585,
"y": 307,
"wires": [
[
"29febe0.008da42"
],
[],
[]
],
"outputLabels": [
"Pressed",
"Long Pressed",
"Released"
]
},
{
"id": "a5f10519.bd8088",
"type": "function",
"z": "3bd26249.fa856e",
"name": "Velbus Scene Button 4",
"func": "// var event = msg.payload.event;\nvar channel = msg.payload.channel;\nvar button = \"velbus:vmbgp2:c5053467:24:input#CH4\";\n\nif (channel === button) {\n return [msg, null];\n}\n\nreturn null;",
"outputs": 1,
"noerr": 0,
"x": 325,
"y": 307,
"wires": [
[
"2bdf42a2.b8873e"
]
]
},
{
"id": "cfbf49f9.4fd118",
"type": "openhab2-out",
"z": "3bd26249.fa856e",
"name": "Scene 1 V Switch OFF",
"controller": "",
"itemname": "",
"topic": "ItemCommand",
"payload": "OFF",
"x": 1085,
"y": 107,
"wires": [
[]
]
},
{
"id": "9827ea7b.5953f8",
"type": "openhab2-out",
"z": "3bd26249.fa856e",
"name": "Scene 2 V Switch OFF",
"controller": "",
"itemname": "",
"topic": "ItemCommand",
"payload": "OFF",
"x": 1085,
"y": 147,
"wires": [
[]
]
},
{
"id": "a83f4652.7c5a58",
"type": "openhab2-out",
"z": "3bd26249.fa856e",
"name": "Scene 3 V Switch OFF",
"controller": "",
"itemname": "",
"topic": "ItemCommand",
"payload": "OFF",
"x": 1085,
"y": 187,
"wires": [
[]
]
},
{
"id": "3a87e605.a805ea",
"type": "openhab2-out",
"z": "3bd26249.fa856e",
"name": "Scene 4 V Switch OFF",
"controller": "",
"itemname": "",
"topic": "ItemCommand",
"payload": "OFF",
"x": 1085,
"y": 227,
"wires": [
[]
]
},
{
"id": "45e52b76.6b0284",
"type": "comment",
"z": "3bd26249.fa856e",
"name": "ALL openHAB events",
"info": "This node provides ALL of the bus events within openHAB\"",
"x": 100,
"y": 40,
"wires": []
},
{
"id": "a5dbe336.659e7",
"type": "comment",
"z": "3bd26249.fa856e",
"name": "Filter Velbus Events",
"info": "These IF statements filter specific Velbus button events",
"x": 310,
"y": 40,
"wires": []
},
{
"id": "49f8431e.bdf8ec",
"type": "comment",
"z": "3bd26249.fa856e",
"name": "Filter Button states",
"info": "Divides up the button status' into\n\nPressed\nLong_Pressed\nReleased",
"x": 590,
"y": 40,
"wires": []
},
{
"id": "8aa80ec6.488f5",
"type": "comment",
"z": "3bd26249.fa856e",
"name": "Actions on PRESSED events",
"info": "",
"x": 820,
"y": 40,
"wires": []
},
{
"id": "f511e83f.d12d48",
"type": "comment",
"z": "3bd26249.fa856e",
"name": "Actions on Long Pressed Events",
"info": "",
"x": 1090,
"y": 40,
"wires": []
},
{
"id": "3e53dcb3.809a14",
"type": "comment",
"z": "3bd26249.fa856e",
"name": "Scene ON events",
"info": "",
"x": 560,
"y": 420,
"wires": []
},
{
"id": "ed0e1118.8dad",
"type": "comment",
"z": "3bd26249.fa856e",
"name": "Scene OFF events",
"info": "",
"x": 570,
"y": 840,
"wires": []
},
{
"id": "3d8e650a.9621ea",
"type": "comment",
"z": "3bd26249.fa856e",
"name": "Delayed ON events",
"info": "",
"x": 810,
"y": 620,
"wires": []
},
{
"id": "e37a475f.3e7ba8",
"type": "comment",
"z": "3bd26249.fa856e",
"name": "Seperate ON and OFF states",
"info": "",
"x": 320,
"y": 780,
"wires": []
}
]
For anyone that is interested, here is my “working out”
[
{
"id": "c1c183f4.eb661",
"type": "openhab2-events",
"z": "aa997a33.1a22b8",
"name": "",
"controller": "4a048897.2cd4b8",
"itemname": "",
"x": 120,
"y": 1180,
"wires": [
[
"a4c00000.ed111",
"83e9bf19.58393"
]
]
},
{
"id": "a4c00000.ed111",
"type": "debug",
"z": "aa997a33.1a22b8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"x": 400,
"y": 1340,
"wires": []
},
{
"id": "83e9bf19.58393",
"type": "function",
"z": "aa997a33.1a22b8",
"name": "Filter Button",
"func": "var event = msg.payload.event;\nvar channel = msg.payload.channel;\nvar button = \"velbus:vmbgp2:c5053467:24:input#CH3\";\nvar newMsg = { payload: msg.payload.event };\n\nif (channel === button) {\n return [newMsg];\n}\n\nif (channel === button && event === \"PRESSED\") {\n return [newMsg];\n}\n\nif (channel === button && event === \"LONG_PRESSED\") {\n return [newMsg];\n}\n\nif (channel === button && event === \"RELEASED\") {\n return [newMsg];\n}\nreturn null;",
"outputs": 4,
"noerr": 0,
"x": 410,
"y": 1200,
"wires": [
[
"95913777.5fd898",
"36abae9e.736c92"
],
[],
[],
[]
]
},
{
"id": "95913777.5fd898",
"type": "debug",
"z": "aa997a33.1a22b8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"x": 790,
"y": 1180,
"wires": []
},
{
"id": "36abae9e.736c92",
"type": "switch",
"z": "aa997a33.1a22b8",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "PRESSED",
"vt": "str"
},
{
"t": "eq",
"v": "LONG_PRESSED",
"vt": "str"
},
{
"t": "eq",
"v": "RELEASED",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 590,
"y": 1300,
"wires": [
[
"f4027050.bc3f9"
],
[
"a85767f8.14f988"
],
[
"4aec6972.c7a7e8"
]
]
},
{
"id": "f4027050.bc3f9",
"type": "trigger",
"z": "aa997a33.1a22b8",
"op1": "",
"op2": "RESET",
"op1type": "pay",
"op2type": "str",
"duration": "250",
"extend": false,
"units": "ms",
"reset": "",
"bytopic": "all",
"name": "",
"x": 820,
"y": 1240,
"wires": [
[
"97ff3822.52ccf8"
]
]
},
{
"id": "a85767f8.14f988",
"type": "trigger",
"z": "aa997a33.1a22b8",
"op1": "",
"op2": "RESET",
"op1type": "pay",
"op2type": "str",
"duration": "1",
"extend": false,
"units": "s",
"reset": "",
"bytopic": "all",
"name": "",
"x": 800,
"y": 1300,
"wires": [
[
"7db22549.5acb4c"
]
]
},
{
"id": "4aec6972.c7a7e8",
"type": "trigger",
"z": "aa997a33.1a22b8",
"op1": "",
"op2": "RESET",
"op1type": "pay",
"op2type": "str",
"duration": "300",
"extend": false,
"units": "ms",
"reset": "",
"bytopic": "all",
"name": "",
"x": 820,
"y": 1380,
"wires": [
[
"aaf5edf3.a83a5"
]
]
},
{
"id": "97ff3822.52ccf8",
"type": "debug",
"z": "aa997a33.1a22b8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"x": 1130,
"y": 1240,
"wires": []
},
{
"id": "7db22549.5acb4c",
"type": "debug",
"z": "aa997a33.1a22b8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"x": 1130,
"y": 1320,
"wires": []
},
{
"id": "aaf5edf3.a83a5",
"type": "debug",
"z": "aa997a33.1a22b8",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"x": 1130,
"y": 1400,
"wires": []
},
{
"id": "4a048897.2cd4b8",
"type": "openhab2-controller",
"z": "",
"name": "openHAB2 controller",
"protocol": "http",
"host": "127.0.0.1",
"port": "8080",
"path": "",
"username": "",
"password": ""
}
]