Code: Select all
[
{
"id": "4a5eccea.110c64",
"type": "tab",
"label": "test pvk nodered ga",
"disabled": false,
"info": ""
},
{
"id": "3b9bcddd.dc852a",
"type": "switch",
"z": "4a5eccea.110c64",
"name": "domoticz_idx_check",
"property": "topic",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "1002",
"vt": "str"
},
{
"t": "eq",
"v": "997",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 500,
"y": 320,
"wires": [
[
"ee8e350d.f25b1",
"c68d6e.b48daa9"
],
[
"c68d6e.b48daa9"
]
]
},
{
"id": "595870d9.04b8e8",
"type": "function",
"z": "4a5eccea.110c64",
"name": "Function out On/Off",
"func": "var idx = parseInt(msg.topic);\nif ( msg.payload === true )\n{\nmsg.payload = { \"command\": \"switchlight\", \"idx\": idx, \"switchcmd\": \"On\" };\n}\nelse if ( msg.payload === false )\n{\nmsg.payload = { \"command\": \"switchlight\", \"idx\": idx, \"switchcmd\": \"Off\" };\n}\nreturn msg\n",
"outputs": 1,
"noerr": 0,
"x": 1040,
"y": 320,
"wires": [
[
"817e59a1.f872c"
]
],
"info": "van msg.topic (dat is idx) \nen msg.payload = true or fale \neen domoticz mqtt bericht maken"
},
{
"id": "817e59a1.f872c",
"type": "json",
"z": "4a5eccea.110c64",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 1250,
"y": 400,
"wires": [
[
"52085ba0.f74c14",
"ef9e75ed.a8c3a"
]
]
},
{
"id": "ee8e350d.f25b1",
"type": "nora-switch",
"z": "4a5eccea.110c64",
"devicename": "testknop",
"roomhint": "Woonkamer",
"name": "testknop",
"passthru": false,
"nora": "a712ce22.fd8b8",
"topic": "510",
"onvalue": "true",
"onvalueType": "bool",
"offvalue": "false",
"offvalueType": "bool",
"x": 760,
"y": 240,
"wires": [
[
"595870d9.04b8e8",
"bb37838b.35bae"
]
]
},
{
"id": "fbf01029.851e58",
"type": "comment",
"z": "4a5eccea.110c64",
"name": "Useful links",
"info": "https://www.domoticz.com/forum/viewtopic.php?f=69&t=27588\nhttps://flows.nodered.org/node/node-red-contrib-nora\nhttps://discourse.nodered.org/t/node-red-google-home-integration/4829\ndomoticz mqtt publish is / en out\nhttps://node-red-google-home.herokuapp.com/login\n\n\n{\n \"Battery\" : 255,\n \"RSSI\" : 12,\n \"description\" : \"\",\n \"dtype\" : \"Lighting 2\",\n \"id\" : \"0E672C2\",\n \"idx\" : 1002,\n \"name\" : \"lantaarn\",\n \"nvalue\" : 1,\n \"stype\" : \"AC\",\n \"svalue1\" : \"15\",\n \"switchType\" : \"On/Off\",\n \"unit\" : 3\n}\n\nzie ook flow voor de overige types zoals dimmers en scenes",
"x": 110,
"y": 40,
"wires": []
},
{
"id": "8685d1e9.f2c4e8",
"type": "mqtt in",
"z": "4a5eccea.110c64",
"name": "Bericht van domoticz (UIT) naar GA",
"topic": "domoticz/out",
"qos": "0",
"datatype": "auto",
"broker": "6242ef98.a960d",
"x": 160,
"y": 760,
"wires": [
[
"5d9862b2.c9b1ac"
]
]
},
{
"id": "9921ba31.f2255",
"type": "debug",
"z": "4a5eccea.110c64",
"name": "debugging",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 726,
"y": 556,
"wires": []
},
{
"id": "5d9862b2.c9b1ac",
"type": "json",
"z": "4a5eccea.110c64",
"name": "json convert",
"property": "payload",
"action": "",
"pretty": false,
"x": 250,
"y": 660,
"wires": [
[
"ab43c9d3.5f8b08",
"22faa080.73b01"
]
]
},
{
"id": "ab43c9d3.5f8b08",
"type": "switch",
"z": "4a5eccea.110c64",
"name": "switchtype_check",
"property": "payload.switchType",
"propertyType": "msg",
"rules": [
{
"t": "cont",
"v": "On/Off",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 230,
"y": 540,
"wires": [
[
"d02788d2.c3b388",
"9921ba31.f2255"
]
]
},
{
"id": "95188afc.1e3768",
"type": "comment",
"z": "4a5eccea.110c64",
"name": "er is een pakket met switchtype On/Off",
"info": "kijkt naar switchtype \"On/Off\"",
"x": 470,
"y": 580,
"wires": []
},
{
"id": "d02788d2.c3b388",
"type": "function",
"z": "4a5eccea.110c64",
"name": "convert message",
"func": "msg.topic = msg.payload.idx\nif (msg.payload.nvalue == 1)\n{\n msg.payload = true\n}\nelse if (msg.payload.nvalue === 0)\n{\n msg.payload = false\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 250,
"y": 400,
"wires": [
[
"3b9bcddd.dc852a",
"e31ee032.c53658"
]
]
},
{
"id": "bb37838b.35bae",
"type": "debug",
"z": "4a5eccea.110c64",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 850,
"y": 120,
"wires": []
},
{
"id": "502ea749.7923c8",
"type": "comment",
"z": "4a5eccea.110c64",
"name": "GA heeft false of true nodig in de body",
"info": "een GA bericht maken\nbevat msg.payload = false or true\ntopic = idx\ningeval een switch",
"x": 490,
"y": 440,
"wires": []
},
{
"id": "52085ba0.f74c14",
"type": "mqtt out",
"z": "4a5eccea.110c64",
"name": "Bericht van GA naar domoticz (IN) ",
"topic": "domoticz/in",
"qos": "",
"retain": "",
"broker": "6242ef98.a960d",
"x": 1540,
"y": 560,
"wires": []
},
{
"id": "a6fc112d.39f25",
"type": "comment",
"z": "4a5eccea.110c64",
"name": "uit domoticz naar google naar boven",
"info": "bericht uit domoticz",
"x": 481.5,
"y": 761,
"wires": []
},
{
"id": "22faa080.73b01",
"type": "debug",
"z": "4a5eccea.110c64",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 730,
"y": 660,
"wires": []
},
{
"id": "e31ee032.c53658",
"type": "debug",
"z": "4a5eccea.110c64",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 725.5,
"y": 471,
"wires": []
},
{
"id": "c68d6e.b48daa9",
"type": "debug",
"z": "4a5eccea.110c64",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 728.5,
"y": 394,
"wires": []
},
{
"id": "ef9e75ed.a8c3a",
"type": "debug",
"z": "4a5eccea.110c64",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 1450,
"y": 480,
"wires": []
},
{
"id": "a712ce22.fd8b8",
"type": "nora-config",
"z": "",
"name": "Wouter",
"group": "",
"notify": false
},
{
"id": "6242ef98.a960d",
"type": "mqtt-broker",
"z": "",
"name": "localhost1883",
"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": ""
}
]