Flow

This is the JSON source file that can be used for the Node-RED flow.
[
{
"id": "101713cf.36afac",
"type": "hue-light",
"z": "640fb4f7.0d690c",
"name": "Inner Light",
"bridge": "2fef9b8e.cce244",
"lightid": "1",
"colornamer": true,
"x": 1590,
"y": 320,
"wires": [
[
"fb4ab690.fa2d08"
]
]
},
{
"id": "fb4ab690.fa2d08",
"type": "debug",
"z": "640fb4f7.0d690c",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 1790,
"y": 320,
"wires": []
},
{
"id": "74c9ed3f.b3b1f4",
"type": "inject",
"z": "640fb4f7.0d690c",
"name": "Turn Off",
"topic": "",
"payload": "false",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 1400,
"y": 360,
"wires": [
[
"101713cf.36afac"
]
]
},
{
"id": "35bbb1a.adf314e",
"type": "hue-light",
"z": "640fb4f7.0d690c",
"name": "Midde Light ",
"bridge": "2fef9b8e.cce244",
"lightid": "2",
"colornamer": true,
"x": 1590,
"y": 500,
"wires": [
[
"9328fbc9.e20348"
]
]
},
{
"id": "9328fbc9.e20348",
"type": "debug",
"z": "640fb4f7.0d690c",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 1790,
"y": 500,
"wires": []
},
{
"id": "5d08159b.99328c",
"type": "inject",
"z": "640fb4f7.0d690c",
"name": "Turn Off",
"topic": "",
"payload": "false",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 1400,
"y": 540,
"wires": [
[
"35bbb1a.adf314e"
]
]
},
{
"id": "15c215b8.af77aa",
"type": "hue-light",
"z": "640fb4f7.0d690c",
"name": "Outer Light",
"bridge": "2fef9b8e.cce244",
"lightid": "3",
"colornamer": true,
"x": 1590,
"y": 680,
"wires": [
[
"4534f41c.b86bac"
]
]
},
{
"id": "4534f41c.b86bac",
"type": "debug",
"z": "640fb4f7.0d690c",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 1790,
"y": 680,
"wires": []
},
{
"id": "6a9f2a75.692834",
"type": "inject",
"z": "640fb4f7.0d690c",
"name": "Turn Off",
"topic": "",
"payload": "false",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 1400,
"y": 720,
"wires": [
[
"15c215b8.af77aa"
]
]
},
{
"id": "a748b712.1fb4a8",
"type": "inject",
"z": "640fb4f7.0d690c",
"name": "Turn On",
"topic": "",
"payload": "true",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 1400,
"y": 280,
"wires": [
[
"101713cf.36afac"
]
]
},
{
"id": "9bad989.d089768",
"type": "inject",
"z": "640fb4f7.0d690c",
"name": "Turn On",
"topic": "",
"payload": "true",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 1400,
"y": 460,
"wires": [
[
"35bbb1a.adf314e"
]
]
},
{
"id": "c5b286d6.bbcbd8",
"type": "inject",
"z": "640fb4f7.0d690c",
"name": "Turn On",
"topic": "",
"payload": "true",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 1400,
"y": 640,
"wires": [
[
"15c215b8.af77aa"
]
]
},
{
"id": "fc17ee60.43962",
"type": "function",
"z": "640fb4f7.0d690c",
"name": "demo",
"func": "msg.payload = {\n on: true,\n brightness: 100,\n hex: \"ff0000\",\n colorloop: 30,\n transitionTime: 0,\n // alert: 15\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1230,
"y": 280,
"wires": [
[
"101713cf.36afac"
]
]
},
{
"id": "8dfb7769.2e0ae8",
"type": "function",
"z": "640fb4f7.0d690c",
"name": "demo",
"func": "msg.payload = {\n on: true,\n brightness: 100,\n hex: \"ffa500\",\n colorloop: 30,\n transitionTime: 3,\n // alert: 15\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1230,
"y": 460,
"wires": [
[
"35bbb1a.adf314e"
]
]
},
{
"id": "40562c64.34c544",
"type": "function",
"z": "640fb4f7.0d690c",
"name": "demo",
"func": "msg.payload = {\n on: true,\n brightness: 100,\n hex: \"008000\",\n colorloop: 30,\n transitionTime: 6,\n // alert: 15\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1230,
"y": 640,
"wires": [
[
"15c215b8.af77aa"
]
]
},
{
"id": "3c7859d.d1a91a6",
"type": "onEvent",
"z": "640fb4f7.0d690c",
"event": "message",
"name": "onEvent",
"x": 240,
"y": 760,
"wires": [
[
"c9e3f9a1.004bb8",
"b1a569c0.b66d18"
]
]
},
{
"id": "483c08f.200daf8",
"type": "inject",
"z": "640fb4f7.0d690c",
"name": "demo",
"topic": "",
"payload": "{\"cmd\":\"demo\"}",
"payloadType": "json",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 270,
"y": 180,
"wires": [
[
"1d052235.65c3de"
]
]
},
{
"id": "1d052235.65c3de",
"type": "send",
"z": "640fb4f7.0d690c",
"DDN": ">>jman",
"topic": "led://hue",
"name": "led://hue",
"x": 490,
"y": 180,
"wires": [
[],
[]
]
},
{
"id": "c9e3f9a1.004bb8",
"type": "function",
"z": "640fb4f7.0d690c",
"name": "led://hue ",
"func": "var str = msg.inctl.To.Topic;\n\nif ( str == \"led://hue\" ) {\n if (msg.data.cmd == \"demo\") {\n return [msg,null,null,null];\n } \n \n else if (msg.data.cmd == \"alert\") {\n return [null,msg,null,null];\n } \n \n else if (msg.data.cmd == \"set\") {\n return [null,null,msg,null];\n }\n else {\n return [null,null,null,msg];\n\n }\n} \n\nreturn [null,null,null,null];\n",
"outputs": 4,
"noerr": 0,
"x": 440,
"y": 760,
"wires": [
[
"fc17ee60.43962",
"8dfb7769.2e0ae8",
"40562c64.34c544"
],
[
"a4d548e0.c31d18",
"34993cb4.2add44",
"5d22c79b.80d4f8"
],
[
"8b97a02b.a4028",
"549ac01f.88933"
],
[
"bd8dc951.ec8388",
"52601f91.ab0aa",
"3f157d9.35fc982"
]
]
},
{
"id": "a4d548e0.c31d18",
"type": "function",
"z": "640fb4f7.0d690c",
"name": "alert",
"func": "msg.payload = {\n on: true,\n brightness: 100,\n hex: \"ff0000\",\n // colorloop: 30,\n // transitionTime: 0,\n alert: 15\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1230,
"y": 320,
"wires": [
[
"101713cf.36afac"
]
]
},
{
"id": "34993cb4.2add44",
"type": "function",
"z": "640fb4f7.0d690c",
"name": "alert",
"func": "msg.payload = {\n on: true,\n brightness: 100,\n hex: \"ff0000\",\n // colorloop: 30,\n // transitionTime: 0,\n alert: 15\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1230,
"y": 500,
"wires": [
[
"35bbb1a.adf314e"
]
]
},
{
"id": "5d22c79b.80d4f8",
"type": "function",
"z": "640fb4f7.0d690c",
"name": "alert",
"func": "msg.payload = {\n on: true,\n brightness: 100,\n hex: \"ff0000\",\n // colorloop: 30,\n // transitionTime: 0,\n alert: 15\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1230,
"y": 680,
"wires": [
[
"15c215b8.af77aa"
]
]
},
{
"id": "d5946f78.89acc",
"type": "inject",
"z": "640fb4f7.0d690c",
"name": "alert",
"topic": "",
"payload": "{\"cmd\":\"alert\"}",
"payloadType": "json",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 270,
"y": 240,
"wires": [
[
"1791593f.37da07"
]
]
},
{
"id": "1791593f.37da07",
"type": "send",
"z": "640fb4f7.0d690c",
"DDN": ">>jman",
"topic": "led://hue",
"name": "led://hue",
"x": 490,
"y": 240,
"wires": [
[],
[]
]
},
{
"id": "4e63f919.7ef8b8",
"type": "inject",
"z": "640fb4f7.0d690c",
"name": "set",
"topic": "",
"payload": "{\"cmd\":\"set\",\"light\":\"all\",\"colour\":\"ffffff\"}",
"payloadType": "json",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 270,
"y": 300,
"wires": [
[
"d063db13.524bd8"
]
]
},
{
"id": "d063db13.524bd8",
"type": "send",
"z": "640fb4f7.0d690c",
"DDN": ">>jman",
"topic": "led://hue",
"name": "led://hue",
"x": 490,
"y": 300,
"wires": [
[],
[]
]
},
{
"id": "8b97a02b.a4028",
"type": "function",
"z": "640fb4f7.0d690c",
"name": "set",
"func": "var colour = msg.data.colour;\n\nif (msg.data.light == \"inner\") {\n msg.payload = {\n on: true,\n brightness: 100,\n hex: colour\n // alert: 15\n }\n return [msg,null,null]\n}\n\nelse if (msg.data.light == \"middle\") {\n msg.payload = {\n on: true,\n brightness: 100,\n hex: colour\n // alert: 15\n }\n return [null,msg,null]\n}\n\nelse if (msg.data.light == \"outer\") {\n msg.payload = {\n on: true,\n brightness: 100,\n hex: colour\n // alert: 15\n }\n return [null,null,msg]\n}\n\nelse {\n msg.payload = {\n on: true,\n brightness: 100,\n hex: colour\n // alert: 15\n }\n return [msg,msg,msg]\n}",
"outputs": 3,
"noerr": 0,
"x": 1470,
"y": 200,
"wires": [
[
"101713cf.36afac"
],
[
"35bbb1a.adf314e"
],
[
"15c215b8.af77aa"
]
]
},
{
"id": "549ac01f.88933",
"type": "debug",
"z": "640fb4f7.0d690c",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 940,
"y": 900,
"wires": []
},
{
"id": "32cbe5dc.5b090a",
"type": "inject",
"z": "640fb4f7.0d690c",
"name": "hue",
"topic": "",
"payload": "{\"cmd\":\"hue\"}",
"payloadType": "json",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 270,
"y": 360,
"wires": [
[
"27932e84.5cdd92"
]
]
},
{
"id": "27932e84.5cdd92",
"type": "send",
"z": "640fb4f7.0d690c",
"DDN": ">>jman",
"topic": "led://hue",
"name": "led://hue",
"x": 490,
"y": 360,
"wires": [
[],
[]
]
},
{
"id": "bd8dc951.ec8388",
"type": "function",
"z": "640fb4f7.0d690c",
"name": "hue",
"func": "msg.payload = {\n on: true,\n brightness: 100,\n hex: \"ff0000\",\n transitionTime: 0,\n // alert: 15\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1230,
"y": 360,
"wires": [
[
"101713cf.36afac"
]
]
},
{
"id": "52601f91.ab0aa",
"type": "function",
"z": "640fb4f7.0d690c",
"name": "hue",
"func": "msg.payload = {\n on: true,\n brightness: 100,\n hex: \"ffa500\",\n // alert: 15\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1230,
"y": 540,
"wires": [
[
"35bbb1a.adf314e"
]
]
},
{
"id": "3f157d9.35fc982",
"type": "function",
"z": "640fb4f7.0d690c",
"name": "hue",
"func": "msg.payload = {\n on: true,\n brightness: 100,\n hex: \"008000\",\n // alert: 15\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1230,
"y": 720,
"wires": [
[
"15c215b8.af77aa"
]
]
},
{
"id": "b1a569c0.b66d18",
"type": "retEvent",
"z": "640fb4f7.0d690c",
"name": "retEvent",
"errorCode": 0,
"errorMsg": "OK",
"x": 440,
"y": 840,
"wires": []
},
{
"id": "2fef9b8e.cce244",
"type": "hue-bridge",
"z": "",
"name": "Philips hue",
"bridge": "192.168.10.150",
"key": "fvXmqf3ncJSJAYZqcxA5H3ncqZyd1YVjMQWkiD8A",
"interval": "3000"
}
]