[
{
"id": "93dfeda6.87345",
"type": "tab",
"label": "Custom Device - Philips Hue",
"disabled": false,
"info": ""
},
{
"id": "7e7e4e7b.883f5",
"type": "group",
"z": "93dfeda6.87345",
"name": "UI Dashboard",
"style": {
"label": true,
"stroke": "#3f93cf",
"color": "#3f93cf"
},
"nodes": [
"54f89a12.6f68e4",
"a5f11ba8.f140a8",
"4a717777.a6ab48",
"c19b605c.755b4",
"91947035.6ab14",
"d572fd0b.26178",
"e488c940.f843a8",
"9c14355c.401f68",
"ae2525ad.c5a688",
"3b11e013.06c1c",
"738c35cd.fde98c",
"ef23474f.8e4a38",
"466923b6.45d58c",
"b78cae3d.d5b03",
"66718ed5.788d8",
"ab1312d4.833ef",
"80f3689b.a23098",
"d97de4d.e1cbc18",
"693331c9.46502",
"2c8db891.263cf8",
"e2a55b4e.553c28",
"9d0a46a6.a87a58",
"469f5e73.1a597",
"432fa332.327ccc",
"ad1e4351.b05b7",
"74336134.91b96",
"3ddd53ca.a25cec",
"64d5d65b.12aad8",
"d9634d00.fe64c",
"6dd965a1.7166bc",
"59d263db.76500c",
"960c7b44.78c1d8",
"5552d335.c405ec",
"d7246a29.1e2358",
"83207e03.29eba",
"58901619.cfc008",
"e4ac9c7e.5486b",
"8ce52662.26ff18",
"c9c60743.554ca8",
"676e5845.334928",
"bd8834b.d53d7c8",
"6e3eb805.a26be8",
"f07a292b.47c6e8",
"f0a062dd.d8d97",
"318fb263.7a63ce",
"fa248a76.1c5018",
"ab8070c0.aada",
"1566188a.702f67",
"a7cc1c32.ac89f",
"96c94e49.2f5dc",
"4ae5ecf8.766664",
"e7726a76.d5db28",
"29dc8109.6cc66e",
"77ace372.8d31bc",
"3862b8cc.ed8868",
"694be44d.a1e44c",
"2e6526ff.6a40ba",
"259a04c6.4431cc",
"8c0c2310.59fd6",
"cae11ec7.23faa",
"d8bab73c.d698a8",
"c41ca3d.2893e6",
"3019cb6f.a4df64",
"80feeddd.1b674",
"2282804d.5fa7b",
"21c6a308.53789c",
"949dd39b.2335e",
"ab99ff70.a516a",
"ff0d95e8.b5c0b8",
"ec842552.3a9ce8",
"1aa49f1c.ece421",
"c1f7875c.d7eb78",
"cd63ccbd.c994a",
"ad2aa50.a916f58"
],
"x": 14,
"y": 479,
"w": 762,
"h": 1182
},
{
"id": "83df3251.a9c15",
"type": "group",
"z": "93dfeda6.87345",
"name": "PHILIPS CUSTOM DEVICES",
"style": {
"label": true,
"stroke": "#9363b7",
"color": "#9363b7"
},
"nodes": [
"d054a147.1e165",
"d431c2b9.54d41",
"17edd027.f975e",
"5fee6739.043a28",
"5eb6b82e.0b9f88",
"39b15c72.995654",
"12c160ec.7aad0f",
"1b37b861.73eac8",
"5efed0ae.b11ae",
"2e3a82d8.b9574e",
"4571fa6c.25aef4",
"fad28ca.bd1e57",
"1a7d94a2.28493b",
"8243632f.a567f",
"24994d7a.2b5442",
"16a27b61.d96a25",
"79d81098.4ca71",
"2399b29a.a443de",
"8931e1a7.57ab2",
"9fcd286b.2a8f18",
"3c2d4256.66d43e",
"18a48d77.70c8d3",
"45dee2c3.68a05c",
"79b6d24a.1f6fcc",
"18b5b04a.a2882",
"e0288de.f5b227",
"d017d58d.71b4a8",
"65befb1.975fc04",
"23e511ec.2e9cce",
"6315308d.f4a2d",
"6b487a58.05ae24",
"b8145d60.da12b",
"c91e8034.bc7e8",
"614c1021.2c9f7",
"bf9fb42f.db4058",
"fe8eea40.bbb328",
"f0c049d.2be87b8",
"58f1a572.757e0c",
"2bd208cf.b19e58",
"cbc4ea65.b983a8",
"d0868a42.37b228",
"c679da8.ce91728",
"69064f6c.6567a",
"4ea97a58.428ae4",
"946c9b67.f30e98",
"7958a547.c0f9bc",
"25422191.c7903e",
"a775d59a.672e28",
"3b606eff.04cbc2",
"10ab2a05.bb7156",
"90743255.7a853"
],
"x": 814,
"y": 479,
"w": 792,
"h": 682
},
{
"id": "87787cf6.2b83a",
"type": "group",
"z": "93dfeda6.87345",
"name": "Authentification",
"style": {
"label": true,
"stroke": "#3f93cf",
"color": "#3f93cf"
},
"nodes": [
"be3cb2d5.d10ea",
"ccfc46fd.35d1b8",
"8d6b19ff.ca3de8",
"bda215f8.ad3208",
"99f73b52.e266f8",
"9a96377d.eb8178",
"f19e81e6.0d7a3",
"2d359c8d.4d09b4",
"99eede8a.f16c9",
"d2c1a2cc.62b36",
"bf0f43e8.8124d",
"78e0242a.e5075c",
"1d1e38d.7bfd5c7",
"3b365c84.d41914",
"6b6bb4a3.acc1ec",
"c0220321.3f646",
"6137324c.f74a7c",
"7770759b.08506c",
"64b458e6.8173b8",
"7519bace.4622d4",
"93136f05.e9f85",
"9f01eaf2.779648",
"8c6c4101.71197",
"b5fd7d4d.6bc0d",
"46b738ff.057968",
"3ab65d94.be0cc2",
"8352f1ff.24024",
"e5356160.2b1ff",
"dc35fbdd.def438",
"89089abb.425e58",
"6f8daef1.78a81",
"4275d02d.94d3d",
"bc8e0030.56568",
"1923136.2f1b8ed",
"83030a76.4cf288",
"558c6fd1.ca744",
"bbe0ed2c.75293",
"27842a50.841f66",
"6009d4b2.b29b8c",
"1df89796.183668",
"58e3b0ea.ad121",
"9a8da7bf.92b708",
"5317cb23.a062f4",
"44b4bf1b.18b9f",
"1809c2d.464703d",
"9b9aadbd.c1bd7",
"a64d8879.099bf8",
"af8c9325.07c3b",
"6e29f4d0.63acbc",
"ec75b25b.b4f54",
"a95f77a.830d588",
"ea8d9374.927a3",
"843d7ac8.c6a068",
"2d3b045d.d1126c",
"92c2733c.ece1b",
"9348fc59.d060c",
"eeb077de.874038",
"e1ee4738.4bf6a8",
"f25fe9fa.115d28",
"dce72bc7.e949e8",
"92d5ddb5.cb2de",
"6e4a6041.8317b",
"651d9733.9f8b88",
"65bc35ff.f337ec",
"3db4a34e.cce78c",
"78233440.defabc",
"c119906e.b188d",
"ab6b22e2.0115d",
"135cfa61.37e1d6",
"b2846de2.2e112",
"59c45eb4.eafd9",
"efb0c0c4.9ef7c",
"fa170853.3d9b48"
],
"x": 14,
"y": 19,
"w": 1722,
"h": 442
},
{
"id": "cbc4ea65.b983a8",
"type": "change",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "Save",
"rules": [
{
"t": "set",
"p": "customDeviceList",
"pt": "global",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1310,
"y": 600,
"wires": [
[]
]
},
{
"id": "2bd208cf.b19e58",
"type": "inject",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "Define manually custom devices",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "3",
"topic": "",
"payload": "[{\"custom\":true,\"name\":\"Office Ceiling\",\"zone\":\"Office\",\"object\":\"Ceiling\",\"type\":\"lights\",\"setOn\":{\"name\":\"On\",\"url\":\"http:///api//lights//state\",\"body\":{\"on\":true}},\"setOff\":{\"name\":\"Off\",\"url\":\"http:///api//lights//state\",\"body\":{\"on\":false}},\"currentState\":{\"name\":\"CurrentState\",\"url\":\"http:///api//lights/\",\"parser\":\"philips\",\"id\":0}}]",
"payloadType": "json",
"x": 990,
"y": 600,
"wires": [
[
"cbc4ea65.b983a8",
"69064f6c.6567a"
]
]
},
{
"id": "58f1a572.757e0c",
"type": "comment",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "↓ Custom devices - define your Philips devices here ↓",
"info": "Template for manual custom device definition (here for lights): see inject node below",
"x": 1040,
"y": 560,
"wires": []
},
{
"id": "d054a147.1e165",
"type": "mqtt in",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "",
"topic": "proknx/custom/cmd",
"qos": "2",
"datatype": "auto",
"broker": "1303831c.a0b82d",
"x": 930,
"y": 1120,
"wires": [
[
"d431c2b9.54d41"
]
]
},
{
"id": "d431c2b9.54d41",
"type": "json",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 905,
"y": 1040,
"wires": [
[
"1b37b861.73eac8"
]
],
"l": false
},
{
"id": "17edd027.f975e",
"type": "http request",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "http",
"method": "GET",
"ret": "txt",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 1395,
"y": 1075,
"wires": [
[
"5fee6739.043a28"
]
]
},
{
"id": "5fee6739.043a28",
"type": "debug",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1495,
"y": 1060,
"wires": [],
"l": false
},
{
"id": "5eb6b82e.0b9f88",
"type": "function",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "Prepare request",
"func": "msg.device=[];\nif (msg.cmd.type === \"lights\") {\n if (msg.cmd.value !== undefined) {\n for (var i = 0; i < msg.items.length; i++) {\n if (msg.items[i].type === \"dimmers\" && msg.cmd.cmd !== \"off\") {\n var val = msg.cmd.value/100 * msg.items[i].setBrightness.valueMax;\n msg.device[i] = msg.items[i].setBrightness;\n \n //-------- Modified code ---------//\n if(msg.items[i].currentState.parser === \"philips\"){\n msg.device[i].body.bri = Math.floor(val);\n }\n else{\n msg.device[i].value = val;\n }\n //-------------------------------//\n \n }else if (msg.cmd.value > 0) {\n msg.device[i] = msg.items[i].setOn;\n }else {\n msg.device[i] = msg.items[i].setOff;\n }\n }\n }else if (msg.cmd.cmd === \"on\") {\n for (var i = 0; i < msg.items.length; i++) {\n msg.device[i] = msg.items[i].setOn;\t \n }\n }else if (msg.cmd.cmd === \"off\") {\n for (var i = 0; i < msg.items.length; i++) {\n msg.device[i] = msg.items[i].setOff;\n }\n }\n}else if (msg.cmd.type === \"aux\") {\n if (msg.cmd.cmd === \"on\" || msg.cmd.cmd === \"set\") {\n if (msg.cmd.value !== undefined) {\n for (var i = 0; i < msg.items.length; i++) {\n if (msg.items[i].setBrightness !== undefined) {\n var val = msg.cmd.value;\n val = precisionRound(val, 1);\n msg.device[i] = msg.items[i].setBrightness;\n msg.device[i].value = val;\n } \n else if (msg.cmd.value > 0) {\n msg.device[i] = msg.items[i].setOn;\n }\n else {\n msg.device[i] = msg.items[i].setOff;\n }\t\t\t\t \n }\n }else {\n for (var i = 0; i < msg.items.length; i++) {\n msg.device[i] = msg.items[i].setOn;\n }\n }\n }else if (msg.cmd.cmd === \"off\") {\n for (var i = 0; i < msg.items.length; i++) {\n if (msg.items[i].setOff !== undefined) {\n msg.device[i] = msg.items[i].setOff;\n }\n }\n }\n}\n//-------- Added code --------//\nelse if (msg.cmd.type === \"scenes\") {\n if (msg.cmd.cmd === \"on\"){\n for (let i = 0; i < msg.items.length; i++) {\n if (msg.items[i].setOn !== undefined) {\n msg.device[i] = msg.items[i].setOn;\n }\n }\n }\n}\n//----------------------------//\n \nflow.set(\"msgDevice\",msg.device) ; //contain command info of the device\nflow.set(\"msgItems\",msg.items); // contain list of devices concerned\nflow.set(\"msgCmd\", msg.cmd);\nmsg.payload = msg.device;\n \nreturn msg; ",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 1135,
"y": 1080,
"wires": [
[
"12c160ec.7aad0f"
]
],
"l": false
},
{
"id": "39b15c72.995654",
"type": "switch",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "Cmd ?",
"property": "cmd.cmd",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "increase",
"vt": "str"
},
{
"t": "eq",
"v": "decrease",
"vt": "str"
},
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
},
{
"t": "eq",
"v": "set",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 5,
"x": 1030,
"y": 1040,
"wires": [
[
"1a7d94a2.28493b"
],
[
"1a7d94a2.28493b"
],
[
"5eb6b82e.0b9f88"
],
[
"5eb6b82e.0b9f88"
],
[
"5eb6b82e.0b9f88"
]
]
},
{
"id": "12c160ec.7aad0f",
"type": "split",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 1195,
"y": 1100,
"wires": [
[
"614c1021.2c9f7"
]
],
"l": false
},
{
"id": "1b37b861.73eac8",
"type": "change",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "move data from payload",
"rules": [
{
"t": "set",
"p": "cmd",
"pt": "msg",
"to": "payload.cmd",
"tot": "msg"
},
{
"t": "set",
"p": "items",
"pt": "msg",
"to": "payload.items",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 955,
"y": 1040,
"wires": [
[
"39b15c72.995654"
]
],
"l": false
},
{
"id": "5efed0ae.b11ae",
"type": "change",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "Replace value and set url",
"rules": [
{
"t": "change",
"p": "payload.url",
"pt": "msg",
"from": "{value}",
"fromt": "str",
"to": "payload.value",
"tot": "msg"
},
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "payload.url",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1300,
"y": 1075,
"wires": [
[
"17edd027.f975e"
]
],
"l": false
},
{
"id": "2e3a82d8.b9574e",
"type": "mqtt in",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "",
"topic": "proknx/custom/query",
"qos": "2",
"datatype": "auto",
"broker": "1303831c.a0b82d",
"x": 930,
"y": 950,
"wires": [
[
"4571fa6c.25aef4"
]
]
},
{
"id": "4571fa6c.25aef4",
"type": "json",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 1075,
"y": 950,
"wires": [
[
"fad28ca.bd1e57"
]
],
"l": false
},
{
"id": "fad28ca.bd1e57",
"type": "change",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "move data from payload",
"rules": [
{
"t": "set",
"p": "cmd",
"pt": "msg",
"to": "payload.cmd",
"tot": "msg"
},
{
"t": "set",
"p": "items",
"pt": "msg",
"to": "payload.items",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1125,
"y": 950,
"wires": [
[
"8243632f.a567f"
]
],
"l": false
},
{
"id": "1a7d94a2.28493b",
"type": "function",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "GET Current",
"func": "msg.device = [];\n\nif (msg.cmd.type === \"aux\" || msg.cmd.type === \"lights\" || msg.cmd.type === \"dimmers\" ) {\n var cptok=0;\n var cpter=0;\n msg.itemsok=[];\n msg.itemser=[];\n for (var i = 0; i < msg.items.length; i++) {\n if(msg.items[i].currentState !== undefined && msg.items[i].type !== \"lights\") {\n msg.itemsok[cptok]=msg.items[i];\n cptok++;\n } else {\n msg.itemser[cpter]=msg.items[i];\n cpter++;\n }\n }\n if (msg.itemsok[0] !== undefined) {\n msg.items = msg.itemsok;\n for (var i = 0; i < msg.itemsok.length; i++) {\n\t\t\tmsg.device[i] = msg.itemsok[i].currentState;\n }\n msg.payload = msg.device;\n delete msg.device;\n flow.set(\"msgDevice\", msg.device);\n flow.set(\"msgItems\", msg.items);\n flow.set(\"msgCmd\", msg.cmd);\n return [msg, null];\n }\n\n if (msg.itemser.length > 0 && msg.itemsok.length === 0) {\n if (msg.itemser.length > 1) {\n if (msg.cmd.lang === \"de\") {\n text1 = msg.itemser[0].name;\n text2 = \" und \";\n text3 = msg.itemser.length-1;\n text4 = \" andere Geräte verstehen diesen Befehl nicht\";\n texttabl = [text1, text2, text3, text4];\n var text = \"\".concat(...texttabl); \n msg.error = {\n text: text,\n siteId: msg.cmd.siteId,\n lang: \"de-DE\"\n };\n } else if (msg.cmd.lang === \"fr\") {\n text1 = msg.itemser[0].name;\n text2 = \" et \";\n text3 = msg.itemser.length-1;\n text4 = \" autres appareils ne supportent pas cette commande\";\n texttabl = [text1, text2, text3, text4];\n var text = \"\".concat(...texttabl); \n msg.error = {\n text: text,\n siteId: msg.cmd.siteId,\n lang: \"fr-FR\"\n };\n } else {\n text1 = msg.itemser[0].name;\n text2 = \" and \";\n text3 = msg.itemser.length-1;\n text4 = \" other devices do not support this command\";\n texttabl = [text1, text2, text3, text4];\n var text = \"\".concat(...texttabl); \n msg.error = {\n text: text,\n siteId: msg.cmd.siteId,\n lang: \"en-EN\"\n };\n }\n } else {\n if (msg.cmd.lang === \"de\") {\n text1 = msg.itemser[0].name;\n text2 = \" versteht diesen Befehl nicht\";\n texttabl = [text1, text2];\n var text = \"\".concat(...texttabl);\n msg.error = {\n text: text,\n siteId: msg.cmd.siteId,\n lang: \"de-DE\"\n };\n } else if (msg.cmd.lang === \"fr\") {\n text1 = msg.itemser[0].name;\n text2 = \" ne supporte pas cette commande\";\n texttabl = [text1, text2];\n var text = \"\".concat(...texttabl);\n msg.error = {\n text: text,\n siteId: msg.cmd.siteId,\n lang: \"fr-FR\"\n };\n } else {\n text1 = msg.itemser[0].name;\n text2 = \" does not support this command\";\n texttabl = [text1, text2];\n var text = \"\".concat(...texttabl);\n msg.error = {\n text: text,\n siteId: msg.cmd.siteId,\n lang: \"en-EN\"\n };\n }\n }\n }\n flow.set(\"msgError\", msg.error);\n flow.set(\"msgCmd\", msg.cmd);\n return [null, msg];\n}",
"outputs": "2",
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 1135,
"y": 1020,
"wires": [
[
"6315308d.f4a2d"
],
[
"24994d7a.2b5442"
]
],
"l": false
},
{
"id": "8243632f.a567f",
"type": "function",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "GET_Current",
"func": "\nmsg.device = [];\ndeviceList = msg.deviceList;\n\nif ( msg.cmd.type === \"aux\" || msg.cmd.type === \"lights\" || msg.cmd.type === \"dimmers\" || msg.cmd.type === \"sensor\") {\n var cptok=0;\n var cpter=0;\n msg.itemsok=[];\n msg.itemser=[];\n for (var i = 0; i < msg.items.length; i++) {\n if(msg.items[i].currentState !== undefined) {\n msg.itemsok[cptok]=msg.items[i];\n cptok++;\n } else {\n msg.itemser[cpter]=msg.items[i];\n cpter++;\n }\n }\n if (msg.itemsok[0] !== undefined) {\n msg.items = msg.itemsok;\n for (var i = 0; i < msg.itemsok.length; i++) {\n\t\t msg.device[i] = msg.itemsok[i].currentState; \n }\n msg.payload = msg.device;\n \t flow.set(\"msgDevice\", msg.device);\n flow.set(\"msgItems\", msg.items);\n flow.set(\"msgCmd\", msg.cmd);\n\t delete msg.device;\n return [msg, null];\n }\n\n if (msg.itemser.length > 0 && msg.itemsok.length === 0) {\n if (msg.itemser.length > 1) {\n if (msg.cmd.lang === \"de\") {\n text1 = msg.itemser[0].name;\n text2 = \" und \";\n text3 = msg.itemser.length-1;\n text4 = \" andere Geräte verstehen diesen Befehl nicht\";\n texttabl = [text1, text2, text3, text4];\n var text = \"\".concat(...texttabl); \n msg.error = {\n text: text,\n siteId: msg.cmd.siteId,\n lang: \"de-DE\"\n };\n } else if (msg.cmd.lang === \"fr\") {\n text1 = msg.itemser[0].name;\n text2 = \" et \";\n text3 = msg.itemser.length-1;\n text4 = \" autres appareils ne supportent pas cette commande\";\n texttabl = [text1, text2, text3, text4];\n var text = \"\".concat(...texttabl); \n msg.error = {\n text: text,\n siteId: msg.cmd.siteId,\n lang: \"fr-FR\"\n };\n } else {\n text1 = msg.itemser[0].name;\n text2 = \" and \";\n text3 = msg.itemser.length-1;\n text4 = \" other devices do not support this command\";\n texttabl = [text1, text2, text3, text4];\n var text = \"\".concat(...texttabl); \n msg.error = {\n text: text,\n siteId: msg.cmd.siteId,\n lang: \"en-EN\"\n };\n }\n } else {\n if (msg.cmd.lang === \"de\") {\n text1 = msg.itemser[0].name;\n text2 = \" versteht diesen Befehl nicht\";\n texttabl = [text1, text2];\n var text = \"\".concat(...texttabl);\n msg.error = {\n text: text,\n siteId: msg.cmd.siteId,\n lang: \"de-DE\"\n };\n } else if (msg.cmd.lang === \"fr\") {\n text1 = msg.itemser[0].name;\n text2 = \" ne supporte pas cette commande\";\n texttabl = [text1, text2];\n var text = \"\".concat(...texttabl);\n msg.error = {\n text: text,\n siteId: msg.cmd.siteId,\n lang: \"fr-FR\"\n };\n } else {\n text1 = msg.itemser[0].name;\n text2 = \" does not support this command\";\n texttabl = [text1, text2];\n var text = \"\".concat(...texttabl);\n msg.error = {\n text: text,\n siteId: msg.cmd.siteId,\n lang: \"en-EN\"\n };\n }\n }\n }\n flow.set(\"msgError\", msg.error);\n flow.set(\"msgCmd\", msg.cmd);\n\n return [null, msg];\n}",
"outputs": "2",
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 1175,
"y": 950,
"wires": [
[
"79d81098.4ca71"
],
[
"16a27b61.d96a25"
]
],
"l": false
},
{
"id": "24994d7a.2b5442",
"type": "link out",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "ERROR TO FEEDBACK",
"links": [
"521b53e0.33f214"
],
"x": 1185,
"y": 1040,
"wires": []
},
{
"id": "16a27b61.d96a25",
"type": "link out",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "ERROR TO FEEDBACK",
"links": [
"521b53e0.33f214"
],
"x": 1255,
"y": 970,
"wires": []
},
{
"id": "79d81098.4ca71",
"type": "function",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "Query",
"func": "msg.device = msg.payload;\nmsg.payload.device = [];\nfor(var i = 0; i < msg.device.length ; i++){\n msg.payload.device[i] = msg.device[i];\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 905,
"y": 900,
"wires": [
[
"2399b29a.a443de"
]
],
"l": false
},
{
"id": "2399b29a.a443de",
"type": "split",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "split",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 955,
"y": 900,
"wires": [
[
"a775d59a.672e28"
]
],
"l": false
},
{
"id": "8931e1a7.57ab2",
"type": "http request",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "http",
"method": "GET",
"ret": "txt",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 1130,
"y": 900,
"wires": [
[
"45dee2c3.68a05c"
]
]
},
{
"id": "9fcd286b.2a8f18",
"type": "change",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "Replace value and set url",
"rules": [
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "payload.url",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1035,
"y": 900,
"wires": [
[
"8931e1a7.57ab2"
]
],
"l": false
},
{
"id": "3c2d4256.66d43e",
"type": "function",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "Parser Philips",
"func": "msg.states = [];\nif(msg.payload.length >= 1){\n for(var i=0; i < msg.payload.length ; ++i){\n \n if(msg.payload.state.on && msg.payload.state.bri !== undefined){\n // Light (dimmer) is on\n msg.states[i]={\n \"Data\" : [{\n \"Value\" : msg.payload.state.bri\n }]\n };\n }\n else{\n // Light is off\n msg.states[i]={\n \"Data\" : [{\n \"Value\" : msg.payload.state.on\n }]\n };\n }\n if(msg.states[i].Data[0].Value !== undefined){\n msg.states[i].Result=true;\n }else{\n msg.states[i].Result=false;\n }\n } \n}\nelse{\n if(msg.payload.state.on && msg.payload.state.bri !== undefined){\n // Light (dimmer) is on\n msg.states[0]={\n \"Data\" : [{\n \"Value\" : msg.payload.state.bri\n }]\n };\n }\n else{\n // Light is off\n msg.states[0]={\n \"Data\" : [{\n \"Value\" : msg.payload.state.on\n }]\n };\n }\n \n if(msg.states[0].Data[0].Value !== undefined){\n msg.states[0].Result=true;\n }else{\n msg.states[0].Result=false;\n }\n}\n\n \nmsg.payload=msg.states;\ndelete msg.states;\nif(msg.cmd.cmd !== undefined){\n msg.command = true;\n}else{\n msg.command = false;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 940,
"y": 830,
"wires": [
[
"79b6d24a.1f6fcc"
]
]
},
{
"id": "18a48d77.70c8d3",
"type": "debug",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1325,
"y": 930,
"wires": [],
"l": false
},
{
"id": "45dee2c3.68a05c",
"type": "switch",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "",
"property": "statusCode",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "200",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 1235,
"y": 900,
"wires": [
[
"d017d58d.71b4a8"
],
[
"18a48d77.70c8d3"
]
],
"l": false
},
{
"id": "79b6d24a.1f6fcc",
"type": "switch",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "command or query?",
"property": "command",
"propertyType": "msg",
"rules": [
{
"t": "false"
},
{
"t": "true"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 1065,
"y": 830,
"wires": [
[
"18b5b04a.a2882"
],
[
"e0288de.f5b227"
]
],
"outputLabels": [
"if query",
"if command"
],
"l": false
},
{
"id": "18b5b04a.a2882",
"type": "link out",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "FEEDBACK",
"links": [
"a1b4e119.a687c8"
],
"x": 1115,
"y": 800,
"wires": []
},
{
"id": "e0288de.f5b227",
"type": "link out",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "CONTINUE COMMAND OUT",
"links": [
"23e511ec.2e9cce"
],
"x": 1115,
"y": 840,
"wires": []
},
{
"id": "d017d58d.71b4a8",
"type": "json",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 1295,
"y": 890,
"wires": [
[
"3c2d4256.66d43e"
]
],
"l": false
},
{
"id": "65befb1.975fc04",
"type": "function",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "Prepare request",
"func": "function precisionRound(number, precision) {\n var factor = Math.pow(10, precision);\n return Math.round(number * factor) / factor;\n}\ndelete msg.type;\ndelete msg.headers;\ndelete msg.certificate;\nmsg.device = [];\nmsg.current = msg.payload;\nmsg.newVal = [];\nif (msg.cmd.type === \"lights\" && msg.cmd.cmd === \"increase\") {\n cptok = 0;\n for (var i = 0; i < msg.items.length; i++) {\n if (msg.items[i].type === \"dimmers\") {\n if (msg.cmd.value !== undefined) {\n var val = msg.cmd.value / 100 * msg.items[i].setBrightness.valueMax;\n val = precisionRound(val, 0);\n var newVal = parseInt(msg.current[i].Data[0].Value) + val;\n if (newVal > msg.items[i].setBrightness.valueMax) {\n newVal = msg.items[i].setBrightness.valueMax;\n }\n newVal = precisionRound(newVal, 0);\n msg.device[cptok] = msg.items[i].setBrightness;\n msg.device[cptok].body.bri = newVal;\n // msg.device[cptok].value = newVal;\n cptok++;\n } else {\n var newVal = parseInt(msg.current[i].Data[0].Value) + (0.2 * msg.items[i].setBrightness.valueMax);\n if (newVal > msg.items[i].setBrightness.valueMax) {\n newVal = msg.items[i].setBrightness.valueMax;\n }\n newVal = precisionRound(newVal, 0);\n msg.device[cptok] = msg.items[i].setBrightness;\n msg.device[cptok].body.bri = newVal;\n // msg.device[cptok].value = newVal;\n cptok++;\n }\n }\n }\n} else if (msg.cmd.type === \"lights\" && msg.cmd.cmd === \"decrease\") {\n cptok = 0;\n for (var i = 0; i < msg.items.length; i++) {\n if (msg.items[i].type === \"dimmers\") {\n if (msg.cmd.value !== undefined) {\n var val = msg.cmd.value / 100 * msg.items[i].setBrightness.valueMax;\n val = precisionRound(val, 0);\n var newVal = parseInt(msg.current[i].Data[0].Value) - val;\n if (newVal < msg.items[i].setBrightness.valueMin) {\n newVal = msg.items[i].setBrightness.valueMin;\n }\n newVal = precisionRound(newVal, 0);\n msg.device[cptok] = msg.items[i].setBrightness;\n msg.device[cptok].body.bri = newVal;\n // msg.device[cptok].value = newVal;\n cptok++;\n } else {\n var newVal = parseInt(msg.current[i].Data[0].Value) - (0.2 * msg.items[i].setBrightness.valueMax);\n if (newVal < msg.items[i].setBrightness.valueMin) {\n newVal = msg.items[i].setBrightness.valueMin;\n }\n newVal = precisionRound(newVal, 0);\n msg.device[cptok] = msg.items[i].setBrightness;\n msg.device[cptok].body.bri = newVal;\n // msg.device[cptok].value = newVal;\n cptok++;\n }\n }\n }\n}\n\nmsg.payload = msg.device;\ndelete msg.url;\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 1135,
"y": 1120,
"wires": [
[
"12c160ec.7aad0f"
]
],
"l": false
},
{
"id": "23e511ec.2e9cce",
"type": "link in",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "CONTINUE COMMAND IN",
"links": [
"e0288de.f5b227"
],
"x": 1085,
"y": 1120,
"wires": [
[
"65befb1.975fc04"
]
]
},
{
"id": "6315308d.f4a2d",
"type": "link out",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "CONTINUE QUERY OUT",
"links": [
"6b487a58.05ae24"
],
"x": 1185,
"y": 1000,
"wires": []
},
{
"id": "6b487a58.05ae24",
"type": "link in",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "CONTINUE QUERY IN",
"links": [
"6315308d.f4a2d"
],
"x": 855,
"y": 880,
"wires": [
[
"79d81098.4ca71"
]
]
},
{
"id": "b8145d60.da12b",
"type": "comment",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "Readme Parser!",
"info": "The parser for each device is defined in the device definition (see below).\nWhen you add a device from a different vendor, you must also modify the parser code below to handle the response.\n\n\"currentState\": {\n \"name\": \"CurrentBrightness\",\n \"url\": \"http://192.168.1.200/status\",\n **\"parser\": \"shelly\",**\n \"valueMin\": 0,\n \"valueMax\": 100\n}",
"x": 940,
"y": 799,
"wires": []
},
{
"id": "c91e8034.bc7e8",
"type": "comment",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "INFO / README",
"info": "- This group, CUSTOM DEVICES, enables voice control of custom devices, i.e. apart from the devices of the main Gateway you can add-on here.\n- \n- Any device that can be controlled via HTTP can be integrataded here.\n- \n- This sample demonstrates how to declare (publish) your custom devices, in this case Philips lamp.",
"x": 920,
"y": 520,
"wires": []
},
{
"id": "614c1021.2c9f7",
"type": "switch",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "Specific body request?",
"property": "payload.body",
"propertyType": "msg",
"rules": [
{
"t": "istype",
"v": "undefined",
"vt": "undefined"
},
{
"t": "istype",
"v": "object",
"vt": "object"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 1246,
"y": 1100,
"wires": [
[
"5efed0ae.b11ae"
],
[
"f0c049d.2be87b8"
]
],
"l": false
},
{
"id": "bf9fb42f.db4058",
"type": "http request",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "http [PUT]",
"method": "PUT",
"ret": "txt",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 1388,
"y": 1115,
"wires": [
[
"fe8eea40.bbb328"
]
]
},
{
"id": "fe8eea40.bbb328",
"type": "debug",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1495,
"y": 1120,
"wires": [],
"l": false
},
{
"id": "f0c049d.2be87b8",
"type": "change",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "Add specific body to http request",
"rules": [
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "payload.url",
"tot": "msg"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.body",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1300,
"y": 1115,
"wires": [
[
"bf9fb42f.db4058"
]
],
"l": false
},
{
"id": "d0868a42.37b228",
"type": "function",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "Automatic CustomDeviceList for Philips Hue",
"func": "// Get devices that are defined in Philips Hue bridge\n// And set them into the right format\nlet devices = [];\n\n// Bridge Ip address\nconst ipAddress = flow.get(\"bridgeIpAddress\");\n\n// Username\nlet username = flow.get(\"bridgeApiKey\");\n\n// Groups (zone)\nlet groups = msg.payload.groups;\n\n//-------------------- Lights --------------------//\nlet lights = msg.payload.lights;\n\nif(lights !== undefined){\n for(const obj in lights){\n try{\n // Template for lights\n let light = \n {\n \"custom\": true,\n \"name\": \"\",\n \"zone\": \"\",\n \"object\": \"\",\n \"type\": \"dimmers\",\n \"setOn\": {\n \"name\": \"On\",\n \"url\": \"\",\n \"body\": {\n \"on\": true\n }\n },\n \"setOff\": {\n \"name\": \"Off\",\n \"url\": \"\",\n \"body\": {\n \"on\": false\n }\n },\n \"setBrightness\": {\n \"name\": \"Brightness\",\n \"url\" : \"\",\n \"valueMin\":1,\n \"valueMax\":254,\n \"body\": {\n \"on\": true,\n \"bri\": 127\n }\n },\n \"currentState\": {\n \"name\": \"CurrentBrightness\",\n \"url\": \"\",\n \"parser\": \"philips\",\n \"id\": 0,\n \"bri\": 0,\n \"valueMin\": 1,\n \"valueMax\": 254\n }\n }\n \n // Light id for url\n let lightID = obj;\n \n // Zone\n for(const grp in groups){\n if(groups[grp].lights.length !== 0){\n // At least one light is part of the group\n for(let i=0; i < groups[grp].lights.length; ++i){\n if(groups[grp].lights[i] === lightID){\n // Get zone\n if(groups[grp].hasOwnProperty(\"name\")){\n light.zone = groups[grp].name;\n }\n else{\n light.zone = \"Default\";\n }\n }\n }\n }\n else{\n // No light is part of the group\n light.zone = \"Default\";\n }\n }\n // Object (light name)\n if(lights[obj].hasOwnProperty(\"name\")){\n light.object = lights[obj].name;\n \n //***** Change functionType if it is a smart plug ****//\n if(lights[obj].type.search(\"plug\") !== -1){\n light.type = \"lights\";\n light.currentState.name = \"CurrentState\";\n }\n }\n else{\n // This case should not happen\n light.object = \"Undefined\";\n }\n \n // Name\n light.name = light.zone+\" \"+light.object;\n \n // On\n light.setOn.url= \"http://\"+ipAddress+\"/api/\"+username+\"/lights/\"+lightID+\"/state\";\n // Off\n light.setOff.url= \"http://\"+ipAddress+\"/api/\"+username+\"/lights/\"+lightID+\"/state\";\n // Brightness\n light.setBrightness.url= \"http://\"+ipAddress+\"/api/\"+username+\"/lights/\"+lightID+\"/state\";\n // State\n light.currentState.url= \"http://\"+ipAddress+\"/api/\"+username+\"/lights/\"+lightID;\n light.currentState.id= parseInt(lightID, 10);\n if(lights[obj].state.bri !== undefined){\n // Current brightness\n light.currentState.bri= lights[obj].state.bri;\n }\n \n // Add light to msgDeviceList\n devices.push(light);\n }\n catch(e){\n node.warn(\"Light Exception=\"+e);\n }\n }\n}\n\n//-------------------- Sensors (Not fully tested yet) --------------------//\n// let sensors = msg.payload.sensors;\n\n// if(sensors !== undefined){\n// for(const obj in sensors){\n// try{\n// // Template for sensors\n// let sensor = \n// {\n// \"custom\": true,\n// \"name\": \"\",\n// \"type\": \"sensor\",\n// \"zone\": \"\",\n// \"object\": \"\",\n// \"currentState\": [\n// {\n// \"name\": \"CurrentValue\",\n// \"url\": \"\",\n// \"parser\": \"philips\",\n// \"id\": 0\n// }\n// ]\n// }\n \n// // sensor id for url\n// let sensorID = obj;\n \n// // Zone\n// for(const grp in groups){\n// if(groups[grp].sensors.length !== 0){\n// // At least one sensor is part of the group\n// for(let i=0; i < groups[grp].sensors.length; ++i){\n// if(groups[grp].sensors[i] === sensorID){\n// // Get zone\n// if(groups[grp].hasOwnProperty(\"name\")){\n// sensor.zone = groups[grp].name;\n// }\n// else{\n// sensor.zone = \"Default\";\n// }\n// }\n// }\n// }\n// else{\n// // No sensor is part of the group\n// sensor.zone = \"Default\";\n// }\n// }\n// // Sensor name\n// if(sensors[obj].hasOwnProperty(\"name\")){\n// sensor.name = sensors[obj].name;\n// }\n \n// // State\n// sensor.currentState.url= \"http://\"+ipAddress+\"/api/\"+username+\"/sensors/\"+sensorID;\n// sensor.currentState.id= parseInt(sensorID,10);\n \n// // Add sensor to msgDeviceList\n// devices.push(sensor);\n// }\n// catch(e){\n// node.warn(\"Sensor Exception=\"+e);\n// }\n// }\n// }\n\n//-------------------- Scenes --------------------//\nlet scenes = msg.payload.scenes;\n\nif(scenes !== undefined){\n for(const obj in scenes){\n try{\n // Template for scene\n let scene = \n {\n \"custom\": true,\n \"name\": \"\",\n \"type\": \"scenes\",\n \"zone\": \"\",\n \"object\": \"\",\n \"group\": \"\",\n \"setOn\":\n {\n \"name\": \"On\",\n \"url\": \"\",\n \"body\": {\n \"scene\": \"\"\n }\n }\n }\n \n // scene id for url\n let sceneID = obj;\n \n // Group & zone\n if(scenes[obj].hasOwnProperty(\"group\") && scenes[obj].group !== \"\" && scenes[obj].group !== undefined){\n scene.group = scenes[obj].group;\n \n if(groups[parseInt(scene.group, 10)].hasOwnProperty(\"name\")){\n scene.zone = groups[parseInt(scene.group, 10)].name;\n }\n else{\n let serverSiteId = global.get(\"msgServerSiteId\");\n serverSiteId = serverSiteId.replace('_', ' ');\n serverSiteId = serverSiteId.charAt(0).toUpperCase() + serverSiteId.slice(1);\n \n scene.zone = serverSiteId;\n }\n }\n else{\n // No scene is part of the group: default group & serverSiteId as zone\n scene.group = \"0\";\n let serverSiteId = global.get(\"msgServerSiteId\");\n serverSiteId = serverSiteId.replace('_', ' ');\n serverSiteId = serverSiteId.charAt(0).toUpperCase() + serverSiteId.slice(1);\n \n scene.zone = serverSiteId;\n }\n \n // Object\n if(scenes[obj].hasOwnProperty(\"name\")){\n scene.object = scenes[obj].name;\n }\n \n // Name\n scene.name = scene.zone+\" \"+scene.object;\n \n // State\n scene.setOn.url= \"http://\"+ipAddress+\"/api/\"+username+\"/groups/\"+scene.group+\"/action/\";\n scene.setOn.body.scene = sceneID;\n \n // Add scene to msgDeviceList\n devices.push(scene);\n }\n catch(e){\n node.warn(\"Scene Exception=\"+e);\n }\n }\n}\n\nmsg.payload = devices;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 1255,
"y": 680,
"wires": [
[
"69064f6c.6567a",
"cbc4ea65.b983a8",
"25422191.c7903e"
]
],
"l": false
},
{
"id": "c679da8.ce91728",
"type": "inject",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "Automatic customDeviceList (debug)",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "15",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 1000,
"y": 680,
"wires": [
[
"7958a547.c0f9bc"
]
]
},
{
"id": "69064f6c.6567a",
"type": "debug",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "Debug Philips Hue Devices",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1440,
"y": 640,
"wires": []
},
{
"id": "4ea97a58.428ae4",
"type": "comment",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "↓ Custom devices - automatically define your Philips devices ↓",
"info": "",
"x": 1060,
"y": 640,
"wires": []
},
{
"id": "946c9b67.f30e98",
"type": "link in",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "AUTO DEVICE LIST IN",
"links": [
"9bcfbaae.298fc8",
"6009d4b2.b29b8c"
],
"x": 1115,
"y": 720,
"wires": [
[
"7958a547.c0f9bc"
]
]
},
{
"id": "7958a547.c0f9bc",
"type": "switch",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "Login?",
"property": "login",
"propertyType": "flow",
"rules": [
{
"t": "true"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 1195,
"y": 680,
"wires": [
[
"d0868a42.37b228"
]
],
"l": false
},
{
"id": "25422191.c7903e",
"type": "link out",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "UI UPDATE DEVICE LIST OUT",
"links": [
"318fb263.7a63ce"
],
"x": 1335,
"y": 680,
"wires": []
},
{
"id": "54f89a12.6f68e4",
"type": "debug",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 235,
"y": 1540,
"wires": [],
"l": false
},
{
"id": "a5f11ba8.f140a8",
"type": "http request",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Create new user (once only)",
"method": "POST",
"ret": "txt",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 335,
"y": 660,
"wires": [
[
"2e6526ff.6a40ba"
]
],
"l": false
},
{
"id": "4a717777.a6ab48",
"type": "inject",
"z": "93dfeda6.87345",
"d": true,
"g": "7e7e4e7b.883f5",
"name": "Create new user (debug)",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "3",
"topic": "",
"payload": "{\"devicetype\":\"my_hue_app#phone default_user\"}",
"payloadType": "json",
"x": 95,
"y": 680,
"wires": [
[]
],
"l": false
},
{
"id": "c19b605c.755b4",
"type": "json",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 455,
"y": 640,
"wires": [
[
"3b11e013.06c1c"
]
],
"l": false
},
{
"id": "91947035.6ab14",
"type": "change",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"rules": [
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "http://{{bridgeIpAddress}}/api",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 215,
"y": 660,
"wires": [
[
"d572fd0b.26178"
]
],
"l": false
},
{
"id": "d572fd0b.26178",
"type": "change",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"rules": [
{
"t": "change",
"p": "url",
"pt": "msg",
"from": "{{bridgeIpAddress}}",
"fromt": "str",
"to": "bridgeIpAddress",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 275,
"y": 660,
"wires": [
[
"a5f11ba8.f140a8"
]
],
"l": false
},
{
"id": "e488c940.f843a8",
"type": "comment",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Create authorized user for Philips Hue Bridge",
"info": "Authorized user are allowed to control all devices that have been defined in Philips Hue Android App.",
"x": 210,
"y": 560,
"wires": []
},
{
"id": "9c14355c.401f68",
"type": "ui_button",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "New connection",
"group": "e4287664.fc5db8",
"order": 3,
"width": 3,
"height": 1,
"passthru": false,
"label": "New connection",
"tooltip": "Please press Philips Hue link button before pressing the \"New connection\" button.",
"color": "",
"bgcolor": "",
"icon": "",
"payload": "{\"devicetype\":\"my_hue_app#phone default_user\"}",
"payloadType": "json",
"topic": "topic",
"x": 95,
"y": 640,
"wires": [
[
"58901619.cfc008"
]
],
"l": false
},
{
"id": "ae2525ad.c5a688",
"type": "ui_toast",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"position": "top right",
"displayTime": "3",
"highlight": "",
"sendall": true,
"outputs": 0,
"ok": "OK",
"cancel": "",
"raw": false,
"topic": "",
"name": "",
"x": 635,
"y": 600,
"wires": [],
"l": false
},
{
"id": "3b11e013.06c1c",
"type": "switch",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Username already created?",
"property": "bridgeApiKey",
"propertyType": "flow",
"rules": [
{
"t": "istype",
"v": "undefined",
"vt": "undefined"
},
{
"t": "istype",
"v": "string",
"vt": "string"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 515,
"y": 620,
"wires": [
[
"74336134.91b96",
"77ace372.8d31bc"
],
[
"e4ac9c7e.5486b",
"ff0d95e8.b5c0b8"
]
],
"l": false
},
{
"id": "738c35cd.fde98c",
"type": "ui_toast",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"position": "top right",
"displayTime": "3",
"highlight": "",
"sendall": true,
"outputs": 0,
"ok": "OK",
"cancel": "",
"raw": false,
"topic": "",
"name": "",
"x": 695,
"y": 660,
"wires": [],
"l": false
},
{
"id": "ef23474f.8e4a38",
"type": "change",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"rules": [
{
"t": "set",
"p": "bridgeDevices",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 135,
"y": 1500,
"wires": [
[
"54f89a12.6f68e4",
"59d263db.76500c",
"e7726a76.d5db28"
]
],
"l": false
},
{
"id": "466923b6.45d58c",
"type": "ui_text",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"group": "e4287664.fc5db8",
"order": 5,
"width": 14,
"height": 1,
"name": "Info",
"label": "Information:",
"format": "{{msg.payload}}",
"layout": "row-left",
"x": 550,
"y": 840,
"wires": []
},
{
"id": "b78cae3d.d5b03",
"type": "change",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "To be able to command your Philips devices, please connect your bridge.",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 375,
"y": 820,
"wires": [
[
"466923b6.45d58c"
]
],
"l": false
},
{
"id": "66718ed5.788d8",
"type": "change",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "Your Philips Hue bridge is connected and ready for use.",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 395,
"y": 860,
"wires": [
[
"466923b6.45d58c"
]
],
"l": false
},
{
"id": "ab1312d4.833ef",
"type": "inject",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "5",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 840,
"wires": [
[
"d9634d00.fe64c"
]
]
},
{
"id": "80f3689b.a23098",
"type": "comment",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "UI Dashboard",
"info": "This user interface helps is used to set up the first connection between Philips Hue bridge and ARAGON.",
"x": 110,
"y": 520,
"wires": []
},
{
"id": "d97de4d.e1cbc18",
"type": "ui_template",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"group": "e4287664.fc5db8",
"name": "Header",
"order": 1,
"width": 14,
"height": 7,
"format": "\n
\n\n",
"storeOutMessages": true,
"fwdInMessages": true,
"resendOnRefresh": true,
"templateScope": "local",
"x": 280,
"y": 1060,
"wires": [
[
"2c8db891.263cf8"
]
]
},
{
"id": "693331c9.46502",
"type": "inject",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Paragraph",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "Philips Hue
This tab is used to set up the connection between your Philips Hue Bridge and your ARAGON.
Please follow the next steps whether it is the first connection:
- Make sure the IP address of your bridge has been found (Huemagic node required), otherwise enter it manually on the popup
- Press the link button on the Philips Hue Bridge
- Click on \"NEW CONNECTION\" button
- Make sure the connection is established, see \"Information\".
Once your Philips Hue bridge is connected, you may be able to command your Philips Devices by using your voice. A list of the available devices is displayed on the side.
Note: - Click on \"SEARCH FOR PHILIPS HUE DEVICES & SCENES\" if no device or scene appears.
",
"payloadType": "str",
"x": 130,
"y": 1060,
"wires": [
[
"d97de4d.e1cbc18"
]
]
},
{
"id": "2c8db891.263cf8",
"type": "debug",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 395,
"y": 1060,
"wires": [],
"l": false
},
{
"id": "e2a55b4e.553c28",
"type": "ui_button",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Devices",
"group": "74e4e3ab.22089c",
"order": 2,
"width": 0,
"height": 0,
"passthru": false,
"label": "Search for Philips Hue devices & scenes",
"tooltip": "Searchs for available devices and displays them in the list below",
"color": "",
"bgcolor": "",
"icon": "",
"payload": "http://{{bridgeIpAddress}}/api/{{bridgeApiKey}}/lights",
"payloadType": "str",
"topic": "topic",
"x": 115,
"y": 1280,
"wires": [
[
"6e3eb805.a26be8"
]
],
"l": false
},
{
"id": "9d0a46a6.a87a58",
"type": "ui_text",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"group": "e4287664.fc5db8",
"order": 2,
"width": 5,
"height": 1,
"name": "Spacer",
"label": "",
"format": "{{msg.payload}}",
"layout": "row-spread",
"x": 55,
"y": 640,
"wires": [],
"l": false
},
{
"id": "469f5e73.1a597",
"type": "ui_dropdown",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Lights_list",
"label": "Lights",
"tooltip": "",
"place": "Show list",
"group": "74e4e3ab.22089c",
"order": 3,
"width": 0,
"height": 0,
"passthru": true,
"multiple": false,
"options": [
{
"label": "",
"value": "",
"type": "str"
}
],
"payload": "",
"topic": "topic",
"x": 600,
"y": 1500,
"wires": [
[
"432fa332.327ccc"
]
]
},
{
"id": "432fa332.327ccc",
"type": "debug",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 705,
"y": 1500,
"wires": [],
"l": false
},
{
"id": "ad1e4351.b05b7",
"type": "change",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "Your bridge is already connected!",
"tot": "str"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 635,
"y": 660,
"wires": [
[
"738c35cd.fde98c"
]
],
"l": false
},
{
"id": "74336134.91b96",
"type": "change",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "Please press the link button then click again on \"NEW CONNECTION\".",
"tot": "str"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 575,
"y": 600,
"wires": [
[
"ae2525ad.c5a688"
]
],
"l": false
},
{
"id": "3ddd53ca.a25cec",
"type": "debug",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload.lights",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 355,
"y": 1540,
"wires": [],
"l": false
},
{
"id": "64d5d65b.12aad8",
"type": "switch",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"property": "login",
"propertyType": "flow",
"rules": [
{
"t": "true"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 335,
"y": 860,
"wires": [
[
"66718ed5.788d8"
]
],
"l": false
},
{
"id": "d9634d00.fe64c",
"type": "switch",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"property": "login",
"propertyType": "flow",
"rules": [
{
"t": "false"
},
{
"t": "istype",
"v": "undefined",
"vt": "undefined"
},
{
"t": "true"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 255,
"y": 840,
"wires": [
[
"b78cae3d.d5b03"
],
[
"b78cae3d.d5b03"
],
[
"64d5d65b.12aad8"
]
],
"l": false
},
{
"id": "6dd965a1.7166bc",
"type": "change",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Failed login",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "Please connect your bridge first.",
"tot": "str"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 295,
"y": 1260,
"wires": [
[
"f0a062dd.d8d97"
]
],
"l": false
},
{
"id": "59d263db.76500c",
"type": "function",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Update device list",
"func": "let devices= flow.get(\"bridgeDevices\");\n\nvar lights_name= [];\nvar sensors_name= [];\nvar scenes_name= [];\nmsg.payload= {};\n\nfor(let id in devices){\n\n switch(devices[id].type){\n \n //Get lights + room\n case \"dimmers\":\n case \"lights\":\n if(devices[id].hasOwnProperty(\"object\") && devices[id].hasOwnProperty(\"zone\")){\n lights_name.push(devices[id].object + \" - Room: \" + devices[id].zone);\n }\n break;\n \n //Get sensors + room\n case \"sensor\":\n if(devices[id].hasOwnProperty(\"name\") && devices[id].hasOwnProperty(\"zone\")){\n sensors_name.push(devices[id].name + \" - Room: \" + devices[id].zone); \n }\n break;\n \n //Get scenes + room\n case \"scenes\":\n if(devices[id].hasOwnProperty(\"object\") && devices[id].hasOwnProperty(\"zone\")){\n scenes_name.push(devices[id].object + \" - Room: \" + devices[id].zone);\n }\n break;\n \n default:\n node.warn(\"Device not found!\");\n }\n \n}\n\nmsg.payload.lights = lights_name;\nmsg.payload.sensors = sensors_name;\nmsg.payload.scenes = scenes_name;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 355,
"y": 1500,
"wires": [
[
"3ddd53ca.a25cec",
"4ae5ecf8.766664",
"3019cb6f.a4df64",
"80feeddd.1b674"
]
],
"l": false
},
{
"id": "960c7b44.78c1d8",
"type": "comment",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Intructions for user",
"info": "",
"x": 130,
"y": 1020,
"wires": []
},
{
"id": "5552d335.c405ec",
"type": "comment",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Connection status",
"info": "",
"x": 130,
"y": 800,
"wires": []
},
{
"id": "d7246a29.1e2358",
"type": "link in",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "SUCESSFUL LOG IN (STATUS)",
"links": [
"e4ac9c7e.5486b",
"78e0242a.e5075c"
],
"x": 255,
"y": 880,
"wires": [
[
"64d5d65b.12aad8"
]
]
},
{
"id": "83207e03.29eba",
"type": "link out",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "GET IP OUT",
"links": [
"a64d8879.099bf8",
"8c6c4101.71197"
],
"x": 215,
"y": 600,
"wires": []
},
{
"id": "58901619.cfc008",
"type": "switch",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "bridge IP?",
"property": "bridgeIpAddress",
"propertyType": "flow",
"rules": [
{
"t": "istype",
"v": "undefined",
"vt": "undefined"
},
{
"t": "istype",
"v": "string",
"vt": "string"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 155,
"y": 640,
"wires": [
[
"83207e03.29eba"
],
[
"91947035.6ab14"
]
],
"l": false
},
{
"id": "e4ac9c7e.5486b",
"type": "link out",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "SUCCESSFUL NEW CONNECTION",
"links": [
"d7246a29.1e2358"
],
"x": 575,
"y": 680,
"wires": []
},
{
"id": "8ce52662.26ff18",
"type": "change",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Logged in",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "Search in progress, please wait.",
"tot": "str"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 295,
"y": 1300,
"wires": [
[
"c9c60743.554ca8"
]
],
"l": false
},
{
"id": "c9c60743.554ca8",
"type": "ui_toast",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"position": "top right",
"displayTime": "4",
"highlight": "",
"sendall": true,
"outputs": 0,
"ok": "OK",
"cancel": "",
"raw": false,
"topic": "",
"name": "",
"x": 355,
"y": 1300,
"wires": [],
"l": false
},
{
"id": "676e5845.334928",
"type": "change",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "Devices found!",
"tot": "str"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 355,
"y": 1420,
"wires": [
[
"bd8834b.d53d7c8"
]
],
"l": false
},
{
"id": "bd8834b.d53d7c8",
"type": "ui_toast",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"position": "top right",
"displayTime": "3",
"highlight": "",
"sendall": true,
"outputs": 0,
"ok": "OK",
"cancel": "",
"raw": false,
"topic": "",
"name": "",
"x": 415,
"y": 1420,
"wires": [],
"l": false
},
{
"id": "6e3eb805.a26be8",
"type": "switch",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "login?",
"property": "login",
"propertyType": "flow",
"rules": [
{
"t": "false"
},
{
"t": "true"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 215,
"y": 1280,
"wires": [
[
"6dd965a1.7166bc"
],
[
"8ce52662.26ff18",
"1566188a.702f67"
]
],
"l": false
},
{
"id": "f07a292b.47c6e8",
"type": "link out",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "UI DEVICES OUT",
"links": [
"dc35fbdd.def438"
],
"x": 355,
"y": 1340,
"wires": []
},
{
"id": "f0a062dd.d8d97",
"type": "ui_toast",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"position": "top right",
"displayTime": "3",
"highlight": "",
"sendall": true,
"outputs": 0,
"ok": "OK",
"cancel": "",
"raw": false,
"topic": "",
"name": "",
"x": 355,
"y": 1260,
"wires": [],
"l": false
},
{
"id": "318fb263.7a63ce",
"type": "link in",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "UI UPDATE DEVICES LIST IN",
"links": [
"25422191.c7903e"
],
"x": 55,
"y": 1500,
"wires": [
[
"ef23474f.8e4a38"
]
]
},
{
"id": "fa248a76.1c5018",
"type": "comment",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "***********************Get Devices & Scenes (manually)***********************",
"info": "",
"x": 300,
"y": 1220,
"wires": []
},
{
"id": "ab8070c0.aada",
"type": "comment",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Update UI",
"info": "",
"x": 100,
"y": 1460,
"wires": []
},
{
"id": "1566188a.702f67",
"type": "delay",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"pauseType": "delay",
"timeout": "2",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 295,
"y": 1340,
"wires": [
[
"f07a292b.47c6e8"
]
],
"l": false
},
{
"id": "a7cc1c32.ac89f",
"type": "ui_dropdown",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Sensors_list",
"label": "Sensors",
"tooltip": "",
"place": "Not supported",
"group": "74e4e3ab.22089c",
"order": 5,
"width": 0,
"height": 0,
"passthru": true,
"multiple": false,
"options": [
{
"label": "",
"value": "",
"type": "str"
}
],
"payload": "",
"topic": "topic",
"x": 610,
"y": 1560,
"wires": [
[
"96c94e49.2f5dc"
]
]
},
{
"id": "96c94e49.2f5dc",
"type": "debug",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 715,
"y": 1560,
"wires": [],
"l": false
},
{
"id": "4ae5ecf8.766664",
"type": "change",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"rules": [
{
"t": "set",
"p": "options",
"pt": "msg",
"to": "payload.sensors",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 495,
"y": 1560,
"wires": [
[
"a7cc1c32.ac89f"
]
],
"l": false
},
{
"id": "e7726a76.d5db28",
"type": "delay",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"pauseType": "delay",
"timeout": "2",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 235,
"y": 1440,
"wires": [
[
"cae11ec7.23faa"
]
],
"l": false
},
{
"id": "29dc8109.6cc66e",
"type": "file",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"filename": "usernamePhilipsHue.json",
"appendNewline": true,
"createDir": false,
"overwriteFile": "true",
"encoding": "none",
"x": 635,
"y": 560,
"wires": [
[
"3862b8cc.ed8868",
"694be44d.a1e44c"
]
],
"l": false
},
{
"id": "77ace372.8d31bc",
"type": "function",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Save username (file & flow variable)",
"func": "if(msg.payload[0].success.username !== undefined){\n \n let usernamePhilips = msg.payload[0].success.username;\n \n // flow variable\n flow.set(\"bridgeApiKey\", usernamePhilips);\n \n // file\n msg.payload = {\"username\": usernamePhilips};\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 575,
"y": 560,
"wires": [
[
"29dc8109.6cc66e"
]
],
"l": false
},
{
"id": "3862b8cc.ed8868",
"type": "debug",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 695,
"y": 520,
"wires": [],
"l": false
},
{
"id": "694be44d.a1e44c",
"type": "link out",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "BRIDGE CONNECTION OUT",
"links": [
"1d1e38d.7bfd5c7"
],
"x": 695,
"y": 560,
"wires": []
},
{
"id": "2e6526ff.6a40ba",
"type": "switch",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "status",
"property": "statusCode",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "200",
"vt": "num"
},
{
"t": "neq",
"v": "200",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 395,
"y": 660,
"wires": [
[
"c19b605c.755b4"
],
[
"8c0c2310.59fd6",
"ec842552.3a9ce8"
]
],
"l": false
},
{
"id": "259a04c6.4431cc",
"type": "ui_toast",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"position": "top right",
"displayTime": "3",
"highlight": "",
"sendall": true,
"outputs": 0,
"ok": "OK",
"cancel": "",
"raw": false,
"topic": "",
"name": "",
"x": 575,
"y": 760,
"wires": [],
"l": false
},
{
"id": "8c0c2310.59fd6",
"type": "change",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Error & delete IP",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "The IP address seems to be wrong, please try again.",
"tot": "str"
},
{
"t": "delete",
"p": "bridgeIpAddress",
"pt": "flow"
},
{
"t": "set",
"p": "login",
"pt": "flow",
"to": "false",
"tot": "bool"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 515,
"y": 760,
"wires": [
[
"259a04c6.4431cc"
]
],
"l": false
},
{
"id": "cae11ec7.23faa",
"type": "switch",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Device found?",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "nempty"
},
{
"t": "empty"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 295,
"y": 1440,
"wires": [
[
"676e5845.334928"
],
[
"d8bab73c.d698a8"
]
],
"l": false
},
{
"id": "d8bab73c.d698a8",
"type": "change",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "No device has been found!",
"tot": "str"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 355,
"y": 1460,
"wires": [
[
"c41ca3d.2893e6"
]
],
"l": false
},
{
"id": "c41ca3d.2893e6",
"type": "ui_toast",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"position": "top right",
"displayTime": "3",
"highlight": "",
"sendall": true,
"outputs": 0,
"ok": "OK",
"cancel": "",
"raw": false,
"topic": "",
"name": "",
"x": 415,
"y": 1460,
"wires": [],
"l": false
},
{
"id": "be3cb2d5.d10ea",
"type": "http request",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "get Bridge IP",
"method": "GET",
"ret": "txt",
"paytoqs": "ignore",
"url": "http://localhost:1880/hue/bridges/",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 250,
"y": 160,
"wires": [
[
"1df89796.183668",
"58e3b0ea.ad121"
]
]
},
{
"id": "ccfc46fd.35d1b8",
"type": "json",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 515,
"y": 200,
"wires": [
[
"2d3b045d.d1126c"
]
],
"l": false
},
{
"id": "8d6b19ff.ca3de8",
"type": "comment",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Get Bridge IP address via Huemagic Node",
"info": "Huemagic node has to be installed via \"Manage palette\" menu.",
"x": 200,
"y": 100,
"wires": []
},
{
"id": "bda215f8.ad3208",
"type": "switch",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "empty?",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "empty"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 435,
"y": 140,
"wires": [
[
"99f73b52.e266f8"
],
[
"ccfc46fd.35d1b8"
]
],
"l": false
},
{
"id": "99f73b52.e266f8",
"type": "function",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "error",
"func": "msg.cmd={};\nmsg.cmd.lang = global.get(\"msgLang\");\n if (msg.cmd.lang === \"de\") {\n text = \"Bitte geben Sie die IP-Adresse der PHILIPS HUE Bridge auf der Benutzeroberfläche ein\";\n msg.error = {\n text: text,\n siteId: msg.cmd.siteId,\n lang: \"de-DE\",\n forceText: true\n };\n } else if (msg.cmd.lang === \"fr\") {\n text = \"Veuillez indiquer l'adresse IP du pont PHILIPS HUE sur l'interface utilisateur\";\n msg.error = {\n text: text,\n siteId: msg.cmd.siteId,\n lang: \"fr-FR\",\n forceText: true\n };\n } else {\n text = \"Please indicate the IP address of PHILIPS HUE bridge in the user interface\";\n msg.error = {\n text: text,\n siteId: msg.cmd.siteId,\n lang: \"en-EN\",\n forceText: true\n };\n }\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 550,
"y": 120,
"wires": [
[
"9a96377d.eb8178"
]
]
},
{
"id": "9a96377d.eb8178",
"type": "link out",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"links": [
"521b53e0.33f214"
],
"x": 635,
"y": 120,
"wires": []
},
{
"id": "f19e81e6.0d7a3",
"type": "debug",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 755,
"y": 200,
"wires": [],
"l": false
},
{
"id": "2d359c8d.4d09b4",
"type": "comment",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Authorized user?",
"info": "",
"x": 1000,
"y": 60,
"wires": []
},
{
"id": "99eede8a.f16c9",
"type": "http request",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"method": "GET",
"ret": "txt",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 1235,
"y": 120,
"wires": [
[
"c0220321.3f646",
"3b365c84.d41914"
]
],
"l": false
},
{
"id": "d2c1a2cc.62b36",
"type": "debug",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1395,
"y": 200,
"wires": [],
"l": false
},
{
"id": "bf0f43e8.8124d",
"type": "json",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 1375,
"y": 140,
"wires": [
[
"7770759b.08506c",
"d2c1a2cc.62b36"
]
],
"l": false
},
{
"id": "78e0242a.e5075c",
"type": "link out",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "SUCCESSFUL LOG IN OUT",
"links": [
"6acb7db6.2431c4",
"dc35fbdd.def438",
"d7246a29.1e2358"
],
"x": 1515,
"y": 200,
"wires": []
},
{
"id": "1d1e38d.7bfd5c7",
"type": "link in",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "BRIDGE CONNECTION IN",
"links": [
"694be44d.a1e44c",
"949dd39b.2335e"
],
"x": 855,
"y": 160,
"wires": [
[
"b5fd7d4d.6bc0d"
]
]
},
{
"id": "3b365c84.d41914",
"type": "switch",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "status",
"property": "statusCode",
"propertyType": "msg",
"rules": [
{
"t": "neq",
"v": "200",
"vt": "num"
},
{
"t": "eq",
"v": "200",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 1295,
"y": 120,
"wires": [
[
"6137324c.f74a7c"
],
[
"bf0f43e8.8124d"
]
],
"l": false
},
{
"id": "6b6bb4a3.acc1ec",
"type": "ui_toast",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"position": "top right",
"displayTime": "3",
"highlight": "",
"sendall": true,
"outputs": 0,
"ok": "OK",
"cancel": "",
"raw": false,
"topic": "",
"name": "",
"x": 1435,
"y": 100,
"wires": [],
"l": false
},
{
"id": "c0220321.3f646",
"type": "debug",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "statusCode",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1295,
"y": 160,
"wires": [],
"l": false
},
{
"id": "6137324c.f74a7c",
"type": "change",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "Sorry an error has occured, please try again.",
"tot": "str"
},
{
"t": "set",
"p": "login",
"pt": "flow",
"to": "false",
"tot": "bool"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1375,
"y": 100,
"wires": [
[
"6b6bb4a3.acc1ec"
]
],
"l": false
},
{
"id": "7770759b.08506c",
"type": "switch",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Authorized user?",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "istype",
"v": "array",
"vt": "array"
},
{
"t": "istype",
"v": "object",
"vt": "object"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 1435,
"y": 140,
"wires": [
[
"64b458e6.8173b8"
],
[
"78e0242a.e5075c",
"93136f05.e9f85"
]
],
"l": false
},
{
"id": "64b458e6.8173b8",
"type": "change",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "Please connect your bridge with \"NEW CONNECTION\"..",
"tot": "str"
},
{
"t": "set",
"p": "login",
"pt": "flow",
"to": "false",
"tot": "bool"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1515,
"y": 100,
"wires": [
[
"7519bace.4622d4"
]
],
"l": false
},
{
"id": "7519bace.4622d4",
"type": "ui_toast",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"position": "top right",
"displayTime": "5",
"highlight": "",
"sendall": true,
"outputs": 0,
"ok": "OK",
"cancel": "",
"raw": false,
"topic": "",
"name": "Failed login",
"x": 1575,
"y": 100,
"wires": [],
"l": false
},
{
"id": "93136f05.e9f85",
"type": "change",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "Successful connection!",
"tot": "str"
},
{
"t": "set",
"p": "login",
"pt": "flow",
"to": "true",
"tot": "bool"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1515,
"y": 160,
"wires": [
[
"9f01eaf2.779648"
]
],
"l": false
},
{
"id": "9f01eaf2.779648",
"type": "ui_toast",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"position": "top right",
"displayTime": "3",
"highlight": "",
"sendall": true,
"outputs": 0,
"ok": "OK",
"cancel": "",
"raw": false,
"topic": "",
"name": "Successful login",
"x": 1575,
"y": 160,
"wires": [],
"l": false
},
{
"id": "8c6c4101.71197",
"type": "link in",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "GET IP IN",
"links": [
"83207e03.29eba",
"8c683cb3.2f7af",
"a95f77a.830d588"
],
"x": 115,
"y": 200,
"wires": [
[
"be3cb2d5.d10ea",
"65bc35ff.f337ec"
]
]
},
{
"id": "b5fd7d4d.6bc0d",
"type": "file in",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"filename": "usernamePhilipsHue.json",
"format": "utf8",
"chunk": false,
"sendError": false,
"encoding": "none",
"x": 935,
"y": 140,
"wires": [
[
"3ab65d94.be0cc2"
]
],
"l": false
},
{
"id": "46b738ff.057968",
"type": "inject",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Get username & IP address from file",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": "5",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 855,
"y": 120,
"wires": [
[
"b5fd7d4d.6bc0d",
"eeb077de.874038"
]
],
"l": false
},
{
"id": "3ab65d94.be0cc2",
"type": "json",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 995,
"y": 140,
"wires": [
[
"dce72bc7.e949e8"
]
],
"l": false
},
{
"id": "8352f1ff.24024",
"type": "change",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Set IpAddress",
"rules": [
{
"t": "set",
"p": "bridgeIpAddress",
"pt": "flow",
"to": "payload.bridgeIpAddress",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1055,
"y": 100,
"wires": [
[
"92d5ddb5.cb2de"
]
],
"l": false
},
{
"id": "83030a76.4cf288",
"type": "function",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "error msg",
"func": "msg.cmd={};\nmsg.cmd.lang = global.get(\"msgLang\");\nvar ourIP = global.get(\"msgServerIP\");\nvar text = \"\";\nvar text2 = \"\";\n\n// No unsolicited spoken error messages 22-07\nvar d = new Date();\nvar hour = d.getHours();\nif (hour >= 22 || hour < 7 ) {\n node.warn(\"Skipping spoken error messages during the night: \"+hour);\n return;\n}\n\nif (msg.cmd.lang === \"de\") {\n text = \"Gehen Sie in Ihrem Browser auf die Benutzeroberfläche von Nod Red, Abschnitt PHILIPS HUE und folgen Sie den Anweisungen.\";\n if(ourIP.length>0){\n text2 = \" Die adresse ist \" + ourIP;\n }\n msg.error = {\n text: text,\n siteId: msg.cmd.siteId,\n lang: \"de-DE\",\n forceRestart: true\n };\n} else if (msg.cmd.lang === \"fr\") {\n text = \"Dans votre navigateur, allez sur l'interface utilisateur Node Red, onglet PHILIPS HUE et suivez les instructions données.\";\n if(ourIP.length>0){\n text = \"Dans votre navigateur, allez sur: \"+ ourIP + \" deux points 1880 slash ui. Suivez les instructions données dans la section PHILIPS Gateway.\";\n text2 = \" L'adresse est \" + ourIP;\n }\n msg.error = {\n text: text,\n siteId: msg.cmd.siteId,\n lang: \"fr-FR\",\n forceRestart: true\n };\n} else {\n text = \"In your browser, navigate to the Node Red user interface and follow the given instructions in the PHILIPS Hue tab\";\n if(ourIP.length>0){\n text = \"In your browser, navigate to: \"+ ourIP + \" colon 1880 slash ui. Follow the given instructions in the PHILIPS Gateway tab\";\n text2 = \" The address is \" + ourIP;\n }\n msg.error = {\n text: text,\n siteId: msg.cmd.siteId,\n lang: \"en-EN\",\n forceRestart: true\n };\n}\nvar msg2;\nif(text2.length>0){\n msg2 = JSON.parse(JSON.stringify(msg))\n msg2.error.text = text2;\n msg2.error.forceRestart= true;\n}\nreturn [msg,msg2];",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 1580,
"y": 300,
"wires": [
[
"27842a50.841f66"
]
]
},
{
"id": "27842a50.841f66",
"type": "link out",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"links": [
"521b53e0.33f214"
],
"x": 1675,
"y": 300,
"wires": []
},
{
"id": "bc8e0030.56568",
"type": "switch",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "status?",
"property": "statusCode",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "EHOSTUNREACH",
"vt": "str"
},
{
"t": "eq",
"v": "ECONNREFUSED",
"vt": "str"
},
{
"t": "neq",
"v": "200",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 4,
"x": 1300,
"y": 340,
"wires": [
[
"83030a76.4cf288"
],
[
"83030a76.4cf288"
],
[
"83030a76.4cf288"
],
[
"558c6fd1.ca744"
]
]
},
{
"id": "1923136.2f1b8ed",
"type": "catch",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"scope": [
"bc8e0030.56568"
],
"uncaught": false,
"x": 1435,
"y": 280,
"wires": [
[
"83030a76.4cf288"
]
],
"l": false
},
{
"id": "558c6fd1.ca744",
"type": "switch",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "empty",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "empty"
},
{
"t": "nempty"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 1470,
"y": 360,
"wires": [
[
"83030a76.4cf288"
],
[
"bbe0ed2c.75293"
]
]
},
{
"id": "4275d02d.94d3d",
"type": "http request",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Philips Hue devices",
"method": "GET",
"ret": "txt",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 1110,
"y": 340,
"wires": [
[
"bc8e0030.56568"
]
]
},
{
"id": "6f8daef1.78a81",
"type": "change",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "IP & Username",
"rules": [
{
"t": "change",
"p": "url",
"pt": "msg",
"from": "{{bridgeIpAddress}}",
"fromt": "str",
"to": "bridgeIpAddress",
"tot": "flow"
},
{
"t": "change",
"p": "url",
"pt": "msg",
"from": "{{username}}",
"fromt": "str",
"to": "bridgeApiKey",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 975,
"y": 340,
"wires": [
[
"4275d02d.94d3d"
]
],
"l": false
},
{
"id": "bbe0ed2c.75293",
"type": "json",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Philips Hue JSON",
"property": "payload",
"action": "",
"pretty": false,
"x": 1510,
"y": 420,
"wires": [
[
"6009d4b2.b29b8c",
"843d7ac8.c6a068"
]
]
},
{
"id": "89089abb.425e58",
"type": "change",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "url",
"rules": [
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "http://{{bridgeIpAddress}}/api/{{username}}/",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 915,
"y": 340,
"wires": [
[
"6f8daef1.78a81"
]
],
"l": false
},
{
"id": "dc35fbdd.def438",
"type": "link in",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "GET DEVICES IN",
"links": [
"9bf5bad8.eb0008",
"58cad645.1441d8",
"f07a292b.47c6e8",
"78e0242a.e5075c"
],
"x": 855,
"y": 340,
"wires": [
[
"89089abb.425e58"
]
]
},
{
"id": "e5356160.2b1ff",
"type": "comment",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Get Philips Hue device list",
"info": "",
"x": 950,
"y": 300,
"wires": []
},
{
"id": "6009d4b2.b29b8c",
"type": "link out",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "AUTO DEVICE LIST OUT",
"links": [
"946c9b67.f30e98"
],
"x": 1675,
"y": 420,
"wires": []
},
{
"id": "3019cb6f.a4df64",
"type": "change",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"rules": [
{
"t": "set",
"p": "options",
"pt": "msg",
"to": "payload.lights",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 495,
"y": 1500,
"wires": [
[
"469f5e73.1a597"
]
],
"l": false
},
{
"id": "1df89796.183668",
"type": "debug",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "statusCode",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 375,
"y": 120,
"wires": [],
"l": false
},
{
"id": "58e3b0ea.ad121",
"type": "switch",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Not found?",
"property": "statusCode",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "200",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 375,
"y": 160,
"wires": [
[
"bda215f8.ad3208"
],
[
"651d9733.9f8b88"
]
],
"l": false
},
{
"id": "9a8da7bf.92b708",
"type": "change",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Search for IP address",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "IP address not found!",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 295,
"y": 340,
"wires": [
[
"78233440.defabc"
]
],
"l": false
},
{
"id": "5317cb23.a062f4",
"type": "ui_toast",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"position": "prompt",
"displayTime": "10",
"highlight": "",
"sendall": true,
"outputs": 1,
"ok": "Submit",
"cancel": "New research",
"raw": true,
"topic": "",
"name": "",
"x": 415,
"y": 340,
"wires": [
[
"ab6b22e2.0115d"
]
],
"l": false
},
{
"id": "44b4bf1b.18b9f",
"type": "inject",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Debug IP",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "192.168.1.173",
"payloadType": "str",
"x": 615,
"y": 340,
"wires": [
[
"2d3b045d.d1126c"
]
],
"l": false
},
{
"id": "1809c2d.464703d",
"type": "switch",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Ip address?",
"property": "bridgeIpAddress",
"propertyType": "flow",
"rules": [
{
"t": "istype",
"v": "undefined",
"vt": "undefined"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 115,
"y": 340,
"wires": [
[
"6e4a6041.8317b"
]
],
"l": false
},
{
"id": "9b9aadbd.c1bd7",
"type": "switch",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "neq",
"v": "New research",
"vt": "str"
},
{
"t": "eq",
"v": "New research",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 535,
"y": 340,
"wires": [
[
"ea8d9374.927a3"
],
[
"a95f77a.830d588"
]
],
"l": false
},
{
"id": "a64d8879.099bf8",
"type": "link in",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "GET IP UI IN",
"links": [
"83207e03.29eba"
],
"x": 55,
"y": 400,
"wires": [
[
"af8c9325.07c3b"
]
]
},
{
"id": "af8c9325.07c3b",
"type": "switch",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "login==false?",
"property": "login",
"propertyType": "flow",
"rules": [
{
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 115,
"y": 400,
"wires": [
[
"6e29f4d0.63acbc"
]
],
"l": false
},
{
"id": "6e29f4d0.63acbc",
"type": "delay",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"pauseType": "delay",
"timeout": "12",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 175,
"y": 400,
"wires": [
[
"6e4a6041.8317b"
]
],
"l": false
},
{
"id": "ec75b25b.b4f54",
"type": "delay",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "3",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 235,
"y": 340,
"wires": [
[
"9a8da7bf.92b708"
]
],
"l": false
},
{
"id": "a95f77a.830d588",
"type": "link out",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "GET IP OUT",
"links": [
"8c6c4101.71197"
],
"x": 595,
"y": 380,
"wires": []
},
{
"id": "ea8d9374.927a3",
"type": "switch",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "login==false?",
"property": "login",
"propertyType": "flow",
"rules": [
{
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 595,
"y": 300,
"wires": [
[
"2d3b045d.d1126c"
]
],
"l": false
},
{
"id": "843d7ac8.c6a068",
"type": "debug",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1675,
"y": 380,
"wires": [],
"l": false
},
{
"id": "80feeddd.1b674",
"type": "change",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"rules": [
{
"t": "set",
"p": "options",
"pt": "msg",
"to": "payload.scenes",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 495,
"y": 1620,
"wires": [
[
"2282804d.5fa7b"
]
],
"l": false
},
{
"id": "2282804d.5fa7b",
"type": "ui_dropdown",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Scenes_list",
"label": "Scenes",
"tooltip": "",
"place": "Show list",
"group": "74e4e3ab.22089c",
"order": 4,
"width": 0,
"height": 0,
"passthru": true,
"multiple": false,
"options": [
{
"label": "",
"value": "",
"type": "str"
}
],
"payload": "",
"topic": "topic",
"x": 610,
"y": 1620,
"wires": [
[
"21c6a308.53789c"
]
]
},
{
"id": "21c6a308.53789c",
"type": "debug",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 715,
"y": 1620,
"wires": [],
"l": false
},
{
"id": "2d3b045d.d1126c",
"type": "function",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Save ip address (file & flow variable)",
"func": "// Ip address found by Huemagic node\nif(msg.payload[0].ip !== undefined){\n \n let bridgeIpAddress = msg.payload[0].ip;\n \n // flow variable\n flow.set(\"bridgeIpAddress\", bridgeIpAddress);\n \n // file\n msg.payload = {\"bridgeIpAddress\": bridgeIpAddress};\n}\n// Ip address not found by Huemagic node\nelse{\n let bridgeIpAddress = msg.payload;\n \n // flow variable\n flow.set(\"bridgeIpAddress\", bridgeIpAddress);\n \n // file\n msg.payload = {\"bridgeIpAddress\": bridgeIpAddress};\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 635,
"y": 200,
"wires": [
[
"92c2733c.ece1b"
]
],
"l": false
},
{
"id": "92c2733c.ece1b",
"type": "file",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"filename": "bridgeIpAddressPH.json",
"appendNewline": true,
"createDir": false,
"overwriteFile": "true",
"encoding": "none",
"x": 695,
"y": 200,
"wires": [
[
"f19e81e6.0d7a3",
"c119906e.b188d"
]
],
"l": false
},
{
"id": "9348fc59.d060c",
"type": "comment",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Ask for Bridge IP address (UI)",
"info": "",
"x": 340,
"y": 300,
"wires": []
},
{
"id": "eeb077de.874038",
"type": "file in",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"filename": "bridgeIpAddressPH.json",
"format": "utf8",
"chunk": false,
"sendError": false,
"encoding": "none",
"x": 935,
"y": 100,
"wires": [
[
"e1ee4738.4bf6a8"
]
],
"l": false
},
{
"id": "e1ee4738.4bf6a8",
"type": "json",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 995,
"y": 100,
"wires": [
[
"8352f1ff.24024"
]
],
"l": false
},
{
"id": "f25fe9fa.115d28",
"type": "function",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Set url",
"func": "// Bridge info\nlet username = flow.get(\"bridgeApiKey\");\nlet bridgeIpAddress = flow.get(\"bridgeIpAddress\");\n\nif(bridgeIpAddress !== undefined && username !== undefined){\n msg.url = \"http://\"+bridgeIpAddress+\"/api/\"+username;\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 1175,
"y": 120,
"wires": [
[
"99eede8a.f16c9"
]
],
"l": false
},
{
"id": "ab99ff70.a516a",
"type": "inject",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Login?",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "600",
"crontab": "",
"once": false,
"onceDelay": "10",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 940,
"wires": [
[
"949dd39b.2335e"
]
]
},
{
"id": "949dd39b.2335e",
"type": "link out",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "BRIDGE CONNECTION OUT",
"links": [
"1d1e38d.7bfd5c7"
],
"x": 255,
"y": 940,
"wires": []
},
{
"id": "dce72bc7.e949e8",
"type": "change",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Set username",
"rules": [
{
"t": "set",
"p": "bridgeApiKey",
"pt": "flow",
"to": "payload.username",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1055,
"y": 140,
"wires": [
[
"92d5ddb5.cb2de"
]
],
"l": false
},
{
"id": "92d5ddb5.cb2de",
"type": "delay",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "3",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 1115,
"y": 120,
"wires": [
[
"f25fe9fa.115d28"
]
],
"l": false
},
{
"id": "6e4a6041.8317b",
"type": "switch",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Login?",
"property": "login",
"propertyType": "flow",
"rules": [
{
"t": "false"
},
{
"t": "istype",
"v": "undefined",
"vt": "undefined"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 175,
"y": 340,
"wires": [
[
"ec75b25b.b4f54"
],
[
"ec75b25b.b4f54"
]
],
"l": false
},
{
"id": "651d9733.9f8b88",
"type": "trigger",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "pay",
"duration": "10",
"extend": false,
"overrideDelay": false,
"units": "s",
"reset": "",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 55,
"y": 340,
"wires": [
[
"1809c2d.464703d"
]
],
"l": false
},
{
"id": "ff0d95e8.b5c0b8",
"type": "switch",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "login?",
"property": "login",
"propertyType": "flow",
"rules": [
{
"t": "false"
},
{
"t": "true"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 575,
"y": 640,
"wires": [
[
"694be44d.a1e44c"
],
[
"ad1e4351.b05b7"
]
],
"l": false
},
{
"id": "65bc35ff.f337ec",
"type": "change",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "Searching for your Philips Hue bridge IP address, please wait.",
"tot": "str"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 195,
"y": 200,
"wires": [
[
"3db4a34e.cce78c"
]
],
"l": false
},
{
"id": "3db4a34e.cce78c",
"type": "ui_toast",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"position": "top right",
"displayTime": "10",
"highlight": "",
"sendall": true,
"outputs": 0,
"ok": "OK",
"cancel": "",
"raw": false,
"topic": "",
"name": "",
"x": 255,
"y": 200,
"wires": [],
"l": false
},
{
"id": "78233440.defabc",
"type": "template",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "html",
"syntax": "mustache",
"template": "\n
Cannot find the IP address of your Philips bridge, please enter the IP address manually then submit it.
\n
You can click on \"NEW RESEARCH\" to try finding the IP address automatically (Huemagic node required).
\n
\n
Philips Hue Bridge IP address:
\n
\n",
"output": "str",
"x": 355,
"y": 340,
"wires": [
[
"5317cb23.a062f4"
]
],
"l": false
},
{
"id": "ec842552.3a9ce8",
"type": "file",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "Delete IP address file",
"filename": "bridgeIpAddressPH.json",
"appendNewline": true,
"createDir": false,
"overwriteFile": "delete",
"encoding": "none",
"x": 515,
"y": 720,
"wires": [
[]
],
"l": false
},
{
"id": "1aa49f1c.ece421",
"type": "link in",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "CREATE NEW USER IN",
"links": [
"c119906e.b188d"
],
"x": 195,
"y": 720,
"wires": [
[
"91947035.6ab14"
]
]
},
{
"id": "c119906e.b188d",
"type": "link out",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "CREATE NEW USER OUT",
"links": [
"1aa49f1c.ece421"
],
"x": 755,
"y": 240,
"wires": []
},
{
"id": "ab6b22e2.0115d",
"type": "change",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Reset notification title",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 475,
"y": 340,
"wires": [
[
"9b9aadbd.c1bd7"
]
],
"l": false
},
{
"id": "a775d59a.672e28",
"type": "function",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "Set URL",
"func": "// Bridge Ip address\nconst ipAddress = flow.get(\"bridgeIpAddress\");\n// Username\nlet username = flow.get(\"bridgeApiKey\");\n// Device ID\nlet deviceID = msg.payload.id;\n\nmsg.payload.url = \"http://\"+ipAddress+\"/api/\"+username+\"/lights/\"+deviceID;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 995,
"y": 900,
"wires": [
[
"9fcd286b.2a8f18"
]
],
"l": false
},
{
"id": "135cfa61.37e1d6",
"type": "catch",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "",
"scope": [
"b5fd7d4d.6bc0d",
"eeb077de.874038"
],
"uncaught": false,
"x": 935,
"y": 180,
"wires": [
[
"92d5ddb5.cb2de"
]
],
"l": false
},
{
"id": "b2846de2.2e112",
"type": "comment",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Version 10-15-2021",
"info": "*Version 10-15-2021:\n - UI: popup updated (to be improved)\n\n*Version 10-14-2021:\n - Get PH devices function updated\n\n*Version 10-05-2021: \n - Query for lights and dimmers\n\n*Version 08-19-2021 (first version):\n - Command for lights and scenes\n - UI Dashboard\n - Query not implemented yet",
"x": 130,
"y": 60,
"wires": [],
"icon": "node-red/light.svg"
},
{
"id": "3b606eff.04cbc2",
"type": "catch",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "",
"scope": [
"d0868a42.37b228"
],
"uncaught": false,
"x": 1255,
"y": 720,
"wires": [
[
"90743255.7a853"
]
],
"l": false
},
{
"id": "10ab2a05.bb7156",
"type": "ui_toast",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"position": "top right",
"displayTime": "3",
"highlight": "",
"sendall": true,
"outputs": 0,
"ok": "OK",
"cancel": "",
"raw": false,
"topic": "",
"name": "",
"x": 1355,
"y": 720,
"wires": [],
"l": false
},
{
"id": "90743255.7a853",
"type": "change",
"z": "93dfeda6.87345",
"g": "83df3251.a9c15",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "Failure to get on or more Philips Hue Devices. Please check the lists.",
"tot": "str"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1305,
"y": 720,
"wires": [
[
"10ab2a05.bb7156"
]
],
"l": false
},
{
"id": "c1f7875c.d7eb78",
"type": "comment",
"z": "93dfeda6.87345",
"g": "7e7e4e7b.883f5",
"name": "***********************IP address (manually)***********************",
"info": "",
"x": 260,
"y": 1120,
"wires": []
},
{
"id": "cd63ccbd.c994a",
"type": "ui_form",
"z": "93dfeda6.87345",
"d": true,
"g": "7e7e4e7b.883f5",
"name": "IP address",
"label": "Enter the IP address of your Philips Hue bridge here:",
"group": "74e4e3ab.22089c",
"order": 1,
"width": "7",
"height": "4",
"options": [
{
"label": "IP address",
"value": "192.168.x.x",
"type": "text",
"required": true,
"rows": null
}
],
"formValue": {
"192.168.x.x": ""
},
"payload": "",
"submit": "submit",
"cancel": "cancel",
"topic": "",
"x": 170,
"y": 1160,
"wires": [
[
"ad2aa50.a916f58"
]
]
},
{
"id": "59c45eb4.eafd9",
"type": "link in",
"z": "93dfeda6.87345",
"d": true,
"g": "87787cf6.2b83a",
"name": "GET IP MANUALLY IN",
"links": [],
"x": 515,
"y": 240,
"wires": [
[
"2d3b045d.d1126c"
]
]
},
{
"id": "ad2aa50.a916f58",
"type": "link out",
"z": "93dfeda6.87345",
"d": true,
"g": "7e7e4e7b.883f5",
"name": "GET IP MANUALLY OUT",
"links": [],
"x": 295,
"y": 1160,
"wires": []
},
{
"id": "fa170853.3d9b48",
"type": "change",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "Login initially false",
"rules": [
{
"t": "set",
"p": "login",
"pt": "flow",
"to": "false",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 115,
"y": 160,
"wires": [
[
"be3cb2d5.d10ea",
"65bc35ff.f337ec"
]
],
"l": false
},
{
"id": "efb0c0c4.9ef7c",
"type": "inject",
"z": "93dfeda6.87345",
"g": "87787cf6.2b83a",
"name": "IP",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 75,
"y": 160,
"wires": [
[
"fa170853.3d9b48"
]
],
"l": false
},
{
"id": "1303831c.a0b82d",
"type": "mqtt-broker",
"name": "",
"broker": "localhost",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": false,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
},
{
"id": "e4287664.fc5db8",
"type": "ui_group",
"name": "Main",
"tab": "3b5f5957.ebaa66",
"order": 1,
"disp": false,
"width": 14,
"collapse": false
},
{
"id": "74e4e3ab.22089c",
"type": "ui_group",
"name": "Hue_devices",
"tab": "3b5f5957.ebaa66",
"order": 5,
"disp": false,
"width": 7,
"collapse": false
},
{
"id": "3b5f5957.ebaa66",
"type": "ui_tab",
"name": "PHILIPS HUE",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]