diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json index 23723ff..cc296a9 100644 --- a/.vs/VSWorkspaceState.json +++ b/.vs/VSWorkspaceState.json @@ -4,6 +4,6 @@ "\\data", "\\data\\images" ], - "SelectedNode": "\\data\\index.htm", + "SelectedNode": "\\esp8266-fastled-webserver.ino", "PreviewInSolutionExplorer": false } \ No newline at end of file diff --git a/.vs/esp8266-fastled-webserver/v15/.suo b/.vs/esp8266-fastled-webserver/v15/.suo index d824d62..3b90e98 100644 Binary files a/.vs/esp8266-fastled-webserver/v15/.suo and b/.vs/esp8266-fastled-webserver/v15/.suo differ diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite index b4f125e..7efa6b3 100644 Binary files a/.vs/slnx.sqlite and b/.vs/slnx.sqlite differ diff --git a/NodeRED_Flow.txt b/NodeRED_Flow.txt new file mode 100644 index 0000000..4798a81 --- /dev/null +++ b/NodeRED_Flow.txt @@ -0,0 +1,5319 @@ +[ + { + "id": "cddf6c26.6a9e3", + "type": "tab", + "label": "Thingiverse_Nanoleafs", + "disabled": false, + "info": "" + }, + { + "id": "3355ce77.b69822", + "type": "alexa-home", + "z": "cddf6c26.6a9e3", + "conf": "", + "device": "47327", + "acknoledge": true, + "name": "", + "topic": "", + "x": 250, + "y": 480, + "wires": [ + [ + "6246299.00fe1d8" + ] + ] + }, + { + "id": "54b40e3a.f5b86", + "type": "alexa-home", + "z": "cddf6c26.6a9e3", + "conf": "", + "device": "47326", + "acknoledge": true, + "name": "", + "topic": "", + "x": 250, + "y": 520, + "wires": [ + [ + "6246299.00fe1d8" + ] + ] + }, + { + "id": "1e93d8f3.c5c2d7", + "type": "alexa-home", + "z": "cddf6c26.6a9e3", + "conf": "", + "device": "47333", + "acknoledge": true, + "name": "Nano", + "topic": "", + "x": 230, + "y": 560, + "wires": [ + [ + "6246299.00fe1d8" + ] + ] + }, + { + "id": "6246299.00fe1d8", + "type": "switch", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "command", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "TurnOnRequest", + "vt": "str" + }, + { + "t": "eq", + "v": "TurnOffRequest", + "vt": "str" + }, + { + "t": "eq", + "v": "SetPercentageRequest", + "vt": "str" + }, + { + "t": "eq", + "v": "IncrementPercentageRequest", + "vt": "str" + }, + { + "t": "eq", + "v": "DecrementPercentageRequest", + "vt": "str" + }, + { + "t": "eq", + "v": "SetColorRequest", + "vt": "str" + }, + { + "t": "else" + } + ], + "checkall": "true", + "repair": false, + "outputs": 7, + "x": 370, + "y": 520, + "wires": [ + [ + "6baf4eee.6319f" + ], + [ + "5d3092e4.3d031c" + ], + [ + "c875ae09.6722d" + ], + [ + "b23ba25.3cbc56" + ], + [ + "89038755.678578" + ], + [ + "33963681.81e95a" + ], + [ + "4752d3b3.11e1bc" + ] + ] + }, + { + "id": "30f24c51.5b0274", + "type": "config", + "z": "cddf6c26.6a9e3", + "name": "Nanoleaf-Config", + "properties": [ + { + "p": "Nanoleaf", + "pt": "global", + "to": "192.168.0.105", + "tot": "str" + }, + { + "p": "NanoleafBrightness", + "pt": "global", + "to": "150", + "tot": "str" + }, + { + "p": "NanoleafSpeed", + "pt": "global", + "to": "30", + "tot": "str" + } + ], + "active": true, + "x": 260, + "y": 320, + "wires": [] + }, + { + "id": "433efcec.8e5384", + "type": "comment", + "z": "cddf6c26.6a9e3", + "name": "Enter the IP of the Nanoleafs and the amount of Leafs below, click the latch afterwards", + "info": "", + "x": 480, + "y": 280, + "wires": [] + }, + { + "id": "33963681.81e95a", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Multiply Values", + "func": "//var h = msg.payload.hue;\ntypeof query !== 'undefined'\nmsg.payload.hue = msg.payload.hue;\nmsg.payload.saturation = msg.payload.saturation * 100;\nmsg.payload.brightness = msg.payload.brightness * 100;\n\n\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 580, + "y": 680, + "wires": [ + [ + "3adf0e95.b51a32" + ] + ] + }, + { + "id": "3adf0e95.b51a32", + "type": "color-convert", + "z": "cddf6c26.6a9e3", + "input": "hsv", + "output": "rgb", + "outputType": "array", + "x": 750, + "y": 680, + "wires": [ + [ + "c464f19a.97355" + ] + ] + }, + { + "id": "c464f19a.97355", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Set Color, Normal Mode", + "func": "var input = [];\ninput = msg.payload;\nvar r = input[0];\nvar g = input[1];\nvar b = input[2];\nmsg.payload = \"solidColor?r=\" + r+\"&g=\"+g+\"&b=\"+b;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 950, + "y": 680, + "wires": [ + [ + "5a1af749.e8d358" + ] + ] + }, + { + "id": "5a1af749.e8d358", + "type": "link out", + "z": "cddf6c26.6a9e3", + "name": "NanoleafOUT", + "links": [ + "b80cf79b.b95778" + ], + "x": 1115, + "y": 540, + "wires": [] + }, + { + "id": "4752d3b3.11e1bc", + "type": "debug", + "z": "cddf6c26.6a9e3", + "name": "ALEXA ERROR", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "x": 580, + "y": 720, + "wires": [] + }, + { + "id": "6baf4eee.6319f", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Turn on", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "power?value=1", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 560, + "y": 480, + "wires": [ + [ + "5a1af749.e8d358" + ] + ] + }, + { + "id": "5d3092e4.3d031c", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Turn off", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "power?value=0", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 560, + "y": 520, + "wires": [ + [ + "13bd35c3.f532da" + ] + ] + }, + { + "id": "c875ae09.6722d", + "type": "range", + "z": "cddf6c26.6a9e3", + "minin": "0", + "maxin": "100", + "minout": "0", + "maxout": "255", + "action": "scale", + "round": true, + "property": "payload", + "name": "", + "x": 560, + "y": 560, + "wires": [ + [ + "d175e893.179f78" + ] + ] + }, + { + "id": "d175e893.179f78", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Set Brightness", + "func": "global.set(\"NanoleafBrightness\", msg.payload);\nmsg.payload = \"brightness?value=\" + msg.payload;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 720, + "y": 560, + "wires": [ + [ + "5a1af749.e8d358" + ] + ] + }, + { + "id": "b23ba25.3cbc56", + "type": "range", + "z": "cddf6c26.6a9e3", + "minin": "0", + "maxin": "100", + "minout": "0", + "maxout": "255", + "action": "scale", + "round": true, + "property": "payload", + "name": "", + "x": 560, + "y": 600, + "wires": [ + [ + "62615b9.da2e2a4" + ] + ] + }, + { + "id": "62615b9.da2e2a4", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Set Brightness", + "func": "var x = global.get(\"NanoleafBrightness\");\nif(x==null)x=100;\nx+=msg.payload;\nglobal.set(\"NanoleafBrightness\", x);\nmsg.payload = \"brightness?value=\" + x;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 720, + "y": 600, + "wires": [ + [ + "5a1af749.e8d358" + ] + ] + }, + { + "id": "3011767a.f9ad4a", + "type": "comment", + "z": "cddf6c26.6a9e3", + "name": "Edit the alexa nodes below and choose the ones from the list that should control brightness, color, on/off, you might as well add others or delete some", + "info": "", + "x": 670, + "y": 440, + "wires": [] + }, + { + "id": "3433d604.d529ca", + "type": "alexa-home", + "z": "cddf6c26.6a9e3", + "conf": "", + "device": "50354", + "acknoledge": true, + "name": "Triangles", + "topic": "", + "x": 240, + "y": 600, + "wires": [ + [ + "6246299.00fe1d8" + ] + ] + }, + { + "id": "c0adb189.5d7a2", + "type": "alexa-home", + "z": "cddf6c26.6a9e3", + "conf": "", + "device": "50355", + "acknoledge": true, + "name": "Nanoleaf Rainbow", + "topic": "", + "x": 270, + "y": 840, + "wires": [ + [ + "ce46aa75.e32858" + ] + ] + }, + { + "id": "ce46aa75.e32858", + "type": "switch", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "command", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "TurnOnRequest", + "vt": "str" + }, + { + "t": "eq", + "v": "TurnOffRequest", + "vt": "str" + }, + { + "t": "else" + } + ], + "checkall": "true", + "repair": false, + "outputs": 3, + "x": 430, + "y": 860, + "wires": [ + [ + "72201452.60808c" + ], + [ + "931ae2eb.d772a" + ], + [ + "948fc335.352f5" + ] + ] + }, + { + "id": "948fc335.352f5", + "type": "debug", + "z": "cddf6c26.6a9e3", + "name": "ALEXA ERROR", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "x": 600, + "y": 920, + "wires": [] + }, + { + "id": "72201452.60808c", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Set Pattern 20 (Rainbow)", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "pattern?value=20", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 630, + "y": 840, + "wires": [ + [ + "e3a04c05.51f3b" + ] + ] + }, + { + "id": "931ae2eb.d772a", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Set Pattern 29 (Solid Color)", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "pattern?value=29", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 640, + "y": 880, + "wires": [ + [ + "e3a04c05.51f3b" + ] + ] + }, + { + "id": "e3a04c05.51f3b", + "type": "link out", + "z": "cddf6c26.6a9e3", + "name": "NanoleafRainbow", + "links": [ + "b80cf79b.b95778" + ], + "x": 817, + "y": 858, + "wires": [] + }, + { + "id": "eb0ff137.7fbf8", + "type": "comment", + "z": "cddf6c26.6a9e3", + "name": "Edit the alexa node below and choose the one that should control the rainbow mode", + "info": "", + "x": 470, + "y": 800, + "wires": [] + }, + { + "id": "81377d13.b0511", + "type": "alexa-home", + "z": "cddf6c26.6a9e3", + "conf": "", + "device": "50356", + "acknoledge": true, + "name": "Nanoleaf Speed", + "topic": "", + "x": 260, + "y": 1040, + "wires": [ + [ + "5f786fd4.724fe" + ] + ] + }, + { + "id": "c61fb358.87f4d", + "type": "debug", + "z": "cddf6c26.6a9e3", + "name": "ALEXA ERROR", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "x": 600, + "y": 1160, + "wires": [] + }, + { + "id": "52016e2b.01061", + "type": "comment", + "z": "cddf6c26.6a9e3", + "name": "Edit the alexa node below and choose the one that should control the speed of the patterns", + "info": "", + "x": 490, + "y": 1000, + "wires": [] + }, + { + "id": "3ae3a95e.bf98b6", + "type": "range", + "z": "cddf6c26.6a9e3", + "minin": "0", + "maxin": "100", + "minout": "0", + "maxout": "255", + "action": "scale", + "round": true, + "property": "payload", + "name": "", + "x": 580, + "y": 1080, + "wires": [ + [ + "8c7379c9.96a208" + ] + ] + }, + { + "id": "8c7379c9.96a208", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Set Speed", + "func": "var x = global.get(\"NanoleafSpeed\");\nif(x==null)x=30;\nx+=msg.payload;\nglobal.set(\"NanoleafSpeed\", x);\nmsg.payload = \"speed?value=\" + x;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 730, + "y": 1080, + "wires": [ + [ + "ef8d9ea8.22369" + ] + ] + }, + { + "id": "5f786fd4.724fe", + "type": "switch", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "command", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "SetPercentageRequest", + "vt": "str" + }, + { + "t": "eq", + "v": "IncrementPercentageRequest", + "vt": "str" + }, + { + "t": "eq", + "v": "DecrementPercentageRequest", + "vt": "str" + }, + { + "t": "else" + } + ], + "checkall": "true", + "repair": false, + "outputs": 4, + "x": 410, + "y": 1060, + "wires": [ + [ + "8e92febb.a46f6" + ], + [ + "3ae3a95e.bf98b6" + ], + [ + "3286a62d.a5b8fa" + ], + [ + "c61fb358.87f4d" + ] + ] + }, + { + "id": "8e92febb.a46f6", + "type": "range", + "z": "cddf6c26.6a9e3", + "minin": "0", + "maxin": "100", + "minout": "0", + "maxout": "255", + "action": "scale", + "round": true, + "property": "payload", + "name": "", + "x": 580, + "y": 1040, + "wires": [ + [ + "ade92cf8.59c15" + ] + ] + }, + { + "id": "ade92cf8.59c15", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Set Speed", + "func": "global.set(\"NanoleafSpeed\", msg.payload);\nmsg.payload = \"speed?value=\" + msg.payload;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 730, + "y": 1040, + "wires": [ + [ + "ef8d9ea8.22369" + ] + ] + }, + { + "id": "89038755.678578", + "type": "range", + "z": "cddf6c26.6a9e3", + "minin": "0", + "maxin": "-100", + "minout": "0", + "maxout": "-255", + "action": "scale", + "round": true, + "property": "payload", + "name": "", + "x": 560, + "y": 640, + "wires": [ + [ + "62615b9.da2e2a4" + ] + ] + }, + { + "id": "3286a62d.a5b8fa", + "type": "range", + "z": "cddf6c26.6a9e3", + "minin": "0", + "maxin": "-100", + "minout": "0", + "maxout": "-255", + "action": "scale", + "round": true, + "property": "payload", + "name": "", + "x": 580, + "y": 1120, + "wires": [ + [ + "8c7379c9.96a208" + ] + ] + }, + { + "id": "ef8d9ea8.22369", + "type": "link out", + "z": "cddf6c26.6a9e3", + "name": "NanoleafSpeed", + "links": [ + "b80cf79b.b95778" + ], + "x": 855, + "y": 1060, + "wires": [] + }, + { + "id": "9e705687.579118", + "type": "alexa-home", + "z": "cddf6c26.6a9e3", + "conf": "", + "device": "50362", + "acknoledge": true, + "name": "Nanoleaf Autoplay", + "topic": "", + "x": 270, + "y": 1280, + "wires": [ + [ + "249ebab4.f55636" + ] + ] + }, + { + "id": "c30ea566.239c78", + "type": "debug", + "z": "cddf6c26.6a9e3", + "name": "ALEXA ERROR", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "x": 620, + "y": 1480, + "wires": [] + }, + { + "id": "bdc187c1.c0f3c8", + "type": "comment", + "z": "cddf6c26.6a9e3", + "name": "Edit the alexa node below and choose the one that should control the Autoplay functionality", + "info": "", + "x": 490, + "y": 1240, + "wires": [] + }, + { + "id": "e7e99932.652018", + "type": "range", + "z": "cddf6c26.6a9e3", + "minin": "0", + "maxin": "100", + "minout": "0", + "maxout": "255", + "action": "scale", + "round": true, + "property": "payload", + "name": "", + "x": 600, + "y": 1400, + "wires": [ + [ + "c596293f.b69f98" + ] + ] + }, + { + "id": "c596293f.b69f98", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Set Duration", + "func": "var x = global.get(\"NanoleafAutoplayDuration\");\nif(x==null)x=30;\nx+=msg.payload;\nglobal.set(\"NanoleafAutoplayDuration\", x);\nmsg.payload = \"autoplayDuration?value=\" + x;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 750, + "y": 1400, + "wires": [ + [ + "8c55dea5.89b95" + ] + ] + }, + { + "id": "5f0f7afb.82a874", + "type": "range", + "z": "cddf6c26.6a9e3", + "minin": "0", + "maxin": "100", + "minout": "0", + "maxout": "255", + "action": "scale", + "round": true, + "property": "payload", + "name": "", + "x": 600, + "y": 1360, + "wires": [ + [ + "2c19176d.d3fac8" + ] + ] + }, + { + "id": "2c19176d.d3fac8", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Set Duration", + "func": "global.set(\"NanoleafAutoplayDuration\", msg.payload);\nmsg.payload = \"autoplayDuration?value=\" + msg.payload;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 750, + "y": 1360, + "wires": [ + [ + "8c55dea5.89b95" + ] + ] + }, + { + "id": "f2c7a103.b1228", + "type": "range", + "z": "cddf6c26.6a9e3", + "minin": "0", + "maxin": "-100", + "minout": "0", + "maxout": "-255", + "action": "scale", + "round": true, + "property": "payload", + "name": "", + "x": 600, + "y": 1440, + "wires": [ + [ + "c596293f.b69f98" + ] + ] + }, + { + "id": "8c55dea5.89b95", + "type": "link out", + "z": "cddf6c26.6a9e3", + "name": "NanoleafAutoplay", + "links": [ + "b80cf79b.b95778" + ], + "x": 875, + "y": 1300, + "wires": [] + }, + { + "id": "249ebab4.f55636", + "type": "switch", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "command", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "TurnOnRequest", + "vt": "str" + }, + { + "t": "eq", + "v": "TurnOffRequest", + "vt": "str" + }, + { + "t": "eq", + "v": "SetPercentageRequest", + "vt": "str" + }, + { + "t": "eq", + "v": "IncrementPercentageRequest", + "vt": "str" + }, + { + "t": "eq", + "v": "DecrementPercentageRequest", + "vt": "str" + }, + { + "t": "else" + } + ], + "checkall": "true", + "repair": false, + "outputs": 6, + "x": 430, + "y": 1320, + "wires": [ + [ + "7b2705a8.5d44ac" + ], + [ + "845a4bb8.435c78" + ], + [ + "5f0f7afb.82a874" + ], + [ + "e7e99932.652018" + ], + [ + "f2c7a103.b1228" + ], + [ + "c30ea566.239c78" + ] + ] + }, + { + "id": "7b2705a8.5d44ac", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Autoplay on", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "autoplay?value=1", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 610, + "y": 1280, + "wires": [ + [ + "8c55dea5.89b95" + ] + ] + }, + { + "id": "845a4bb8.435c78", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Autoplay off", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "autoplay?value=0", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 610, + "y": 1320, + "wires": [ + [ + "8c55dea5.89b95" + ] + ] + }, + { + "id": "2fcf75a2.34b8da", + "type": "alexa-home", + "z": "cddf6c26.6a9e3", + "conf": "", + "device": "50367", + "acknoledge": true, + "name": "Nanoleaf standard", + "topic": "", + "x": 270, + "y": 1600, + "wires": [ + [ + "42a9efd3.365e1" + ] + ] + }, + { + "id": "42a9efd3.365e1", + "type": "switch", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "command", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "TurnOnRequest", + "vt": "str" + }, + { + "t": "eq", + "v": "TurnOffRequest", + "vt": "str" + }, + { + "t": "else" + } + ], + "checkall": "true", + "repair": false, + "outputs": 3, + "x": 430, + "y": 1620, + "wires": [ + [ + "a55b2c2c.e623b", + "39a5a0a1.b9669" + ], + [ + "3068a2c9.d89a5e" + ], + [ + "f1b72539.b15ca8" + ] + ] + }, + { + "id": "f1b72539.b15ca8", + "type": "debug", + "z": "cddf6c26.6a9e3", + "name": "ALEXA ERROR", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "x": 600, + "y": 1720, + "wires": [] + }, + { + "id": "a55b2c2c.e623b", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Set Pattern 0 (Pride)", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "pattern?value=0", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 620, + "y": 1600, + "wires": [ + [ + "f55a72c0.de12f" + ] + ] + }, + { + "id": "3068a2c9.d89a5e", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Set Pattern 29 (Solid Color)", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "pattern?value=29", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 640, + "y": 1680, + "wires": [ + [ + "f55a72c0.de12f" + ] + ] + }, + { + "id": "f55a72c0.de12f", + "type": "link out", + "z": "cddf6c26.6a9e3", + "name": "NanoleafDefault", + "links": [ + "b80cf79b.b95778" + ], + "x": 817, + "y": 1618, + "wires": [] + }, + { + "id": "9c8660b3.cd1dd", + "type": "comment", + "z": "cddf6c26.6a9e3", + "name": "Edit the alexa node below and choose the one that should control the default mode", + "info": "", + "x": 470, + "y": 1560, + "wires": [] + }, + { + "id": "39a5a0a1.b9669", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Set Brightness 120", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "brightness?value=120", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 610, + "y": 1640, + "wires": [ + [ + "f55a72c0.de12f" + ] + ] + }, + { + "id": "6c029192.d603a", + "type": "alexa-home", + "z": "cddf6c26.6a9e3", + "conf": "", + "device": "50371", + "acknoledge": true, + "name": "Nanoleaf 1", + "topic": "", + "x": 240, + "y": 1840, + "wires": [ + [ + "7416b243.ef3cbc" + ] + ] + }, + { + "id": "7416b243.ef3cbc", + "type": "switch", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "command", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "TurnOnRequest", + "vt": "str" + }, + { + "t": "eq", + "v": "TurnOffRequest", + "vt": "str" + }, + { + "t": "else" + } + ], + "checkall": "true", + "repair": false, + "outputs": 3, + "x": 430, + "y": 1860, + "wires": [ + [ + "e1b2e9be.fd1958", + "6808d5b5.c183cc", + "e2690dbd.3d556" + ], + [ + "24ec4f20.06b6b" + ], + [ + "4acb22a6.734f9c" + ] + ] + }, + { + "id": "4acb22a6.734f9c", + "type": "debug", + "z": "cddf6c26.6a9e3", + "name": "ALEXA ERROR", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "x": 600, + "y": 2000, + "wires": [] + }, + { + "id": "e1b2e9be.fd1958", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Set Pattern 24 (Sinelon)", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "pattern?value=24", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 630, + "y": 1840, + "wires": [ + [ + "10babbac.b84494" + ] + ] + }, + { + "id": "24ec4f20.06b6b", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Set Pattern 29 (Solid Color)", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "pattern?value=29", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 640, + "y": 1960, + "wires": [ + [ + "10babbac.b84494" + ] + ] + }, + { + "id": "10babbac.b84494", + "type": "link out", + "z": "cddf6c26.6a9e3", + "name": "NanoleafDefault", + "links": [ + "b80cf79b.b95778" + ], + "x": 817, + "y": 1858, + "wires": [] + }, + { + "id": "a226f12d.3e187", + "type": "comment", + "z": "cddf6c26.6a9e3", + "name": "Edit the alexa node below and choose the one that should control the theme Nr.1", + "info": "", + "x": 460, + "y": 1800, + "wires": [] + }, + { + "id": "6808d5b5.c183cc", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Set Brightness 255", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "brightness?value=255", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 610, + "y": 1880, + "wires": [ + [ + "10babbac.b84494" + ] + ] + }, + { + "id": "378d27fc.0f3fa8", + "type": "alexa-home", + "z": "cddf6c26.6a9e3", + "conf": "", + "device": "50372", + "acknoledge": true, + "name": "Nanoleaf 2", + "topic": "", + "x": 240, + "y": 2120, + "wires": [ + [ + "d14fb91d.c37978" + ] + ] + }, + { + "id": "d14fb91d.c37978", + "type": "switch", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "command", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "TurnOnRequest", + "vt": "str" + }, + { + "t": "eq", + "v": "TurnOffRequest", + "vt": "str" + }, + { + "t": "else" + } + ], + "checkall": "true", + "repair": false, + "outputs": 3, + "x": 430, + "y": 2140, + "wires": [ + [ + "62f58c34.c08644", + "12a642b7.f74f5d", + "2e408e4e.94e8c2" + ], + [ + "4bf08f02.11b3a" + ], + [ + "a9abb49f.290698" + ] + ] + }, + { + "id": "a9abb49f.290698", + "type": "debug", + "z": "cddf6c26.6a9e3", + "name": "ALEXA ERROR", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "x": 600, + "y": 2280, + "wires": [] + }, + { + "id": "62f58c34.c08644", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Set Pattern 25 (Beat)", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "pattern?value=25", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 620, + "y": 2120, + "wires": [ + [ + "5325c0f4.ee88e" + ] + ] + }, + { + "id": "4bf08f02.11b3a", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Set Pattern 29 (Solid Color)", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "pattern?value=29", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 640, + "y": 2240, + "wires": [ + [ + "5325c0f4.ee88e" + ] + ] + }, + { + "id": "5325c0f4.ee88e", + "type": "link out", + "z": "cddf6c26.6a9e3", + "name": "NanoleafDefault", + "links": [ + "b80cf79b.b95778" + ], + "x": 817, + "y": 2138, + "wires": [] + }, + { + "id": "1a075c06.8a37b4", + "type": "comment", + "z": "cddf6c26.6a9e3", + "name": "Edit the alexa node below and choose the one that should control the theme Nr.2", + "info": "", + "x": 460, + "y": 2080, + "wires": [] + }, + { + "id": "12a642b7.f74f5d", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Set Brightness 255", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "brightness?value=255", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 610, + "y": 2160, + "wires": [ + [ + "5325c0f4.ee88e" + ] + ] + }, + { + "id": "2e408e4e.94e8c2", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Set Palette 4 (Ocean)", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "palette?value=4", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 620, + "y": 2200, + "wires": [ + [ + "5325c0f4.ee88e" + ] + ] + }, + { + "id": "e2690dbd.3d556", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Set Palette 6 (Party)", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "palette?value=6", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 620, + "y": 1920, + "wires": [ + [ + "10babbac.b84494" + ] + ] + }, + { + "id": "a51678d2.da2398", + "type": "alexa-home", + "z": "cddf6c26.6a9e3", + "conf": "", + "device": "50373", + "acknoledge": true, + "name": "Nanoleaf 3", + "topic": "", + "x": 240, + "y": 2400, + "wires": [ + [ + "9fa0e5b2.1fc5a8" + ] + ] + }, + { + "id": "9fa0e5b2.1fc5a8", + "type": "switch", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "command", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "TurnOnRequest", + "vt": "str" + }, + { + "t": "eq", + "v": "TurnOffRequest", + "vt": "str" + }, + { + "t": "else" + } + ], + "checkall": "true", + "repair": false, + "outputs": 3, + "x": 430, + "y": 2420, + "wires": [ + [ + "ba8a24c9.a2bb08" + ], + [ + "4104d0bc.8e13c" + ], + [ + "a6697664.1444e8" + ] + ] + }, + { + "id": "a6697664.1444e8", + "type": "debug", + "z": "cddf6c26.6a9e3", + "name": "ALEXA ERROR", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "x": 600, + "y": 2480, + "wires": [] + }, + { + "id": "ba8a24c9.a2bb08", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Set custom rgb (0;102;255)", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "solidColor?r=0&g=102&b=255", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 640, + "y": 2400, + "wires": [ + [ + "f880d406.243a68" + ] + ] + }, + { + "id": "4104d0bc.8e13c", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "Set Pattern 29 (Solid Color)", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "pattern?value=29", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 640, + "y": 2440, + "wires": [ + [ + "f880d406.243a68" + ] + ] + }, + { + "id": "f880d406.243a68", + "type": "link out", + "z": "cddf6c26.6a9e3", + "name": "NanoleafDefault", + "links": [ + "b80cf79b.b95778" + ], + "x": 817, + "y": 2418, + "wires": [] + }, + { + "id": "142b035c.4a8b2d", + "type": "comment", + "z": "cddf6c26.6a9e3", + "name": "Edit the alexa node below and choose the one that should control the theme Nr.2", + "info": "", + "x": 460, + "y": 2360, + "wires": [] + }, + { + "id": "b05e04ba.3aed58", + "type": "ui_switch", + "z": "cddf6c26.6a9e3", + "name": "", + "label": "Power", + "group": "9f40378b.457ad8", + "order": 2, + "width": "5", + "height": "1", + "passthru": true, + "decouple": "false", + "topic": "", + "style": "", + "onvalue": "true", + "onvalueType": "bool", + "onicon": "", + "oncolor": "", + "offvalue": "false", + "offvalueType": "bool", + "officon": "", + "offcolor": "", + "x": 1710, + "y": 140, + "wires": [ + [ + "d6a5ed4b.2467d" + ] + ] + }, + { + "id": "c38656d0.228018", + "type": "link out", + "z": "cddf6c26.6a9e3", + "name": "NanoleafDMain", + "links": [ + "dc5348cd.f5ba28" + ], + "x": 2135, + "y": 180, + "wires": [] + }, + { + "id": "d6a5ed4b.2467d", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "On/Off", + "func": "if(msg.payload)msg.payload=\"power?value=1\";\nelse msg.payload = \"power?value=0\";\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1950, + "y": 140, + "wires": [ + [ + "c38656d0.228018" + ] + ] + }, + { + "id": "91400109.36205", + "type": "ui_slider", + "z": "cddf6c26.6a9e3", + "name": "Speed-Slider", + "label": "Animation Speed", + "group": "7f1ff9b6.485398", + "order": 1, + "width": "7", + "height": "1", + "passthru": true, + "topic": "", + "min": 0, + "max": "255", + "step": 1, + "x": 1690, + "y": 400, + "wires": [ + [ + "b537b63a.fba748" + ] + ] + }, + { + "id": "689c5c5f.8a8b34", + "type": "ui_switch", + "z": "cddf6c26.6a9e3", + "name": "", + "label": "Autoplay", + "group": "ba6866b4.b54908", + "order": 1, + "width": "5", + "height": "1", + "passthru": true, + "decouple": "false", + "topic": "", + "style": "", + "onvalue": "true", + "onvalueType": "bool", + "onicon": "", + "oncolor": "", + "offvalue": "false", + "offvalueType": "bool", + "officon": "", + "offcolor": "", + "x": 1700, + "y": 440, + "wires": [ + [ + "5cab614b.91d67" + ] + ] + }, + { + "id": "5cab614b.91d67", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "On/Off", + "func": "if(msg.payload)msg.payload=\"autoplay?value=1\";\nelse msg.payload = \"autoplay?value=0\";\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1950, + "y": 440, + "wires": [ + [ + "c319d1e6.638de" + ] + ] + }, + { + "id": "291f1e3b.275322", + "type": "ui_slider", + "z": "cddf6c26.6a9e3", + "name": "Autoplay Duration Slider", + "label": "", + "group": "ba6866b4.b54908", + "order": 3, + "width": "4", + "height": "1", + "passthru": true, + "topic": "", + "min": "1", + "max": "255", + "step": 1, + "x": 1650, + "y": 480, + "wires": [ + [ + "97dcd4fb.b834e8", + "c2f996f5.dff9b8" + ] + ] + }, + { + "id": "b80cf79b.b95778", + "type": "link in", + "z": "cddf6c26.6a9e3", + "name": "NanoleafWithPowerON", + "links": [ + "5325c0f4.ee88e", + "f880d406.243a68", + "f55a72c0.de12f", + "e3a04c05.51f3b", + "10babbac.b84494", + "5a1af749.e8d358", + "ef8d9ea8.22369", + "8c55dea5.89b95", + "c319d1e6.638de", + "5dead56c.a6149c", + "5eacdb79.95d744", + "6d04adb.58c2754" + ], + "x": 175, + "y": 2560, + "wires": [ + [ + "3927f551.2f80aa" + ] + ] + }, + { + "id": "3927f551.2f80aa", + "type": "delay", + "z": "cddf6c26.6a9e3", + "name": "", + "pauseType": "rate", + "timeout": "5", + "timeoutUnits": "seconds", + "rate": "10", + "nbRateUnits": "1", + "rateUnits": "second", + "randomFirst": "1", + "randomLast": "5", + "randomUnits": "seconds", + "drop": false, + "x": 320, + "y": 2540, + "wires": [ + [ + "a5ffbed4.7d487" + ] + ] + }, + { + "id": "d4ee0eab.b5abe", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Set Request URL", + "func": "var url = global.get(\"Nanoleaf\")+\"/\";\nmsg.payload = url+msg.payload2;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 510, + "y": 2600, + "wires": [ + [ + "876a9ed5.bebd5" + ] + ] + }, + { + "id": "876a9ed5.bebd5", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "", + "rules": [ + { + "t": "set", + "p": "url", + "pt": "msg", + "to": "payload", + "tot": "msg" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 690, + "y": 2600, + "wires": [ + [ + "a90726ea.fe80f8", + "3a874fed.29db6" + ] + ] + }, + { + "id": "5b3e1212.1a18fc", + "type": "debug", + "z": "cddf6c26.6a9e3", + "name": "Nanoleaf Response", + "active": false, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "x": 1030, + "y": 2600, + "wires": [] + }, + { + "id": "a90726ea.fe80f8", + "type": "debug", + "z": "cddf6c26.6a9e3", + "name": "Nanoleaf Request", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "url", + "x": 1030, + "y": 2560, + "wires": [] + }, + { + "id": "13bd35c3.f532da", + "type": "link out", + "z": "cddf6c26.6a9e3", + "name": "NanoleafPowerOFF", + "links": [ + "dc5348cd.f5ba28" + ], + "x": 1115, + "y": 500, + "wires": [] + }, + { + "id": "dc5348cd.f5ba28", + "type": "link in", + "z": "cddf6c26.6a9e3", + "name": "NanoleafWithoutPowerON", + "links": [ + "13bd35c3.f532da", + "c38656d0.228018" + ], + "x": 375, + "y": 2640, + "wires": [ + [ + "cdf0fd3c.ac893" + ] + ] + }, + { + "id": "a5ffbed4.7d487", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "power on", + "func": "var url = global.get(\"Nanoleaf\")+\"/\";\nvar on = url+\"power?value=1\";\nvar msg2 = \n{\n payload2: msg.payload, \n url: on\n};\nreturn msg2;", + "outputs": 1, + "noerr": 0, + "x": 480, + "y": 2540, + "wires": [ + [ + "694aa622.638ed8" + ] + ] + }, + { + "id": "694aa622.638ed8", + "type": "http request", + "z": "cddf6c26.6a9e3", + "name": "", + "method": "POST", + "ret": "txt", + "url": "", + "tls": "", + "x": 630, + "y": 2540, + "wires": [ + [ + "d4ee0eab.b5abe" + ] + ] + }, + { + "id": "3a874fed.29db6", + "type": "http request", + "z": "cddf6c26.6a9e3", + "name": "", + "method": "POST", + "ret": "txt", + "url": "", + "tls": "", + "x": 850, + "y": 2600, + "wires": [ + [ + "5b3e1212.1a18fc" + ] + ] + }, + { + "id": "cdf0fd3c.ac893", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Set Request URL", + "func": "var url = global.get(\"Nanoleaf\")+\"/\";\nmsg.payload = url+msg.payload;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 510, + "y": 2640, + "wires": [ + [ + "876a9ed5.bebd5" + ] + ] + }, + { + "id": "b858cc9e.a5b2b", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Reposition ", + "func": "var leafs =[];\nvar o = global.get(\"CanvasOffset\");\nif(global.get(\"NanoleafCfg\")!=null)leafs = global.get(\"NanoleafCfg\");\nvar leafs_old = leafs;\n\nvar offsetX = 0;\nvar offsetY = 0;\nvar maxX = 0;\nvar maxY=0;\n\nvar w = global.get(\"CanvasWidth\");\nvar h = global.get(\"CanvasHeight\");\n\nfor(var i = 0;i(maxX))maxX=leafs[i].p1x;\n if(leafs[i].p2x>(maxX))maxX=leafs[i].p2x;\n if(leafs[i].p3x>(maxX))maxX=leafs[i].p3x;\n \n if(leafs[i].p1y>(maxY))maxY=leafs[i].p1y;\n if(leafs[i].p2y>(maxY))maxY=leafs[i].p2y;\n if(leafs[i].p3y>(maxY))maxY=leafs[i].p3y;\n}\nvar scale = 1;\nif((maxX+40)>w)\n{\n scale = w/(maxX+40);\n}\nif((maxY+40)>h)\n{\n if((h/(maxY+40))`;\nhtml+='';\n\njs+=`\nvar canvas = document.getElementById(\"canvas\");\nvar ctx = canvas.getContext(\"2d\");\nvar BB = canvas.getBoundingClientRect();\nvar offsetX = BB.left;\nvar offsetY = BB.top;\nvar WIDTH = canvas.width;\nvar HEIGHT = canvas.height;\n`\njs+='ctx.scale('+parseFloat(msg.topic)+', '+parseFloat(msg.topic)+');';\nfor (var i = 0; i < leafs.length; i++) { \n js+='ctx.beginPath();\\n';\n js+='ctx.moveTo('+leafs[i].p1x+', '+leafs[i].p1y+');\\n';\n js+='ctx.lineTo('+leafs[i].p2x+', '+leafs[i].p2y+');\\n';\n js+='ctx.lineTo('+leafs[i].p3x+', '+leafs[i].p3y+');\\n';\n js+='ctx.closePath();\\n';\n js+='ctx.lineWidth ='+s+';';\n js+='ctx.lineCap = \"round\";';\n js+=\"ctx.strokeStyle = '#111111';\";\n if(i==selected)js+=\"ctx.strokeStyle = '#FF0000';\";\n js+=\"ctx.stroke();\";\n js+='ctx.fillStyle = \"'+ leafs[i].fill+'\";\\n';\n js+='ctx.fill();'\n \n js+=\"ctx.fillStyle = '#000000';\";\n js+='ctx.font = \"'+fs+ 'px Arial\";';\n var ox = (leafs[i].p1x+leafs[i].p3x)/2-fs/2;\n var oy = (leafs[i].p1y+leafs[i].p2y)/2;\n js+=\"ctx.fillText(\"+leafs[i].pos.toString()+\", \"+ox+\", \"+oy+\");\";\n if(leafs[i].pos == selected)\n {\n var a = true;\n var b = true;\n var c = true;\n \nfor(var i2 = 0;i2\"+js+scale+\"\";\nvar msg = {template: finalstring};\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 2200, + "y": 2400, + "wires": [ + [ + "4de8a85c.41b318" + ] + ] + }, + { + "id": "4de8a85c.41b318", + "type": "ui_template", + "z": "cddf6c26.6a9e3", + "group": "44fbf503.d3152c", + "name": "", + "order": 1, + "width": "12", + "height": "10", + "format": "", + "storeOutMessages": true, + "fwdInMessages": true, + "templateScope": "local", + "x": 2360, + "y": 2400, + "wires": [ + [] + ] + }, + { + "id": "b2672dcd.ab257", + "type": "ui_button", + "z": "cddf6c26.6a9e3", + "name": "", + "group": "44fbf503.d3152c", + "order": 2, + "width": "4", + "height": "1", + "passthru": false, + "label": "Add Position A", + "color": "", + "bgcolor": "", + "icon": "", + "payload": "", + "payloadType": "str", + "topic": "", + "x": 1730, + "y": 2520, + "wires": [ + [ + "ecef9ed1.80696" + ] + ] + }, + { + "id": "726f4b1c.4ef374", + "type": "ui_button", + "z": "cddf6c26.6a9e3", + "name": "", + "group": "44fbf503.d3152c", + "order": 3, + "width": "4", + "height": "1", + "passthru": false, + "label": "Add Position B", + "color": "", + "bgcolor": "", + "icon": "", + "payload": "", + "payloadType": "str", + "topic": "", + "x": 1730, + "y": 2560, + "wires": [ + [ + "2d1c7b5c.a228b4" + ] + ] + }, + { + "id": "4ddfab1c.617bf4", + "type": "ui_button", + "z": "cddf6c26.6a9e3", + "name": "", + "group": "44fbf503.d3152c", + "order": 8, + "width": "4", + "height": "1", + "passthru": false, + "label": "Reset", + "color": "", + "bgcolor": "", + "icon": "", + "payload": "", + "payloadType": "str", + "topic": "", + "x": 1530, + "y": 2440, + "wires": [ + [ + "5e91a4c2.e4246c" + ] + ] + }, + { + "id": "5e91a4c2.e4246c", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Reset", + "func": "var leafs = [];\n\nglobal.set(\"NanoleafCfg\", leafs);\nglobal.set(\"DesignerSelected\",0);\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1670, + "y": 2440, + "wires": [ + [ + "b858cc9e.a5b2b", + "e84d7734.1c9bc8" + ] + ] + }, + { + "id": "2cde9e7f.f45182", + "type": "config", + "z": "cddf6c26.6a9e3", + "name": "", + "properties": [ + { + "p": "CanvasHeight", + "pt": "global", + "to": "500", + "tot": "str" + }, + { + "p": "CanvasWidth", + "pt": "global", + "to": "800", + "tot": "str" + }, + { + "p": "TriangleSide", + "pt": "global", + "to": "100", + "tot": "num" + }, + { + "p": "TriangleOffset", + "pt": "global", + "to": "12", + "tot": "num" + }, + { + "p": "TriangleStroke", + "pt": "global", + "to": "8", + "tot": "num" + }, + { + "p": "DesignerFontSize", + "pt": "global", + "to": "20", + "tot": "num" + }, + { + "p": "DesignerOffset", + "pt": "global", + "to": "20", + "tot": "num" + }, + { + "p": "CanvasOffset", + "pt": "global", + "to": "30", + "tot": "str" + }, + { + "p": "CanvasHeightMini", + "pt": "global", + "to": "190", + "tot": "str" + }, + { + "p": "CanvasWidthMini", + "pt": "global", + "to": "350", + "tot": "str" + } + ], + "active": true, + "x": 1510, + "y": 2380, + "wires": [] + }, + { + "id": "e84d7734.1c9bc8", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Button-Control", + "func": "var p = global.get(\"DesignerSelected\");\nvar leafs = global.get(\"NanoleafCfg\");\nvar o = global.get(\"TriangleOffset\");\nvar s = global.get(\"TriangleSide\");\nif(p==null)\n{\n p = leafs.length-1;\n}\n\nvar a = false;\nvar b = false;\nvar c = false;\n\nif(p==-1 || p==0)\n{\n a=true;\n b=true;\n c=true;\n}\nelse\n{\n var d = leafs[p].add;\n if(d==111||d==110||d==100||d==101)\n {\n a=true;\n }\n if(d==111||d==110||d==10||d==11)\n {\n b=true;\n }\n if(d==111||d==101||d==1||d==11)\n {\n c=true;\n }\n for(var i = 0;iC", + "color": "", + "bgcolor": "", + "icon": "", + "payload": "", + "payloadType": "str", + "topic": "", + "x": 1730, + "y": 2600, + "wires": [ + [ + "c3eb1a04.6d53d8" + ] + ] + }, + { + "id": "ecef9ed1.80696", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Add Pos A", + "func": "var leafs = [];\nvar s = global.get(\"TriangleSide\");\nvar o = global.get(\"TriangleOffset\");\nvar p = global.get(\"DesignerSelected\");\n\n\n\nif(global.get(\"NanoleafCfg\")!=null)leafs = global.get(\"NanoleafCfg\");\nif(p==null)\n{\n if(leafs==null)p=0;else\n p = leafs.length-1;\n}\nvar cnt = 0;\nif(leafs.length !=null)cnt=leafs.length;\nif(cnt == 0)\n{\n leafs.push({\n pos: 0,\n p1x: 0,\n p1y: parseInt(s*(Math.sqrt(3)/2)),\n p2x: s/2,\n p2y: 0,\n p3x: s,\n p3y: parseInt(s*(Math.sqrt(3)/2)),\n fill: \"#dddddd\",\n type: true,\n add: 111\n});\n}\nelse\n{\n if(leafs[p].type==true)\n {\n leafs.push({\n pos: leafs.length,\n p1x: leafs[p].p2x-o-s,\n p1y: leafs[p].p2y,\n p2x: leafs[p].p1x-o,\n p2y: leafs[p].p1y,\n p3x: leafs[p].p2x-o,\n p3y: leafs[p].p2y,\n fill: \"#41f45c\",\n type: false,\n add: 110\n});\n }\n else\n {\n leafs.push({\n pos: leafs.length,\n p1x: leafs[p].p2x-o-s,\n p1y: leafs[p].p2y,\n p2x: leafs[p].p1x-o,\n p2y: leafs[p].p1y,\n p3x: leafs[p].p2x-o,\n p3y: leafs[p].p2y,\n fill: \"#41f45c\",\n type: true,\n add: 101\n});\n }\n}\nglobal.set(\"NanoleafCfg\", leafs);\nglobal.set(\"DesignerSelected\",cnt);\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1970, + "y": 2520, + "wires": [ + [ + "b858cc9e.a5b2b" + ] + ] + }, + { + "id": "2d1c7b5c.a228b4", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Add Pos B", + "func": "var leafs = [];\nvar s = global.get(\"TriangleSide\");\nvar o = global.get(\"TriangleOffset\");\nvar p = global.get(\"DesignerSelected\");\n\n\n\nif(global.get(\"NanoleafCfg\")!=null)leafs = global.get(\"NanoleafCfg\");\nif(p==null)\n{\n if(leafs==null)p=0;else\n p = leafs.length-1;\n}\nvar cnt = 0;\nif(leafs.length !=null)cnt=leafs.length;\nif(cnt == 0)\n{\n leafs.push({\n pos: 0,\n p1x: 0,\n p1y: 0,\n p2x: s/2,\n p2y: parseInt(s*(Math.sqrt(3)/2)),\n p3x: s,\n p3y: 0,\n fill: \"#aaaaaa\",\n type: false,\n add: 111\n});\n}\nelse\n{\n if(leafs[p].type==true)\n {\n leafs.push({\n pos: leafs.length,\n p1x: leafs[p].p2x+o,\n p1y: leafs[p].p2y,\n p2x: leafs[p].p3x+o,\n p2y: leafs[p].p3y,\n p3x: leafs[p].p2x+s+o,\n p3y: leafs[p].p2y,\n fill: \"#42f1f4\",\n type: false,\n add: 11\n});\n }\n else\n {\n leafs.push({\n pos: leafs.length,\n p1x: leafs[p].p1x,\n p1y: leafs[p].p1y-o,\n p2x: leafs[p].p2x,\n p2y: leafs[p].p1y-o-parseInt((Math.sqrt(3)/2)*s),\n p3x: leafs[p].p3x,\n p3y: leafs[p].p3y-o,\n fill: \"#42f1f4\",\n type: true,\n add: 110\n});\n }\n}\n\nglobal.set(\"NanoleafCfg\", leafs);\nglobal.set(\"DesignerSelected\", cnt);\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1970, + "y": 2560, + "wires": [ + [ + "b858cc9e.a5b2b" + ] + ] + }, + { + "id": "c3eb1a04.6d53d8", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Add Pos C", + "func": "var leafs = [];\nvar s = global.get(\"TriangleSide\");\nvar o = global.get(\"TriangleOffset\");\nvar p = global.get(\"DesignerSelected\");\n\n\n\nif(global.get(\"NanoleafCfg\")!=null)leafs = global.get(\"NanoleafCfg\");\nif(p==null)\n{\n if(leafs==null)p=0;else\n p = leafs.length-1;\n}\nvar cnt = 0;\nif(leafs.length !=null)cnt=leafs.length;\nif(cnt == 0)\n{\n leafs.push({\n pos: 0,\n p1x: 0,\n p1y: 0,\n p2x: s/2,\n p2y: parseInt(s*(Math.sqrt(3)/2)),\n p3x: s,\n p3y: 0,\n fill: \"#aaaaaa\",\n type: false,\n add: 111\n});\n}\nelse\n{\n if(leafs[p].type==true)\n {\n leafs.push({\n pos: leafs.length,\n p1x: leafs[p].p1x,\n p1y: leafs[p].p1y+o,\n p2x: leafs[p].p2x,\n p2y: leafs[p].p2y+o+2*parseInt((Math.sqrt(3)/2)*s),\n p3x: leafs[p].p3x,\n p3y: leafs[p].p3y+o,\n fill: \"#f7ff21\",\n type: false,\n add: 101\n});\n }\n else\n {\n leafs.push({\n pos: leafs.length,\n p1x: leafs[p].p2x+o,\n p1y: leafs[p].p2y,\n p2x: leafs[p].p3x+o,\n p2y: leafs[p].p3y,\n p3x: leafs[p].p2x+o+s,\n p3y: leafs[p].p2y,\n fill: \"#f7ff21\",\n type: true,\n add: 11\n});\n }\n\n}\nglobal.set(\"NanoleafCfg\", leafs);\nglobal.set(\"DesignerSelected\",cnt);\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1970, + "y": 2600, + "wires": [ + [ + "b858cc9e.a5b2b" + ] + ] + }, + { + "id": "25b34d97.6303b2", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Seleted", + "func": "var x = msg.payload;\nvar leafs = global.get(\"NanoleafCfg\");\nvar c = global.get(\"DesignerSelected\");\nvar y = 0;\ny=c+x;\nif(y>=leafs.length)y=0;\nif(y<0)y=leafs.length-1;\nglobal.set(\"DesignerSelected\",y);\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 2320, + "y": 2480, + "wires": [ + [ + "b858cc9e.a5b2b" + ] + ] + }, + { + "id": "e33be40a.e44588", + "type": "ui_button", + "z": "cddf6c26.6a9e3", + "name": "Right", + "group": "44fbf503.d3152c", + "order": 6, + "width": "2", + "height": "1", + "passthru": false, + "label": "", + "color": "", + "bgcolor": "", + "icon": "fa-arrow-right", + "payload": "+1", + "payloadType": "num", + "topic": "", + "x": 1950, + "y": 2640, + "wires": [ + [ + "25b34d97.6303b2" + ] + ] + }, + { + "id": "7542d568.1efc2c", + "type": "ui_button", + "z": "cddf6c26.6a9e3", + "name": "Left", + "group": "44fbf503.d3152c", + "order": 5, + "width": "2", + "height": "1", + "passthru": false, + "label": "", + "color": "", + "bgcolor": "", + "icon": "fa-arrow-left", + "payload": "-1", + "payloadType": "num", + "topic": "", + "x": 1950, + "y": 2680, + "wires": [ + [ + "25b34d97.6303b2" + ] + ] + }, + { + "id": "eca2acf5.cb0ac", + "type": "ui_button", + "z": "cddf6c26.6a9e3", + "name": "", + "group": "44fbf503.d3152c", + "order": 7, + "width": "4", + "height": "1", + "passthru": false, + "label": "Remove Last", + "color": "", + "bgcolor": "", + "icon": "", + "payload": "", + "payloadType": "str", + "topic": "", + "x": 1970, + "y": 2720, + "wires": [ + [ + "473dbfbe.73d8" + ] + ] + }, + { + "id": "473dbfbe.73d8", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Remove Last", + "func": "var leafs = global.get(\"NanoleafCfg\");\nif(leafs==null)return null;\nif(leafs.length>0)leafs.pop();\nglobal.set(\"NanoleafCfg\", leafs);\nglobal.set(\"DesignerSelected\",leafs.length-1);\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 2130, + "y": 2720, + "wires": [ + [ + "b858cc9e.a5b2b" + ] + ] + }, + { + "id": "f9b688a4.59e5d8", + "type": "file", + "z": "cddf6c26.6a9e3", + "name": "", + "filename": "NanoleafCfg.json", + "appendNewline": true, + "createDir": false, + "overwriteFile": "true", + "x": 2450, + "y": 2800, + "wires": [ + [ + "b0d8bd52.65e2d", + "3bb66cee.d68894" + ] + ] + }, + { + "id": "28b9652d.3b612a", + "type": "file in", + "z": "cddf6c26.6a9e3", + "name": "", + "filename": "NanoleafCfg.json", + "format": "utf8", + "chunk": false, + "sendError": false, + "x": 2130, + "y": 2760, + "wires": [ + [ + "58b4a094.24526" + ] + ] + }, + { + "id": "47cebab.e260644", + "type": "json", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "payload", + "action": "str", + "pretty": false, + "x": 2290, + "y": 2800, + "wires": [ + [ + "f9b688a4.59e5d8" + ] + ] + }, + { + "id": "be469f25.47c8e", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "NanoleafCfg", + "tot": "global" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 2120, + "y": 2800, + "wires": [ + [ + "47cebab.e260644" + ] + ] + }, + { + "id": "8dd8fc70.37d2a", + "type": "ui_button", + "z": "cddf6c26.6a9e3", + "name": "", + "group": "44fbf503.d3152c", + "order": 0, + "width": "4", + "height": "1", + "passthru": false, + "label": "Save Design", + "color": "", + "bgcolor": "", + "icon": "", + "payload": "", + "payloadType": "str", + "topic": "", + "x": 1490, + "y": 2800, + "wires": [ + [ + "a318e7d9.bab5e8" + ] + ] + }, + { + "id": "7e449e9c.3783d", + "type": "ui_toast", + "z": "cddf6c26.6a9e3", + "position": "dialog", + "displayTime": "3", + "highlight": "", + "outputs": 1, + "ok": "Yes", + "cancel": "Cancel", + "topic": "Are you sure?", + "name": "confirm", + "x": 1820, + "y": 2800, + "wires": [ + [ + "c2857062.70511" + ] + ] + }, + { + "id": "c2857062.70511", + "type": "switch", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "payload", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "Yes", + "vt": "str" + } + ], + "checkall": "true", + "repair": false, + "outputs": 1, + "x": 1970, + "y": 2800, + "wires": [ + [ + "be469f25.47c8e" + ] + ] + }, + { + "id": "6caefba1.71e714", + "type": "ui_button", + "z": "cddf6c26.6a9e3", + "name": "", + "group": "44fbf503.d3152c", + "order": 0, + "width": "4", + "height": "1", + "passthru": false, + "label": "Load Design", + "color": "", + "bgcolor": "", + "icon": "", + "payload": "", + "payloadType": "str", + "topic": "", + "x": 1490, + "y": 2760, + "wires": [ + [ + "170287ff.beaf08" + ] + ] + }, + { + "id": "d07e90fc.da19d", + "type": "ui_toast", + "z": "cddf6c26.6a9e3", + "position": "dialog", + "displayTime": "3", + "highlight": "", + "outputs": 1, + "ok": "Yes", + "cancel": "Cancel", + "topic": "Are you sure?", + "name": "confirm", + "x": 1820, + "y": 2760, + "wires": [ + [ + "a1d6a03a.6b53d" + ] + ] + }, + { + "id": "a1d6a03a.6b53d", + "type": "switch", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "payload", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "Yes", + "vt": "str" + } + ], + "checkall": "true", + "repair": false, + "outputs": 1, + "x": 1970, + "y": 2760, + "wires": [ + [ + "28b9652d.3b612a" + ] + ] + }, + { + "id": "b0dc8b83.382ae8", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "", + "rules": [ + { + "t": "set", + "p": "NanoleafCfg", + "pt": "global", + "to": "payload", + "tot": "msg" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 2460, + "y": 2760, + "wires": [ + [ + "b858cc9e.a5b2b" + ] + ] + }, + { + "id": "58b4a094.24526", + "type": "json", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "payload", + "action": "obj", + "pretty": false, + "x": 2290, + "y": 2760, + "wires": [ + [ + "b0dc8b83.382ae8" + ] + ] + }, + { + "id": "170287ff.beaf08", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1660, + "y": 2760, + "wires": [ + [ + "d07e90fc.da19d" + ] + ] + }, + { + "id": "a318e7d9.bab5e8", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1660, + "y": 2800, + "wires": [ + [ + "7e449e9c.3783d" + ] + ] + }, + { + "id": "5175d9cb.8e51b8", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Check NanoleafCfg", + "func": "if(global.get(\"NanoleafCfg\")!=null)return null;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1790, + "y": 2720, + "wires": [ + [ + "a1d6a03a.6b53d" + ] + ] + }, + { + "id": "88beb4f6.1f28c8", + "type": "ui_ui_control", + "z": "cddf6c26.6a9e3", + "name": "", + "x": 1820, + "y": 2840, + "wires": [ + [] + ] + }, + { + "id": "763f3960.723208", + "type": "ui_button", + "z": "cddf6c26.6a9e3", + "name": "", + "group": "44fbf503.d3152c", + "order": 0, + "width": "4", + "height": "1", + "passthru": false, + "label": "Close Designer", + "color": "", + "bgcolor": "", + "icon": "", + "payload": "", + "payloadType": "str", + "topic": "", + "x": 1480, + "y": 2840, + "wires": [ + [ + "4635a372.226d5c" + ] + ] + }, + { + "id": "4635a372.226d5c", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Hide Designer", + "func": "msg.payload= {group:{hide:[\"Nanoleafs_Nanoleaf_Designer\"], show:[\"Nanoleafs_Nanoleaf_Simulator\"], focus:true}};\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1660, + "y": 2840, + "wires": [ + [ + "88beb4f6.1f28c8" + ] + ] + }, + { + "id": "c319d1e6.638de", + "type": "link out", + "z": "cddf6c26.6a9e3", + "name": "NanoleafDMain", + "links": [ + "b80cf79b.b95778" + ], + "x": 2215, + "y": 440, + "wires": [] + }, + { + "id": "9c968433.d8d178", + "type": "ui_dropdown", + "z": "cddf6c26.6a9e3", + "name": "", + "label": "Pattern", + "place": "Select Pattern", + "group": "38d8f98d.5d51c6", + "order": 9, + "width": "7", + "height": "1", + "passthru": false, + "options": [ + { + "label": "", + "value": "", + "type": "str" + } + ], + "payload": "", + "topic": "", + "x": 1700, + "y": 280, + "wires": [ + [ + "931acf5e.287e1" + ] + ] + }, + { + "id": "50748020.a77fd", + "type": "ui_ui_control", + "z": "cddf6c26.6a9e3", + "name": "", + "x": 1300, + "y": 320, + "wires": [ + [ + "ff7b061b.2b1228", + "3025f8c3.d5e318", + "dad4e8c2.f4b9d8" + ] + ] + }, + { + "id": "ff7b061b.2b1228", + "type": "template", + "z": "cddf6c26.6a9e3", + "name": "", + "field": "options", + "fieldType": "msg", + "format": "json", + "syntax": "plain", + "template": "[\n {\"Pride\": \"0\"},\n {\"Color Waves\":\"1\"},\n {\"Rainbow\":\"20\"},\n {\"Rainbow With Glitter\":\"21\"},\n {\"Solid Rainbow\":\"22\"},\n {\"Confetti\":\"23\"},\n {\"Sinelon\":\"24\"},\n {\"Beat\":\"25\"},\n {\"Juggle\":\"26\"},\n {\"Fire\":\"27\"},\n {\"Water\":\"28\"},\n {\"Solid Color\":\"29\"}\n]", + "output": "str", + "x": 1440, + "y": 280, + "wires": [ + [ + "c2bc1be0.8dcae8" + ] + ] + }, + { + "id": "c2bc1be0.8dcae8", + "type": "json", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "options", + "action": "obj", + "pretty": false, + "x": 1570, + "y": 280, + "wires": [ + [ + "9c968433.d8d178" + ] + ] + }, + { + "id": "931acf5e.287e1", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Set Command", + "func": "msg.payload = \"pattern?value=\"+msg.payload;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1980, + "y": 300, + "wires": [ + [ + "c319d1e6.638de" + ] + ] + }, + { + "id": "3025f8c3.d5e318", + "type": "template", + "z": "cddf6c26.6a9e3", + "name": "", + "field": "options", + "fieldType": "msg", + "format": "json", + "syntax": "plain", + "template": "[\n {\"Rainbow Twinkles\":\"2\"},\n {\"Snow Twinkles\":\"3\"},\n {\"Cloud Twinkles\":\"4\"},\n {\"Incandescent Twinkles\":\"5\"},\n {\"Retro C9 Twinkles\":\"6\"},\n {\"Red & White Twinkles\":\"7\"},\n {\"Blue & White Twinkles\":\"8\"},\n {\"Red, Green & White Twinkles\":\"9\"},\n {\"Fairy Light Twinkles\":\"10\"},\n {\"Snow 2 Twinkles\":\"11\"},\n {\"Holly Twinkles\":\"12\"},\n {\"Ice Twinkles\":\"13\"},\n {\"Party Twinkles\":\"14\"},\n {\"Forest Twinkles\":\"15\"},\n {\"Lava Twinkles\":\"16\"},\n {\"Fire Twinkles\":\"17\"},\n {\"Cloud 2 Twinkles\":\"18\"},\n {\"Ocean Twinkles\":\"19\"}\n]", + "output": "str", + "x": 1440, + "y": 320, + "wires": [ + [ + "f72c92a8.30bcb" + ] + ] + }, + { + "id": "f72c92a8.30bcb", + "type": "json", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "options", + "action": "obj", + "pretty": false, + "x": 1570, + "y": 320, + "wires": [ + [ + "5f431f31.34eaa" + ] + ] + }, + { + "id": "5f431f31.34eaa", + "type": "ui_dropdown", + "z": "cddf6c26.6a9e3", + "name": "", + "label": "Twinkles", + "place": "Select Pattern", + "group": "38d8f98d.5d51c6", + "order": 10, + "width": "7", + "height": "1", + "passthru": false, + "options": [ + { + "label": "", + "value": "", + "type": "str" + } + ], + "payload": "", + "topic": "", + "x": 1700, + "y": 320, + "wires": [ + [ + "931acf5e.287e1" + ] + ] + }, + { + "id": "b537b63a.fba748", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Set Speed", + "func": "global.set(\"NanoleafSpeed\", msg.payload);\nmsg.payload = \"speed?value=\" + msg.payload;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1970, + "y": 400, + "wires": [ + [ + "c319d1e6.638de" + ] + ] + }, + { + "id": "97dcd4fb.b834e8", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Set Duration", + "func": "global.set(\"NanoleafAutoplayDuration\", msg.payload);\nmsg.payload = \"autoplayDuration?value=\" + msg.payload;\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1970, + "y": 480, + "wires": [ + [ + "c319d1e6.638de" + ] + ] + }, + { + "id": "227b2a01.fe37f6", + "type": "ui_dropdown", + "z": "cddf6c26.6a9e3", + "name": "", + "label": "Palette", + "place": "Select Palette", + "group": "38d8f98d.5d51c6", + "order": 11, + "width": "7", + "height": "1", + "passthru": false, + "options": [ + { + "label": "", + "value": "", + "type": "str" + } + ], + "payload": "", + "topic": "", + "x": 1710, + "y": 360, + "wires": [ + [ + "99c85859.463098" + ] + ] + }, + { + "id": "99c85859.463098", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Set Command", + "func": "msg.payload = \"palette?value=\"+msg.payload;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1980, + "y": 340, + "wires": [ + [ + "c319d1e6.638de" + ] + ] + }, + { + "id": "dad4e8c2.f4b9d8", + "type": "template", + "z": "cddf6c26.6a9e3", + "name": "", + "field": "options", + "fieldType": "msg", + "format": "json", + "syntax": "plain", + "template": "[\n {\"Rainbow\":\"0\"},\n {\"Rainbow Stripe\":\"1\"},\n {\"Cloud\":\"2\"},\n {\"Lava\":\"3\"},\n {\"Ocean\":\"4\"},\n {\"Forest\":\"5\"},\n {\"Party\":\"6\"},\n {\"Heat\":\"7\"}\n]", + "output": "str", + "x": 1440, + "y": 360, + "wires": [ + [ + "8d667f9d.6876f" + ] + ] + }, + { + "id": "8d667f9d.6876f", + "type": "json", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "options", + "action": "obj", + "pretty": false, + "x": 1570, + "y": 360, + "wires": [ + [ + "227b2a01.fe37f6" + ] + ] + }, + { + "id": "96b67382.72e7d", + "type": "ui_slider", + "z": "cddf6c26.6a9e3", + "name": "Brightness Slider", + "label": "", + "group": "9f40378b.457ad8", + "order": 4, + "width": "4", + "height": "1", + "passthru": true, + "topic": "", + "min": 0, + "max": "255", + "step": 1, + "x": 1670, + "y": 180, + "wires": [ + [ + "6c68daf0.054d94", + "149a4019.99fce" + ] + ] + }, + { + "id": "6c68daf0.054d94", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Set Brightness", + "func": "global.set(\"NanoleafBrightness\", msg.payload);\nmsg.payload = \"brightness?value=\" + msg.payload;\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1980, + "y": 180, + "wires": [ + [ + "c319d1e6.638de" + ] + ] + }, + { + "id": "74a5dd1d.816c24", + "type": "ui_text", + "z": "cddf6c26.6a9e3", + "group": "9f40378b.457ad8", + "order": 3, + "width": "3", + "height": "1", + "name": "", + "label": "Brightness: ", + "format": "{{msg.payload}}%", + "layout": "row-spread", + "x": 1970, + "y": 220, + "wires": [] + }, + { + "id": "149a4019.99fce", + "type": "range", + "z": "cddf6c26.6a9e3", + "minin": "0", + "maxin": "255", + "minout": "0", + "maxout": "100", + "action": "scale", + "round": true, + "property": "payload", + "name": "", + "x": 1710, + "y": 220, + "wires": [ + [ + "74a5dd1d.816c24" + ] + ] + }, + { + "id": "714fa023.6ecad", + "type": "ui_colour_picker", + "z": "cddf6c26.6a9e3", + "name": "", + "label": "Solid Color", + "group": "38d8f98d.5d51c6", + "format": "rgb", + "outformat": "string", + "showSwatch": false, + "showPicker": true, + "showValue": true, + "showHue": true, + "showAlpha": false, + "showLightness": true, + "dynOutput": "false", + "order": 0, + "width": "7", + "height": "4", + "passthru": true, + "topic": "", + "x": 1690, + "y": 560, + "wires": [ + [ + "c9671359.9c1c1" + ] + ] + }, + { + "id": "c9671359.9c1c1", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Extract colors", + "func": "var str = msg.payload.substr(4, msg.payload.length-5);\nvar str = str.split(\", \");\nmsg.payload = \"solidColor?r=\"+str[0]+\"&g=\"+str[1]+\"&b=\"+str[2];\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1980, + "y": 560, + "wires": [ + [ + "c319d1e6.638de" + ] + ] + }, + { + "id": "c2f996f5.dff9b8", + "type": "ui_text", + "z": "cddf6c26.6a9e3", + "group": "ba6866b4.b54908", + "order": 2, + "width": "3", + "height": "1", + "name": "", + "label": "Duration:", + "format": "{{msg.payload}} s", + "layout": "row-spread", + "x": 1960, + "y": 520, + "wires": [] + }, + { + "id": "34b3de7f.260872", + "type": "comment", + "z": "cddf6c26.6a9e3", + "name": "Nanoleaf Designer, warning: complicated code, don't touch anything down here :D", + "info": "", + "x": 1720, + "y": 2340, + "wires": [] + }, + { + "id": "7b51471a.bb9828", + "type": "ui_slider", + "z": "cddf6c26.6a9e3", + "name": "", + "label": "Cooling", + "group": "7f1ff9b6.485398", + "order": 2, + "width": "7", + "height": "1", + "passthru": true, + "topic": "", + "min": "0", + "max": "255", + "step": 1, + "x": 1700, + "y": 600, + "wires": [ + [ + "4d165e06.9caab" + ] + ] + }, + { + "id": "4d165e06.9caab", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Set Value", + "func": "msg.payload = \"cooling?value=\" + msg.payload;\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1960, + "y": 600, + "wires": [ + [ + "c319d1e6.638de" + ] + ] + }, + { + "id": "391bd61f.808c8a", + "type": "ui_slider", + "z": "cddf6c26.6a9e3", + "name": "", + "label": "Sparking", + "group": "7f1ff9b6.485398", + "order": 3, + "width": "7", + "height": "1", + "passthru": true, + "topic": "", + "min": "0", + "max": "255", + "step": 1, + "x": 1700, + "y": 640, + "wires": [ + [ + "d3dc0fae.ddf1f" + ] + ] + }, + { + "id": "3a25389d.16efd8", + "type": "ui_slider", + "z": "cddf6c26.6a9e3", + "name": "", + "label": "Twinkle Speed", + "group": "7f1ff9b6.485398", + "order": 4, + "width": "7", + "height": "1", + "passthru": true, + "topic": "", + "min": "0", + "max": "8", + "step": 1, + "x": 1680, + "y": 680, + "wires": [ + [ + "7bf6672d.9ba278" + ] + ] + }, + { + "id": "3ea1d27b.ffd8fe", + "type": "ui_slider", + "z": "cddf6c26.6a9e3", + "name": "", + "label": "Twinkle Density", + "group": "7f1ff9b6.485398", + "order": 5, + "width": "7", + "height": "1", + "passthru": true, + "topic": "", + "min": "0", + "max": "8", + "step": 1, + "x": 1680, + "y": 720, + "wires": [ + [ + "2d34f90b.105606" + ] + ] + }, + { + "id": "d3dc0fae.ddf1f", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Set Value", + "func": "msg.payload = \"sparking?value=\" + msg.payload;\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1960, + "y": 640, + "wires": [ + [ + "c319d1e6.638de" + ] + ] + }, + { + "id": "7bf6672d.9ba278", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Set Value", + "func": "msg.payload = \"twinkleSpeed?value=\" + msg.payload;\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1960, + "y": 680, + "wires": [ + [ + "c319d1e6.638de" + ] + ] + }, + { + "id": "2d34f90b.105606", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Set Value", + "func": "msg.payload = \"twinkleDensity?value=\" + msg.payload;\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1960, + "y": 720, + "wires": [ + [ + "c319d1e6.638de" + ] + ] + }, + { + "id": "3f2fb0d4.9adb8", + "type": "debug", + "z": "cddf6c26.6a9e3", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "template", + "x": 2600, + "y": 1000, + "wires": [] + }, + { + "id": "d2f003f.5b52c", + "type": "ui_template", + "z": "cddf6c26.6a9e3", + "group": "52add45d.cb1fbc", + "name": "", + "order": 1, + "width": "14", + "height": "10", + "format": "", + "storeOutMessages": true, + "fwdInMessages": true, + "templateScope": "local", + "x": 2170, + "y": 1040, + "wires": [ + [] + ] + }, + { + "id": "ae86f739.5e36a8", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Reposition ", + "func": "var leafs =[];\nvar o = global.get(\"CanvasOffset\");\nif(global.get(\"PatternCfg\")!=null)leafs = global.get(\"PatternCfg\");\nvar leafs_old = leafs;\n\nvar offsetX = 0;\nvar offsetY = 0;\nvar maxX = 0;\nvar maxY=0;\n\nvar w = global.get(\"CanvasWidth\");\nvar h = global.get(\"CanvasHeight\");\n\nfor(var i = 0;i(maxX))maxX=leafs[i].p1x;\n if(leafs[i].p2x>(maxX))maxX=leafs[i].p2x;\n if(leafs[i].p3x>(maxX))maxX=leafs[i].p3x;\n \n if(leafs[i].p1y>(maxY))maxY=leafs[i].p1y;\n if(leafs[i].p2y>(maxY))maxY=leafs[i].p2y;\n if(leafs[i].p3y>(maxY))maxY=leafs[i].p3y;\n}\nvar scale = 1;\nif((maxX+40)>w)\n{\n scale = w/(maxX+40);\n}\nif((maxY+40)>h)\n{\n if((h/(maxY+40))`;\nhtml+='';\n\njs+=`\nvar canvasPattern = document.getElementById(\"canvasPattern\");\nvar ctxPattern = canvasPattern.getContext(\"2d\");\nvar BB = canvasPattern.getBoundingClientRect();\nvar offsetX = BB.left;\nvar offsetY = BB.top;\nvar WIDTH = canvasPattern.width;\nvar HEIGHT = canvasPattern.height;\n`\njs+='ctxPattern.scale('+parseFloat(msg.topic)+', '+parseFloat(msg.topic)+');';\nfor (var i = 0; i < leafs.length; i++) { \n js+='ctxPattern.beginPath();\\n';\n js+='ctxPattern.moveTo('+leafs[i].p1x+', '+leafs[i].p1y+');\\n';\n js+='ctxPattern.lineTo('+leafs[i].p2x+', '+leafs[i].p2y+');\\n';\n js+='ctxPattern.lineTo('+leafs[i].p3x+', '+leafs[i].p3y+');\\n';\n js+='ctxPattern.closePath();\\n';\n js+='ctxPattern.lineWidth ='+s+';';\n js+='ctxPattern.lineCap = \"round\";';\n js+=\"ctxPattern.strokeStyle = '#000000';\";\n if(i==selected)js+=\"ctxPattern.strokeStyle = '#FF0000';\";\n js+=\"ctxPattern.stroke();\";\n js+='ctxPattern.fillStyle = \"'+ leafs[i].fill+'\";\\n';\n js+='ctxPattern.fill();'\n}\nvar eventjs=`\ndocument.getElementById('canvasPattern').addEventListener('click',\nfunction(ev){\n var x = ev.clientX - canvasPattern.offsetLeft;\n var y = ev.clientY - canvasPattern.offsetTop;\nalert(x+\", \"+y);\n},false);\n`\n\nvar finalstring = html+\"\";\nvar msg = {template: finalstring};\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 2010, + "y": 1040, + "wires": [ + [ + "d2f003f.5b52c" + ] + ] + }, + { + "id": "48628ea3.0df7e", + "type": "ui_text", + "z": "cddf6c26.6a9e3", + "group": "52add45d.cb1fbc", + "order": 6, + "width": "2", + "height": "1", + "name": "Mode label", + "label": "... ", + "format": "{{msg.payload}}", + "layout": "row-left", + "x": 2860, + "y": 1200, + "wires": [] + }, + { + "id": "8d6078e6.0e42d8", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Static/Breathe/Flow", + "func": "var leafs = global.get(\"PatternCfg\");\nvar selected = global.get(\"DesignerSelected\");\nleafs[selected].mode=msg.payload;\nglobal.set(\"PatternCfg\", leafs);\n\n\n\n\n\nvar msg2 = {payload: \"\"};\nmsg2.phase=leafs[selected].phase;\nif(msg.payload==\"Yes\")\n{\n for(var i = 0;i=leafs.length)y=0;\nif(y<0)y=leafs.length-1;\nmsg.payload = leafs[y].mode;\nmsg.phase=leafs[y].phase;\nmsg.color = leafs[y].fill.substr(1,leafs[y].fill.length-1);\nglobal.set(\"DesignerSelected\",y);\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1600, + "y": 1120, + "wires": [ + [ + "ae86f739.5e36a8", + "d222dd18.561d6", + "10b75bf2.212fb4" + ] + ] + }, + { + "id": "4231946c.a75e8c", + "type": "ui_colour_picker", + "z": "cddf6c26.6a9e3", + "name": "", + "label": "Color Leaf", + "group": "52add45d.cb1fbc", + "format": "hex", + "outformat": "string", + "showSwatch": false, + "showPicker": true, + "showValue": true, + "showHue": true, + "showAlpha": false, + "showLightness": true, + "dynOutput": "false", + "order": 7, + "width": "7", + "height": "4", + "passthru": false, + "topic": "", + "x": 1460, + "y": 1280, + "wires": [ + [ + "5b2b22a1.64f4dc" + ] + ] + }, + { + "id": "5b2b22a1.64f4dc", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Extract colors", + "func": "var selected = global.get(\"DesignerSelected\");\n\nvar leafs = [];\nif(global.get(\"PatternCfg\")!=null)leafs = global.get(\"PatternCfg\");\nfor(var i = 0;i;;,;;;;,;;;;,;;;.....", + "info": "", + "x": 1710, + "y": 1780, + "wires": [] + }, + { + "id": "cfe7da79.fce3f8", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Build Message string", + "func": "var leafs = msg.payload;\nvar isflow = 1;\nfor(var i = 0;i\n \n \n Name\n Run\n Delete\n Load\n \n \n`;\n\n\n\nfor(var prp in patterns)\n{\n html+=\"\";\n html+=\"\"+prp+\"\";\n html+=\"<\\/md-button><\\/td>\"; \n html+=\"<\\/md-button><\\/td>\"; \n html+=\"<\\/md-button><\\/td>\"; \n html+=\"\";\n}\nhtml+=`\n \n\n`;\nmsg.template = html;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1700, + "y": 1920, + "wires": [ + [ + "1d0ff4d4.794dfb" + ] + ] + }, + { + "id": "ae89697a.e43828", + "type": "file in", + "z": "cddf6c26.6a9e3", + "name": "", + "filename": "Patterns.json", + "format": "utf8", + "chunk": false, + "sendError": true, + "x": 1390, + "y": 1920, + "wires": [ + [ + "da4d8908.109d58" + ] + ] + }, + { + "id": "da4d8908.109d58", + "type": "json", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "payload", + "action": "obj", + "pretty": false, + "x": 1530, + "y": 1920, + "wires": [ + [ + "f731b9fe.7196f8" + ] + ] + }, + { + "id": "1d0ff4d4.794dfb", + "type": "ui_template", + "z": "cddf6c26.6a9e3", + "group": "72e5ee31.af07a", + "name": "", + "order": 0, + "width": "7", + "height": "6", + "format": "", + "storeOutMessages": true, + "fwdInMessages": false, + "templateScope": "local", + "x": 1880, + "y": 1920, + "wires": [ + [ + "2d8e7cfa.94fc54" + ] + ] + }, + { + "id": "320367eb.50efc8", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Delete Pattern", + "func": "var patterns = msg.payload;\nvar del = msg.command;\ndelete patterns[del];\nmsg.payload=patterns;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 1420, + "y": 2060, + "wires": [ + [ + "c3db13d9.eb53c" + ] + ] + }, + { + "id": "c3db13d9.eb53c", + "type": "json", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "payload", + "action": "str", + "pretty": false, + "x": 1570, + "y": 2060, + "wires": [ + [ + "39647b92.3f8a74" + ] + ] + }, + { + "id": "39647b92.3f8a74", + "type": "file", + "z": "cddf6c26.6a9e3", + "name": "", + "filename": "Patterns.json", + "appendNewline": true, + "createDir": false, + "overwriteFile": "true", + "x": 1710, + "y": 2060, + "wires": [ + [ + "e5cebc3e.fd838" + ] + ] + }, + { + "id": "e5cebc3e.fd838", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1880, + "y": 2060, + "wires": [ + [ + "a5a5d0f2.794c9", + "fc67e84e.fab488" + ] + ] + }, + { + "id": "a5a5d0f2.794c9", + "type": "ui_toast", + "z": "cddf6c26.6a9e3", + "position": "top right", + "displayTime": "3", + "highlight": "", + "outputs": 0, + "ok": "OK", + "cancel": "", + "topic": "Pattern deleted", + "name": "", + "x": 2070, + "y": 2060, + "wires": [] + }, + { + "id": "2a26d2d5.71152e", + "type": "file in", + "z": "cddf6c26.6a9e3", + "name": "", + "filename": "Patterns.json", + "format": "utf8", + "chunk": false, + "sendError": true, + "x": 2230, + "y": 1920, + "wires": [ + [ + "7b49c3ea.19c23c" + ] + ] + }, + { + "id": "7b49c3ea.19c23c", + "type": "json", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "payload", + "action": "obj", + "pretty": false, + "x": 2370, + "y": 1920, + "wires": [ + [ + "e3cc6b2.e868c98" + ] + ] + }, + { + "id": "2d8e7cfa.94fc54", + "type": "change", + "z": "cddf6c26.6a9e3", + "name": "", + "rules": [ + { + "t": "set", + "p": "command", + "pt": "msg", + "to": "payload", + "tot": "msg" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 2050, + "y": 1920, + "wires": [ + [ + "2a26d2d5.71152e" + ] + ] + }, + { + "id": "e3cc6b2.e868c98", + "type": "switch", + "z": "cddf6c26.6a9e3", + "name": "", + "property": "mode", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "P", + "vt": "str" + }, + { + "t": "eq", + "v": "T", + "vt": "str" + }, + { + "t": "eq", + "v": "E", + "vt": "str" + } + ], + "checkall": "true", + "repair": false, + "outputs": 3, + "x": 1230, + "y": 2020, + "wires": [ + [ + "e45005c.e1128f8" + ], + [ + "320367eb.50efc8" + ], + [ + "d9f031ed.cb70a" + ] + ] + }, + { + "id": "e45005c.e1128f8", + "type": "function", + "z": "cddf6c26.6a9e3", + "name": "Convert HEX to RGB", + "func": "var leafs = msg.payload[msg.command];\nvar result;\nmsg.cnt = leafs.length;\n\nfor(var i = 0;i= 255)breathe_dir = 0; + else if (breathe <= 0) breathe_dir = 1; + //Serial.println(breathe); + } + thistimer.setPeriod(64-(speed/4)); + if (autoplay && (millis() > autoPlayTimeout)) { adjustPattern(true); autoPlayTimeout = millis() + (autoplayDuration * 1000); @@ -691,9 +720,10 @@ void setSolidColor(uint8_t r, uint8_t g, uint8_t b) EEPROM.write(4, b); EEPROM.commit(); - setPattern(patternCount - 1); + setPattern(29); broadcastString("color", String(solidColor.r) + "," + String(solidColor.g) + "," + String(solidColor.b)); + FastLED.show(); } // increase or decrease the current pattern number, and wrap around at the ends @@ -884,21 +914,21 @@ void bpm() uint8_t beat = beatsin8(speed, 64, 255); CRGBPalette16 palette = palettes[currentPaletteIndex]; for (int i = 0; i < LEAFCOUNT; i++) { - for (int i2 = 0; i2 < PIXELS_PER_LEAF; i2++)leds[i*PIXELS_PER_LEAF + i2] = ColorFromPalette(palette, gHue + (i * 2), beat - gHue + (i * 10)); + for (int i2 = 0; i2 < PIXELS_PER_LEAF; i2++)leds[i * PIXELS_PER_LEAF + i2] = ColorFromPalette(palette, gHue + (i * 2), beat - gHue + (i * 10)); } } // BACKUP /* -void bpm() -{ + void bpm() + { // colored stripes pulsing at a defined Beats-Per-Minute (BPM) uint8_t beat = beatsin8(speed, 64, 255); CRGBPalette16 palette = palettes[currentPaletteIndex]; for (int i = 0; i < NUM_LEDS; i++) { leds[i] = ColorFromPalette(palette, gHue + (i * 2), beat - gHue + (i * 10)); } -} + } */ void juggle() @@ -918,10 +948,10 @@ void juggle() if (lastSecond != secondHand) { // Debounce to make sure we're not repeating an assignment. lastSecond = secondHand; switch (secondHand) { - case 0: numdots = 1; basebeat = 20; hueinc = 16; faderate = 2; thishue = 0; break; // You can change values here, one at a time , or altogether. - case 10: numdots = 4; basebeat = 10; hueinc = 16; faderate = 8; thishue = 128; break; - case 20: numdots = 8; basebeat = 3; hueinc = 0; faderate = 8; thishue = random8(); break; // Only gets called once, and not continuously for the next several seconds. Therefore, no rainbows. - case 30: break; + case 0: numdots = 1; basebeat = 20; hueinc = 16; faderate = 2; thishue = 0; break; // You can change values here, one at a time , or altogether. + case 10: numdots = 4; basebeat = 10; hueinc = 16; faderate = 8; thishue = 128; break; + case 20: numdots = 8; basebeat = 3; hueinc = 0; faderate = 8; thishue = random8(); break; // Only gets called once, and not continuously for the next several seconds. Therefore, no rainbows. + case 30: break; } } @@ -987,18 +1017,18 @@ void pride() for (int i2 = 0; i2 < (PIXELS_PER_LEAF / 3); i2++) { - nblend(leds[pixelnumber*(PIXELS_PER_LEAF / 3) + i2], newcolor, 64); + nblend(leds[pixelnumber * (PIXELS_PER_LEAF / 3) + i2], newcolor, 64); } } } //#############BACKUP######################## /* -// Pride2015 by Mark Kriegsman: https://gist.github.com/kriegsman/964de772d64c502760e5 -// This function draws rainbows with an ever-changing, -// widely-varying set of parameters. -void pride() -{ + // Pride2015 by Mark Kriegsman: https://gist.github.com/kriegsman/964de772d64c502760e5 + // This function draws rainbows with an ever-changing, + // widely-varying set of parameters. + void pride() + { static uint16_t sPseudotime = 0; static uint16_t sLastMillis = 0; static uint16_t sHue16 = 0; @@ -1036,7 +1066,7 @@ void pride() nblend( leds[pixelnumber], newcolor, 64); } -} + } */ @@ -1110,7 +1140,7 @@ extern const TProgmemRGBGradientPalettePtr gGradientPalettes[]; extern const uint8_t gGradientPaletteCount; uint8_t beatsaw8(accum88 beats_per_minute, uint8_t lowest = 0, uint8_t highest = 255, - uint32_t timebase = 0, uint8_t phase_offset = 0) + uint32_t timebase = 0, uint8_t phase_offset = 0) { uint8_t beat = beat8(beats_per_minute, timebase); uint8_t beatsaw = beat + phase_offset; @@ -1180,7 +1210,7 @@ void colorwaves(CRGB* ledarray, uint16_t numleds, CRGBPalette16& palette) pixelnumber = ((LEAFCOUNT * 3) - 1) - pixelnumber; for (int i2 = 0; i2 < (PIXELS_PER_LEAF / 3); i2++) { - nblend(leds[pixelnumber*(PIXELS_PER_LEAF / 3) + i2], newcolor, 128); + nblend(leds[pixelnumber * (PIXELS_PER_LEAF / 3) + i2], newcolor, 128); } } } @@ -1193,3 +1223,96 @@ void palettetest(CRGB* ledarray, uint16_t numleds, const CRGBPalette16& gCurrent startindex--; fill_palette(ledarray, numleds, startindex, (256 / NUM_LEDS) + 1, gCurrentPalette, 255, LINEARBLEND); } + + +/* + Function: ExtractValues + Used to extract a given amount of values from the message with a start index + Parameters: + - startindex: position in the string where to start + - valuecount: amount of values to capture +*/ +void ExtractValues(char receivedChars[], int startindex, int valuecount) +{ + int pos = startindex; + for (int c = 0; c < valuecount; c++) + { + int i = 0; + while (receivedChars[pos] != ';' && receivedChars[pos] != '\0') { + vals[c][i] = receivedChars[pos]; + pos++; + i++; + } + vals[c][i] = '\0'; + pos++; + } +#ifdef DEBUG_SERIAL + for (int p = 0; p < valuecount; p++) + { + Serial.print("Extracting: "); Serial.println(vals[p]); + } +#endif // DEBUG_SERIAL +} +void cycle(CRGB endclr, CRGB midclr, uint8_t start) { + fill_gradient_RGB(leds, start, endclr, PIXELS_PER_LEAF/ 2, midclr); + fill_gradient_RGB(leds, PIXELS_PER_LEAF/ 2 + 1, midclr, PIXELS_PER_LEAF, endclr); +} +// Set Custom Pattern for the node red part +void SetCustomPattern() +{ + uint8_t cnt = 0; + uint8_t isflow = 0; + + ExtractValues(cpattern, 0, 2); + cnt = atoi(vals[0]); + isflow = atoi(vals[1]); + ExtractValues(cpattern, 0, 2 + 5 * cnt); + if (isflow == 0) + { + for (uint8_t i = 0; i < cnt; i++) + { + int8_t cmode = atoi(vals[2 + i * 5]); + uint8_t phase = atoi(vals[2 + i * 5 + 1]); + int mul = breathe; + if (breathe_dir == 1) + { + if ((mul + phase) > 255)mul = 255 + (255 - mul - phase); + else mul += phase; + } + else + { + if ((mul - phase) < 0)mul = -mul + phase; + else mul -= phase; + } + if (cmode == 0)mul = 255; + double fac = (mul * 100) / 255.00; + //if(cmode==1)Serial.printf("%d ", mul); + for (uint8_t x = 0; x < PIXELS_PER_LEAF; x++) + { + //Serial.printf("Setting %d to %d, %d, %d\n", cnt*PIXELS_PER_LEAF+x,atoi(vals[2+i*5+2]), atoi(vals[2+i*5+3]), atoi(vals[2+i*5+4])); + leds[i * PIXELS_PER_LEAF + x] = CRGB((atoi(vals[2 + i * 5 + 2]) * fac) / 100.00, (atoi(vals[2 + i * 5 + 3]) * fac) / 100.00, (atoi(vals[2 + i * 5 + 4]) * fac) / 100.00); + } + } + } + else + { + for (int i = 0; i < cnt; i++) + { + if (i != (cnt - 1)) + { + //uint8_t speed = beatsin8(6,0,255); + CRGB endclr = blend(CRGB(atoi(vals[2 + i * 5 + 2]), atoi(vals[2 + i * 5 + 3]), atoi(vals[2 + i * 5 + 4])), CRGB(atoi(vals[2 + (i + 1) * 5 + 2]), atoi(vals[2 + (i + 1) * 5 + 3]), atoi(vals[2 + (i + 1) * 5 + 4])), breathe); + CRGB midclr = blend(CRGB(atoi(vals[2 + (i + 1) * 5 + 2]), atoi(vals[2 + (i + 1) * 5 + 3]), atoi(vals[2 + (i + 1) * 5 + 4])), CRGB(atoi(vals[2 + i * 5 + 2]), atoi(vals[2 + i * 5 + 3]), atoi(vals[2 + i * 5 + 4])), breathe); + cycle(endclr, midclr, i*PIXELS_PER_LEAF); + } + else + { + //uint8_t speed = beatsin8(6,0,255); + CRGB endclr = blend(CRGB(atoi(vals[2 + 2]), atoi(vals[2 + 3]), atoi(vals[2 + 4])), CRGB(atoi(vals[2 + (i + 1) * 5 + 2]), atoi(vals[2 + (i + 1) * 5 + 3]), atoi(vals[2 + (i + 1) * 5 + 4])), breathe); + CRGB midclr = blend(CRGB(atoi(vals[2 + (i + 1) * 5 + 2]), atoi(vals[2 + (i + 1) * 5 + 3]), atoi(vals[2 + (i + 1) * 5 + 4])), CRGB(atoi(vals[2 + 2]), atoi(vals[2 + 3]), atoi(vals[2 + 4])), breathe); + cycle(endclr, midclr, i*PIXELS_PER_LEAF); + } + } + } + //Serial.println(""); +} diff --git a/gallery/NodeRED_UI/alexa_skill.png b/gallery/NodeRED_UI/alexa_skill.png new file mode 100644 index 0000000..687d6ac Binary files /dev/null and b/gallery/NodeRED_UI/alexa_skill.png differ diff --git a/gallery/NodeRED_UI/autoplay_and_parameters.png b/gallery/NodeRED_UI/autoplay_and_parameters.png new file mode 100644 index 0000000..2781d4d Binary files /dev/null and b/gallery/NodeRED_UI/autoplay_and_parameters.png differ diff --git a/gallery/NodeRED_UI/conf_1.png b/gallery/NodeRED_UI/conf_1.png new file mode 100644 index 0000000..7e25ece Binary files /dev/null and b/gallery/NodeRED_UI/conf_1.png differ diff --git a/gallery/NodeRED_UI/config_1.png b/gallery/NodeRED_UI/config_1.png new file mode 100644 index 0000000..d7ebc08 Binary files /dev/null and b/gallery/NodeRED_UI/config_1.png differ diff --git a/gallery/NodeRED_UI/config_2.png b/gallery/NodeRED_UI/config_2.png new file mode 100644 index 0000000..21e949f Binary files /dev/null and b/gallery/NodeRED_UI/config_2.png differ diff --git a/gallery/NodeRED_UI/device_1.png b/gallery/NodeRED_UI/device_1.png new file mode 100644 index 0000000..08ff671 Binary files /dev/null and b/gallery/NodeRED_UI/device_1.png differ diff --git a/gallery/NodeRED_UI/device_2.png b/gallery/NodeRED_UI/device_2.png new file mode 100644 index 0000000..2a40b10 Binary files /dev/null and b/gallery/NodeRED_UI/device_2.png differ diff --git a/gallery/NodeRED_UI/device_3.png b/gallery/NodeRED_UI/device_3.png new file mode 100644 index 0000000..119e258 Binary files /dev/null and b/gallery/NodeRED_UI/device_3.png differ diff --git a/gallery/NodeRED_UI/device_4.png b/gallery/NodeRED_UI/device_4.png new file mode 100644 index 0000000..7e7edbe Binary files /dev/null and b/gallery/NodeRED_UI/device_4.png differ diff --git a/gallery/NodeRED_UI/device_config.png b/gallery/NodeRED_UI/device_config.png new file mode 100644 index 0000000..4d90c28 Binary files /dev/null and b/gallery/NodeRED_UI/device_config.png differ diff --git a/gallery/NodeRED_UI/full.png b/gallery/NodeRED_UI/full.png new file mode 100644 index 0000000..addc63b Binary files /dev/null and b/gallery/NodeRED_UI/full.png differ diff --git a/gallery/NodeRED_UI/import.png b/gallery/NodeRED_UI/import.png new file mode 100644 index 0000000..aacd110 Binary files /dev/null and b/gallery/NodeRED_UI/import.png differ diff --git a/gallery/NodeRED_UI/main.png b/gallery/NodeRED_UI/main.png new file mode 100644 index 0000000..862ea73 Binary files /dev/null and b/gallery/NodeRED_UI/main.png differ diff --git a/gallery/NodeRED_UI/nanoleaf_designer.png b/gallery/NodeRED_UI/nanoleaf_designer.png new file mode 100644 index 0000000..89c5e1f Binary files /dev/null and b/gallery/NodeRED_UI/nanoleaf_designer.png differ diff --git a/gallery/NodeRED_UI/nanoleaf_designer_2.png b/gallery/NodeRED_UI/nanoleaf_designer_2.png new file mode 100644 index 0000000..6308eb6 Binary files /dev/null and b/gallery/NodeRED_UI/nanoleaf_designer_2.png differ diff --git a/gallery/NodeRED_UI/pattern_designer.png b/gallery/NodeRED_UI/pattern_designer.png new file mode 100644 index 0000000..b3e619e Binary files /dev/null and b/gallery/NodeRED_UI/pattern_designer.png differ diff --git a/gallery/NodeRED_UI/pattern_designer_2.png b/gallery/NodeRED_UI/pattern_designer_2.png new file mode 100644 index 0000000..8cd002a Binary files /dev/null and b/gallery/NodeRED_UI/pattern_designer_2.png differ diff --git a/gallery/NodeRED_UI/patternlist.png b/gallery/NodeRED_UI/patternlist.png new file mode 100644 index 0000000..b87e193 Binary files /dev/null and b/gallery/NodeRED_UI/patternlist.png differ diff --git a/gallery/NodeRED_UI/patterns.png b/gallery/NodeRED_UI/patterns.png new file mode 100644 index 0000000..5863d80 Binary files /dev/null and b/gallery/NodeRED_UI/patterns.png differ diff --git a/gallery/test.md b/gallery/test.md deleted file mode 100644 index 8b13789..0000000 --- a/gallery/test.md +++ /dev/null @@ -1 +0,0 @@ -