Re: Velux Integra
Posted: Wednesday 08 July 2020 21:46
I already have the integra. And also interested in the working solution 

Hi.mojojojo490 wrote: ↑Wednesday 08 July 2020 21:46 I already have the integra. And also interested in the working solution![]()
Code: Select all
sudo node-red-stop
cd ~/.node-red/
npm install [email protected]
sudo node-red-start
Code: Select all
[
{
"id": "774ff8d2.0467c8",
"type": "Velux Nodes",
"z": "6e3cbaf0.36e4e4",
"name": "",
"datasource": "e59f5b49.c02b58",
"index": "-1",
"nodevalue": "ALL",
"topic": "",
"x": 590,
"y": 80,
"wires": [
[
"d7808506.616dc8",
"209dd4dd.4e37ac"
]
]
},
{
"id": "a2494c81.43609",
"type": "mqtt out",
"z": "6e3cbaf0.36e4e4",
"name": "",
"topic": "domoticz/in",
"qos": "",
"retain": "",
"broker": "26a40b17.e8e744",
"x": 1030,
"y": 80,
"wires": []
},
{
"id": "209dd4dd.4e37ac",
"type": "debug",
"z": "6e3cbaf0.36e4e4",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1030,
"y": 160,
"wires": []
},
{
"id": "d7808506.616dc8",
"type": "function",
"z": "6e3cbaf0.36e4e4",
"name": "UpdatePosition",
"func": "var dt = new Date();\n\nvar nodeID = msg.payload.nodeID;\nvar cpv = msg.payload.currentPosition.value;\n// var tpv = msg.payload.target.value\n\n//Convert NodeID to Domoticz IDX value\n\nif (nodeID === 0) {\n\tvar idx = 4556;\n} else if (nodeID === 1) {\n\tvar idx = 4550;\n} else if (nodeID === 2) {\n\tvar idx = 4551;\n} else if (nodeID === 3) {\n\tvar idx = 4552;\n}\n\n// set nvalue and svalue from current position\nif (cpv === 0) {\n\tvar nv=0;\n\tvar sv=0;\n} else if (cpv === 100) {\n\tvar nv=1;\n\tvar sv=100;\n} else {\n\tvar nv=2;\n\tvar sv=cpv;\n}\n\nmsg.payload = {};\nmsg.payload.command = \"switchlight\";\nmsg.payload.switchcmd = \"Set Level\";\nmsg.payload.level = sv;\nmsg.payload.idx = idx;\n// msg.payload.nvalue = nv;\n// msg.payload.svalue = sv;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 820,
"y": 80,
"wires": [
[
"a2494c81.43609"
]
]
},
{
"id": "c1b21be6.47156",
"type": "comment",
"z": "6e3cbaf0.36e4e4",
"name": "Opérationel",
"info": "it works !",
"x": 590,
"y": 40,
"wires": []
},
{
"id": "6f16143d.f9793c",
"type": "inject",
"z": "6e3cbaf0.36e4e4",
"name": "LectureVelux",
"props": [
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "velux:read",
"payloadType": "str",
"x": 330,
"y": 80,
"wires": [
[
"774ff8d2.0467c8"
]
]
},
{
"id": "e59f5b49.c02b58",
"type": "velux-connection",
"z": "",
"host": "192.168.xx.xx",
"password": "YourWifiPassword",
"monitor": "MONITOR"
},
{
"id": "26a40b17.e8e744",
"type": "mqtt-broker",
"z": "",
"name": "MQTTBroker",
"broker": "localhost",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
}
]
Code: Select all
26/10/2020 à 18:12:15node: 209dd4dd.4e37acmsg.payload : Object
{ id: 0, api: 529, apiText: "GW_NODE_STATE_POSITION_CHANGED…", nodeID: 0, order: 1 … }
26/10/2020 à 18:12:15node: 209dd4dd.4e37acmsg.payload : Object
{ id: 0, api: 529, apiText: "GW_NODE_STATE_POSITION_CHANGED…", nodeID: 1, order: 0 … }
26/10/2020 à 18:12:15node: 209dd4dd.4e37acmsg.payload : Object
{ id: 0, api: 529, apiText: "GW_NODE_STATE_POSITION_CHANGED…", nodeID: 2, order: 2 … }
26/10/2020 à 18:12:15node: 209dd4dd.4e37acmsg.payload : Object
{ id: 0, api: 529, apiText: "GW_NODE_STATE_POSITION_CHANGED…", nodeID: 3, order: 3 … }
Code: Select all
2020-10-26 18:07:47.340 MQTT: Topic: domoticz/in, Message: {"command":"switchlight","switchcmd":"Set Level","level":100,"idx":4556}
2020-10-26 18:07:47.350 (Velux) Light/Switch (VeluxDroite)
2020-10-26 18:07:47.463 MQTT: Topic: domoticz/in, Message: {"command":"switchlight","switchcmd":"Set Level","level":100,"idx":4550}
2020-10-26 18:07:47.471 (Velux) Light/Switch (VeluxGauche)
2020-10-26 18:07:47.583 MQTT: Topic: domoticz/in, Message: {"command":"switchlight","switchcmd":"Set Level","level":100,"idx":4551}
2020-10-26 18:07:47.592 (Velux) Light/Switch (VoletVeluxGauche)
2020-10-26 18:07:47.704 MQTT: Topic: domoticz/in, Message: {"command":"switchlight","switchcmd":"Set Level","level":100,"idx":4552}
2020-10-26 18:07:47.714 (Velux) Light/Switch (VoletVeluxDroit)
Code: Select all
[
{
"id": "4adc61a.8da8ca",
"type": "mqtt in",
"z": "6e3cbaf0.36e4e4",
"name": "",
"topic": "domoticz/out",
"qos": "2",
"datatype": "json",
"broker": "26a40b17.e8e744",
"x": 110,
"y": 220,
"wires": [
[
"7e99db6c.65c0a4"
]
]
},
{
"id": "209dd4dd.4e37ac",
"type": "debug",
"z": "6e3cbaf0.36e4e4",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1170,
"y": 220,
"wires": []
},
{
"id": "11487e17.9aadfa",
"type": "switch",
"z": "6e3cbaf0.36e4e4",
"name": "VeluxMsg",
"property": "payload.name",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "VeluxGauche",
"vt": "str"
},
{
"t": "eq",
"v": "VeluxDroite",
"vt": "str"
},
{
"t": "eq",
"v": "VoletVeluxGauche",
"vt": "str"
},
{
"t": "eq",
"v": "VoletVeluxDroit",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 4,
"x": 260,
"y": 400,
"wires": [
[
"14871380.3ebfbd"
],
[
"3a5904ed.26840c"
],
[
"a2ff102b.2de6c"
],
[
"91019c5a.a94348"
]
]
},
{
"id": "14871380.3ebfbd",
"type": "change",
"z": "6e3cbaf0.36e4e4",
"name": "SetVeluxGauchenodeID",
"rules": [
{
"t": "set",
"p": "payload.nodeID",
"pt": "msg",
"to": "1",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 510,
"y": 340,
"wires": [
[
"acb78b54.7f69b"
]
]
},
{
"id": "3a5904ed.26840c",
"type": "change",
"z": "6e3cbaf0.36e4e4",
"name": "SetVeluxDroitenodeID",
"rules": [
{
"t": "set",
"p": "payload.nodeID",
"pt": "msg",
"to": "0",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 500,
"y": 380,
"wires": [
[
"acb78b54.7f69b"
]
]
},
{
"id": "7e99db6c.65c0a4",
"type": "change",
"z": "6e3cbaf0.36e4e4",
"name": "SetPosition",
"rules": [
{
"t": "set",
"p": "payload.position",
"pt": "msg",
"to": "$number(payload.svalue1)",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 310,
"y": 220,
"wires": [
[
"11487e17.9aadfa"
]
]
},
{
"id": "4ff6fe72.96ce78",
"type": "Velux Api",
"z": "6e3cbaf0.36e4e4",
"name": "",
"datasource": "e59f5b49.c02b58",
"api": "768",
"ntf": [
"770",
"771"
],
"topic": "",
"x": 1000,
"y": 400,
"wires": [
[
"209dd4dd.4e37ac"
]
]
},
{
"id": "acb78b54.7f69b",
"type": "function",
"z": "6e3cbaf0.36e4e4",
"name": "BougePosition",
"func": "var dt = new Date();\n\nvar nodeID = msg.payload.nodeID\nvar position = msg.payload.position\nif (msg.payload.nvalue === 0) {\n position = 0;\n} else if (msg.payload.nvalue === 1) {\n position = 100;\n}\n\nvar cmd = { \n commandOriginator: 1,\n priorityLevel: 2,\n parameterActive: 0,\n functionalParameterMP: {valueType:'RELATIVE', value:position},\n indexArrayCount: 1,\n indexArray: [nodeID],\n priorityLevelLock: false,\n lockTime: 0\n }\n\nmsg.payload = cmd;\n\n// msg.topic = \"velux:write\"\n// msg.payload.nvalue = nv;\n// msg.payload.svalue = sv;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 800,
"y": 400,
"wires": [
[
"4ff6fe72.96ce78"
]
]
},
{
"id": "a2ff102b.2de6c",
"type": "change",
"z": "6e3cbaf0.36e4e4",
"name": "SetVoletVeluxGauchenodeID",
"rules": [
{
"t": "set",
"p": "payload.nodeID",
"pt": "msg",
"to": "2",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 520,
"y": 420,
"wires": [
[
"acb78b54.7f69b"
]
]
},
{
"id": "91019c5a.a94348",
"type": "change",
"z": "6e3cbaf0.36e4e4",
"name": "SetVoletVeluxDroitnodeID",
"rules": [
{
"t": "set",
"p": "payload.nodeID",
"pt": "msg",
"to": "3",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 510,
"y": 460,
"wires": [
[
"acb78b54.7f69b"
]
]
},
{
"id": "26a40b17.e8e744",
"type": "mqtt-broker",
"z": "",
"name": "MQTTBroker",
"broker": "localhost",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
},
{
"id": "e59f5b49.c02b58",
"type": "velux-connection",
"z": "",
"host": "192.168.xx.xx",
"password": "YouWIFIPassword",
"monitor": "MONITOR"
}
]