[ { "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": "" } ]