[ { "id": "a564595f.642818", "type": "tab", "label": "Main" }, { "id": "81394fa6.f9523", "type": "ui_group", "z": "", "name": "Quick Start", "tab": "6529e313.74108c", "order": 1, "disp": true, "width": "6" }, { "id": "b642e71.9697318", "type": "ui_group", "z": "", "name": "1", "tab": "4ede131f.f2e09c", "order": 1, "disp": false, "width": "6" }, { "id": "b914fb40.bc5c78", "type": "ui_group", "z": "", "name": "5", "tab": "4ede131f.f2e09c", "order": 5, "disp": false, "width": "6" }, { "id": "4a85df35.41e16", "type": "ui_group", "z": "", "name": "6", "tab": "4ede131f.f2e09c", "order": 6, "disp": false, "width": "6" }, { "id": "19fab5c2.199ffa", "type": "ui_group", "z": "", "name": "Cloud Settings", "tab": "6529e313.74108c", "order": 2, "disp": true, "width": "6" }, { "id": "307e2bd0.e69514", "type": "ui_group", "z": "", "name": "2", "tab": "4ede131f.f2e09c", "order": 2, "disp": false, "width": "6" }, { "id": "8de27cf2.dbd6a", "type": "ui_group", "z": "", "name": "3", "tab": "4ede131f.f2e09c", "order": 3, "disp": false, "width": "6" }, { "id": "6acae0b0.a184", "type": "ui_group", "z": "", "name": "Specific Gravity Calibration", "tab": "75f710f5.16d2e", "order": 2, "disp": true, "width": "6", "collapse": false }, { "id": "b8d3bbbf.2c9cb8", "type": "ui_group", "z": "", "name": "4", "tab": "4ede131f.f2e09c", "order": 4, "disp": false, "width": "6" }, { "id": "ab6da67f.a47fa8", "type": "ui_group", "z": "", "name": "8", "tab": "4ede131f.f2e09c", "order": 8, "disp": false, "width": "6" }, { "id": "a510f969.f28538", "type": "ui_group", "z": "", "name": "7", "tab": "4ede131f.f2e09c", "order": 7, "disp": false, "width": "6" }, { "id": "82607108.c5be8", "type": "ui_group", "z": "", "name": "Tilt Pi Settings", "tab": "6529e313.74108c", "order": 3, "disp": true, "width": "6" }, { "id": "eb4ab3d5.7b3f1", "type": "ui_group", "z": "", "name": "Select Tilt in Range", "tab": "75f710f5.16d2e", "order": 1, "disp": true, "width": "6", "collapse": false }, { "id": "5ca7d250.c3938c", "type": "ui_group", "z": "", "name": "Time", "tab": "c9c26b4a.4cde78", "order": 1, "disp": true, "width": "6" }, { "id": "c8854cd2.f1773", "type": "ui_group", "z": "", "name": "App Admin (Tilt Pi)", "tab": "c9c26b4a.4cde78", "order": 6, "disp": true, "width": "6", "collapse": false }, { "id": "6529e313.74108c", "type": "ui_tab", "z": "", "name": "Logging", "icon": "fa-line-chart", "order": 3 }, { "id": "4ede131f.f2e09c", "type": "ui_tab", "z": "", "name": "Tilt Pi", "icon": "fa-tachometer", "order": 1, "disabled": false, "hidden": false }, { "id": "75f710f5.16d2e", "type": "ui_tab", "z": "", "name": "Calibration", "icon": "fa-bullseye", "order": 4 }, { "id": "c9c26b4a.4cde78", "type": "ui_tab", "z": "", "name": "System", "icon": "fa-clock-o", "order": 5 }, { "id": "5fec9a11.37a164", "type": "ui_base", "theme": { "name": "theme-custom", "lightTheme": { "default": "#0094CE", "baseColor": "#0094CE", "baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif", "edited": false, "reset": false }, "darkTheme": { "default": "#097479", "baseColor": "#097479", "baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif", "edited": true, "reset": false }, "customTheme": { "name": "", "default": "#4B7930", "baseColor": "#666666", "baseFont": "Tahoma,Geneva,sans-serif", "reset": false }, "themeState": { "base-color": { "default": "#4B7930", "value": "#4B7930", "edited": false }, "page-titlebar-backgroundColor": { "value": "#666666", "edited": false }, "page-backgroundColor": { "value": "#111111", "edited": false }, "page-sidebar-backgroundColor": { "value": "#000000", "edited": false }, "group-textColor": { "value": "#8c8c8c", "edited": false }, "group-borderColor": { "value": "#555555", "edited": false }, "group-backgroundColor": { "value": "#333333", "edited": false }, "widget-textColor": { "value": "#eeeeee", "edited": false }, "widget-backgroundColor": { "value": "#336633", "edited": true }, "widget-borderColor": { "value": "#333333", "edited": false }, "base-font": { "value": "Tahoma,Geneva,sans-serif" } }, "angularTheme": { "primary": "indigo", "accents": "blue", "warn": "red", "background": "grey" } }, "site": { "name": "Tilt Pi", "hideToolbar": "false", "allowSwipe": "false", "dateFormat": "DD/MM/YYYY", "sizes": { "sx": 48, "sy": 53, "gx": 6, "gy": 6, "cx": 6, "cy": 6, "px": 0, "py": 0 } } }, { "id": "c12bcb12.dbd0d8", "type": "ui_group", "z": "", "name": "Temperature Calibration", "tab": "75f710f5.16d2e", "order": 4, "disp": true, "width": "6", "collapse": false }, { "id": "b0619070.ac95d", "type": "ui_group", "z": "", "name": "Tilt Pi Display Units", "tab": "c9c26b4a.4cde78", "order": 2, "disp": true, "width": "6" }, { "id": "7e458eda.984cd", "type": "ui_group", "z": "", "name": "Raspberry Pi", "tab": "c9c26b4a.4cde78", "order": 9, "disp": true, "width": "6", "collapse": false }, { "id": "2f8a7619.951f3a", "type": "ui_group", "z": "", "name": "Filter Tilt by RSSI", "tab": "c9c26b4a.4cde78", "order": 4, "disp": true, "width": "6", "collapse": false }, { "id": "822d1243.fc995", "type": "ui_link", "z": "", "name": "Tilt Shop", "link": "http://tilthydrometer.com", "icon": "open_in_browser", "target": "newtab", "order": 6 }, { "id": "267d3836.6dd8c8", "type": "ui_group", "z": "", "name": "9", "tab": "4ede131f.f2e09c", "order": 9, "disp": false, "width": "6", "collapse": false }, { "id": "108bd956.936727", "type": "ui_group", "z": "", "name": "10", "tab": "4ede131f.f2e09c", "order": 10, "disp": false, "width": "6", "collapse": false }, { "id": "a50556b1.dbfcb8", "type": "ui_group", "z": "", "name": "11", "tab": "4ede131f.f2e09c", "order": 11, "disp": false, "width": "6", "collapse": false }, { "id": "5c7445d4.98ad6c", "type": "ui_group", "z": "", "name": "12", "tab": "4ede131f.f2e09c", "order": 12, "disp": false, "width": "6", "collapse": false }, { "id": "12fd05d8.05d72a", "type": "ui_group", "z": "", "name": "13", "tab": "4ede131f.f2e09c", "order": 13, "disp": false, "width": "6", "collapse": false }, { "id": "4c37ac06.315ed4", "type": "ui_group", "z": "", "name": "14", "tab": "4ede131f.f2e09c", "order": 14, "disp": false, "width": "6", "collapse": false }, { "id": "e45abb75.3c20e8", "type": "ui_group", "z": "", "name": "15", "tab": "4ede131f.f2e09c", "order": 15, "disp": false, "width": "6", "collapse": false }, { "id": "15de3d7c.511dc3", "type": "ui_group", "z": "", "name": "16", "tab": "4ede131f.f2e09c", "order": 16, "disp": false, "width": "6", "collapse": false }, { "id": "819bc8e0.bcd088", "type": "ui_group", "z": "", "name": "17", "tab": "4ede131f.f2e09c", "order": 17, "disp": false, "width": "6", "collapse": false }, { "id": "fc7d68d0.753128", "type": "ui_group", "z": "", "name": "18", "tab": "4ede131f.f2e09c", "order": 18, "disp": false, "width": "6", "collapse": false }, { "id": "bd62ad81.4b044", "type": "ui_group", "z": "", "name": "19", "tab": "4ede131f.f2e09c", "order": 19, "disp": false, "width": "6", "collapse": false }, { "id": "41d62802.51c5b8", "type": "ui_group", "z": "", "name": "20", "tab": "4ede131f.f2e09c", "order": 20, "disp": false, "width": "6", "collapse": false }, { "id": "44534105.db4bc", "type": "ui_group", "z": "", "name": "21", "tab": "4ede131f.f2e09c", "order": 21, "disp": false, "width": "6", "collapse": false }, { "id": "51d09488.cc74ec", "type": "ui_group", "z": "", "name": "22", "tab": "4ede131f.f2e09c", "order": 22, "disp": false, "width": "6", "collapse": false }, { "id": "401076ab.e74368", "type": "ui_group", "z": "", "name": "23", "tab": "4ede131f.f2e09c", "order": 23, "disp": false, "width": "6", "collapse": false }, { "id": "e317dbe5.cb4a88", "type": "ui_group", "z": "", "name": "24", "tab": "4ede131f.f2e09c", "order": 24, "disp": false, "width": "6", "collapse": false }, { "id": "cc24e60a.97bf38", "type": "ui_group", "z": "", "name": "25", "tab": "4ede131f.f2e09c", "order": 25, "disp": false, "width": "6", "collapse": false }, { "id": "1b53fa80.bc1576", "type": "ui_group", "z": "", "name": "Identify Tilt by MAC Address", "tab": "c9c26b4a.4cde78", "order": 5, "disp": true, "width": "6", "collapse": false }, { "id": "c794b7cd.ac92b8", "type": "ui_group", "z": "", "name": "Tilt Measurement Smoothing", "tab": "c9c26b4a.4cde78", "order": 3, "disp": true, "width": "6", "collapse": false }, { "id": "f1b2ab0a.9118e8", "type": "ui_group", "z": "", "name": "Dashboard Link (local URL)", "tab": "c9c26b4a.4cde78", "order": 7, "disp": true, "width": "6", "collapse": false }, { "id": "90501bee.89d8c8", "type": "ui_group", "z": "", "name": "Boost Range with Mulitple Tilt Pi's", "tab": "c9c26b4a.4cde78", "order": 8, "disp": true, "width": "6", "collapse": false }, { "id": "f42fdaab.48a078", "type": "inject", "z": "a564595f.642818", "name": "Start", "topic": "", "payload": "pkill -f aioblescan", "payloadType": "str", "repeat": "", "crontab": "", "once": true, "onceDelay": "0.1", "x": 410, "y": 260, "wires": [ [ "c0f36d.ab686c9", "9d251f5a.10bdc", "1a349481.97830b", "6fd56f4c.da2ef" ] ] }, { "id": "8dc4fe46.fc364", "type": "json", "z": "a564595f.642818", "name": "JSON", "property": "payload", "action": "", "pretty": false, "x": 770, "y": 120, "wires": [ [ "d504d607.384f48", "1d0659ea.6c2c26", "84f5a2fd.5ef26" ] ] }, { "id": "2836e0e1.4ea9c", "type": "http request", "z": "a564595f.642818", "name": "Cloud Service", "method": "POST", "ret": "obj", "url": "", "tls": "", "x": 3700, "y": 160, "wires": [ [ "6cbfa171.d2106", "f14feb76.aebb48", "d5884cdc.50b47" ] ] }, { "id": "7f2f1fbf.e1098", "type": "change", "z": "a564595f.642818", "name": "Colors", "rules": [ { "t": "set", "p": "payload.Color", "pt": "msg", "to": "payload.uuid", "tot": "msg" }, { "t": "change", "p": "payload.Color", "pt": "msg", "from": "a495bb60c5b14b44b5121370f02d74de", "fromt": "str", "to": "BLUE", "tot": "str" }, { "t": "change", "p": "payload.Color", "pt": "msg", "from": "a495bb70c5b14b44b5121370f02d74de", "fromt": "str", "to": "YELLOW", "tot": "str" }, { "t": "change", "p": "payload.Color", "pt": "msg", "from": "a495bb20c5b14b44b5121370f02d74de", "fromt": "str", "to": "GREEN", "tot": "str" }, { "t": "change", "p": "payload.Color", "pt": "msg", "from": "a495bb50c5b14b44b5121370f02d74de", "fromt": "str", "to": "ORANGE", "tot": "str" }, { "t": "change", "p": "payload.Color", "pt": "msg", "from": "a495bb10c5b14b44b5121370f02d74de", "fromt": "str", "to": "RED", "tot": "str" }, { "t": "change", "p": "payload.Color", "pt": "msg", "from": "a495bb80c5b14b44b5121370f02d74de", "fromt": "str", "to": "PINK", "tot": "str" }, { "t": "change", "p": "payload.Color", "pt": "msg", "from": "a495bb30c5b14b44b5121370f02d74de", "fromt": "str", "to": "BLACK", "tot": "str" }, { "t": "change", "p": "payload.Color", "pt": "msg", "from": "a495bb40c5b14b44b5121370f02d74de", "fromt": "str", "to": "PURPLE", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1170, "y": 120, "wires": [ [ "7c18d8fe.188168" ] ] }, { "id": "e5652ef0.acaaf", "type": "switch", "z": "a564595f.642818", "name": "Tilts", "property": "payload.uuid", "propertyType": "msg", "rules": [ { "t": "regex", "v": "a495bb..c5b14b44b5121370f02d74de", "vt": "str", "case": true } ], "checkall": "true", "repair": false, "outputs": 1, "x": 1050, "y": 120, "wires": [ [ "7f2f1fbf.e1098" ] ] }, { "id": "656f0cf9.e79cd4", "type": "ui_text_input", "z": "a564595f.642818", "name": "Beer Name", "label": "Set Beer Name", "tooltip": "", "group": "81394fa6.f9523", "order": 3, "width": 0, "height": 0, "passthru": false, "mode": "text", "delay": "0", "topic": "", "x": 4095, "y": 529, "wires": [ [ "6040e73e.fa2088", "bc42a38f.e9d94" ] ] }, { "id": "6040e73e.fa2088", "type": "function", "z": "a564595f.642818", "name": "Set Beer Name", "func": "var color = flow.get('colordropdownSelect')||\"\";\nvar beerArray = msg.payload.split(\",\");\nif (beerArray[1] === undefined){\n beerArray[1] = true;\n flow.set(color + \"-URL\",\"\");\n}\nflow.set(color + \"-Beer\",beerArray);\n//node.warn(beerArray);\n\nif (beerArray[1] === true){\n msg.payload = beerArray[0];\n msg.topic = \"Beer name set for \" + color;\n} else {\n msg.payload = beerArray[0] + \",\" + beerArray[1];\n msg.topic = \"[Beer name],[cloud ID] set for \" + color;\n}\nreturn msg;", "outputs": 1, "noerr": 0, "x": 4317, "y": 528, "wires": [ [ "2f84bf9f.847b6" ] ] }, { "id": "7c18d8fe.188168", "type": "function", "z": "a564595f.642818", "name": "Add Parameter", "func": "//get color-mac combo\nvar IDbyMAC = flow.get('IDbyMAC')||false;\nif (IDbyMAC) {\nmsg.payload.Color = msg.payload.Color + \":\" + msg.payload.mac;\nmsg.payload.displayColor = msg.payload.Color.split(\":\");\nmsg.payload.IDbyMAC = true;\n} else {\n msg.payload.displayColor = [msg.payload.Color];\n msg.payload.IDbyMAC = false;\n}\n//set beer name and local name status\nvar beerArray = flow.get(msg.payload.Color + \"-Beer\")||[\"Untitled\",true];\nmsg.payload.Beer = beerArray;\n//set dropdown options\nvar options = flow.get('options')||[];\nvar color = msg.payload.Color;\nif (options.indexOf(color) === -1){ //check if Tilt color has been seen\n options.push(color);\n options.sort();\n //node.warn(options);\n flow.set('options',options);\n node.send([null, {'payload': options}]);\n}\n//set SG cal points\nvar actualSGArray = flow.get('actualSGpoints-' + msg.payload.Color)||[];\nvar uncalSGArray = flow.get('uncalSGpoints-' + msg.payload.Color)||[];\nmsg.payload.actualSGPoints = actualSGArray.toString();\nmsg.payload.unCalSGPoints = uncalSGArray.toString();\n//set Temp cal points\nvar actualTempArray = flow.get('actualTemppoints-' + msg.payload.Color)||[];\nvar uncalTempArray = flow.get('uncalTemppoints-' + msg.payload.Color)||[];\nmsg.payload.actualTempPoints = actualTempArray.toString();\nmsg.payload.unCalTempPoints = uncalTempArray.toString();\n//add timeStamp parameter\nmsg.payload.timeStamp = Date.now();\nvar date = new Date();\n//add Timepoint parameter\nvar timeZone = date.getTimezoneOffset()/24/60;\nmsg.payload.formatteddate = date.toLocaleString();\nmsg.payload.Timepoint = msg.payload.timeStamp / 1000 / 60 / 60 / 24 + 25569 - timeZone;\n//add SG parameter, account for extra precision if needed\nmsg.payload.fermunits = flow.get('fermdisplayUnits')||'';\nif (msg.payload.minor > 2000){\nmsg.payload.SG = msg.payload.minor / 10000;\nmsg.payload.major /= 10;\nmsg.payload.hd = true;\n}else{\nmsg.payload.SG = msg.payload.minor / 1000;\nmsg.payload.hd = false;\n}\n//add Temp parameter\nmsg.payload.Temp = msg.payload.major;\nmsg.payload.tempunits = flow.get('displayUnits')||\"°F\";\n//Google Sheet URL for displaying link in display\nmsg.payload.doclongurl = flow.get(msg.payload.Color + '-URL')||\"\";\nmsg.topic = msg.payload.Color;\nmsg.filename = \"/home/pi/\" + msg.payload.Color + \".json\";\n//get custom cloud URL if default cloud URL set to undefined\nmsg.payload.customcloudURL = flow.get('cloudURL-' + msg.payload.Color);\n//set global cloud settings\nmsg.payload.defaultcloudURL = flow.get('cloudURL')||['https://script.google.com/macros/s/AKfycbwNXh6rEWoULd0vxWxDylG_PJwQwe0dn5hdtSkuC4k3D9AXBSA/exec',true];\nmsg.payload.logCloudDataCheck = flow.get('logCloudDataCheck')||true;\nmsg.payload.logLocalDataCheck = flow.get('logLocalDataCheck');\nmsg.payload.localloggingInterval = flow.get('localloggingInterval')||15;\nmsg.payload.loggingInterval = flow.get('loggingInterval')||15;\nmsg.payload.minRSSI = flow.get('minRSSI');\nmsg.payload.alphaSG = flow.get('alphaSG');\nmsg.payload.alphaTemp = flow.get('alphaTemp');\nmsg.payload.numberSamples = flow.get('numberSamples');\nmsg.payload.smoothSwitch = flow.get('smoothSwitch');\nmsg.payload.enableRangeBoost = flow.get('enableRangeBoost');\nmsg.payload.rangerHostnames = flow.get('rangerHostnames');\nreturn [ msg, null ];", "outputs": 2, "noerr": 0, "x": 1320, "y": 140, "wires": [ [ "b90d01ad.44d08", "2418cca9.80c104", "17d09cdf.4751f3" ], [ "e493bf39.98126" ] ] }, { "id": "1aee8aa4.c92885", "type": "ui_template", "z": "a564595f.642818", "group": "b642e71.9697318", "name": "1", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 140, "wires": [ [ "394a5d3d.92fa72", "1ee5d27c.fa4e8e", "425f9ce9.7d5064" ] ] }, { "id": "79bac478.35317c", "type": "ui_template", "z": "a564595f.642818", "group": "b914fb40.bc5c78", "name": "5", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 300, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "2ddd6c1f.7838e4", "type": "inject", "z": "a564595f.642818", "name": "Stop", "topic": "", "payload": "pkill -f aioblescan", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": "", "x": 430, "y": 160, "wires": [ [ "9d251f5a.10bdc" ] ] }, { "id": "64f10179.474c9", "type": "change", "z": "a564595f.642818", "name": "1", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-1", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 140, "wires": [ [ "5006138a.18932c" ] ] }, { "id": "be15eceb.e8738", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-1", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "x": 2240, "y": 140, "wires": [ [ "9628a72.af07d58" ] ] }, { "id": "e0d6a855.d4e018", "type": "ui_template", "z": "a564595f.642818", "group": "4a85df35.41e16", "name": "6", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 340, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "c4b0f249.af093", "type": "switch", "z": "a564595f.642818", "name": "Display", "property": "payload.Color", "propertyType": "msg", "rules": [ { "t": "cont", "v": "options[0]", "vt": "flow" }, { "t": "cont", "v": "options[1]", "vt": "flow" }, { "t": "cont", "v": "options[2]", "vt": "flow" }, { "t": "cont", "v": "options[3]", "vt": "flow" }, { "t": "cont", "v": "options[4]", "vt": "flow" }, { "t": "cont", "v": "options[5]", "vt": "flow" }, { "t": "cont", "v": "options[6]", "vt": "flow" }, { "t": "cont", "v": "options[7]", "vt": "flow" }, { "t": "cont", "v": "options[8]", "vt": "flow" }, { "t": "cont", "v": "options[9]", "vt": "flow" }, { "t": "cont", "v": "options[10]", "vt": "flow" }, { "t": "cont", "v": "options[11]", "vt": "flow" }, { "t": "cont", "v": "options[12]", "vt": "flow" }, { "t": "cont", "v": "options[13]", "vt": "flow" }, { "t": "cont", "v": "options[14]", "vt": "flow" }, { "t": "cont", "v": "options[15]", "vt": "flow" }, { "t": "cont", "v": "options[16]", "vt": "flow" }, { "t": "cont", "v": "options[17]", "vt": "flow" }, { "t": "cont", "v": "options[18]", "vt": "flow" }, { "t": "cont", "v": "options[19]", "vt": "flow" }, { "t": "cont", "v": "options[20]", "vt": "flow" }, { "t": "cont", "v": "options[21]", "vt": "flow" }, { "t": "cont", "v": "options[22]", "vt": "flow" }, { "t": "cont", "v": "options[23]", "vt": "flow" }, { "t": "cont", "v": "options[24]", "vt": "flow" } ], "checkall": "false", "repair": false, "outputs": 25, "x": 1840, "y": 360, "wires": [ [ "64f10179.474c9" ], [ "45da85de.0a884c" ], [ "4c140999.2a7428" ], [ "561c3f7f.1b8ab" ], [ "2e45b69e.abf3fa" ], [ "8803bae2.740958" ], [ "5ea7f34.5181f0c" ], [ "eba532a9.2afe3" ], [ "5a5923ad.6c1d5c" ], [ "616e1556.07aeac" ], [ "262fa5ae.5dfbda" ], [ "53d6e829.db2008" ], [ "80f5dfea.985b2" ], [ "bf532ad9.219628" ], [ "285a2030.d13ba" ], [ "393a255d.2d8e1a" ], [ "4c160e20.1b26a" ], [ "5225a0ca.061d" ], [ "7406a265.d2752c" ], [ "8d5d51dc.2a629" ], [ "92ba8385.acef3" ], [ "9f6e9e76.c44dd" ], [ "5eb5cdca.85a624" ], [ "349a74f.c19918c" ], [ "ef0d5029.28851" ] ] }, { "id": "2e45b69e.abf3fa", "type": "change", "z": "a564595f.642818", "name": "5", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-5", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 300, "wires": [ [] ] }, { "id": "5ea7f34.5181f0c", "type": "change", "z": "a564595f.642818", "name": "7", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-7", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 380, "wires": [ [] ] }, { "id": "8803bae2.740958", "type": "change", "z": "a564595f.642818", "name": "6", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-6", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 340, "wires": [ [] ] }, { "id": "2c53503.d97f0b", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-5", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "x": 2240, "y": 300, "wires": [ [ "97228e52.47232" ] ] }, { "id": "d66a9ebe.70d94", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-6", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "x": 2240, "y": 340, "wires": [ [ "87e70118.323b3" ] ] }, { "id": "9628a72.af07d58", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 140, "wires": [ [ "14d297fb.15dbc8" ] ] }, { "id": "86447ba5.5d5b68", "type": "function", "z": "a564595f.642818", "name": "Interpolate", "func": "//this function block requires msg.payload.SG, msg.payload.Temp, msg.payload.actualSGPoints, msg.payload.actualTempPoints(a comma separated string of the actual values), msg.payload.unCalSGPoints, and msg.payload.unCalTempPoints (a comma separated string of the measured raw values)\nfunction linearInterpolation (x, x0, y0, x1, y1) {\n var a = (y1 - y0) / (x1 - x0);\n var b = -a * x0 + y0;\n return a * x + b;\n}\n//calculate calibrated SG by linear interpolation of calibration points\nvar actualSGPoints = [];\nvar unCalSGPoints = [];\nvar unCalSGPointsTemp = [];\nvar SG = msg.payload.SG;\nactualSGPoints = msg.payload.actualSGPoints.split(\",\");\nunCalSGPoints = msg.payload.unCalSGPoints.split(\",\");\nunCalSGPointsTemp = msg.payload.unCalSGPoints.split(\",\");\n//ensure uncal value always between two numbers\nunCalSGPointsTemp.push(-0.001, SG, Number.MAX_VALUE);\nunCalSGPoints.push(-0.001, Number.MAX_VALUE);\nactualSGPoints.push(-0.001, Number.MAX_VALUE);\nunCalSGPointsTemp.sort(function(a, b){return a-b;});\nunCalSGPoints.sort(function(a, b){return a-b;});\nactualSGPoints.sort(function(a, b){return a-b;});\nvar indexSG = unCalSGPointsTemp.indexOf(SG);\nvar calSG = linearInterpolation (Number(SG), Number(unCalSGPoints[indexSG-1]), Number(actualSGPoints[indexSG-1]), Number(unCalSGPoints[indexSG]), Number(actualSGPoints[indexSG]));\nmsg.payload.uncalSG = SG;\nmsg.payload.uncalPlato = 1111.14 * msg.payload.uncalSG - 630.272 * msg.payload.uncalSG * msg.payload.uncalSG + 135.997 * msg.payload.uncalSG * msg.payload.uncalSG * msg.payload.uncalSG - 616.868;\nmsg.payload.uncalBrix = (((182.4601 * msg.payload.uncalSG - 775.6821) * msg.payload.uncalSG + 1262.7794) * msg.payload.uncalSG - 669.5622);\nmsg.payload.SG = calSG;\nmsg.payload.Plato = 1111.14 * msg.payload.SG - 630.272 * msg.payload.SG * msg.payload.SG + 135.997 * msg.payload.SG * msg.payload.SG * msg.payload.SG - 616.868;\nmsg.payload.Brix = (((182.4601 * msg.payload.SG - 775.6821) * msg.payload.SG + 1262.7794) * msg.payload.SG - 669.5622);\nswitch (msg.payload.fermunits){\n case \"\" : if (msg.payload.hd){msg.payload.ferm = msg.payload.SG.toFixed(4);\n msg.payload.uncalferm = msg.payload.uncalSG.toFixed(4);\n }\n if (!msg.payload.hd){msg.payload.ferm = msg.payload.SG.toFixed(3);\n msg.payload.uncalferm = msg.payload.uncalSG.toFixed(3);\n }\n break;\n case \"°P\" : if (msg.payload.hd){msg.payload.ferm = msg.payload.Plato.toFixed(2);\n msg.payload.uncalferm = msg.payload.uncalPlato.toFixed(2); \n }\n if (!msg.payload.hd){msg.payload.ferm = msg.payload.Plato.toFixed(1);\n msg.payload.uncalferm = msg.payload.uncalPlato.toFixed(1); \n }\n break;\n case \"°Bx\": if (msg.payload.hd){msg.payload.ferm = msg.payload.Brix.toFixed(2);\n msg.payload.uncalferm = msg.payload.uncalBrix.toFixed(2);\n }\n if (!msg.payload.hd){msg.payload.ferm = msg.payload.Brix.toFixed(1);\n msg.payload.uncalferm = msg.payload.uncalBrix.toFixed(1);\n }\n}\n\n//calculate calibrated Temp by linear interpolation of calibration points\nvar actualTempPoints = [];\nvar unCalTempPoints = [];\nvar unCalTempPointsTemp = [];\nvar Temp = msg.payload.Temp;\nif (msg.payload.tempunits === \"°C\"){\n Temp -= 32;\n Temp *= 0.5555;\n}\nactualTempPoints = msg.payload.actualTempPoints.split(\",\");\nunCalTempPoints = msg.payload.unCalTempPoints.split(\",\");\nunCalTempPointsTemp = msg.payload.unCalTempPoints.split(\",\");\n//ensure uncal value always between two numbers\nunCalTempPointsTemp.push(-999, Temp, Number.MAX_VALUE);\nunCalTempPoints.push(-999, Number.MAX_VALUE);\nactualTempPoints.push(-999, Number.MAX_VALUE);\nunCalTempPointsTemp.sort(function(a, b){return a-b;});\nunCalTempPoints.sort(function(a, b){return a-b;});\nactualTempPoints.sort(function(a, b){return a-b;});\n//node.warn(actualTempPoints);\nvar indexTemp = unCalTempPointsTemp.indexOf(Temp);\nvar calTemp = linearInterpolation (Number(Temp), Number(unCalTempPoints[indexTemp-1]), Number(actualTempPoints[indexTemp-1]), Number(unCalTempPoints[indexTemp]), Number(actualTempPoints[indexTemp]));\nif (Number.isNaN(calTemp)){\n calTemp = 0;\n}\nmsg.payload.uncalTemp = Temp.toFixed(1);\nmsg.payload.displayuncalTemp = Temp.toFixed(1);\nmsg.payload.displayTemp = calTemp.toFixed(1);\nif (msg.payload.tempunits === \"°C\"){\n calTemp *= 1.8;\n calTemp += 32;\n msg.payload.Temp = calTemp.toFixed(1);\n}else{\nmsg.payload.Temp = calTemp.toFixed(1);\n}\nreturn msg;", "outputs": "1", "noerr": 0, "x": 1670, "y": 140, "wires": [ [ "c4b0f249.af093" ] ] }, { "id": "93d9202c.d9c1e", "type": "ui_dropdown", "z": "a564595f.642818", "name": "Logging Dropdown", "label": "TILT | ", "tooltip": "", "place": "Select Tilt Color", "group": "81394fa6.f9523", "order": 1, "width": 0, "height": 0, "passthru": true, "options": [ { "label": "", "value": "", "type": "str" } ], "payload": "", "topic": "", "x": 1570, "y": 1060, "wires": [ [ "6aa75852.1e3068", "d5439ed.a8afa6" ] ] }, { "id": "971574e0.783ba8", "type": "function", "z": "a564595f.642818", "name": "Get Beer Name", "func": "var color = flow.get('colordropdownSelect')||undefined;\nif (color !== undefined){\n var beerArray = flow.get(color + \"-Beer\")||[\"\",true];\n if (beerArray[1] === true){\n msg.payload = beerArray[0];\n }\n else {\n msg.payload = beerArray;\n }\n} else {\n msg.enabled = false;\n}\nreturn msg;", "outputs": 1, "noerr": 0, "x": 3080, "y": 1160, "wires": [ [ "656f0cf9.e79cd4" ] ] }, { "id": "e899ac8f.ec903", "type": "function", "z": "a564595f.642818", "name": "Send Comment", "func": "var color = flow.get('colordropdownSelect')||\"\";\nvar comment = msg.payload;\nflow.set(color + \"-Comment\",comment);\nflow.set('lastpost-' + color,0);\nflow.set('lastlocalpost-' + color,0);\nmsg.payload = \"Sending: \" + comment;\nmsg.topic = \"TILT | \" + color;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 2486.9999237060547, "y": 1239.9999895095825, "wires": [ [ "8dec8962.63e398" ] ] }, { "id": "39028c20.4a5fb4", "type": "comment", "z": "a564595f.642818", "name": "Store latest and update every x seconds", "info": "Saves iBeacon scans to flow database and reads back at 1 second intervals. Allows read out to continue to display last reading even if out of range.", "x": 2144.5, "y": 41, "wires": [] }, { "id": "1ee5d27c.fa4e8e", "type": "function", "z": "a564595f.642818", "name": "Setup Cloud Post", "func": "var postEnabled = (flow.get('logCloudDataCheck'))||false;\nvar interval = flow.get('loggingInterval')||15;\ninterval *= 60000;\nif (postEnabled && msg.payload.Color !== undefined){\n var lastPost = flow.get('lastpost-' + msg.payload.Color)||0;\n if (msg.payload.timeStamp - lastPost > interval){\n flow.set('lastpost-' + msg.payload.Color,msg.payload.timeStamp);\n //node.warn(msg.payload.Color + ' triggered');\n //node.warn(msg.payload.timeStamp - lastPost);\n msg.payload.Comment = flow.get(msg.payload.Color + \"-Comment\")||\"\";\n msg.payload.Beer = flow.get(msg.payload.Color + \"-Beer\")||[\"Untitled\",true];\n msg.topic = msg.payload.Color;\n if (msg.payload.Beer[1] === true){\n msg.payload.Beer = msg.payload.Beer[0];\n }\n //msg.headers = {};\n //msg.headers['content-type'] = 'application/x-www-form-urlencoded; charset=utf-8';\n var payloadEncoded = encodeURI(\"Timepoint=\" + msg.payload.Timepoint + \"&Temp=\" + msg.payload.Temp + \"&SG=\" + msg.payload.SG + \"&Beer=\" + msg.payload.Beer + \"&Color=\" + msg.payload.Color + \"&Comment=\" + msg.payload.Comment);\n if (flow.get('cloudURL')[1] === true){\n var defaultCloudURL = flow.get('cloudURL')[0];\n node.send({ headers : { 'content-type' : 'application/x-www-form-urlencoded; charset=utf-8' }, url : defaultCloudURL, payload : payloadEncoded, cloudwait : 'Contacting Default Cloud URL...
(allow up to 30 seconds)' });\n }\n else{\n var cloudURLs = flow.get('cloudURL-' + msg.payload.Color)||'none';\n if (cloudURLs != 'none'){\n var cloudURLsArray = cloudURLs.split(',');\n for (var i = 0; i < cloudURLsArray.length; i++){\n node.send({ headers : { 'content-type' : 'application/x-www-form-urlencoded; charset=utf-8' }, url : cloudURLsArray[i], payload : payloadEncoded, cloudwait : 'Contacting Cloud URL ' + (i + 1) + '...
(allow up to 30 seconds)' });\n }\n }\n }\n}\n}", "outputs": 1, "noerr": 0, "x": 3177.5, "y": 246, "wires": [ [ "bac24b5.6a220b8" ] ] }, { "id": "edb75c90.8414", "type": "ui_text_input", "z": "a564595f.642818", "name": "Cloud URL", "label": "Cloud URL", "group": "19fab5c2.199ffa", "order": 1, "width": 0, "height": 0, "passthru": false, "mode": "text", "delay": "0", "topic": "", "x": 1990, "y": 1260, "wires": [ [ "c79f0193.2a7c7" ] ] }, { "id": "dc8e0ec5.550d", "type": "ui_switch", "z": "a564595f.642818", "name": "", "label": "Start Logging to the Cloud", "group": "19fab5c2.199ffa", "order": 3, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "x": 2131.9999237060547, "y": 1403.9999895095825, "wires": [ [ "bed68eaf.abdc3" ] ] }, { "id": "c79f0193.2a7c7", "type": "function", "z": "a564595f.642818", "name": "Set CloudURL", "func": "var color = flow.get('colordropdownSelect');\nflow.set(\"cloudURL-\" + color,msg.payload);\nmsg.topic = \"Custom cloud URL set for \" + color;\nvar cloudURLs = msg.payload;\nvar cloudURLsList = cloudURLs.replace(/,/g,'
');\nmsg.payload = cloudURLsList;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 2185.500156402588, "y": 1325.000060081482, "wires": [ [ "ecffbfac.2fc53" ] ] }, { "id": "bed68eaf.abdc3", "type": "function", "z": "a564595f.642818", "name": "Set Logging to Cloud", "func": "var color = flow.get('colordropdownSelect')||\"\";\nflow.set('logCloudDataCheck',msg.payload);\nflow.set('lastpost-' + color,0);\nmsg.topic = \"TILT | \" + color;\nif (msg.payload){\nmsg.payload = \"Logging request sent. Waiting for response.\";\n}\nelse {\n msg.payload = \"Logging disabled.\";\n}\nreturn msg;", "outputs": 1, "noerr": 0, "x": 2414.9999237060547, "y": 1392.9999895095825, "wires": [ [ "8dec8962.63e398" ] ] }, { "id": "777f1a14.1b3e44", "type": "function", "z": "a564595f.642818", "name": "set Pre-cal SG Value", "func": "flow.set('uncalSGpoint',Number(msg.payload).toFixed(4));", "outputs": 1, "noerr": 0, "x": 2860, "y": 1460, "wires": [ [] ] }, { "id": "6aa75852.1e3068", "type": "function", "z": "a564595f.642818", "name": "Save selected color", "func": "flow.set('colordropdownSelect',msg.payload);\nmsg.payload = \"\";\nreturn msg;", "outputs": 1, "noerr": 0, "x": 2050, "y": 1160, "wires": [ [ "971574e0.783ba8", "df1c3ed0.bd3a9", "de92b02f.5ebe1" ] ] }, { "id": "3eb6f3c4.588d1c", "type": "function", "z": "a564595f.642818", "name": "Get Current SG", "func": "if (msg.payload == \"disabled\") {\n context.set(\"autoUpdate\", \"disabled\");\n}\nif (msg.payload == \"enabled\") {\n context.set(\"autoUpdate\", \"enabled\");\n}\nvar autoUpdate = context.get(\"autoUpdate\")||\"enabled\";\nif (autoUpdate == \"enabled\"){\nvar options = flow.get('options')||[];\nvar color = msg.payload;\nvar displayNumber = options.indexOf(color) + 1;\nmsg.payload = flow.get(\"storage-\" + displayNumber.toString());\nif (msg.payload !== undefined){\nvar msg1 = {};\nvar msg2 = {};\nmsg1.payload = msg.payload.uncalSG.toFixed(4);\nmsg2.payload = msg.payload.SG.toFixed(4);\nreturn [msg1,msg2];\n}\n}", "outputs": 2, "noerr": 0, "x": 2180, "y": 1500, "wires": [ [ "26d12db4.df7f82", "777f1a14.1b3e44" ], [ "8756395a.c6f6e8", "84ffe685.150d58" ] ] }, { "id": "84ffe685.150d58", "type": "function", "z": "a564595f.642818", "name": "set Actual SG Value", "func": "var value = Number(msg.payload);\nflow.set('actualSGpoint',value.toFixed(4));\nreturn msg;", "outputs": 1, "noerr": 0, "x": 2850, "y": 1520, "wires": [ [] ] }, { "id": "45da85de.0a884c", "type": "change", "z": "a564595f.642818", "name": "2", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-2", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 180, "wires": [ [] ] }, { "id": "4dbe6177.1028", "type": "ui_template", "z": "a564595f.642818", "group": "307e2bd0.e69514", "name": "2", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 180, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "4c140999.2a7428", "type": "change", "z": "a564595f.642818", "name": "3", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-3", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 220, "wires": [ [] ] }, { "id": "7c6f1c01.297234", "type": "ui_template", "z": "a564595f.642818", "group": "8de27cf2.dbd6a", "name": "3", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 220, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "638214b2.6402bc", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-3", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 220, "wires": [ [ "455abe60.6afd4" ] ] }, { "id": "e767b4ca.6228c8", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-2", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "x": 2240, "y": 180, "wires": [ [ "b4de88bb.e0e148" ] ] }, { "id": "14d297fb.15dbc8", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 140, "wires": [ [ "1aee8aa4.c92885" ] ] }, { "id": "6c6270ad.ae742", "type": "function", "z": "a564595f.642818", "name": "Add SG Cal Points", "func": "var color = msg.payload;\nif (msg.topic == \"clear calibration\"){\n flow.set('uncalSGpoints-' + color,[]);\n flow.set('actualSGpoints-' + color,[]);\n}else{\nvar uncalSGcalPoint = flow.get('uncalSGpoint')||0;\nvar actualSGcalPoint = flow.get('actualSGpoint')||0;\nif (msg.topic == \"calibrate in water\"){\n actualSGcalPoint = \"1.0000\";\n}\nvar uncalpointsArray = flow.get('uncalSGpoints-' + color)||[];\nvar actualpointsArray = flow.get('actualSGpoints-' + color)||[];\nif (!Array.isArray(uncalpointsArray)){\n uncalpointsArray = uncalpointsArray.split(',');\n}\nif (!Array.isArray(actualpointsArray)){\n actualpointsArray = actualpointsArray.split(',');\n}\nuncalpointsArray.push(uncalSGcalPoint);\nuncalpointsArray.sort(function(a, b){return a-b;});\nflow.set('uncalSGpoints-' + color,uncalpointsArray);\nactualpointsArray.push(actualSGcalPoint);\nactualpointsArray.sort(function(a, b){return a-b;});\nflow.set('actualSGpoints-' + color,actualpointsArray);\n}\nmsg.topic = color;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 3030, "y": 1760, "wires": [ [ "3b195e06.c8f962" ] ] }, { "id": "df1c3ed0.bd3a9", "type": "function", "z": "a564595f.642818", "name": "update display", "func": "msg.topic = flow.get('colordropdownSelect')||\"\";\nreturn msg;", "outputs": 1, "noerr": 0, "x": 2460, "y": 1860, "wires": [ [ "3b195e06.c8f962", "518cb266.0001dc" ] ] }, { "id": "bac24b5.6a220b8", "type": "delay", "z": "a564595f.642818", "name": "", "pauseType": "rate", "timeout": "5", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "5", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "x": 3415, "y": 203, "wires": [ [ "6cbfa171.d2106", "2836e0e1.4ea9c", "c9d0dfc1.9cca2" ] ] }, { "id": "b4de88bb.e0e148", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 180, "wires": [ [ "c9e125df.66b318" ] ] }, { "id": "c9e125df.66b318", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 180, "wires": [ [ "4dbe6177.1028" ] ] }, { "id": "455abe60.6afd4", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 220, "wires": [ [ "3fc07c6.f563084" ] ] }, { "id": "3fc07c6.f563084", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 220, "wires": [ [ "7c6f1c01.297234" ] ] }, { "id": "97228e52.47232", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 300, "wires": [ [ "a6fc7026.3943f" ] ] }, { "id": "a6fc7026.3943f", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 300, "wires": [ [ "79bac478.35317c" ] ] }, { "id": "87e70118.323b3", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 340, "wires": [ [ "822668cd.451b98" ] ] }, { "id": "822668cd.451b98", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 340, "wires": [ [ "e0d6a855.d4e018" ] ] }, { "id": "dd81e411.1cdd78", "type": "ui_template", "z": "a564595f.642818", "group": "b8d3bbbf.2c9cb8", "name": "4", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 260, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "29f2062c.9eafea", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 260, "wires": [ [ "10fa6d83.b3b1b2" ] ] }, { "id": "10fa6d83.b3b1b2", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 260, "wires": [ [ "dd81e411.1cdd78" ] ] }, { "id": "e2227000.fd309", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-4", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 260, "wires": [ [ "29f2062c.9eafea" ] ] }, { "id": "228b94fc.188afc", "type": "ui_template", "z": "a564595f.642818", "group": "ab6da67f.a47fa8", "name": "8", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 420, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "6d7ca362.0790dc", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-8", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "x": 2240, "y": 420, "wires": [ [ "49c2c87.03bfc38" ] ] }, { "id": "49c2c87.03bfc38", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 420, "wires": [ [ "ba5663bf.b7cd6" ] ] }, { "id": "ba5663bf.b7cd6", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 420, "wires": [ [ "228b94fc.188afc" ] ] }, { "id": "2cbc023f.86f2de", "type": "ui_template", "z": "a564595f.642818", "group": "a510f969.f28538", "name": "7", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 380, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "8e49f6ea.8fa718", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 380, "wires": [ [ "68f079f0.789e18" ] ] }, { "id": "68f079f0.789e18", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 380, "wires": [ [ "2cbc023f.86f2de" ] ] }, { "id": "153b404.67792c", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-7", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "x": 2243.5, "y": 377, "wires": [ [ "8e49f6ea.8fa718" ] ] }, { "id": "df1ac3a9.c4472", "type": "ui_template", "z": "a564595f.642818", "group": "81394fa6.f9523", "name": "Cloud Response", "order": 5, "width": "6", "height": "4", "format": "\n\n
Cloud Status:
' + msg.cloudwait\">
\n
\n
\n", "storeOutMessages": false, "fwdInMessages": true, "templateScope": "local", "x": 4090, "y": 600, "wires": [ [] ] }, { "id": "f14feb76.aebb48", "type": "function", "z": "a564595f.642818", "name": "update name, clear comment", "func": "if (msg.payload.beername !== undefined){\n if (msg.payload.beername.indexOf(\",\") > -1){\n beerArray = msg.payload.beername.split(\",\");\n //node.warn(msg.payload.beername[1]);\n flow.set(msg.payload.tiltcolor + \"-Beer\",beerArray);\n //node.warn(flow.get(msg.payload.tiltcolor + \"-Beer\"));\n flow.set(msg.payload.tiltcolor + \"-Comment\",\"\");\n if (msg.payload.doclongurl !== undefined) {\n flow.set(msg.payload.tiltcolor + \"-URL\",' | View Cloud Log');\n }\n msg.payload = beerArray;\n return msg;\n }\n}", "outputs": 1, "noerr": 0, "x": 3975, "y": 175, "wires": [ [ "656f0cf9.e79cd4" ] ] }, { "id": "8dec8962.63e398", "type": "ui_toast", "z": "a564595f.642818", "position": "top right", "displayTime": "8", "highlight": "", "outputs": 0, "ok": "OK", "cancel": "", "topic": "", "name": "", "x": 2687.4999237060547, "y": 1334.9999895095825, "wires": [] }, { "id": "561c3f7f.1b8ab", "type": "change", "z": "a564595f.642818", "name": "4", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-4", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 260, "wires": [ [] ] }, { "id": "eba532a9.2afe3", "type": "change", "z": "a564595f.642818", "name": "8", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-8", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 420, "wires": [ [] ] }, { "id": "de92b02f.5ebe1", "type": "ui_text_input", "z": "a564595f.642818", "name": "", "label": "Comment", "group": "19fab5c2.199ffa", "order": 10, "width": "6", "height": "2", "passthru": false, "mode": "text", "delay": "0", "topic": "", "x": 2300, "y": 1200, "wires": [ [ "e899ac8f.ec903" ] ] }, { "id": "6cbfa171.d2106", "type": "function", "z": "a564595f.642818", "name": "filter cloud response", "func": "var color = flow.get('colordropdownSelect')||\"\";\n//delete cloud wait message\nif (msg.payload.tiltcolor === color){\n msg.cloudwait = \"\";\n msg.cloudlink = flow.get(color + \"-URL\");\n}\nreturn msg;", "outputs": 1, "noerr": 0, "x": 3838, "y": 434, "wires": [ [ "7799f0b1.ee4b8", "df1ac3a9.c4472" ] ] }, { "id": "b1836d66.f976c", "type": "ui_switch", "z": "a564595f.642818", "name": "", "label": "Use Default Cloud URL for All", "group": "19fab5c2.199ffa", "order": 1, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "x": 1450, "y": 1280, "wires": [ [ "d599e3c9.1ae09" ] ] }, { "id": "88a2c98f.f38b08", "type": "ui_slider", "z": "a564595f.642818", "name": "", "label": "Time Interval", "group": "19fab5c2.199ffa", "order": 8, "width": 0, "height": 0, "passthru": true, "topic": "", "min": "5", "max": "60", "step": "5", "x": 2402.9999237060547, "y": 1428.9999895095825, "wires": [ [ "e95c8a86.0f73c8", "1a5d2031.88af3" ] ] }, { "id": "e95c8a86.0f73c8", "type": "ui_text", "z": "a564595f.642818", "group": "19fab5c2.199ffa", "order": 9, "width": 0, "height": 0, "name": "", "label": "Minutes:", "format": "{{msg.payload}}", "layout": "row-left", "x": 2600, "y": 1440, "wires": [] }, { "id": "1a5d2031.88af3", "type": "function", "z": "a564595f.642818", "name": "Save Interval", "func": "flow.set('loggingInterval',msg.payload);", "outputs": 1, "noerr": 0, "x": 2666.4999237060547, "y": 1389.9999895095825, "wires": [ [] ] }, { "id": "2f5685a6.76e34a", "type": "file", "z": "a564595f.642818", "name": "", "filename": "/home/pi/log.csv", "appendNewline": true, "createDir": false, "overwriteFile": "false", "x": 3549.5007934570312, "y": 351.00007247924805, "wires": [ [] ] }, { "id": "6af4a20b.f5f3cc", "type": "http response", "z": "a564595f.642818", "name": "Show Local Data", "x": 3560.5, "y": 395, "wires": [] }, { "id": "dd2bec42.f4069", "type": "http in", "z": "a564595f.642818", "name": "", "url": "/log.csv", "method": "get", "upload": false, "swaggerDoc": "", "x": 3160.5, "y": 394, "wires": [ [ "898ef56a.365648" ] ] }, { "id": "898ef56a.365648", "type": "file in", "z": "a564595f.642818", "name": "", "filename": "/home/pi/log.csv", "format": "", "sendError": false, "x": 3351.5, "y": 392, "wires": [ [ "6af4a20b.f5f3cc" ] ] }, { "id": "2cabe65a.14f1ba", "type": "ui_text", "z": "a564595f.642818", "group": "82607108.c5be8", "order": 3, "width": 0, "height": 0, "name": "", "label": "Minimum Minutes:", "format": "{{msg.payload}}", "layout": "row-left", "x": 2030, "y": 1780, "wires": [] }, { "id": "7b1370e2.6e8c9", "type": "ui_slider", "z": "a564595f.642818", "name": "", "label": "Time Interval", "tooltip": "", "group": "82607108.c5be8", "order": 2, "width": 0, "height": 0, "passthru": true, "outs": "all", "topic": "", "min": ".1", "max": "60", "step": ".1", "x": 1830, "y": 1740, "wires": [ [ "2cabe65a.14f1ba", "b560ab50.dc71d8" ] ] }, { "id": "b560ab50.dc71d8", "type": "function", "z": "a564595f.642818", "name": "Save Interval", "func": "flow.set('localloggingInterval',msg.payload);", "outputs": 1, "noerr": 0, "x": 2010, "y": 1700, "wires": [ [] ] }, { "id": "394a5d3d.92fa72", "type": "function", "z": "a564595f.642818", "name": "Setup Local Log", "func": "var postEnabled = (flow.get('logLocalDataCheck'));\nvar interval = flow.get('localloggingInterval')||15;\ninterval *= 60000;\nif (postEnabled && msg.payload.Color !== undefined){\n var lastPost = flow.get('lastlocalpost-' + msg.payload.Color)||0;\n if (msg.payload.timeStamp - lastPost > interval){\n msg.payload.Comment = flow.get(msg.payload.Color + \"-Comment\")||\"\";\n msg.payload.Beer = flow.get(msg.payload.Color + \"-Beer\")||[\"Untitled\",true];\n msg.topic = msg.payload.Color;\n var date = new Date().toLocaleString();\n date = date.replace(\",\",\" \");\n //unsigned bonus byte\n var uint8 = new Uint8Array(1);\n uint8[0] = msg.payload.tx_power;\n msg.payload.tx_power = uint8[0];\n flow.set('lastlocalpost-' + msg.payload.Color,msg.payload.timeStamp);\n msg.payload = date + \",\" + msg.payload.Timepoint + \",\" + msg.payload.Temp + \",\" + msg.payload.SG + \",\" + msg.payload.Beer[0] + \",\" + msg.payload.Color + \",\" + msg.payload.Comment + \",\" + msg.payload.rssi + \",\" + msg.payload.tx_power;\n return msg;\n}\n}", "outputs": 1, "noerr": 0, "x": 3160, "y": 340, "wires": [ [ "dcc41bde.fc7208", "9b32b69b.089738" ] ] }, { "id": "2316593.5ec70a6", "type": "function", "z": "a564595f.642818", "name": "Set Logging to SD Card", "func": "var color = flow.get('colordropdownSelect')||\"\";\nflow.set('logLocalDataCheck',msg.payload);\nflow.set('lastlocalpost-' + color,0);\nif (msg.payload){\nmsg.payload = \"Logging to Tilt Pi enabled.\";\n}\nelse {\n msg.payload = \"Logging disabled.\"\n}\nreturn msg;", "outputs": 1, "noerr": 0, "x": 2550, "y": 1700, "wires": [ [ "cd2573a4.64137" ] ] }, { "id": "c7601414.73cf68", "type": "ui_switch", "z": "a564595f.642818", "name": "", "label": "Start Logging to Tilt Pi", "tooltip": "", "group": "82607108.c5be8", "order": 1, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "x": 2300, "y": 1700, "wires": [ [ "2316593.5ec70a6" ] ] }, { "id": "cd2573a4.64137", "type": "ui_toast", "z": "a564595f.642818", "position": "top right", "displayTime": "8", "highlight": "", "outputs": 0, "ok": "OK", "cancel": "", "topic": "", "name": "", "x": 2790, "y": 1700, "wires": [] }, { "id": "644a5410.3ea0bc", "type": "ui_text", "z": "a564595f.642818", "group": "82607108.c5be8", "order": 6, "width": 0, "height": 0, "name": "Log Size", "label": "", "format": "{{msg.payload}}", "layout": "row-left", "x": 3932.5, "y": 311, "wires": [] }, { "id": "dcc41bde.fc7208", "type": "exec", "z": "a564595f.642818", "command": "stat", "addpay": false, "append": "log.csv", "useSpawn": "true", "timer": "5", "oldrc": false, "name": "", "x": 3350, "y": 280, "wires": [ [ "5c5d0dab.293cc4" ], [], [] ] }, { "id": "5c5d0dab.293cc4", "type": "split", "z": "a564595f.642818", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": "1", "arraySpltType": "len", "stream": false, "addname": "", "x": 3495, "y": 273, "wires": [ [ "7317b5bb.adcf1c" ] ] }, { "id": "7317b5bb.adcf1c", "type": "switch", "z": "a564595f.642818", "name": "", "property": "payload", "propertyType": "msg", "rules": [ { "t": "cont", "v": "Size", "vt": "str" } ], "checkall": "true", "outputs": 1, "x": 3638, "y": 306, "wires": [ [ "ae037878.ee52b8" ] ] }, { "id": "ae037878.ee52b8", "type": "change", "z": "a564595f.642818", "name": "format", "rules": [ { "t": "change", "p": "payload", "pt": "msg", "from": "Blocks*.*file", "fromt": "re", "to": " bytes", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 3783.5, "y": 310, "wires": [ [ "644a5410.3ea0bc" ] ] }, { "id": "9b51bae9.bed728", "type": "file", "z": "a564595f.642818", "name": "", "filename": "/home/pi/log.csv", "appendNewline": true, "createDir": false, "overwriteFile": "true", "x": 3396.5, "y": 494, "wires": [ [] ] }, { "id": "da1dd72.c86df28", "type": "ui_button", "z": "a564595f.642818", "name": "", "group": "82607108.c5be8", "order": 7, "width": 0, "height": 0, "passthru": true, "label": "Delete Log", "tooltip": "", "color": "white", "bgcolor": "#FF5733", "icon": "", "payload": "Time,Timepoint,Temp,SG,Beer,Color,Comment,RSSI,Uptime", "payloadType": "str", "topic": "", "x": 3147.5, "y": 497, "wires": [ [ "dcc41bde.fc7208", "9b51bae9.bed728" ] ] }, { "id": "b418ce11.8981a", "type": "ui_dropdown", "z": "a564595f.642818", "name": "Calibration Dropdown", "label": "TILT | ", "place": "Select Tilt Color", "group": "eb4ab3d5.7b3f1", "order": 1, "width": 0, "height": 0, "passthru": false, "options": [ { "label": "", "value": "", "type": "str" } ], "payload": "", "topic": "", "x": 1540, "y": 980, "wires": [ [ "6aa75852.1e3068", "3eb6f3c4.588d1c", "d6de2020.56974" ] ] }, { "id": "f9e2fc12.8340c", "type": "inject", "z": "a564595f.642818", "name": "Logging Interval", "topic": "", "payload": "loggingInterval", "payloadType": "flow", "repeat": "15", "crontab": "", "once": false, "x": 2108.4999237060547, "y": 1450.9999895095825, "wires": [ [ "88a2c98f.f38b08" ] ] }, { "id": "b13cb5ba.f355b8", "type": "exec", "z": "a564595f.642818", "command": "sudo reboot", "addpay": false, "append": "", "useSpawn": false, "timer": "", "name": "Reboot", "x": 900, "y": 2900, "wires": [ [ "2a36a03c.47d1f" ], [], [] ] }, { "id": "a85e96c5.56cc58", "type": "ui_button", "z": "a564595f.642818", "name": "", "group": "7e458eda.984cd", "order": 4, "width": 0, "height": 0, "passthru": false, "label": "Restart", "color": "", "bgcolor": "", "icon": "fa-refresh", "payload": "now", "payloadType": "str", "topic": "", "x": 700, "y": 2900, "wires": [ [ "b13cb5ba.f355b8" ] ] }, { "id": "2a36a03c.47d1f", "type": "ui_toast", "z": "a564595f.642818", "position": "top right", "displayTime": "3", "highlight": "", "outputs": 0, "ok": "OK", "cancel": "", "topic": "", "name": "", "x": 1150, "y": 2880, "wires": [] }, { "id": "9fa076ac.17f568", "type": "function", "z": "a564595f.642818", "name": "time zones", "func": "var options = [\"Africa/Harare\",\"Africa/Lusaka\",\"Africa/Johannesburg\",\"Indian/Mayotte\",\"Asia/Aden\",\"Pacific/Apia\",\"Pacific/Wallis\",\"Pacific/Efate\",\"Asia/Ho_Chi_Minh\",\"America/St_Thomas\",\"America/Tortola\",\"America/Caracas\",\"America/St_Vincent\",\"Europe/Vatican\",\"Asia/Samarkand\",\"Asia/Tashkent\",\"America/Montevideo\",\"America/Adak\",\"America/Anchorage\",\"America/Boise\",\"America/Chicago\",\"America/Denver\",\"America/Detroit\",\"America/Indiana/Indianapolis\",\"America/Indiana/Knox\",\"America/Indiana/Marengo\",\"America/Indiana/Petersburg\",\"America/Indiana/Tell_City\",\"America/Indiana/Vevay\",\"America/Indiana/Vincennes\",\"America/Indiana/Winamac\",\"America/Juneau\",\"America/Kentucky/Louisville\",\"America/Kentucky/Monticello\",\"America/Los_Angeles\",\"America/Menominee\",\"America/Metlakatla\",\"America/New_York\",\"America/Nome\",\"America/North_Dakota/Beulah\",\"America/North_Dakota/Center\",\"America/North_Dakota/New_Salem\",\"America/Phoenix\",\"America/Sitka\",\"America/Yakutat\",\"Pacific/Honolulu\",\"Pacific/Midway\",\"Pacific/Wake\",\"Africa/Kampala\",\"Europe/Kiev\",\"Europe/Uzhgorod\",\"Europe/Zaporozhye\",\"Africa/Dar_es_Salaam\",\"Asia/Taipei\",\"Pacific/Funafuti\",\"America/Port_of_Spain\",\"Europe/Istanbul\",\"Pacific/Tongatapu\",\"Africa/Tunis\",\"Asia/Ashgabat\",\"Asia/Dili\",\"Pacific/Fakaofo\",\"Asia/Dushanbe\",\"Asia/Bangkok\",\"Africa/Lome\",\"Indian/Kerguelen\",\"Africa/Ndjamena\",\"America/Grand_Turk\",\"Africa/Mbabane\",\"Asia/Damascus\",\"America/Lower_Princes\",\"America/El_Salvador\",\"Africa/Sao_Tome\",\"Africa/Juba\",\"America/Paramaribo\",\"Africa/Mogadishu\",\"Africa/Dakar\",\"Europe/San_Marino\",\"Africa/Freetown\",\"Europe/Bratislava\",\"Arctic/Longyearbyen\",\"Europe/Ljubljana\",\"Atlantic/St_Helena\",\"Asia/Singapore\",\"Europe/Stockholm\",\"Africa/Khartoum\",\"Indian/Mahe\",\"Pacific/Guadalcanal\",\"Asia/Riyadh\",\"Africa/Kigali\",\"Asia/Anadyr\",\"Asia/Barnaul\",\"Asia/Chita\",\"Asia/Irkutsk\",\"Asia/Kamchatka\",\"Asia/Khandyga\",\"Asia/Krasnoyarsk\",\"Asia/Magadan\",\"Asia/Novokuznetsk\",\"Asia/Novosibirsk\",\"Asia/Omsk\",\"Asia/Sakhalin\",\"Asia/Srednekolymsk\",\"Asia/Tomsk\",\"Asia/Ust-Nera\",\"Asia/Vladivostok\",\"Asia/Yakutsk\",\"Asia/Yekaterinburg\",\"Europe/Astrakhan\",\"Europe/Kaliningrad\",\"Europe/Kirov\",\"Europe/Moscow\",\"Europe/Samara\",\"Europe/Saratov\",\"Europe/Simferopol\",\"Europe/Ulyanovsk\",\"Europe/Volgograd\",\"Europe/Belgrade\",\"Europe/Bucharest\",\"Indian/Reunion\",\"Asia/Qatar\",\"America/Asuncion\",\"Pacific/Palau\",\"Atlantic/Azores\",\"Atlantic/Madeira\",\"Europe/Lisbon\",\"Asia/Gaza\",\"Asia/Hebron\",\"America/Puerto_Rico\",\"Pacific/Pitcairn\",\"America/Miquelon\",\"Europe/Warsaw\",\"Asia/Karachi\",\"Asia/Manila\",\"Pacific/Bougainville\",\"Pacific/Port_Moresby\",\"Pacific/Gambier\",\"Pacific/Marquesas\",\"Pacific/Tahiti\",\"America/Lima\",\"America/Panama\",\"Asia/Muscat\",\"Pacific/Auckland\",\"Pacific/Chatham\",\"Pacific/Niue\",\"Pacific/Nauru\",\"Asia/Kathmandu\",\"Europe/Oslo\",\"Europe/Amsterdam\",\"America/Managua\",\"Africa/Lagos\",\"Pacific/Norfolk\",\"Africa/Niamey\",\"Pacific/Noumea\",\"Africa/Windhoek\",\"Africa/Maputo\",\"Asia/Kuala_Lumpur\",\"Asia/Kuching\",\"America/Bahia_Banderas\",\"America/Cancun\",\"America/Chihuahua\",\"America/Hermosillo\",\"America/Matamoros\",\"America/Mazatlan\",\"America/Merida\",\"America/Mexico_City\",\"America/Monterrey\",\"America/Ojinaga\",\"America/Tijuana\",\"Africa/Blantyre\",\"Indian/Maldives\",\"Indian/Mauritius\",\"Europe/Malta\",\"America/Montserrat\",\"Africa/Nouakchott\",\"America/Martinique\",\"Pacific/Saipan\",\"Asia/Macau\",\"Asia/Choibalsan\",\"Asia/Hovd\",\"Asia/Ulaanbaatar\",\"Asia/Yangon\",\"Africa/Bamako\",\"Europe/Skopje\",\"Pacific/Kwajalein\",\"Pacific/Majuro\",\"Indian/Antananarivo\",\"America/Marigot\",\"Europe/Podgorica\",\"Europe/Chisinau\",\"Europe/Monaco\",\"Africa/Casablanca\",\"Africa/Tripoli\",\"Europe/Riga\",\"Europe/Luxembourg\",\"Europe/Vilnius\",\"Africa/Maseru\",\"Africa/Monrovia\",\"Asia/Colombo\",\"Europe/Vaduz\",\"America/St_Lucia\",\"Asia/Beirut\",\"Asia/Vientiane\",\"Asia/Almaty\",\"Asia/Aqtau\",\"Asia/Aqtobe\",\"Asia/Atyrau\",\"Asia/Oral\",\"Asia/Qyzylorda\",\"America/Cayman\",\"Asia/Kuwait\",\"Asia/Seoul\",\"Asia/Pyongyang\",\"America/St_Kitts\",\"Indian/Comoro\",\"Pacific/Enderbury\",\"Pacific/Kiritimati\",\"Pacific/Tarawa\",\"Asia/Phnom_Penh\",\"Asia/Bishkek\",\"Africa/Nairobi\",\"Asia/Tokyo\",\"Asia/Amman\",\"America/Jamaica\",\"Europe/Jersey\",\"Europe/Rome\",\"Atlantic/Reykjavik\",\"Asia/Tehran\",\"Asia/Baghdad\",\"Indian/Chagos\",\"Asia/Kolkata\",\"Europe/Isle_of_Man\",\"Asia/Jerusalem\",\"Europe/Dublin\",\"Asia/Jakarta\",\"Asia/Jayapura\",\"Asia/Makassar\",\"Asia/Pontianak\",\"Europe/Budapest\",\"America/Port-au-Prince\",\"Europe/Zagreb\",\"America/Tegucigalpa\",\"Asia/Hong_Kong\",\"America/Guyana\",\"Africa/Bissau\",\"Pacific/Guam\",\"America/Guatemala\",\"Atlantic/South_Georgia\",\"Europe/Athens\",\"Africa/Malabo\",\"America/Guadeloupe\",\"Africa/Conakry\",\"Africa/Banjul\",\"America/Danmarkshavn\",\"America/Godthab\",\"America/Scoresbysund\",\"America/Thule\",\"Europe/Gibraltar\",\"Africa/Accra\",\"Europe/Guernsey\",\"America/Cayenne\",\"Asia/Tbilisi\",\"America/Grenada\",\"Europe/London\",\"Africa/Libreville\",\"Europe/Paris\",\"Atlantic/Faroe\",\"Pacific/Chuuk\",\"Pacific/Kosrae\",\"Pacific/Pohnpei\",\"Atlantic/Stanley\",\"Pacific/Fiji\",\"Europe/Helsinki\",\"Africa/Addis_Ababa\",\"Africa/Ceuta\",\"Atlantic/Canary\",\"Europe/Madrid\",\"Africa/Asmara\",\"Africa/El_Aaiun\",\"Africa/Cairo\",\"Europe/Tallinn\",\"America/Guayaquil\",\"Pacific/Galapagos\",\"Africa/Algiers\",\"America/Santo_Domingo\",\"America/Dominica\",\"Europe/Copenhagen\",\"Africa/Djibouti\",\"Europe/Berlin\",\"Europe/Busingen\",\"Europe/Prague\",\"Asia/Famagusta\",\"Asia/Nicosia\",\"Indian/Christmas\",\"America/Curacao\",\"Atlantic/Cape_Verde\",\"America/Havana\",\"America/Costa_Rica\",\"America/Bogota\",\"Asia/Shanghai\",\"Asia/Urumqi\",\"Africa/Douala\",\"America/Punta_Arenas\",\"America/Santiago\",\"Pacific/Easter\",\"Pacific/Rarotonga\",\"Africa/Abidjan\",\"Europe/Zurich\",\"Africa/Brazzaville\",\"Africa/Bangui\",\"Africa/Kinshasa\",\"Africa/Lubumbashi\",\"Indian/Cocos\",\"America/Atikokan\",\"America/Blanc-Sablon\",\"America/Cambridge_Bay\",\"America/Creston\",\"America/Dawson\",\"America/Dawson_Creek\",\"America/Edmonton\",\"America/Fort_Nelson\",\"America/Glace_Bay\",\"America/Goose_Bay\",\"America/Halifax\",\"America/Inuvik\",\"America/Iqaluit\",\"America/Moncton\",\"America/Nipigon\",\"America/Pangnirtung\",\"America/Rainy_River\",\"America/Rankin_Inlet\",\"America/Regina\",\"America/Resolute\",\"America/St_Johns\",\"America/Swift_Current\",\"America/Thunder_Bay\",\"America/Toronto\",\"America/Vancouver\",\"America/Whitehorse\",\"America/Winnipeg\",\"America/Yellowknife\",\"America/Belize\",\"Europe/Minsk\",\"Africa/Gaborone\",\"Asia/Thimphu\",\"America/Nassau\",\"America/Araguaina\",\"America/Bahia\",\"America/Belem\",\"America/Boa_Vista\",\"America/Campo_Grande\",\"America/Cuiaba\",\"America/Eirunepe\",\"America/Fortaleza\",\"America/Maceio\",\"America/Manaus\",\"America/Noronha\",\"America/Porto_Velho\",\"America/Recife\",\"America/Rio_Branco\",\"America/Santarem\",\"America/Sao_Paulo\",\"America/Kralendijk\",\"America/La_Paz\",\"Asia/Brunei\",\"Atlantic/Bermuda\",\"America/St_Barthelemy\",\"Africa/Porto-Novo\",\"Africa/Bujumbura\",\"Asia/Bahrain\",\"Europe/Sofia\",\"Africa/Ouagadougou\",\"Europe/Brussels\",\"Asia/Dhaka\",\"America/Barbados\",\"Europe/Sarajevo\",\"Asia/Baku\",\"Europe/Mariehamn\",\"America/Aruba\",\"Antarctica/Macquarie\",\"Australia/Adelaide\",\"Australia/Brisbane\",\"Australia/Broken_Hill\",\"Australia/Currie\",\"Australia/Darwin\",\"Australia/Eucla\",\"Australia/Hobart\",\"Australia/Lindeman\",\"Australia/Lord_Howe\",\"Australia/Melbourne\",\"Australia/Perth\",\"Australia/Sydney\",\"Europe/Vienna\",\"Pacific/Pago_Pago\",\"America/Argentina/Buenos_Aires\",\"America/Argentina/Catamarca\",\"America/Argentina/Cordoba\",\"America/Argentina/Jujuy\",\"America/Argentina/La_Rioja\",\"America/Argentina/Mendoza\",\"America/Argentina/Rio_Gallegos\",\"America/Argentina/Salta\",\"America/Argentina/San_Juan\",\"America/Argentina/San_Luis\",\"America/Argentina/Tucuman\",\"America/Argentina/Ushuaia\",\"Antarctica/Casey\",\"Antarctica/Davis\",\"Antarctica/DumontDUrville\",\"Antarctica/Mawson\",\"Antarctica/McMurdo\",\"Antarctica/Palmer\",\"Antarctica/Rothera\",\"Antarctica/Syowa\",\"Antarctica/Troll\",\"Antarctica/Vostok\",\"Africa/Luanda\",\"Asia/Yerevan\",\"Europe/Tirane\",\"America/Anguilla\",\"America/Antigua\",\"Asia/Kabul\",\"Asia/Dubai\",\"Europe/Andorra\",\"Africa/Asmera\",\"Africa/Timbuktu\",\"America/Argentina/ComodRivadavia\",\"America/Atka\",\"America/Buenos_Aires\",\"America/Catamarca\",\"America/Coral_Harbour\",\"America/Cordoba\",\"America/Ensenada\",\"America/Fort_Wayne\",\"America/Indianapolis\",\"America/Jujuy\",\"America/Knox_IN\",\"America/Louisville\",\"America/Mendoza\",\"America/Montreal\",\"America/Porto_Acre\",\"America/Rosario\",\"America/Santa_Isabel\",\"America/Shiprock\",\"America/Virgin\",\"Antarctica/South_Pole\",\"Asia/Ashkhabad\",\"Asia/Calcutta\",\"Asia/Chongqing\",\"Asia/Chungking\",\"Asia/Dacca\",\"Asia/Harbin\",\"Asia/Istanbul\",\"Asia/Kashgar\",\"Asia/Katmandu\",\"Asia/Macao\",\"Asia/Rangoon\",\"Asia/Saigon\",\"Asia/Tel_Aviv\",\"Asia/Thimbu\",\"Asia/Ujung_Pandang\",\"Asia/Ulan_Bator\",\"Atlantic/Faeroe\",\"Atlantic/Jan_Mayen\",\"Australia/ACT\",\"Australia/Canberra\",\"Australia/LHI\",\"Australia/North\",\"Australia/NSW\",\"Australia/Queensland\",\"Australia/South\",\"Australia/Tasmania\",\"Australia/Victoria\",\"Australia/West\",\"Australia/Yancowinna\",\"Brazil/Acre\",\"Brazil/DeNoronha\",\"Brazil/East\",\"Brazil/West\",\"Canada/Atlantic\",\"Canada/Central\",\"Canada/East-Saskatchewan\",\"Canada/Eastern\",\"Canada/Mountain\",\"Canada/Newfoundland\",\"Canada/Pacific\",\"Canada/Saskatchewan\",\"Canada/Yukon\",\"CET\",\"Chile/Continental\",\"Chile/EasterIsland\",\"CST6CDT\",\"Cuba\",\"EET\",\"Egypt\",\"Eire\",\"EST\",\"EST5EDT\",\"Etc/GMT\",\"Etc/GMT+0\",\"Etc/GMT+1\",\"Etc/GMT+10\",\"Etc/GMT+11\",\"Etc/GMT+12\",\"Etc/GMT+2\",\"Etc/GMT+3\",\"Etc/GMT+4\",\"Etc/GMT+5\",\"Etc/GMT+6\",\"Etc/GMT+7\",\"Etc/GMT+8\",\"Etc/GMT+9\",\"Etc/GMT-0\",\"Etc/GMT-1\",\"Etc/GMT-10\",\"Etc/GMT-11\",\"Etc/GMT-12\",\"Etc/GMT-13\",\"Etc/GMT-14\",\"Etc/GMT-2\",\"Etc/GMT-3\",\"Etc/GMT-4\",\"Etc/GMT-5\",\"Etc/GMT-6\",\"Etc/GMT-7\",\"Etc/GMT-8\",\"Etc/GMT-9\",\"Etc/GMT0\",\"Etc/Greenwich\",\"Etc/UCT\",\"Etc/Universal\",\"Etc/UTC\",\"Etc/Zulu\",\"Europe/Belfast\",\"Europe/Nicosia\",\"Europe/Tiraspol\",\"GB\",\"GB-Eire\",\"GMT\",\"GMT+0\",\"GMT-0\",\"GMT0\",\"Greenwich\",\"Hongkong\",\"HST\",\"Iceland\",\"Iran\",\"Israel\",\"Jamaica\",\"Japan\",\"Kwajalein\",\"Libya\",\"MET\",\"Mexico/BajaNorte\",\"Mexico/BajaSur\",\"Mexico/General\",\"MST\",\"MST7MDT\",\"Navajo\",\"NZ\",\"NZ-CHAT\",\"Pacific/Johnston\",\"Pacific/Ponape\",\"Pacific/Samoa\",\"Pacific/Truk\",\"Pacific/Yap\",\"Poland\",\"Portugal\",\"PRC\",\"PST8PDT\",\"ROC\",\"ROK\",\"Singapore\",\"Turkey\",\"UCT\",\"Universal\",\"US/Alaska\",\"US/Aleutian\",\"US/Arizona\",\"US/Central\",\"US/East-Indiana\",\"US/Eastern\",\"US/Hawaii\",\"US/Indiana-Starke\",\"US/Michigan\",\"US/Mountain\",\"US/Pacific\",\"US/Pacific-New\",\"US/Samoa\",\"UTC\",\"W-SU\",\"WET\",\"Zulu\"];\nmsg.options = options.sort();\nreturn msg;", "outputs": 1, "noerr": 0, "x": 1090, "y": 2340, "wires": [ [ "9bb86c18.f0deb" ] ] }, { "id": "9bb86c18.f0deb", "type": "ui_dropdown", "z": "a564595f.642818", "name": "", "label": "Time Zone:", "place": "Select", "group": "5ca7d250.c3938c", "order": 1, "width": 0, "height": 0, "passthru": true, "options": [ { "label": "", "value": "", "type": "str" } ], "payload": "", "topic": "", "x": 1542, "y": 2334, "wires": [ [ "a6b43763.a12aa8", "90a37ef8.2317d" ] ] }, { "id": "a1357f50.ee57a", "type": "file in", "z": "a564595f.642818", "name": "", "filename": "/etc/timezone", "format": "utf8", "sendError": true, "x": 1096, "y": 2433, "wires": [ [ "6547f655.0621e8" ] ] }, { "id": "6547f655.0621e8", "type": "function", "z": "a564595f.642818", "name": "remove line breaks", "func": "msg.payload = msg.payload.replace(/(\\r\\n|\\n|\\r)/gm,\"\");\nreturn msg;", "outputs": 1, "noerr": 0, "x": 1303, "y": 2432, "wires": [ [ "9bb86c18.f0deb" ] ] }, { "id": "3a8464e7.9213dc", "type": "ui_button", "z": "a564595f.642818", "name": "", "group": "5ca7d250.c3938c", "order": 2, "width": 0, "height": 0, "passthru": false, "label": "Set Time Zone", "color": "", "bgcolor": "", "icon": "", "payload": "tz", "payloadType": "flow", "topic": "", "x": 1099, "y": 2498, "wires": [ [ "c542fa3.77cb308" ] ] }, { "id": "c542fa3.77cb308", "type": "exec", "z": "a564595f.642818", "command": "sudo ln -fs", "addpay": true, "append": "/etc/localtime", "useSpawn": "true", "timer": "", "oldrc": false, "name": "set timezone sym link", "x": 1320, "y": 2500, "wires": [ [], [], [ "10d7ccc5.8a1033" ] ] }, { "id": "8ee3b7e3.1833a8", "type": "ui_toast", "z": "a564595f.642818", "position": "top right", "displayTime": "3", "highlight": "", "outputs": 0, "ok": "OK", "cancel": "", "topic": "", "name": "", "x": 2090, "y": 2520, "wires": [] }, { "id": "be6c33c3.62e8a", "type": "change", "z": "a564595f.642818", "name": "Set Alerts", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Click restart to save changes.", "tot": "str" }, { "t": "set", "p": "topic", "pt": "msg", "to": "Restart Needed", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1900, "y": 2480, "wires": [ [ "8ee3b7e3.1833a8", "c08f3c8c.b6e87" ] ] }, { "id": "c08f3c8c.b6e87", "type": "ui_text", "z": "a564595f.642818", "group": "5ca7d250.c3938c", "order": 4, "width": 0, "height": 0, "name": "status", "label": "", "format": "{{msg.payload}}", "layout": "col-center", "x": 2050, "y": 2460, "wires": [] }, { "id": "1dc3fc9e.e1f193", "type": "ui_text_input", "z": "a564595f.642818", "name": "", "label": "Enter GMAIL email", "group": "81394fa6.f9523", "order": 4, "width": 0, "height": 0, "passthru": false, "mode": "text", "delay": "0", "topic": "", "x": 1333.4999237060547, "y": 1412.9999895095825, "wires": [ [ "e899ac8f.ec903", "4e68e4c.496741c", "d656e52b.f2a508" ] ] }, { "id": "4e68e4c.496741c", "type": "change", "z": "a564595f.642818", "name": "turn on logging", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1712.9999237060547, "y": 1453.9999895095825, "wires": [ [ "dc8e0ec5.550d", "c7601414.73cf68" ] ] }, { "id": "7496a044.dd719", "type": "exec", "z": "a564595f.642818", "command": "hostname -I", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "IP Address", "x": 310, "y": 4220, "wires": [ [ "deb9c4fc.20c098" ], [], [] ] }, { "id": "58a4e2b2.11320c", "type": "inject", "z": "a564595f.642818", "name": "get ip", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": true, "onceDelay": "10", "x": 130, "y": 4220, "wires": [ [ "7496a044.dd719", "aa8f3e02.fde1c" ] ] }, { "id": "a4a5a7ed.d59958", "type": "ui_text", "z": "a564595f.642818", "group": "f1b2ab0a.9118e8", "order": 1, "width": 0, "height": 0, "name": "", "label": "Tilt Pi Local IP Address Link", "format": "{{msg.payload}}", "layout": "col-center", "x": 887, "y": 4225.5, "wires": [] }, { "id": "5312bf4.09fd44", "type": "ui_switch", "z": "a564595f.642818", "name": "", "label": "Celsius", "group": "b0619070.ac95d", "order": 2, "width": 0, "height": 0, "passthru": false, "decouple": "true", "topic": "", "style": "", "onvalue": "°C", "onvalueType": "str", "onicon": "", "oncolor": "", "offvalue": "°F", "offvalueType": "str", "officon": "", "offcolor": "", "x": 2394.0002632141113, "y": 2410.0005922317505, "wires": [ [ "b58e5805.5d5928" ] ] }, { "id": "b58e5805.5d5928", "type": "function", "z": "a564595f.642818", "name": "Change Temp Units", "func": "if (msg.payload === \"°C\"){\nflow.set('tempUnits',[-32,0.555]);\nflow.set('displayUnits',\"°C\");\nreturn msg;\n}\nif (msg.payload === \"°F\"){\nflow.set('tempUnits',[0,1]);\nflow.set('displayUnits',\"°F\");\nreturn msg;\n}", "outputs": "1", "noerr": 0, "x": 2647.99991607666, "y": 2375.0002250671387, "wires": [ [ "5312bf4.09fd44", "8951ba9f.798ae8" ] ] }, { "id": "5a69b142.f96b6", "type": "exec", "z": "a564595f.642818", "command": "sudo shutdown", "addpay": true, "append": "", "useSpawn": false, "timer": "", "name": "Shutdown", "x": 890, "y": 2840, "wires": [ [ "f2bdbc36.5644d" ], [], [] ] }, { "id": "2bcbe8c9.eefe28", "type": "ui_button", "z": "a564595f.642818", "name": "", "group": "7e458eda.984cd", "order": 5, "width": 0, "height": 0, "passthru": false, "label": "Shutdown", "color": "", "bgcolor": "", "icon": "fa-power-off", "payload": "now", "payloadType": "str", "topic": "", "x": 690, "y": 2860, "wires": [ [ "5a69b142.f96b6" ] ] }, { "id": "f2bdbc36.5644d", "type": "ui_toast", "z": "a564595f.642818", "position": "top right", "displayTime": "3", "highlight": "", "outputs": 0, "ok": "OK", "cancel": "", "topic": "", "name": "", "x": 1150, "y": 2840, "wires": [] }, { "id": "510190df.5876c", "type": "function", "z": "a564595f.642818", "name": "clear email address", "func": "//prevent excessive cloud logs\nmsg.payload = '';\nreturn msg;", "outputs": 1, "noerr": 0, "x": 1362.9999237060547, "y": 1572.9999895095825, "wires": [ [ "1dc3fc9e.e1f193" ] ] }, { "id": "d656e52b.f2a508", "type": "delay", "z": "a564595f.642818", "name": "", "pauseType": "delay", "timeout": "500", "timeoutUnits": "milliseconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "x": 1468.9999237060547, "y": 1482.9999895095825, "wires": [ [ "510190df.5876c" ] ] }, { "id": "13f0085a.0d5178", "type": "exec", "z": "a564595f.642818", "command": "wget -O /home/pi/flow.json ", "addpay": true, "append": "", "useSpawn": "true", "timer": "", "oldrc": false, "name": "Download Update from GitHub", "x": 1110, "y": 2740, "wires": [ [], [], [ "ef8b11d3.ed055", "a7d80e0.0411ef" ] ] }, { "id": "94e4a0ea.aeb8", "type": "ui_button", "z": "a564595f.642818", "name": "Update App", "group": "c8854cd2.f1773", "order": 1, "width": 0, "height": 0, "passthru": false, "label": "Update App (flow)", "color": "", "bgcolor": "", "icon": "", "payload": "", "payloadType": "str", "topic": "", "x": 710, "y": 2740, "wires": [ [ "35b035bf.c8c96a" ] ] }, { "id": "ef8b11d3.ed055", "type": "function", "z": "a564595f.642818", "name": "Check Success", "func": "if (msg.payload.code === 0){\n return msg;\n}\n", "outputs": 1, "noerr": 0, "x": 1360, "y": 2740, "wires": [ [ "b0fab2cd.d77d4" ] ] }, { "id": "b0fab2cd.d77d4", "type": "exec", "z": "a564595f.642818", "command": "curl -X POST http://localhost:1880/flows -H \"Content-Type: application/json\" -H \"Node-RED-Deployment-Type: nodes\" --data \"@/home/pi/flow.json\"", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "Update App", "x": 1530, "y": 2740, "wires": [ [], [], [] ] }, { "id": "640f9404.72d27c", "type": "file in", "z": "a564595f.642818", "name": "cloud_log_color", "filename": "", "format": "utf8", "sendError": false, "x": 3000.5, "y": 41, "wires": [ [ "68ec71d.2dec29" ] ] }, { "id": "3c8572c8.6a4b1e", "type": "function", "z": "a564595f.642818", "name": "Set Up Tilt Pi", "func": "flow.set('cloudURL',[\"https://script.google.com/macros/s/AKfycbwNXh6rEWoULd0vxWxDylG_PJwQwe0dn5hdtSkuC4k3D9AXBSA/exec\",true]);\nflow.set(msg.payload.Color + \"-Comment\",msg.payload.Comment);\nflow.set('logCloudDataCheck',true);\nflow.set('loggingInterval',15);\nflow.set(msg.payload.Color + \"-Beer\",msg.payload.Beer);\n//initialize local logging\nflow.set('logLocalDataCheck',true);\nflow.set('localloggingInterval',15);\nmsg2 = {};\nmsg2.payload = \"Time,Timepoint,Temp,SG,Beer,Color,Comment,RSSI,Uptime\";\n//post now\nflow.set('lastpost-' + msg.payload.Color,0);\nreturn [msg,msg2];", "outputs": "2", "noerr": 0, "x": 3106.5, "y": 152, "wires": [ [ "cdf7a5f1.e44358" ], [ "da1dd72.c86df28" ] ] }, { "id": "84c05058.79f0d", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "boot", "payloadType": "str", "repeat": "", "crontab": "", "once": true, "x": 2394, "y": 40, "wires": [ [ "5006138a.18932c" ] ] }, { "id": "7b880cec.674314", "type": "exec", "z": "a564595f.642818", "command": "sudo rm", "addpay": true, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "Remove Config File", "x": 3540, "y": 47.5, "wires": [ [], [], [] ] }, { "id": "d599e3c9.1ae09", "type": "function", "z": "a564595f.642818", "name": "Custom CloudURL", "func": "//get custom cloud URL if previously set\nvar color = flow.get('colordropdownSelect');\nif (msg.payload === true){\n flow.set(\"cloudURL\",[\"https://script.google.com/macros/s/AKfycbwNXh6rEWoULd0vxWxDylG_PJwQwe0dn5hdtSkuC4k3D9AXBSA/exec\",true]);\n msg.payload = flow.get(\"cloudURL\")[0]; \n}\nif (msg.payload === false){\n flow.set(\"cloudURL\",[\"https://script.google.com/macros/s/AKfycbwNXh6rEWoULd0vxWxDylG_PJwQwe0dn5hdtSkuC4k3D9AXBSA/exec\",false]);\n msg.payload = flow.get(\"cloudURL-\" + color)||\"Not set for \" + color;\n }\nreturn msg;", "outputs": 1, "noerr": 0, "x": 1730, "y": 1300, "wires": [ [ "edb75c90.8414" ] ] }, { "id": "ecffbfac.2fc53", "type": "ui_toast", "z": "a564595f.642818", "position": "top right", "displayTime": "5", "highlight": "", "outputs": 0, "ok": "OK", "cancel": "", "topic": "", "name": "Cloud URL Status", "x": 2450, "y": 1300, "wires": [] }, { "id": "5b24e16f.7eab", "type": "http in", "z": "a564595f.642818", "name": "", "url": "/data/:color", "method": "get", "upload": false, "swaggerDoc": "", "x": 4060, "y": 920, "wires": [ [ "dc9ecd32.25037" ] ] }, { "id": "bdb5caad.d3dba8", "type": "file in", "z": "a564595f.642818", "name": "", "filename": "", "format": "utf8", "chunk": false, "sendError": false, "x": 4414.21842956543, "y": 925.031304359436, "wires": [ [ "7b788221.059a2c" ] ] }, { "id": "60f15c0d.04a0b4", "type": "http response", "z": "a564595f.642818", "name": "", "statusCode": "", "headers": { "Access-Control-Allow-Origin": "*" }, "x": 4706.111217498779, "y": 925.0694370269775, "wires": [] }, { "id": "cdc2a491.47b908", "type": "file in", "z": "a564595f.642818", "name": "Tilt Color", "filename": "", "format": "utf8", "chunk": false, "sendError": false, "x": 1280, "y": 340, "wires": [ [ "543d2dd7.2fe974" ] ] }, { "id": "543d2dd7.2fe974", "type": "json", "z": "a564595f.642818", "name": "", "pretty": false, "x": 1410, "y": 340, "wires": [ [ "a2f14292.5b0f3", "bd6598f5.142858" ] ] }, { "id": "a2f14292.5b0f3", "type": "function", "z": "a564595f.642818", "name": "Restore Tilt Settings", "func": "if (msg.payload !== undefined){\nflow.set(msg.payload.Color + '-Beer',msg.payload.Beer);\nflow.set('actualSGpoints-' + msg.payload.Color,msg.payload.actualSGPoints);\nflow.set('uncalSGpoints-' + msg.payload.Color,msg.payload.unCalSGPoints);\nflow.set('actualTemppoints-' + msg.payload.Color,msg.payload.actualTempPoints);\nflow.set('uncalTemppoints-' + msg.payload.Color,msg.payload.unCalTempPoints);\n//node.warn(msg.payload.defaultCloudURL);\nflow.set('cloudURL-' + msg.payload.Color,msg.payload.customcloudURL);\n}\n//after last tilt (pink) settings restored, start scanning\nelse if (msg.filename === 0){//ls command completed\n msg.payload = \"python3 -u -m aioblescan -T\";\n return msg;\n }", "outputs": "1", "noerr": 0, "x": 1520, "y": 400, "wires": [ [ "31588cca.783d84" ] ] }, { "id": "d5439ed.a8afa6", "type": "function", "z": "a564595f.642818", "name": "Update", "func": "//only updates if custom Cloud URLs are in use\nvar check = flow.get('cloudURL')[1]||false;\nif (check === true){\n}else{\n return msg;\n}\n", "outputs": 1, "noerr": 0, "x": 1140, "y": 1280, "wires": [ [ "b1836d66.f976c" ] ] }, { "id": "2f84bf9f.847b6", "type": "ui_toast", "z": "a564595f.642818", "position": "top right", "displayTime": "5", "highlight": "", "outputs": 0, "ok": "OK", "cancel": "", "topic": "", "name": "Beer Name Status", "x": 4555.181529998779, "y": 527.5486431121826, "wires": [] }, { "id": "e56d18b9.6cbc88", "type": "file", "z": "a564595f.642818", "name": "Backup Tilt Specific Settings", "filename": "", "appendNewline": false, "createDir": false, "overwriteFile": "true", "x": 1849.0565185546875, "y": 40, "wires": [ [] ] }, { "id": "dc9ecd32.25037", "type": "function", "z": "a564595f.642818", "name": "set filename", "func": "if (msg.req.params.color === undefined){\n msg.req.params.color = \"global\";\n}\nmsg.filename = \"/home/pi/\" + msg.req.params.color;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 4249.642906188965, "y": 922.8828468322754, "wires": [ [ "bdb5caad.d3dba8" ] ] }, { "id": "6a77b965.400cc8", "type": "delay", "z": "a564595f.642818", "name": "", "pauseType": "queue", "timeout": "5", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "15", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": true, "x": 1600.746826171875, "y": 52.618064880371094, "wires": [ [ "c6fd016d.ab4a7", "e56d18b9.6cbc88" ] ] }, { "id": "7b788221.059a2c", "type": "json", "z": "a564595f.642818", "name": "", "pretty": false, "x": 4552.655807495117, "y": 924.7291736602783, "wires": [ [ "60f15c0d.04a0b4" ] ] }, { "id": "423412c2.1b104c", "type": "function", "z": "a564595f.642818", "name": "Set options", "func": "//set default dropdown item if undefined\nmsg.options = msg.payload||[\"NONE\"];\nmsg.payload = flow.get('colordropdownSelect')||msg.options[0];\nreturn msg;", "outputs": 1, "noerr": 0, "x": 990, "y": 880, "wires": [ [ "93d9202c.d9c1e", "b418ce11.8981a" ] ] }, { "id": "d6de2020.56974", "type": "function", "z": "a564595f.642818", "name": "Get Current Temp", "func": "if (msg.payload == \"disabled\") {\n context.set(\"autoUpdate\", \"disabled\");\n}\nif (msg.payload == \"enabled\") {\n context.set(\"autoUpdate\", \"enabled\");\n}\nvar autoUpdate = context.get(\"autoUpdate\")||\"enabled\";\nif (autoUpdate == \"enabled\"){\nvar options = flow.get('options')||[];\nvar color = msg.payload;\nvar displayNumber = options.indexOf(color) + 1;\nmsg.payload = flow.get(\"storage-\" + displayNumber.toString());\nif (msg.payload !== undefined){\nvar msg1 = {};\nvar msg2 = {};\nmsg1.payload = Number(msg.payload.displayuncalTemp).toFixed(1);\nmsg2.payload = Number(msg.payload.displayTemp).toFixed(1);\nreturn [msg1,msg2];\n}\n}", "outputs": 2, "noerr": 0, "x": 2150, "y": 1580, "wires": [ [ "67b168fa.e90078", "ee2ae6f4.9089f8" ], [ "1381f934.df5b27", "37e5d681.345a7a" ] ] }, { "id": "67b168fa.e90078", "type": "function", "z": "a564595f.642818", "name": "set Pre-cal Temp Value", "func": "flow.set('uncalTemppoint',Number(msg.payload).toFixed(1));", "outputs": 1, "noerr": 0, "x": 2880, "y": 1600, "wires": [ [] ] }, { "id": "15afce7c.5604d2", "type": "function", "z": "a564595f.642818", "name": "Change Ferm Units", "func": "if (msg.payload === \"sg\"){\nflow.set('fermdisplayUnits',\"\");\nnode.send([{'payload':'sg'},{'payload':false},{'payload':false}]);\n}\nif (msg.payload === \"plato\"){\nflow.set('fermdisplayUnits',\"°P\");\nnode.send([{'payload':false},{'payload':'plato'},{'payload':false}]);\n}\nif (msg.payload === \"brix\"){\nflow.set('fermdisplayUnits',\"°Bx\");\nnode.send([{'payload':false},{'payload':false},{'payload':'brix'}]);\n}", "outputs": "3", "noerr": 0, "x": 2684, "y": 2543.0002098083496, "wires": [ [ "d66a9036.7565" ], [ "88a56bea.b66268" ], [ "3c18b104.de8f2e" ] ] }, { "id": "88a56bea.b66268", "type": "ui_switch", "z": "a564595f.642818", "name": "", "label": "Plato", "group": "b0619070.ac95d", "order": 4, "width": 0, "height": 0, "passthru": false, "decouple": "true", "topic": "", "style": "", "onvalue": "plato", "onvalueType": "str", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "x": 2505.000690460205, "y": 2632.5001878738403, "wires": [ [ "15afce7c.5604d2" ] ] }, { "id": "3c18b104.de8f2e", "type": "ui_switch", "z": "a564595f.642818", "name": "", "label": "Brix", "group": "b0619070.ac95d", "order": 5, "width": 0, "height": 0, "passthru": false, "decouple": "true", "topic": "", "style": "", "onvalue": "brix", "onvalueType": "str", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "x": 2509.750312805176, "y": 2719.75013923645, "wires": [ [ "15afce7c.5604d2" ] ] }, { "id": "c0f36d.ab686c9", "type": "file in", "z": "a564595f.642818", "name": "", "filename": "/home/pi/global.json", "format": "utf8", "chunk": false, "sendError": false, "x": 640, "y": 440, "wires": [ [ "326af4b8.42494c" ] ] }, { "id": "326af4b8.42494c", "type": "json", "z": "a564595f.642818", "name": "", "pretty": false, "x": 1010, "y": 440, "wires": [ [ "59df1198.a2519" ] ] }, { "id": "59df1198.a2519", "type": "function", "z": "a564595f.642818", "name": "Restore Global", "func": "flow.set('logCloudDataCheck',msg.payload.logCloudDataCheck);\nnode.send([null,{'payload':msg.payload.logCloudDataCheck},null]);\nflow.set('logLocalDataCheck',msg.payload.logLocalDataCheck);\nnode.send([null,null,{'payload':msg.payload.logLocalDataCheck}]);\nflow.set('localloggingInterval',msg.payload.localloggingInterval);\nflow.set('loggingInterval',msg.payload.loggingInterval);\nflow.set('cloudURL',msg.payload.defaultcloudURL);\nnode.send([{'payload':msg.payload.defaultcloudURL[1]},null,null]);\nflow.set('fermdisplayUnits',msg.payload.fermunits);\nflow.set('displayUnits',msg.payload.tempunits);\nflow.set('minRSSI',msg.payload.minRSSI);\nflow.set('IDbyMAC',msg.payload.IDbyMAC);\nflow.set('alphaSG', msg.payload.alphaSG||100);\nflow.set('alphaTemp', msg.payload.alphaTemp||100);\nflow.set('numberSamples', msg.payload.numberSamples||0.5);\nflow.set('smoothSwitch', msg.payload.smoothSwitch||false);\nflow.set('enableRangeBoost', msg.payload.enableRangeBoost||'false');\nflow.set('rangerHostnames', msg.payload.rangerHostnames);\n//return msg;", "outputs": "3", "noerr": 0, "x": 1220, "y": 460, "wires": [ [ "b1836d66.f976c" ], [ "dc8e0ec5.550d" ], [ "c7601414.73cf68" ] ] }, { "id": "c6fd016d.ab4a7", "type": "file", "z": "a564595f.642818", "name": "Back Up Global Settings", "filename": "/home/pi/global.json", "appendNewline": false, "createDir": false, "overwriteFile": "true", "x": 1838.239501953125, "y": 88.01043319702148, "wires": [ [] ] }, { "id": "dc0ffeac.632b6", "type": "http in", "z": "a564595f.642818", "name": "", "url": "/data/", "method": "get", "upload": false, "swaggerDoc": "", "x": 4046.9335861206055, "y": 985.8784227371216, "wires": [ [ "dc9ecd32.25037" ] ] }, { "id": "d66a9036.7565", "type": "ui_switch", "z": "a564595f.642818", "name": "", "label": "SG 15°C/59°F (default)", "group": "b0619070.ac95d", "order": 3, "width": 0, "height": 0, "passthru": false, "decouple": "true", "topic": "", "style": "", "onvalue": "sg", "onvalueType": "str", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "x": 2612.688522338867, "y": 2442.262928009033, "wires": [ [ "15afce7c.5604d2" ] ] }, { "id": "8951ba9f.798ae8", "type": "ui_switch", "z": "a564595f.642818", "name": "", "label": "Fahrenheit (default)", "group": "b0619070.ac95d", "order": 1, "width": 0, "height": 0, "passthru": false, "decouple": "true", "topic": "", "style": "", "onvalue": "°F", "onvalueType": "str", "onicon": "", "oncolor": "", "offvalue": "°C", "offvalueType": "str", "officon": "", "offcolor": "", "x": 2400.3509521484375, "y": 2336.010766029358, "wires": [ [ "b58e5805.5d5928" ] ] }, { "id": "681c2428.1c3a5c", "type": "ui_template", "z": "a564595f.642818", "group": "82607108.c5be8", "name": "Download Log Button", "order": 4, "width": 0, "height": 0, "format": "\n\n\n\n", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 3180, "y": 440, "wires": [ [] ] }, { "id": "ba245bd3.026ab8", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "displayUnits", "payloadType": "str", "repeat": "", "crontab": "", "once": true, "onceDelay": "2", "x": 1990, "y": 2380, "wires": [ [ "fd49eb70.32ff38" ] ] }, { "id": "69cfcfd8.b2018", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "fermdisplayUnits", "payloadType": "str", "repeat": "", "crontab": "", "once": true, "onceDelay": "2", "x": 2130, "y": 2660, "wires": [ [ "3c9890f9.04d5f" ] ] }, { "id": "3c9890f9.04d5f", "type": "function", "z": "a564595f.642818", "name": "filter", "func": "msg.payload = flow.get(msg.payload);\nif (msg.payload === \"\"){\n msg.payload = \"sg\";\n}\nif (msg.payload === \"°P\"){\n msg.payload = \"plato\";\n}\nif (msg.payload === \"°Bx\"){\n msg.payload = \"brix\";\n}\nreturn msg;", "outputs": 1, "noerr": 0, "x": 2319.6248779296875, "y": 2651.4583740234375, "wires": [ [ "88a56bea.b66268", "d66a9036.7565", "3c18b104.de8f2e" ] ] }, { "id": "b90d01ad.44d08", "type": "function", "z": "a564595f.642818", "name": "Changed?", "func": "var previous = context.get('watchedData-' + msg.payload.Color)||\"\";\n//changes in settings/measurements below trigger a backup\nvar current = \nmsg.payload.Beer + \nmsg.payload.unCalSGPoints +\nmsg.payload.actualSGPoints +\nmsg.payload.actualTempPoints +\nmsg.payload.unCalTempPoints +\nmsg.payload.fermunits +\nmsg.payload.tempunits +\nmsg.payload.defaultcloudURL +\nmsg.payload.customcloudURL +\nmsg.payload.logCloudDataCheck +\nmsg.payload.logLocalDataCheck +\nmsg.payload.localloggingInterval +\nmsg.payload.loggingInterval +\nmsg.payload.minRSSI +\nmsg.payload.IDbyMAC +\nmsg.payload.alphaSG +\nmsg.payload.alphaTemp +\nmsg.payload.numberSamples +\nmsg.payload.smoothSwitch +\nmsg.payload.enableRangeBoost +\nmsg.payload.rangerHostnames;\nif (current !== previous){\n //node.warn(current);\n //node.warn(previous);\n context.set('watchedData-' + msg.payload.Color,current);\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 1394.8472900390625, "y": 55.68404006958008, "wires": [ [ "6a77b965.400cc8" ] ] }, { "id": "a4d1964e.cb4f78", "type": "ui_slider", "z": "a564595f.642818", "name": "RSSI Filter", "label": "RSSI Filter", "group": "2f8a7619.951f3a", "order": 2, "width": 0, "height": 0, "passthru": true, "topic": "", "min": "-105", "max": "-35", "step": 1, "x": 970, "y": 2940, "wires": [ [ "99ac3bca.7a1868" ] ] }, { "id": "99ac3bca.7a1868", "type": "change", "z": "a564595f.642818", "name": "", "rules": [ { "t": "set", "p": "minRSSI", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1150, "y": 2940, "wires": [ [ "3505363e.8a498a" ] ] }, { "id": "3505363e.8a498a", "type": "ui_text", "z": "a564595f.642818", "group": "2f8a7619.951f3a", "order": 3, "width": 0, "height": 0, "name": "", "label": "Minimum RSSI in dBm", "format": "{{msg.payload}}", "layout": "row-spread", "x": 1380, "y": 2940, "wires": [] }, { "id": "9b32b69b.089738", "type": "function", "z": "a564595f.642818", "name": "changed?", "func": "var previous = context.get('data-' + msg.topic)||[];\nvar currentArray = msg.payload.split(\",\");\nvar current = currentArray[2] + currentArray[3] + currentArray[4] + currentArray[6];\nvar time = context.get('time-' + msg.topic)||Date.now();\n//node.warn(current);\n//node.warn(Date.now() - time);\nif (previous !== current || Date.now() - time > 900000 ){\n context.set('time-' + msg.topic,Date.now());\n context.set('data-' + msg.topic,current);\n //only clear comment if cloud logging not checked\n if (!flow.get('logCloudDataCheck')){\n flow.set(msg.topic + \"-Comment\",\"\");\n }\n return msg;\n}\n\n", "outputs": 1, "noerr": 0, "x": 3360.96915435791, "y": 338.01389932632446, "wires": [ [ "2f5685a6.76e34a" ] ] }, { "id": "c908bac9.7cfc38", "type": "watch", "z": "a564595f.642818", "name": "watch for USB drive", "files": "/dev", "recursive": "", "x": 575, "y": 3110.0626363754272, "wires": [ [ "bc55cff6.44c8d" ] ] }, { "id": "bc55cff6.44c8d", "type": "switch", "z": "a564595f.642818", "name": "get device ID", "property": "payload", "propertyType": "msg", "rules": [ { "t": "regex", "v": "/dev/sd.", "vt": "str", "case": false } ], "checkall": "false", "outputs": 1, "x": 766.5242309570312, "y": 3052.2256088256836, "wires": [ [ "27555620.4af91a" ] ] }, { "id": "32967fe2.78f", "type": "exec", "z": "a564595f.642818", "command": "", "addpay": true, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "mount usb drive", "x": 1295.6322784423828, "y": 3113.7571334838867, "wires": [ [], [ "eef04124.0438f" ], [ "b2e261f0.d1861" ] ] }, { "id": "c83e4803.8db528", "type": "exec", "z": "a564595f.642818", "command": "sudo umount /mnt/usb", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "", "x": 1893.8790435791016, "y": 3109.706090927124, "wires": [ [], [ "eef04124.0438f" ], [ "801bdfa2.e1664" ] ] }, { "id": "c80707fb.c9ff98", "type": "function", "z": "a564595f.642818", "name": "setup mount", "func": "var device = msg.payload;\nmsg.payload = \"sudo mount -o uid=pi,gid=pi \" + device.substring(0,8) + \"1 /mnt/usb\";\nreturn msg;", "outputs": 1, "noerr": 0, "x": 1177.4063987731934, "y": 3048.469259262085, "wires": [ [ "32967fe2.78f" ] ] }, { "id": "d9e2bf6d.bccc7", "type": "catch", "z": "a564595f.642818", "name": "No URL Provided Errors", "scope": [ "2836e0e1.4ea9c" ], "x": 3674.517433166504, "y": 204.9272117614746, "wires": [ [ "ffdc5060.780ca" ] ] }, { "id": "c10d9b6d.0b1098", "type": "exec", "z": "a564595f.642818", "command": "sudo cp /home/pi/log.csv /mnt/usb", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "", "x": 1593.684310913086, "y": 3109.6776008605957, "wires": [ [], [ "eef04124.0438f" ], [ "e9bea5b5.0883e8" ] ] }, { "id": "b2e261f0.d1861", "type": "function", "z": "a564595f.642818", "name": "Check Success", "func": "if (msg.payload.code === 0){\n return msg;\n}\n", "outputs": 1, "noerr": 0, "x": 1406.4617309570312, "y": 3214.011266708374, "wires": [ [ "c10d9b6d.0b1098" ] ] }, { "id": "e9bea5b5.0883e8", "type": "function", "z": "a564595f.642818", "name": "Check Success", "func": "if (msg.payload.code === 0){\n return msg;\n}\n", "outputs": 1, "noerr": 0, "x": 1786.1284408569336, "y": 3189.010994911194, "wires": [ [ "c83e4803.8db528" ] ] }, { "id": "11f93581.985a8a", "type": "function", "z": "a564595f.642818", "name": "Configure Mount Point", "func": "node.send({'payload':'sudo chown -R pi:pi /mnt/usb'});\nnode.send({'payload':'sudo chmod -R 775 /mnt/usb'});\nnode.send({'payload':'sudo setfacl -Rdm g:pi:rwx /mnt/usb'});\nnode.send({'payload':'sudo setfacl -Rm g:pi:rwx /mnt/usb'});", "outputs": 1, "noerr": 0, "x": 1060.517349243164, "y": 3363.125386238098, "wires": [ [ "1c2730c3.d43b4f" ] ] }, { "id": "34b160f1.5b1ee", "type": "exec", "z": "a564595f.642818", "command": "sudo mkdir -p /mnt/usb", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "", "x": 764.5208587646484, "y": 3181.4202003479004, "wires": [ [], [], [ "b69d2560.934d18" ] ] }, { "id": "b69d2560.934d18", "type": "function", "z": "a564595f.642818", "name": "Check Success", "func": "if (msg.payload.code === 0){\n return msg;\n}\n", "outputs": 1, "noerr": 0, "x": 904.0174713134766, "y": 3275.12242603302, "wires": [ [ "11f93581.985a8a" ] ] }, { "id": "39a9e291.1fe1fe", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "Mount Point", "payloadType": "str", "repeat": "", "crontab": "", "once": true, "x": 555, "y": 3179.0731925964355, "wires": [ [ "34b160f1.5b1ee" ] ] }, { "id": "235307e4.347e18", "type": "exec", "z": "a564595f.642818", "command": "", "addpay": true, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "", "x": 1409.0173301696777, "y": 3359.1218185424805, "wires": [ [], [], [] ] }, { "id": "1c2730c3.d43b4f", "type": "delay", "z": "a564595f.642818", "name": "", "pauseType": "delay", "timeout": "1", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "x": 1258.5139389038086, "y": 3360.732711791992, "wires": [ [ "235307e4.347e18" ] ] }, { "id": "e37566b2.2c78f8", "type": "catch", "z": "a564595f.642818", "name": "", "scope": [ "c0f36d.ab686c9" ], "x": 500, "y": 540, "wires": [ [ "410f235c.c1f2ac" ] ] }, { "id": "410f235c.c1f2ac", "type": "change", "z": "a564595f.642818", "name": "start anyway if error", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "on", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 710, "y": 540, "wires": [ [ "31588cca.783d84" ] ] }, { "id": "6308b03a.25d4a", "type": "catch", "z": "a564595f.642818", "name": "", "scope": [ "c0f36d.ab686c9" ], "x": 560, "y": 3000, "wires": [ [ "6ccc73b5.86205c" ] ] }, { "id": "6ccc73b5.86205c", "type": "change", "z": "a564595f.642818", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "-105", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 740, "y": 3000, "wires": [ [ "a4d1964e.cb4f78" ] ] }, { "id": "34ef6654.47916a", "type": "ui_toast", "z": "a564595f.642818", "position": "top right", "displayTime": "3", "highlight": "", "outputs": 0, "ok": "OK", "cancel": "", "topic": "", "name": "", "x": 4047.999954223633, "y": 226.00000953674316, "wires": [] }, { "id": "ffdc5060.780ca", "type": "template", "z": "a564595f.642818", "name": "Alert", "field": "payload", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "Alert: {{error.message}}", "output": "str", "x": 3860.6319465637207, "y": 216.31249809265137, "wires": [ [ "34ef6654.47916a" ] ] }, { "id": "d504d607.384f48", "type": "function", "z": "a564595f.642818", "name": "RSSI", "func": "var minRSSI = flow.get('minRSSI');\nif (msg.payload.rssi >= minRSSI){\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 930, "y": 120, "wires": [ [ "e5652ef0.acaaf" ] ] }, { "id": "eef04124.0438f", "type": "ui_text", "z": "a564595f.642818", "group": "82607108.c5be8", "order": 5, "width": 0, "height": 0, "name": "", "label": "Download via USB", "format": "{{msg.payload}}", "layout": "col-center", "x": 2350.250030517578, "y": 3056.5000343322754, "wires": [] }, { "id": "27555620.4af91a", "type": "delay", "z": "a564595f.642818", "name": "send once", "pauseType": "rate", "timeout": "1", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": true, "x": 978.5, "y": 3039, "wires": [ [ "c80707fb.c9ff98", "113b924.25cc06e" ] ] }, { "id": "85296978.d8a2d8", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "Insert Windows (FAT32, MBR) formatted USB drive.", "payloadType": "str", "repeat": "30", "crontab": "", "once": true, "x": 1874.375, "y": 2965, "wires": [ [ "eef04124.0438f" ] ] }, { "id": "801bdfa2.e1664", "type": "function", "z": "a564595f.642818", "name": "Check Success", "func": "if (msg.payload.code === 0){\n msg.payload = \"Success, remove USB drive.\";\n return msg;\n}\n", "outputs": 1, "noerr": 0, "x": 2126.2500228881836, "y": 3121.2500343322754, "wires": [ [ "eef04124.0438f" ] ] }, { "id": "113b924.25cc06e", "type": "function", "z": "a564595f.642818", "name": "Detect USB", "func": "msg.payload = msg.payload.substring(0,8) + \"1 detected\";\nreturn msg;", "outputs": 1, "noerr": 0, "x": 1433.125015258789, "y": 3003.7500343322754, "wires": [ [ "eef04124.0438f" ] ] }, { "id": "68ec71d.2dec29", "type": "json", "z": "a564595f.642818", "name": "", "pretty": false, "x": 3147.5, "y": 40, "wires": [ [ "3c8572c8.6a4b1e", "dd8b62f0.c52ca" ] ] }, { "id": "780b4fd0.c274b", "type": "function", "z": "a564595f.642818", "name": "Send IP Addr", "func": "var ipAddress = flow.get('ipaddress')||\"http://tiltpi.local:1880/ui\";\nflow.set(msg.payload.Color + \"-Comment\",ipAddress);\nflow.set('lastpost-' + msg.payload.Color,0);", "outputs": 1, "noerr": 0, "x": 3433, "y": 132, "wires": [ [] ] }, { "id": "cdf7a5f1.e44358", "type": "delay", "z": "a564595f.642818", "name": "", "pauseType": "delay", "timeout": "60", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "5", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "x": 3264.5, "y": 132, "wires": [ [ "780b4fd0.c274b" ] ] }, { "id": "51590585.1fbfec", "type": "catch", "z": "a564595f.642818", "name": "", "scope": [ "8dc4fe46.fc364", "cdc2a491.47b908" ], "x": 500, "y": 600, "wires": [ [] ] }, { "id": "fd48b85c.2f1918", "type": "catch", "z": "a564595f.642818", "name": "", "scope": [ "640f9404.72d27c" ], "x": 3704, "y": 68, "wires": [ [] ] }, { "id": "5006138a.18932c", "type": "function", "z": "a564595f.642818", "name": "Send Tilt Colors", "func": "//check if system starting up and Tilts are in range.\nif (msg.payload === \"boot\"){\ncontext.set('startup',true);\n}else{\ncontext.set('tilt',true);\n}\n//contine startup if Tilt detected\nif (context.get('startup') && context.get('tilt')){\n//initializes settings file for each color\nvar colors = [\"red\",\"green\",\"black\",\"purple\",\"orange\",\"blue\",\"yellow\",\"pink\"];\nvar arrayLength = colors.length;\nfor (var i = 0; i < arrayLength; i++) {\n node.send({filename:\"/boot/firmware/cloud_log_\" + colors[i] + \".json\"});\n}\ncontext.set('startup',false);\n}", "outputs": 1, "noerr": 0, "x": 2609, "y": 40, "wires": [ [ "a81ac973.c7f1a8" ] ] }, { "id": "a81ac973.c7f1a8", "type": "delay", "z": "a564595f.642818", "name": "", "pauseType": "rate", "timeout": "5", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "5", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "x": 2820, "y": 40, "wires": [ [ "640f9404.72d27c" ] ] }, { "id": "2c73dfce.b79cc", "type": "delay", "z": "a564595f.642818", "name": "", "pauseType": "rate", "timeout": "5", "timeoutUnits": "seconds", "rate": "10", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "x": 1000, "y": 360, "wires": [ [ "a2f14292.5b0f3", "ae5a9919.560518" ] ] }, { "id": "d5884cdc.50b47", "type": "debug", "z": "a564595f.642818", "name": "response debugger", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "x": 3950, "y": 100, "wires": [] }, { "id": "dd8b62f0.c52ca", "type": "change", "z": "a564595f.642818", "name": "", "rules": [ { "t": "move", "p": "filename", "pt": "msg", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 3327.5, "y": 42, "wires": [ [ "7b880cec.674314" ] ] }, { "id": "fd49eb70.32ff38", "type": "function", "z": "a564595f.642818", "name": "filter", "func": "msg.payload = flow.get(msg.payload);\nreturn msg;", "outputs": 1, "noerr": 0, "x": 2212, "y": 2384, "wires": [ [ "5312bf4.09fd44", "8951ba9f.798ae8" ] ] }, { "id": "e5905320.33efc", "type": "exec", "z": "a564595f.642818", "command": "date '+%F %T'", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "", "x": 758.25, "y": 2543.500026702881, "wires": [ [ "437432fd.79dbbc" ], [], [] ] }, { "id": "437432fd.79dbbc", "type": "ui_text_input", "z": "a564595f.642818", "name": "", "label": "Adjust System Time Manually", "group": "5ca7d250.c3938c", "order": 3, "width": 0, "height": 0, "passthru": false, "mode": "text", "delay": "0", "topic": "", "x": 1014.0000076293945, "y": 2549.250026702881, "wires": [ [ "f8a4aa49.743c88" ] ] }, { "id": "f8a4aa49.743c88", "type": "exec", "z": "a564595f.642818", "command": "sudo date -s '", "addpay": true, "append": "'", "useSpawn": "false", "timer": "", "oldrc": false, "name": "", "x": 1360, "y": 2580, "wires": [ [ "673f8112.35a61" ], [ "8ee3b7e3.1833a8" ], [] ] }, { "id": "669c32ed.8030ac", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "", "payloadType": "date", "repeat": "60", "crontab": "", "once": true, "x": 577.5, "y": 2533.750026702881, "wires": [ [ "e5905320.33efc" ] ] }, { "id": "673f8112.35a61", "type": "function", "z": "a564595f.642818", "name": "topic", "func": "msg.topic = \"System Time Updated\";\nreturn msg;", "outputs": 1, "noerr": 0, "x": 1530, "y": 2540, "wires": [ [ "8ee3b7e3.1833a8" ] ] }, { "id": "375008fe.27a988", "type": "function", "z": "a564595f.642818", "name": "create URL", "func": "var ipAddress = msg.payload.ipv4;\nmsg.payload = \"http://\" + ipAddress.trim() + \":1880/ui\"\nflow.set('ipaddress',msg.payload);\nreturn msg;", "outputs": 1, "noerr": 0, "x": 629, "y": 4220.5, "wires": [ [ "a4a5a7ed.d59958" ] ] }, { "id": "deb9c4fc.20c098", "type": "csv", "z": "a564595f.642818", "name": "", "sep": " ", "hdrin": "", "hdrout": "", "multi": "one", "ret": "\\n", "temp": "ipv4,ipv6", "skip": 0, "x": 469, "y": 4220.5, "wires": [ [ "375008fe.27a988" ] ] }, { "id": "a6b43763.a12aa8", "type": "file", "z": "a564595f.642818", "name": "", "filename": "/home/pi/timezone", "appendNewline": false, "createDir": false, "overwriteFile": "true", "x": 1730, "y": 2300, "wires": [ [] ] }, { "id": "90a37ef8.2317d", "type": "function", "z": "a564595f.642818", "name": "Set Timezone", "func": "flow.set(\"tz\",\"/usr/share/zoneinfo/\" + msg.payload);\nreturn msg;", "outputs": 1, "noerr": 0, "x": 1740, "y": 2340, "wires": [ [] ] }, { "id": "10d7ccc5.8a1033", "type": "exec", "z": "a564595f.642818", "command": "sudo cp -f /home/pi/timezone /etc/timezone", "addpay": false, "append": "", "useSpawn": "", "timer": "", "oldrc": false, "name": "copy timezone file (for jessie)", "x": 1560, "y": 2440, "wires": [ [], [], [ "be6c33c3.62e8a" ] ] }, { "id": "9d251f5a.10bdc", "type": "exec", "z": "a564595f.642818", "command": "sudo", "addpay": true, "append": "", "useSpawn": "true", "timer": "", "oldrc": false, "name": "scan control", "x": 590, "y": 140, "wires": [ [ "8dc4fe46.fc364", "6fd56f4c.da2ef", "6ce10677.d50f88" ], [ "1d0659ea.6c2c26", "6ce10677.d50f88" ], [] ] }, { "id": "425f9ce9.7d5064", "type": "debug", "z": "a564595f.642818", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 3030, "y": 100, "wires": [] }, { "id": "1d0659ea.6c2c26", "type": "debug", "z": "a564595f.642818", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 910, "y": 160, "wires": [] }, { "id": "31588cca.783d84", "type": "trigger", "z": "a564595f.642818", "op1": "pkill -f aioblescan", "op2": "python3 -u -m aioblescan -T", "op1type": "str", "op2type": "str", "duration": "5", "extend": false, "units": "s", "reset": "", "bytopic": "all", "name": "Reset", "x": 630, "y": 20, "wires": [ [ "9d251f5a.10bdc", "1d0659ea.6c2c26" ] ] }, { "id": "a6e4b381.0a8fa", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "minRSSI", "payloadType": "str", "repeat": "", "crontab": "", "once": true, "onceDelay": "2", "x": 580, "y": 2940, "wires": [ [ "e5c9eaf5.b44748" ] ] }, { "id": "e5c9eaf5.b44748", "type": "function", "z": "a564595f.642818", "name": "filter", "func": "msg.payload = flow.get(msg.payload);\nreturn msg;", "outputs": 1, "noerr": 0, "x": 750, "y": 2940, "wires": [ [ "a4d1964e.cb4f78" ] ] }, { "id": "2c407f92.0b22b", "type": "exec", "z": "a564595f.642818", "command": "sudo sed -i", "addpay": false, "append": "'s/921600 noflow/115200 noflow/g' /usr/bin/btuart", "useSpawn": "false", "timer": "", "oldrc": false, "name": "Reduce Baud", "x": 1800, "y": 2620, "wires": [ [], [], [ "be6c33c3.62e8a" ] ] }, { "id": "6b927b9c.f1c794", "type": "exec", "z": "a564595f.642818", "command": "sudo sed -i", "addpay": false, "append": "'s/115200 noflow/921600 noflow/g' /usr/bin/btuart", "useSpawn": "false", "timer": "", "oldrc": false, "name": "Restore Baud", "x": 1800, "y": 2680, "wires": [ [], [], [ "be6c33c3.62e8a" ] ] }, { "id": "473deb1e.3fc504", "type": "ui_button", "z": "a564595f.642818", "name": "Stability Fix for RPi3", "group": "7e458eda.984cd", "order": 2, "width": 0, "height": 0, "passthru": false, "label": "BT Stability Fix for RPi3", "color": "", "bgcolor": "", "icon": "settings_bluetooth", "payload": "", "payloadType": "date", "topic": "", "x": 1580, "y": 2620, "wires": [ [ "2c407f92.0b22b" ] ] }, { "id": "ffe5510b.99527", "type": "ui_button", "z": "a564595f.642818", "name": "Revert Stability Fix for RPi3", "group": "7e458eda.984cd", "order": 3, "width": 0, "height": 0, "passthru": false, "label": "Revert BT Stability Fix for RPi3", "color": "", "bgcolor": "", "icon": "settings_backup_restore", "payload": "", "payloadType": "date", "topic": "", "x": 1560, "y": 2680, "wires": [ [ "6b927b9c.f1c794" ] ] }, { "id": "47d6079b.2ae9c8", "type": "ui_text", "z": "a564595f.642818", "group": "c8854cd2.f1773", "order": 2, "width": "6", "height": "2", "name": "Current Updates", "label": "Current Version: {{msg.label}}", "format": "{{msg.payload}}", "layout": "col-center", "x": 2330, "y": 2860, "wires": [] }, { "id": "7799f0b1.ee4b8", "type": "trigger", "z": "a564595f.642818", "op1": "", "op2": "{\"result\":\"Waiting for next time point...\"}", "op1type": "nul", "op2type": "json", "duration": "30", "extend": true, "units": "s", "reset": "", "bytopic": "all", "name": "Reset Result", "x": 3690, "y": 600, "wires": [ [ "b94e4a26.8805b8" ] ] }, { "id": "b94e4a26.8805b8", "type": "change", "z": "a564595f.642818", "name": "clear cloudwait", "rules": [ { "t": "set", "p": "cloudwait", "pt": "msg", "to": "", "tot": "str" }, { "t": "set", "p": "cloudlink", "pt": "msg", "to": "", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 3860, "y": 600, "wires": [ [ "df1ac3a9.c4472" ] ] }, { "id": "c9d0dfc1.9cca2", "type": "debug", "z": "a564595f.642818", "name": "http payload debug", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "x": 3930, "y": 60, "wires": [] }, { "id": "b434dd22.03a0f", "type": "function", "z": "a564595f.642818", "name": "enable dev-mode", "func": "// true marks tiltpi as developer mode \n// dev-mode: true allows custom update source\n//var devEnabled = true; // dev-mode enabled\nvar devEnabled = false; // dev-mode disabled\nflow.set('dev-mode',devEnabled); \n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 850, "y": 2700, "wires": [ [ "f089aeab.e0832" ] ] }, { "id": "f089aeab.e0832", "type": "function", "z": "a564595f.642818", "name": "custom update source", "func": "// replace this url with your custom publicly resolved github source\nvar customUrl = \"https://raw.githubusercontent.com/baronbrew/TILTpi/Aioblescan/flow.json\";\n//var customUrl = \"https://raw.githubusercontent.com/baronbrew/tiltpi/tiltpi-dev/flow.json\";\nvar customReleases = \"https://api.github.com/repos/baronbrew/tiltpi/releases\";\nflow.set('custom-update-url', customUrl);\nflow.set('custom-update-release-url', customReleases);\nreturn msg;", "outputs": 1, "noerr": 0, "x": 1060, "y": 2700, "wires": [ [] ] }, { "id": "35b035bf.c8c96a", "type": "function", "z": "a564595f.642818", "name": "update source", "func": "// disabled use of master due to broken builds on later raspberry pi images\n//var defaultUrl = \"https://raw.githubusercontent.com/baronbrew/TILTpi/master/flow.json\";\nvar defaultUrl = \"https://raw.githubusercontent.com/baronbrew/TILTpi/Aioblescan/flow.json\";\n\nvar customUrl = flow.get('custom-update-url');\n\nif (flow.get('dev-mode') && customUrl) {\n msg.payload = customUrl;\n} else {\n msg.payload = defaultUrl;\n}\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 880, "y": 2740, "wires": [ [ "13f0085a.0d5178" ] ] }, { "id": "fda0c78c.e93008", "type": "inject", "z": "a564595f.642818", "name": "set dev-mode", "topic": "", "payload": "", "payloadType": "date", "repeat": "60", "crontab": "", "once": true, "onceDelay": "", "x": 660, "y": 2700, "wires": [ [ "b434dd22.03a0f" ] ] }, { "id": "28059b08.d92734", "type": "function", "z": "a564595f.642818", "name": "set release source", "func": "// use github releases API to fetch latest release details\nvar defaultReleases = \"https://api.github.com/repos/baronbrew/TILTpi/releases/latest\";\nvar customReleases = flow.get('custom-update-release-url') + \"/latest\";\n\nif (flow.get('dev-mode') && customReleases) {\n msg.url = customReleases;\n} else {\n msg.url = defaultReleases;\n}\n\nmsg.headers = {\n \"User-Agent\": \"node-red;tiltpi\"\n}\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 1830, "y": 2820, "wires": [ [ "e5ef4db6.33ad1" ] ] }, { "id": "4d283807.7a37b8", "type": "inject", "z": "a564595f.642818", "name": "latest releases", "topic": "", "payload": "", "payloadType": "date", "repeat": "86400", "crontab": "", "once": true, "onceDelay": "", "x": 1640, "y": 2820, "wires": [ [ "28059b08.d92734" ] ] }, { "id": "a1089058.b969", "type": "ui_text", "z": "a564595f.642818", "group": "c8854cd2.f1773", "order": 3, "width": "6", "height": "2", "name": "Latest Releases", "label": "{{msg.label}}", "format": "{{msg.payload}}", "layout": "col-center", "x": 2560, "y": 2820, "wires": [] }, { "id": "9ae6ebe8.91e128", "type": "function", "z": "a564595f.642818", "name": "filter", "func": "var status = msg.statusCode;\nvar resp = msg.payload;\n\nvar msg = {};\nif (status == 200 && resp !== []) {\n var latest = flow.get(\"version\");\n if (resp.name == latest.name) {\n msg.enabled = false;\n msg.label = \"\";\n msg.payload = \"Running most current version.\";\n } else {\n msg.enabled = true;\n msg.label = \"Latest Update: \" + resp.name;\n msg.payload = resp.body;\n }\n} else {\n msg.enabled = false;\n msg.label = \"Lastest Update: Unknown\";\n msg.payload = \"Failed to retrieve latest release information. Check internet connectivity.\"\n}\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 2410, "y": 2820, "wires": [ [ "a1089058.b969" ] ] }, { "id": "a5a85aba.a9d748", "type": "http request", "z": "a564595f.642818", "name": "fetch latest release notes", "method": "GET", "ret": "obj", "url": "", "tls": "", "x": 2230, "y": 2820, "wires": [ [ "9ae6ebe8.91e128" ] ] }, { "id": "e5ef4db6.33ad1", "type": "delay", "z": "a564595f.642818", "name": "", "pauseType": "rate", "timeout": "5", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "5", "rateUnits": "minute", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "x": 2020, "y": 2820, "wires": [ [ "a5a85aba.a9d748" ] ] }, { "id": "41af0fce.49552", "type": "inject", "z": "a564595f.642818", "name": "current release", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": true, "onceDelay": "8", "x": 1980, "y": 2860, "wires": [ [ "edb8b308.bde27" ] ] }, { "id": "edb8b308.bde27", "type": "function", "z": "a564595f.642818", "name": "release info", "func": "var release = {\n name: \"v.2.9.2\",\n notes: \"Now with customizable hostname (for custom local URL) and option to use other Tilt Pi's on your network as range boosters.\"\n}\nflow.set(\"version\", release);\n\nmsg.label = release.name;\nmsg.payload = release.notes;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 2150, "y": 2860, "wires": [ [ "47d6079b.2ae9c8" ] ] }, { "id": "2418cca9.80c104", "type": "debug", "z": "a564595f.642818", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 1640, "y": 240, "wires": [] }, { "id": "bc42a38f.e9d94", "type": "debug", "z": "a564595f.642818", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 4340, "y": 420, "wires": [] }, { "id": "5a5923ad.6c1d5c", "type": "change", "z": "a564595f.642818", "name": "9", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-9", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 460, "wires": [ [] ] }, { "id": "616e1556.07aeac", "type": "change", "z": "a564595f.642818", "name": "10", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-10", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 500, "wires": [ [] ] }, { "id": "262fa5ae.5dfbda", "type": "change", "z": "a564595f.642818", "name": "11", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-11", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 540, "wires": [ [] ] }, { "id": "53d6e829.db2008", "type": "change", "z": "a564595f.642818", "name": "12", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-12", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 580, "wires": [ [] ] }, { "id": "80f5dfea.985b2", "type": "change", "z": "a564595f.642818", "name": "13", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-13", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 640, "wires": [ [] ] }, { "id": "bf532ad9.219628", "type": "change", "z": "a564595f.642818", "name": "14", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-14", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 680, "wires": [ [] ] }, { "id": "285a2030.d13ba", "type": "change", "z": "a564595f.642818", "name": "15", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-15", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 720, "wires": [ [] ] }, { "id": "393a255d.2d8e1a", "type": "change", "z": "a564595f.642818", "name": "16", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-16", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 760, "wires": [ [] ] }, { "id": "4c160e20.1b26a", "type": "change", "z": "a564595f.642818", "name": "17", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-17", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 800, "wires": [ [] ] }, { "id": "5225a0ca.061d", "type": "change", "z": "a564595f.642818", "name": "18", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-18", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 840, "wires": [ [] ] }, { "id": "7406a265.d2752c", "type": "change", "z": "a564595f.642818", "name": "19", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-19", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 880, "wires": [ [] ] }, { "id": "8d5d51dc.2a629", "type": "change", "z": "a564595f.642818", "name": "20", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-20", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 920, "wires": [ [] ] }, { "id": "a448d832.2f8a38", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-9", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 460, "wires": [ [ "647d71c4.628e8" ] ] }, { "id": "647d71c4.628e8", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 460, "wires": [ [ "23acb7c8.0f4fa8" ] ] }, { "id": "23acb7c8.0f4fa8", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 460, "wires": [ [ "b0c871ee.825fa" ] ] }, { "id": "b0c871ee.825fa", "type": "ui_template", "z": "a564595f.642818", "group": "267d3836.6dd8c8", "name": "9", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 460, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "1b07d15a.22721f", "type": "ui_template", "z": "a564595f.642818", "group": "108bd956.936727", "name": "10", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 500, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "69c80d48.ff3944", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 500, "wires": [ [ "1b07d15a.22721f" ] ] }, { "id": "a388c3a2.eac4d", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 500, "wires": [ [ "69c80d48.ff3944" ] ] }, { "id": "78df2d65.c62dd4", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-10", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 500, "wires": [ [ "a388c3a2.eac4d" ] ] }, { "id": "d85b1a06.40d7c8", "type": "ui_template", "z": "a564595f.642818", "group": "a50556b1.dbfcb8", "name": "11", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 540, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "9292de64.9ae", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 540, "wires": [ [ "d85b1a06.40d7c8" ] ] }, { "id": "720fd272.1a56cc", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 540, "wires": [ [ "9292de64.9ae" ] ] }, { "id": "7b29dcf.5810724", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-11", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 540, "wires": [ [ "720fd272.1a56cc" ] ] }, { "id": "c3e65142.1abc1", "type": "ui_template", "z": "a564595f.642818", "group": "5c7445d4.98ad6c", "name": "12", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 580, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "4b54d3d8.c7a56c", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 580, "wires": [ [ "c3e65142.1abc1" ] ] }, { "id": "99a8c422.9a5d18", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 580, "wires": [ [ "4b54d3d8.c7a56c" ] ] }, { "id": "6545b170.0e59e", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-12", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 580, "wires": [ [ "99a8c422.9a5d18" ] ] }, { "id": "b7987897.334ee8", "type": "ui_template", "z": "a564595f.642818", "group": "12fd05d8.05d72a", "name": "13", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 640, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "6fbf3d7b.557c44", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 640, "wires": [ [ "b7987897.334ee8" ] ] }, { "id": "4d34d92a.daacb8", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 640, "wires": [ [ "6fbf3d7b.557c44" ] ] }, { "id": "7ea242b8.d4cd2c", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-13", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 640, "wires": [ [ "4d34d92a.daacb8" ] ] }, { "id": "50c01cc7.5c7ce4", "type": "ui_template", "z": "a564595f.642818", "group": "4c37ac06.315ed4", "name": "14", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 680, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "adb9f508.09beb8", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 680, "wires": [ [ "50c01cc7.5c7ce4" ] ] }, { "id": "bf999e86.007a", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 680, "wires": [ [ "adb9f508.09beb8" ] ] }, { "id": "d7370b8a.579b58", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-14", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 680, "wires": [ [ "bf999e86.007a" ] ] }, { "id": "96fc73f7.4aedf", "type": "ui_template", "z": "a564595f.642818", "group": "e45abb75.3c20e8", "name": "15", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 720, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "56b1aaf6.963794", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 720, "wires": [ [ "96fc73f7.4aedf" ] ] }, { "id": "302c41e1.93c55e", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 720, "wires": [ [ "56b1aaf6.963794" ] ] }, { "id": "929509e8.7f0e68", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-15", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 720, "wires": [ [ "302c41e1.93c55e" ] ] }, { "id": "2c830d1d.47a5c2", "type": "ui_template", "z": "a564595f.642818", "group": "15de3d7c.511dc3", "name": "16", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 760, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "f158029e.ab5ad", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 760, "wires": [ [ "2c830d1d.47a5c2" ] ] }, { "id": "bf4e38c5.6b64e8", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 760, "wires": [ [ "f158029e.ab5ad" ] ] }, { "id": "eeff4541.e3b128", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-16", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 760, "wires": [ [ "bf4e38c5.6b64e8" ] ] }, { "id": "9fb8659c.72a988", "type": "ui_template", "z": "a564595f.642818", "group": "819bc8e0.bcd088", "name": "17", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 800, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "52a8aa48.8cbb84", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 800, "wires": [ [ "9fb8659c.72a988" ] ] }, { "id": "5e446f27.4b485", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 800, "wires": [ [ "52a8aa48.8cbb84" ] ] }, { "id": "51f8faba.d67a74", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-17", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 800, "wires": [ [ "5e446f27.4b485" ] ] }, { "id": "fad59c31.459a5", "type": "ui_template", "z": "a564595f.642818", "group": "fc7d68d0.753128", "name": "18", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 840, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "ee3d5711.f574e8", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 840, "wires": [ [ "fad59c31.459a5" ] ] }, { "id": "57519e88.1b6e3", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 840, "wires": [ [ "ee3d5711.f574e8" ] ] }, { "id": "f68ed6c.f987c28", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-18", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 840, "wires": [ [ "57519e88.1b6e3" ] ] }, { "id": "2d9318ec.26fb18", "type": "ui_template", "z": "a564595f.642818", "group": "bd62ad81.4b044", "name": "19", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 880, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "4eddc4d8.fd628c", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 880, "wires": [ [ "2d9318ec.26fb18" ] ] }, { "id": "8d67d3dc.c514e", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 880, "wires": [ [ "4eddc4d8.fd628c" ] ] }, { "id": "f5d16c6c.e063b", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-19", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 880, "wires": [ [ "8d67d3dc.c514e" ] ] }, { "id": "e58cff3a.8f6cd", "type": "ui_template", "z": "a564595f.642818", "group": "41d62802.51c5b8", "name": "20", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 920, "wires": [ [ "1ee5d27c.fa4e8e", "394a5d3d.92fa72" ] ] }, { "id": "5fc1729f.da123c", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 920, "wires": [ [ "e58cff3a.8f6cd" ] ] }, { "id": "ca4b0ee0.4371d", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 920, "wires": [ [ "5fc1729f.da123c" ] ] }, { "id": "fd5f82d1.ae093", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-20", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 920, "wires": [ [ "ca4b0ee0.4371d" ] ] }, { "id": "1a349481.97830b", "type": "exec", "z": "a564595f.642818", "command": "ls /home/pi/*.json", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "", "x": 550, "y": 360, "wires": [ [ "3f72b10e.4b106e" ], [], [ "3f72b10e.4b106e" ] ] }, { "id": "3f72b10e.4b106e", "type": "split", "z": "a564595f.642818", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": true, "addname": "", "x": 710, "y": 360, "wires": [ [ "f5df2cba.4ec66" ] ] }, { "id": "f5df2cba.4ec66", "type": "change", "z": "a564595f.642818", "name": "filename", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "filename", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 840, "y": 360, "wires": [ [ "2c73dfce.b79cc" ] ] }, { "id": "ae5a9919.560518", "type": "switch", "z": "a564595f.642818", "name": "filter", "property": "filename", "propertyType": "msg", "rules": [ { "t": "neq", "v": "0", "vt": "num" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 1150, "y": 340, "wires": [ [ "cdc2a491.47b908" ] ] }, { "id": "bd6598f5.142858", "type": "debug", "z": "a564595f.642818", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 1670, "y": 520, "wires": [] }, { "id": "14afaa5e.5b9ff6", "type": "ui_text_input", "z": "a564595f.642818", "name": "Beta Test", "label": "Beta Testing (enter \"tiltpi-dev\" to test)", "tooltip": "", "group": "c8854cd2.f1773", "order": 4, "width": 0, "height": 0, "passthru": false, "mode": "text", "delay": "0", "topic": "", "x": 720, "y": 2780, "wires": [ [ "71555fdb.854f1" ] ] }, { "id": "71555fdb.854f1", "type": "template", "z": "a564595f.642818", "name": "GitHub URL", "field": "payload", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "https://raw.githubusercontent.com/baronbrew/TILTpi/{{payload}}/flow.json\n", "output": "str", "x": 890, "y": 2780, "wires": [ [ "13f0085a.0d5178" ] ] }, { "id": "a7d80e0.0411ef", "type": "change", "z": "a564595f.642818", "name": "Clear", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 670, "y": 2820, "wires": [ [ "14afaa5e.5b9ff6" ] ] }, { "id": "92ba8385.acef3", "type": "change", "z": "a564595f.642818", "name": "21", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-21", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 960, "wires": [ [] ] }, { "id": "e7184de8.a126d", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-21", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 960, "wires": [ [ "ec92d732.73b488" ] ] }, { "id": "ec92d732.73b488", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 960, "wires": [ [ "6b2630c1.ee399" ] ] }, { "id": "6b2630c1.ee399", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 960, "wires": [ [ "cf792291.cb942" ] ] }, { "id": "cf792291.cb942", "type": "ui_template", "z": "a564595f.642818", "group": "44534105.db4bc", "name": "21", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 960, "wires": [ [ "394a5d3d.92fa72", "1ee5d27c.fa4e8e" ] ] }, { "id": "9f6e9e76.c44dd", "type": "change", "z": "a564595f.642818", "name": "22", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-22", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 1000, "wires": [ [] ] }, { "id": "e3d86d67.bc1ae", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-22", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 1000, "wires": [ [ "95307bd3.783cc8" ] ] }, { "id": "95307bd3.783cc8", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 1000, "wires": [ [ "6b914e1.9bb8eb" ] ] }, { "id": "6b914e1.9bb8eb", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 1000, "wires": [ [ "a68bf66a.5f1538" ] ] }, { "id": "a68bf66a.5f1538", "type": "ui_template", "z": "a564595f.642818", "group": "51d09488.cc74ec", "name": "22", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 1000, "wires": [ [ "394a5d3d.92fa72", "1ee5d27c.fa4e8e" ] ] }, { "id": "5eb5cdca.85a624", "type": "change", "z": "a564595f.642818", "name": "23", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-23", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 1040, "wires": [ [] ] }, { "id": "2109ecc7.bf8cc4", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-23", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 1040, "wires": [ [ "a7e1f3b1.13f8e" ] ] }, { "id": "a7e1f3b1.13f8e", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 1040, "wires": [ [ "c3bb0e8a.e2ea3" ] ] }, { "id": "c3bb0e8a.e2ea3", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 1040, "wires": [ [ "9d398dc.08dc57" ] ] }, { "id": "9d398dc.08dc57", "type": "ui_template", "z": "a564595f.642818", "group": "401076ab.e74368", "name": "23", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 1040, "wires": [ [ "394a5d3d.92fa72", "1ee5d27c.fa4e8e" ] ] }, { "id": "349a74f.c19918c", "type": "change", "z": "a564595f.642818", "name": "24", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-24", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 1080, "wires": [ [] ] }, { "id": "e8e7308c.c4d17", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-24", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 1080, "wires": [ [ "8843e2c8.51bdf" ] ] }, { "id": "8843e2c8.51bdf", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 1080, "wires": [ [ "6d524c1c.8009f4" ] ] }, { "id": "6d524c1c.8009f4", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 1080, "wires": [ [ "96d4a8e7.f414a8" ] ] }, { "id": "96d4a8e7.f414a8", "type": "ui_template", "z": "a564595f.642818", "group": "e317dbe5.cb4a88", "name": "24", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 1080, "wires": [ [ "394a5d3d.92fa72", "1ee5d27c.fa4e8e" ] ] }, { "id": "ef0d5029.28851", "type": "change", "z": "a564595f.642818", "name": "25", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "storage-25", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 1120, "wires": [ [] ] }, { "id": "8dd595e8.8ace48", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "storage-25", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": "", "x": 2240, "y": 1120, "wires": [ [ "da4dbd71.50463" ] ] }, { "id": "da4dbd71.50463", "type": "change", "z": "a564595f.642818", "name": "clock", "rules": [ { "t": "set", "p": "payload.clock", "pt": "msg", "to": "", "tot": "date" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2430, "y": 1120, "wires": [ [ "4200342b.ee6e5c" ] ] }, { "id": "4200342b.ee6e5c", "type": "function", "z": "a564595f.642818", "name": "check", "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg; \n}\nvar displayTimeout = flow.get('displayTimeout')||120000;\n//set msg.topic for use in displaying the correct color\nmsg.topic = msg.payload.Color;\n//reorder list if a Tilt disconnects\nif (msg.payload.clock - msg.payload.timeStamp > displayTimeout){\n flow.set('storage-1',undefined);\n flow.set('storage-2',undefined);\n flow.set('storage-3',undefined);\n flow.set('storage-4',undefined);\n flow.set('storage-5',undefined);\n flow.set('storage-6',undefined);\n flow.set('storage-7',undefined);\n flow.set('storage-8',undefined);\n flow.set('storage-9',undefined);\n flow.set('storage-10',undefined);\n flow.set('storage-11',undefined);\n flow.set('storage-12',undefined);\n flow.set('storage-13',undefined);\n flow.set('storage-14',undefined);\n flow.set('storage-15',undefined);\n flow.set('storage-16',undefined);\n flow.set('storage-17',undefined);\n flow.set('storage-18',undefined);\n flow.set('storage-19',undefined);\n flow.set('storage-20',undefined);\n flow.set('storage-21',undefined);\n flow.set('storage-22',undefined);\n flow.set('storage-23',undefined);\n flow.set('storage-24',undefined);\n flow.set('storage-25',undefined);\n flow.set('options',[]);\n if (msg.topic === flow.get('colordropdownSelect')){\n flow.set('colordropdownSelect',undefined);\n }\n msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 2610, "y": 1120, "wires": [ [ "b8172640.fdaf28" ] ] }, { "id": "b8172640.fdaf28", "type": "ui_template", "z": "a564595f.642818", "group": "cc24e60a.97bf38", "name": "25", "order": 1, "width": "6", "height": "6", "format": "\n\n
\n

{{msg.payload.Beer[0]}}

\n

TILT | {{msg.payload.displayColor[0]}} {{msg.payload.displayColor[5]}} {{msg.payload.displayColor[6]}}

\n
\n

SG/Concentration: {{msg.payload.uncalferm}} (pre-calibrated)

\n

{{msg.payload.ferm}}{{msg.payload.fermunits}}

\n
\n

Temperature: {{msg.payload.displayuncalTemp | number:1}} (pre-calibrated)

\n

{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}

\n
\n
{{msg.payload.formatteddate}}
\n
Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm
\n
", "storeOutMessages": true, "fwdInMessages": true, "templateScope": "local", "x": 2830, "y": 1120, "wires": [ [ "394a5d3d.92fa72", "1ee5d27c.fa4e8e" ] ] }, { "id": "712aa79c.da4988", "type": "ui_ui_control", "z": "a564595f.642818", "name": "", "x": 1320, "y": 3540, "wires": [ [] ] }, { "id": "be79385c.484a28", "type": "ui_switch", "z": "a564595f.642818", "name": "IDbyMAC", "label": "Use MAC address", "tooltip": "", "group": "1b53fa80.bc1576", "order": 2, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "x": 600, "y": 3460, "wires": [ [ "1bd050cb.503d1f" ] ] }, { "id": "1bd050cb.503d1f", "type": "change", "z": "a564595f.642818", "name": "set IDbyMAC", "rules": [ { "t": "set", "p": "IDbyMAC", "pt": "flow", "to": "payload", "tot": "msg" }, { "t": "set", "p": "displayTimeout", "pt": "flow", "to": "5000", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 3440, "wires": [ [ "87e1a3b9.13fb6" ] ] }, { "id": "87e1a3b9.13fb6", "type": "delay", "z": "a564595f.642818", "name": "", "pauseType": "delay", "timeout": "7", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "x": 980, "y": 3460, "wires": [ [ "bc47cb99.cb1a18" ] ] }, { "id": "bc47cb99.cb1a18", "type": "change", "z": "a564595f.642818", "name": "reset displayTimeout", "rules": [ { "t": "set", "p": "displayTimeout", "pt": "flow", "to": "120000", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1200, "y": 3460, "wires": [ [] ] }, { "id": "5b27c3f.cfa473c", "type": "ui_ui_control", "z": "a564595f.642818", "name": "", "x": 600, "y": 880, "wires": [ [ "9215e4a9.c3af38" ] ] }, { "id": "9215e4a9.c3af38", "type": "change", "z": "a564595f.642818", "name": "Options", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "options", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 760, "y": 880, "wires": [ [ "423412c2.1b104c" ] ] }, { "id": "e493bf39.98126", "type": "link out", "z": "a564595f.642818", "name": "found Tilts", "links": [ "e829c02e.da7e1" ], "x": 1660, "y": 200, "wires": [] }, { "id": "e829c02e.da7e1", "type": "link in", "z": "a564595f.642818", "name": "get found Tilts", "links": [ "e493bf39.98126" ], "x": 775, "y": 940, "wires": [ [ "423412c2.1b104c" ] ] }, { "id": "84b471d.dd3d59", "type": "switch", "z": "a564595f.642818", "name": "Check", "property": "payload", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "false" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 850, "y": 3540, "wires": [ [ "b7da9395.ce5ca" ], [ "1bdd9612.5a18ba" ] ] }, { "id": "b7da9395.ce5ca", "type": "change", "z": "a564595f.642818", "name": "Show Panels 9-25", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"group\":{\"show\":[\"Tilt_Pi_9\",\"Tilt_Pi_10\",\"Tilt_Pi_11\",\"Tilt_Pi_12\",\"Tilt_Pi_13\",\"Tilt_Pi_14\",\"Tilt_Pi_15\",\"Tilt_Pi_16\",\"Tilt_Pi_17\",\"Tilt_Pi_18\",\"Tilt_Pi_19\",\"Tilt_Pi_20\",\"Tilt_Pi_21\",\"Tilt_Pi_22\",\"Tilt_Pi_23\",\"Tilt_Pi_24\",\"Tilt_Pi_25\"]}}", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1070, "y": 3520, "wires": [ [ "712aa79c.da4988" ] ] }, { "id": "1bdd9612.5a18ba", "type": "change", "z": "a564595f.642818", "name": "Hide Panels 9-25", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"group\":{\"hide\":[\"Tilt_Pi_9\",\"Tilt_Pi_10\",\"Tilt_Pi_11\",\"Tilt_Pi_12\",\"Tilt_Pi_13\",\"Tilt_Pi_14\",\"Tilt_Pi_15\",\"Tilt_Pi_16\",\"Tilt_Pi_17\",\"Tilt_Pi_18\",\"Tilt_Pi_19\",\"Tilt_Pi_20\",\"Tilt_Pi_21\",\"Tilt_Pi_22\",\"Tilt_Pi_23\",\"Tilt_Pi_24\",\"Tilt_Pi_25\"]}}", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1070, "y": 3560, "wires": [ [ "712aa79c.da4988" ] ] }, { "id": "d2e10a69.bf7128", "type": "ui_ui_control", "z": "a564595f.642818", "name": "", "x": 540, "y": 3540, "wires": [ [ "45d0c134.d6bcf" ] ] }, { "id": "45d0c134.d6bcf", "type": "change", "z": "a564595f.642818", "name": "set payload", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "IDbyMAC", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 710, "y": 3540, "wires": [ [ "84b471d.dd3d59" ] ] }, { "id": "1e102cb6.f57423", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "IDbyMAC", "payloadType": "flow", "repeat": "", "crontab": "", "once": true, "onceDelay": "8", "x": 540, "y": 3340, "wires": [ [ "be79385c.484a28" ] ] }, { "id": "17d09cdf.4751f3", "type": "function", "z": "a564595f.642818", "name": "Smooth", "func": "var smoothSwitch = flow.get('smoothSwitch')||false;\nif (smoothSwitch && msg.payload.SG > 0.5){\nvar color = msg.payload.Color;\nvar SG = msg.payload.SG;\nvar Temp = msg.payload.Temp;\nvar alphaSG = flow.get('alphaSG') / 100||0.5;//ratio of current sample vs. average of previous samples over sample rate\nvar alphaTemp = flow.get('alphaTemp') / 100||0.5;//ratio of current sample vs. average of previous samples over sample rate\nvar numberSamples = flow.get('numberSamples') * 12 || 36;//multiply this number by sample rate to determine timeframe of moving average\nvar sampleRate = 5000;//measurements on Tilt taken every 5 seconds\nvar timeSinceLastSample = context.get(color + '-timeSinceLastSample')||sampleRate;\nvar prevSampleTime = context.get(color + '-prevSampleTime')||msg.payload.timeStamp;\nvar sampleTakenFlag = context.get(color + '-sampleTakenFlag')||\"not taken\";\nvar prevSGArray = context.get(color + '-SG')||[];\nvar prevTempArray = context.get(color + '-Temp')||[];\nif (timeSinceLastSample >= sampleRate && sampleTakenFlag == \"not taken\"){//take sample if time elapsed is more than sample rate\n context.set(color + '-sampleTakenFlag', \"taken\");\n prevSGArray.push(SG);\n prevTempArray.push(Temp);\n if (prevSGArray.length > numberSamples || prevTempArray.length > numberSamples){\n prevSGArray.shift();\n prevTempArray.shift();\n }\n context.set(color + '-SG', prevSGArray);\n context.set(color + '-Temp', prevTempArray);\n context.set(color + '-prevSampleTime', msg.payload.timeStamp);\n}else{\n context.set(color + '-sampleTakenFlag', \"not taken\")\n}\ntimeSinceLastSample = msg.payload.timeStamp - prevSampleTime;\ncontext.set(color + '-timeSinceLastSample', timeSinceLastSample)\n//calculate means\nvar totalSG = 0;\nfor(var i = 0; i < prevSGArray.length; i++) {\n totalSG += prevSGArray[i];\n}\nvar meanSG = totalSG / prevSGArray.length;\nmsg.payload.SG = ((SG * (1 - alphaSG)) + (meanSG * alphaSG));\nvar totalTemp = 0;\nfor(var i = 0; i < prevTempArray.length; i++) {\n totalTemp += prevTempArray[i];\n}\nvar meanTemp = totalTemp / prevTempArray.length;\nmsg.payload.Temp = ((Temp * (1 - alphaTemp)) + (meanTemp * alphaTemp));\n}\nreturn msg;", "outputs": 1, "noerr": 0, "x": 1520, "y": 140, "wires": [ [ "86447ba5.5d5b68" ] ] }, { "id": "69de6eed.51ee3", "type": "ui_switch", "z": "a564595f.642818", "name": "Smoothing Switch", "label": "Enable Smoothing", "tooltip": "", "group": "c794b7cd.ac92b8", "order": 1, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "x": 550, "y": 3680, "wires": [ [ "78939739.e7eac8" ] ] }, { "id": "78939739.e7eac8", "type": "change", "z": "a564595f.642818", "name": "set smoothSwitch", "rules": [ { "t": "set", "p": "smoothSwitch", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 3680, "wires": [ [] ] }, { "id": "abb434fc.fa72a8", "type": "change", "z": "a564595f.642818", "name": "set SG alpha", "rules": [ { "t": "set", "p": "alphaSG", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 830, "y": 3760, "wires": [ [] ] }, { "id": "a99b227e.f6b3", "type": "change", "z": "a564595f.642818", "name": "set SG alpha", "rules": [ { "t": "set", "p": "alphaTemp", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 830, "y": 3840, "wires": [ [] ] }, { "id": "b8cf9d8c.26898", "type": "ui_numeric", "z": "a564595f.642818", "name": "", "label": "Averaging Time (Minutes)", "tooltip": "", "group": "c794b7cd.ac92b8", "order": 2, "width": 0, "height": 0, "passthru": true, "topic": "", "format": "{{value}}", "min": 0, "max": "120", "step": ".1", "x": 590, "y": 3920, "wires": [ [ "349b10e1.3c62c" ] ] }, { "id": "349b10e1.3c62c", "type": "change", "z": "a564595f.642818", "name": "set Number of Samples", "rules": [ { "t": "set", "p": "numberSamples", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 870, "y": 3920, "wires": [ [] ] }, { "id": "bc58593a.8338b8", "type": "ui_numeric", "z": "a564595f.642818", "name": "", "label": "Temperature Smoothing %", "tooltip": "", "group": "c794b7cd.ac92b8", "order": 2, "width": 0, "height": 0, "passthru": true, "topic": "", "format": "{{value}}", "min": "1", "max": "100", "step": "1", "x": 580, "y": 3840, "wires": [ [ "a99b227e.f6b3" ] ] }, { "id": "4c545b57.8a8e44", "type": "ui_numeric", "z": "a564595f.642818", "name": "", "label": "Gravity Smoothing %", "tooltip": "", "group": "c794b7cd.ac92b8", "order": 2, "width": 0, "height": 0, "passthru": true, "topic": "", "format": "{{value}}", "min": "1", "max": "100", "step": "1", "x": 580, "y": 3760, "wires": [ [ "abb434fc.fa72a8" ] ] }, { "id": "fcf6e184.32999", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "smoothSwitch", "payloadType": "flow", "repeat": "", "crontab": "", "once": true, "onceDelay": "8", "x": 290, "y": 3680, "wires": [ [ "69de6eed.51ee3" ] ] }, { "id": "c20d2ca8.2b8dc", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "alphaSG", "payloadType": "flow", "repeat": "", "crontab": "", "once": true, "onceDelay": "8", "x": 300, "y": 3760, "wires": [ [ "4c545b57.8a8e44" ] ] }, { "id": "45d3070d.8449b8", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "alphaTemp", "payloadType": "flow", "repeat": "", "crontab": "", "once": true, "onceDelay": "8", "x": 280, "y": 3840, "wires": [ [ "bc58593a.8338b8" ] ] }, { "id": "ca3228fe.7b9478", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "numberSamples", "payloadType": "flow", "repeat": "", "crontab": "", "once": true, "onceDelay": "8", "x": 300, "y": 3920, "wires": [ [ "b8cf9d8c.26898" ] ] }, { "id": "26d12db4.df7f82", "type": "ui_numeric", "z": "a564595f.642818", "name": "", "label": "Enter Pre-cal/Tilt SG", "tooltip": "", "group": "6acae0b0.a184", "order": 2, "width": "0", "height": "0", "passthru": false, "topic": "", "format": "{{msg.payload}}", "min": "0.9900", "max": "1.1200", "step": ".0001", "x": 2600, "y": 1480, "wires": [ [ "777f1a14.1b3e44", "ba7658fb.988088" ] ] }, { "id": "8756395a.c6f6e8", "type": "ui_numeric", "z": "a564595f.642818", "name": "", "label": "Enter Actual SG", "tooltip": "", "group": "6acae0b0.a184", "order": 4, "width": "0", "height": "0", "passthru": false, "topic": "", "format": "{{msg.payload}}", "min": "0.990", "max": "1.200", "step": ".0001", "x": 2580, "y": 1540, "wires": [ [ "84ffe685.150d58", "ba7658fb.988088" ] ] }, { "id": "2b26e418.b14aec", "type": "ui_button", "z": "a564595f.642818", "name": "", "group": "6acae0b0.a184", "order": 5, "width": 0, "height": 0, "passthru": false, "label": "Calibrate in Known SG", "tooltip": "", "color": "", "bgcolor": "", "icon": "", "payload": "colordropdownSelect", "payloadType": "flow", "topic": "", "x": 2740, "y": 1820, "wires": [ [ "6c6270ad.ae742" ] ] }, { "id": "7edb039d.78073c", "type": "ui_button", "z": "a564595f.642818", "name": "", "group": "6acae0b0.a184", "order": 1, "width": 0, "height": 0, "passthru": false, "label": "Calibrate in Water", "tooltip": "", "color": "", "bgcolor": "", "icon": "", "payload": "colordropdownSelect", "payloadType": "flow", "topic": "calibrate in water", "x": 2730, "y": 1740, "wires": [ [ "6c6270ad.ae742" ] ] }, { "id": "483fead5.b9c834", "type": "ui_switch", "z": "a564595f.642818", "name": "", "label": "Get Current SG", "tooltip": "", "group": "6acae0b0.a184", "order": 3, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "style": "", "onvalue": "enabled", "onvalueType": "str", "onicon": "", "oncolor": "", "offvalue": "disabled", "offvalueType": "str", "officon": "", "offcolor": "", "x": 1760, "y": 1520, "wires": [ [ "3eb6f3c4.588d1c" ] ] }, { "id": "58debd3d.af16a4", "type": "inject", "z": "a564595f.642818", "name": "Color", "topic": "", "payload": "colordropdownSelect", "payloadType": "flow", "repeat": "1", "crontab": "", "once": false, "onceDelay": 0.1, "x": 1910, "y": 1460, "wires": [ [ "3eb6f3c4.588d1c", "d6de2020.56974" ] ] }, { "id": "18df7203.454ade", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "enabled", "payloadType": "str", "repeat": "", "crontab": "", "once": true, "onceDelay": 0.1, "x": 1580, "y": 1520, "wires": [ [ "483fead5.b9c834" ] ] }, { "id": "ba7658fb.988088", "type": "link out", "z": "a564595f.642818", "name": "sg calibration update", "links": [ "22133d6c.455a72" ], "x": 2795, "y": 1380, "wires": [] }, { "id": "22133d6c.455a72", "type": "link in", "z": "a564595f.642818", "name": "sg calibration update", "links": [ "ba7658fb.988088" ], "x": 1475, "y": 1620, "wires": [ [ "b47e694e.3ce3c8" ] ] }, { "id": "b47e694e.3ce3c8", "type": "change", "z": "a564595f.642818", "name": "Disabled", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "disabled", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1560, "y": 1560, "wires": [ [ "483fead5.b9c834" ] ] }, { "id": "3b195e06.c8f962", "type": "function", "z": "a564595f.642818", "name": "SG Calibration Table", "func": "var color = msg.topic;\nmsg.uncalpointsArray = flow.get('uncalSGpoints-' + color)||[];\nmsg.actualpointsArray = flow.get('actualSGpoints-' + color)||[];\nif (typeof msg.uncalpointsArray == \"string\" || typeof msg.actualpointsArray == \"string\"){\n msg.uncalpointsArray = msg.uncalpointsArray.split(\",\");\n msg.actualpointsArray = msg.actualpointsArray.split(\",\");\n}\nif (msg.uncalpointsArray[0] === undefined){\n msg.row0 = 'hidden'\n}else{\nmsg.row0 = 'visible';\n}\nif (msg.uncalpointsArray[1] === undefined){\n msg.row1 = 'hidden'\n}else{\nmsg.row1 = 'visible';\n}\nif (msg.uncalpointsArray[2] === undefined){\n msg.row2 = 'hidden'\n}else{\nmsg.row2 = 'visible';\n}\nif (msg.uncalpointsArray[3] === undefined){\n msg.row3 = 'hidden'\n}else{\nmsg.row3 = 'visible';\n}\nif (msg.uncalpointsArray[4] === undefined){\n msg.row4 = 'hidden'\n}else{\nmsg.row4 = 'visible';\n}\nreturn msg;", "outputs": 1, "noerr": 0, "x": 3280, "y": 1740, "wires": [ [ "44aae1a8.7f6b3" ] ] }, { "id": "44aae1a8.7f6b3", "type": "ui_template", "z": "a564595f.642818", "group": "6acae0b0.a184", "name": "SG Calibration Points", "order": 6, "width": "0", "height": "0", "format": "\n\n\n\n\n

SG Calibration Points:

\n\n \n \n \n \n \n \n
DeletePre-Cal/TiltActual
X{{msg.uncalpointsArray[0]}}{{msg.actualpointsArray[0]}}
X{{msg.uncalpointsArray[1]}}{{msg.actualpointsArray[1]}}
X{{msg.uncalpointsArray[2]}}{{msg.actualpointsArray[2]}}
X{{msg.uncalpointsArray[3]}}{{msg.actualpointsArray[3]}}
X{{msg.uncalpointsArray[4]}}{{msg.actualpointsArray[4]}}
\n", "storeOutMessages": false, "fwdInMessages": false, "templateScope": "local", "x": 3520, "y": 1740, "wires": [ [ "25ccc367.8d427c" ] ] }, { "id": "5a6c003b.37e3", "type": "ui_button", "z": "a564595f.642818", "name": "", "group": "6acae0b0.a184", "order": 7, "width": 0, "height": 0, "passthru": false, "label": "Delete All", "tooltip": "", "color": "", "bgcolor": "#FF5733", "icon": "", "payload": "colordropdownSelect", "payloadType": "flow", "topic": "clear calibration", "x": 2720, "y": 1780, "wires": [ [ "6c6270ad.ae742" ] ] }, { "id": "25ccc367.8d427c", "type": "function", "z": "a564595f.642818", "name": "Remove SG Cal Point", "func": "var calpointIndex = Number(msg.payload);\nvar color = flow.get('colordropdownSelect');\nvar uncalpointsArray = flow.get('uncalSGpoints-' + color)||[];\nvar actualpointsArray = flow.get('actualSGpoints-' + color)||[];\nif (typeof uncalpointsArray == \"string\" || typeof actualpointsArray == \"string\"){\n uncalpointsArray = uncalpointsArray.split(\",\");\n actualpointsArray = actualpointsArray.split(\",\");\n}\nuncalpointsArray.splice(calpointIndex,1);\nactualpointsArray.splice(calpointIndex,1);\nflow.set('uncalSGpoints-' + color,uncalpointsArray);\nflow.set('actualSGpoints-' + color,actualpointsArray);\nmsg.topic = color;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 3500, "y": 1940, "wires": [ [ "3b195e06.c8f962" ] ] }, { "id": "8cb2d9.bccfcd28", "type": "ui_button", "z": "a564595f.642818", "name": "", "group": "c12bcb12.dbd0d8", "order": 7, "width": 0, "height": 0, "passthru": false, "label": "Delete All", "tooltip": "", "color": "", "bgcolor": "#FF5733", "icon": "", "payload": "colordropdownSelect", "payloadType": "flow", "topic": "clear calibration", "x": 2320, "y": 2140, "wires": [ [ "c78e4ac7.89ba88" ] ] }, { "id": "a4aa0e4b.1999d", "type": "ui_button", "z": "a564595f.642818", "name": "", "group": "c12bcb12.dbd0d8", "order": 5, "width": 0, "height": 0, "passthru": false, "label": "Calibrate in Known Temp", "tooltip": "", "color": "", "bgcolor": "", "icon": "", "payload": "colordropdownSelect", "payloadType": "flow", "topic": "", "x": 2350, "y": 2200, "wires": [ [ "c78e4ac7.89ba88" ] ] }, { "id": "c78e4ac7.89ba88", "type": "function", "z": "a564595f.642818", "name": "Add Temp Cal Points", "func": "var color = msg.payload;\nif (msg.topic == \"clear calibration\"){\n flow.set('uncalTemppoints-' + color,[]);\n flow.set('actualTemppoints-' + color,[]);\n}else{\nvar uncalTempcalPoint = flow.get('uncalTemppoint')||0;\nvar actualTempcalPoint = flow.get('actualTemppoint')||0;\nif (msg.topic == \"calibrate in ice water\"){\n if (flow.get(\"displayUnits\") == \"°F\"){\n actualTempcalPoint = \"32.0\";\n }else{\n actualTempcalPoint = \"0.0\"\n }\n \n}\nvar uncalpointsArray = flow.get('uncalTemppoints-' + color)||[];\nvar actualpointsArray = flow.get('actualTemppoints-' + color)||[];\nif (!Array.isArray(uncalpointsArray)){\n uncalpointsArray = uncalpointsArray.split(',');\n}\nif (!Array.isArray(actualpointsArray)){\n actualpointsArray = actualpointsArray.split(',');\n}\nuncalpointsArray.push(uncalTempcalPoint);\nuncalpointsArray.sort(function(a, b){return a-b;});\nflow.set('uncalTemppoints-' + color,uncalpointsArray);\nactualpointsArray.push(actualTempcalPoint);\nactualpointsArray.sort(function(a, b){return a-b;});\nflow.set('actualTemppoints-' + color,actualpointsArray);\n}\nmsg.topic = color;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 2640, "y": 2140, "wires": [ [ "518cb266.0001dc" ] ] }, { "id": "518cb266.0001dc", "type": "function", "z": "a564595f.642818", "name": "Temp Calibration Table", "func": "var color = msg.topic;\nmsg.uncalpointsArray = flow.get('uncalTemppoints-' + color)||[];\nmsg.actualpointsArray = flow.get('actualTemppoints-' + color)||[];\nif (typeof msg.uncalpointsArray == \"string\" || typeof msg.actualpointsArray == \"string\"){\n msg.uncalpointsArray = msg.uncalpointsArray.split(\",\");\n msg.actualpointsArray = msg.actualpointsArray.split(\",\");\n}\nif (msg.uncalpointsArray[0] === undefined){\n msg.row0 = 'hidden'\n}else{\nmsg.row0 = 'visible';\n}\nif (msg.uncalpointsArray[1] === undefined){\n msg.row1 = 'hidden'\n}else{\nmsg.row1 = 'visible';\n}\nif (msg.uncalpointsArray[2] === undefined){\n msg.row2 = 'hidden'\n}else{\nmsg.row2 = 'visible';\n}\nif (msg.uncalpointsArray[3] === undefined){\n msg.row3 = 'hidden'\n}else{\nmsg.row3 = 'visible';\n}\nif (msg.uncalpointsArray[4] === undefined){\n msg.row4 = 'hidden'\n}else{\nmsg.row4 = 'visible';\n}\nreturn msg;", "outputs": 1, "noerr": 0, "x": 2900, "y": 2140, "wires": [ [ "1eb8ab12.557895" ] ] }, { "id": "1eb8ab12.557895", "type": "ui_template", "z": "a564595f.642818", "group": "c12bcb12.dbd0d8", "name": "Temp Calibration Points", "order": 6, "width": "0", "height": "0", "format": "\n\n\n\n\n

Temp Calibration Points:

\n\n \n \n \n \n \n \n
DeletePre-Cal/TiltActual
X{{msg.uncalpointsArray[0]}}{{msg.actualpointsArray[0]}}
X{{msg.uncalpointsArray[1]}}{{msg.actualpointsArray[1]}}
X{{msg.uncalpointsArray[2]}}{{msg.actualpointsArray[2]}}
X{{msg.uncalpointsArray[3]}}{{msg.actualpointsArray[3]}}
X{{msg.uncalpointsArray[4]}}{{msg.actualpointsArray[4]}}
\n", "storeOutMessages": false, "fwdInMessages": false, "templateScope": "local", "x": 3150, "y": 2140, "wires": [ [ "4ee1ce04.5d" ] ] }, { "id": "4ee1ce04.5d", "type": "function", "z": "a564595f.642818", "name": "Remove Temp Cal Point", "func": "var calpointIndex = Number(msg.payload);\nvar color = flow.get('colordropdownSelect');\nvar uncalpointsArray = flow.get('uncalTemppoints-' + color)||[];\nvar actualpointsArray = flow.get('actualTemppoints-' + color)||[];\nif (typeof uncalpointsArray == \"string\" || typeof actualpointsArray == \"string\"){\n uncalpointsArray = uncalpointsArray.split(\",\");\n actualpointsArray = actualpointsArray.split(\",\");\n}\nuncalpointsArray.splice(calpointIndex,1);\nactualpointsArray.splice(calpointIndex,1);\nflow.set('uncalTemppoints-' + color,uncalpointsArray);\nflow.set('actualTemppoints-' + color,actualpointsArray);\nmsg.topic = color;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 3110, "y": 2300, "wires": [ [ "518cb266.0001dc" ] ] }, { "id": "ee2ae6f4.9089f8", "type": "ui_numeric", "z": "a564595f.642818", "name": "", "label": "Enter Pre-cal/Tilt Temp", "tooltip": "", "group": "c12bcb12.dbd0d8", "order": 2, "width": "0", "height": "0", "passthru": false, "topic": "", "format": "{{msg.payload}}", "min": "-20", "max": "220", "step": ".1", "x": 2600, "y": 1580, "wires": [ [ "67b168fa.e90078", "4e784ef2.20482" ] ] }, { "id": "1381f934.df5b27", "type": "ui_numeric", "z": "a564595f.642818", "name": "", "label": "Enter Actual Temp", "tooltip": "", "group": "c12bcb12.dbd0d8", "order": 4, "width": "0", "height": "0", "passthru": false, "topic": "", "format": "{{msg.payload}}", "min": "-20", "max": "220", "step": ".1", "x": 2610, "y": 1620, "wires": [ [ "37e5d681.345a7a", "4e784ef2.20482" ] ] }, { "id": "37e5d681.345a7a", "type": "function", "z": "a564595f.642818", "name": "set Actual Temp Value", "func": "var value = Number(msg.payload);\nflow.set('actualTemppoint',value.toFixed(1));\nreturn msg;", "outputs": 1, "noerr": 0, "x": 2860, "y": 1660, "wires": [ [] ] }, { "id": "31140e5b.ae7102", "type": "ui_ui_control", "z": "a564595f.642818", "name": "", "x": 1360, "y": 1740, "wires": [ [ "2c202db.f124dd2" ] ] }, { "id": "2c202db.f124dd2", "type": "change", "z": "a564595f.642818", "name": "Update Local Logging Interval", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "localloggingInterval", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1590, "y": 1740, "wires": [ [ "7b1370e2.6e8c9" ] ] }, { "id": "4e784ef2.20482", "type": "link out", "z": "a564595f.642818", "name": "temp calibration update", "links": [ "5a61d854.c47468" ], "x": 2855, "y": 1560, "wires": [] }, { "id": "5a61d854.c47468", "type": "link in", "z": "a564595f.642818", "name": "temp calibration update", "links": [ "4e784ef2.20482" ], "x": 1520, "y": 1680, "wires": [ [ "4419c6f1.d35ca8" ] ] }, { "id": "4419c6f1.d35ca8", "type": "change", "z": "a564595f.642818", "name": "Disabled", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "disabled", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1640, "y": 1680, "wires": [ [ "dfd8fe97.8ff78" ] ] }, { "id": "a1cbb161.09291", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "enabled", "payloadType": "str", "repeat": "", "crontab": "", "once": true, "onceDelay": 0.1, "x": 1600, "y": 1620, "wires": [ [ "dfd8fe97.8ff78" ] ] }, { "id": "dfd8fe97.8ff78", "type": "ui_switch", "z": "a564595f.642818", "name": "", "label": "Get Current Temp", "tooltip": "", "group": "c12bcb12.dbd0d8", "order": 3, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "style": "", "onvalue": "enabled", "onvalueType": "str", "onicon": "", "oncolor": "", "offvalue": "disabled", "offvalueType": "str", "officon": "", "offcolor": "", "x": 1790, "y": 1640, "wires": [ [ "d6de2020.56974" ] ] }, { "id": "e53f4a.4ede80b8", "type": "ui_ui_control", "z": "a564595f.642818", "name": "", "x": 580, "y": 2340, "wires": [ [ "a1357f50.ee57a", "9fa076ac.17f568" ] ] }, { "id": "757b57b9.6d63a8", "type": "ui_button", "z": "a564595f.642818", "name": "", "group": "c12bcb12.dbd0d8", "order": 1, "width": 0, "height": 0, "passthru": false, "label": "Calibrate in Ice Water", "tooltip": "", "color": "", "bgcolor": "", "icon": "", "payload": "colordropdownSelect", "payloadType": "flow", "topic": "calibrate in ice water", "x": 2340, "y": 2080, "wires": [ [ "c78e4ac7.89ba88" ] ] }, { "id": "5335ca0a.9588f4", "type": "http in", "z": "a564595f.642818", "name": "Get data from Tilt by macID", "url": "/macid/:mac", "method": "get", "upload": false, "swaggerDoc": "", "x": 3210, "y": 700, "wires": [ [ "1bde4de.21a20b2" ] ] }, { "id": "1bde4de.21a20b2", "type": "function", "z": "a564595f.642818", "name": "Find macID", "func": "var requestedMac = msg.req.params.mac;\nvar tiltData = {};\nvar allData = [];\nvar i;\nfor (i = 1; i < 26; i++){\n tiltData = flow.get(\"storage-\" + i.toString());\n if (tiltData !== undefined){\n if (requestedMac == \"all\"){\n allData.push(tiltData);\n msg.payload = allData;\n }\n else if (requestedMac == tiltData.mac) {\n msg.payload = tiltData;\n { break; }\n }\n }\n}\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 3430, "y": 700, "wires": [ [ "8cecafbd.3c63a" ] ] }, { "id": "8cecafbd.3c63a", "type": "http response", "z": "a564595f.642818", "name": "", "statusCode": "", "headers": {}, "x": 3590, "y": 700, "wires": [] }, { "id": "6fd56f4c.da2ef", "type": "trigger", "z": "a564595f.642818", "op1": "", "op2": "1", "op1type": "nul", "op2type": "str", "duration": "30", "extend": true, "units": "s", "reset": "", "bytopic": "all", "name": "Watchdog", "x": 870, "y": 60, "wires": [ [ "31588cca.783d84" ] ] }, { "id": "6ce10677.d50f88", "type": "trigger", "z": "a564595f.642818", "op1": "", "op2": "1", "op1type": "nul", "op2type": "str", "duration": "5", "extend": true, "units": "s", "reset": "", "bytopic": "all", "name": "BLE Scan Error Handling", "x": 410, "y": 20, "wires": [ [ "31588cca.783d84" ] ] }, { "id": "7900b0b1.47e32", "type": "exec", "z": "a564595f.642818", "command": "sudo raspi-config nonint do_hostname", "addpay": true, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "hostname", "x": 820, "y": 4140, "wires": [ [ "d2339a88.d77b78" ], [], [] ] }, { "id": "95ff5f18.9c5be", "type": "ui_button", "z": "a564595f.642818", "name": "", "group": "f1b2ab0a.9118e8", "order": 3, "width": 0, "height": 0, "passthru": false, "label": "Reset Link to tiltpi.local:1880/ui", "tooltip": "", "color": "", "bgcolor": "", "icon": "", "payload": "tiltpi", "payloadType": "str", "topic": "", "x": 150, "y": 4040, "wires": [ [ "7949feb.6b492" ] ] }, { "id": "7949feb.6b492", "type": "function", "z": "a564595f.642818", "name": "Validate Hostname", "func": "var prevHostname = context.get('prevHostname');\nif (msg.payload != prevHostname){\ncontext.set('prevHostname', msg.payload);\nvar regExpHostname = new RegExp(/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$/); // RFC 1123\nvar regResultHostname = regExpHostname.test(msg.payload);\nif (regResultHostname){\nmsg.topic = 'Success: New hostname set.'\nreturn msg;\n}else{\n msg.topic = 'Error: Characters not valid.'\n msg.payload = 'Use only numbers, letters, or dashes.';\n return msg;\n}\n}", "outputs": 1, "noerr": 0, "x": 410, "y": 4060, "wires": [ [ "318a1d42.f1ba82", "2ae3dde4.6055e2" ] ] }, { "id": "8b6cf810.bd8538", "type": "ui_text_input", "z": "a564595f.642818", "name": "Set Custom Hostname", "label": "Set New Hostname (ex. tiltpi-north)", "tooltip": "", "group": "f1b2ab0a.9118e8", "order": 4, "width": 0, "height": 0, "passthru": true, "mode": "text", "delay": "0", "topic": "", "x": 120, "y": 4140, "wires": [ [ "7949feb.6b492" ] ] }, { "id": "318a1d42.f1ba82", "type": "ui_toast", "z": "a564595f.642818", "position": "top right", "displayTime": "3", "highlight": "", "outputs": 0, "ok": "OK", "cancel": "", "topic": "", "name": "", "x": 610, "y": 4020, "wires": [] }, { "id": "2ae3dde4.6055e2", "type": "switch", "z": "a564595f.642818", "name": "Filter valid hostname", "property": "topic", "propertyType": "msg", "rules": [ { "t": "cont", "v": "Success", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 620, "y": 4100, "wires": [ [ "7900b0b1.47e32", "1d260968.834aa7", "c3d508f9.41cd38" ] ] }, { "id": "d9788375.b50fc", "type": "ui_text", "z": "a564595f.642818", "group": "f1b2ab0a.9118e8", "order": 2, "width": 0, "height": 0, "name": "", "label": "Tilt Pi Local Hostname Link", "format": "{{msg.payload}}", "layout": "col-center", "x": 900, "y": 4300, "wires": [] }, { "id": "aa8f3e02.fde1c", "type": "exec", "z": "a564595f.642818", "command": "sudo raspi-config nonint get_hostname", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "Hostname", "x": 310, "y": 4300, "wires": [ [ "9c5489ba.e33388" ], [], [] ] }, { "id": "9c5489ba.e33388", "type": "function", "z": "a564595f.642818", "name": "create URL", "func": "var hostname = msg.payload;\nmsg.payload = \"http://\" + hostname.trim() + \".local:1880/ui\"\nreturn msg;", "outputs": 1, "noerr": 0, "x": 630, "y": 4300, "wires": [ [ "d9788375.b50fc" ] ] }, { "id": "d891e4eb.69dc28", "type": "ui_toast", "z": "a564595f.642818", "position": "dialog", "displayTime": "3", "highlight": "", "outputs": 1, "ok": "Restart Now", "cancel": "Restart Later", "topic": "New Tilt Pi Link After Restart:", "name": "Success message", "x": 1270, "y": 4040, "wires": [ [ "bbea99c6.6a4048" ] ] }, { "id": "63606bd0.fb4a54", "type": "exec", "z": "a564595f.642818", "command": "sudo reboot", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "Reboot", "x": 1680, "y": 4040, "wires": [ [], [], [] ] }, { "id": "d2339a88.d77b78", "type": "exec", "z": "a564595f.642818", "command": "sudo raspi-config nonint get_hostname", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "Hostname", "x": 310, "y": 4380, "wires": [ [ "c40da982.670868" ], [], [] ] }, { "id": "c40da982.670868", "type": "function", "z": "a564595f.642818", "name": "create URL", "func": "var hostname = msg.payload;\nmsg.payload = \"http://\" + hostname.trim() + \".local:1880/ui\"\nreturn msg;", "outputs": 1, "noerr": 0, "x": 630, "y": 4380, "wires": [ [ "d891e4eb.69dc28" ] ] }, { "id": "bbea99c6.6a4048", "type": "function", "z": "a564595f.642818", "name": "reboot confirmation", "func": "if (msg.payload == 'Restart Now'){\n return msg;\n}\n", "outputs": 1, "noerr": 0, "x": 1510, "y": 4040, "wires": [ [ "63606bd0.fb4a54" ] ] }, { "id": "3a42c84.0921438", "type": "exec", "z": "a564595f.642818", "command": " mv", "addpay": true, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "rename", "x": 1200, "y": 3980, "wires": [ [], [], [] ] }, { "id": "1d260968.834aa7", "type": "function", "z": "a564595f.642818", "name": "handle changes", "func": "if (msg.payload.includes('.json')){\n var flowFileArray = msg.payload.split('\\n');\n for (var i = 0; i < flowFileArray.length; i++) {\n node.warn(flowFileArray);\n node.warn(flowFileArray[i].includes('_cred.json'));\n node.warn(flowFileArray[i].includes('flows_'));\n if (!flowFileArray[i].includes('_cred.json') && flowFileArray[i].includes('flows_')){\n var flowFile = flowFileArray[i];\n }\n }\ncontext.set('flowFile', flowFile);\n}else{\ncontext.set('newHostname', msg.payload)\n}\nif (context.get('flowFile') !== undefined && context.get('newHostname') !== undefined){\nmsg.payload = context.get('flowFile') + ' ~/.node-red/flows_' + context.get('newHostname') + '.json';\ncontext.set('flowFile', undefined);\ncontext.set('newHostname', undefined);\nreturn msg;\n}", "outputs": 1, "noerr": 0, "x": 980, "y": 3980, "wires": [ [ "3a42c84.0921438" ] ] }, { "id": "c3d508f9.41cd38", "type": "exec", "z": "a564595f.642818", "command": "ls ~/.node-red/flows_*.json", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "get filenames", "x": 830, "y": 4040, "wires": [ [ "1d260968.834aa7" ], [], [] ] }, { "id": "cd74b806.c19078", "type": "http in", "z": "a564595f.642818", "name": "", "url": "/tiltscan", "method": "get", "upload": false, "swaggerDoc": "", "x": 950, "y": 260, "wires": [ [ "73bb2bf7.f98814" ] ] }, { "id": "c44ac237.da5", "type": "debug", "z": "a564595f.642818", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 1530, "y": 280, "wires": [] }, { "id": "fc5a0bb2.c45c08", "type": "delay", "z": "a564595f.642818", "name": "rate limit by mac", "pauseType": "timed", "timeout": "5", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "2.5", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": true, "x": 910, "y": 200, "wires": [ [ "90cd025b.45fbe" ] ] }, { "id": "84f5a2fd.5ef26", "type": "change", "z": "a564595f.642818", "name": "", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "payload.mac", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 720, "y": 200, "wires": [ [ "fc5a0bb2.c45c08" ] ] }, { "id": "90cd025b.45fbe", "type": "function", "z": "a564595f.642818", "name": "Array of Scans", "func": "if (context.get('macArray') === undefined){\n context.set('macArray', [msg.topic]);\n context.set('scanArray', [msg.payload]);\n}else{\n var macArray = context.get('macArray');\n var scanArray = context.get('scanArray');\n if (macArray.includes(msg.topic)){\n //node.send({payload:macArray});\n node.send({payload:scanArray});\n context.set('macArray', undefined);\n } else {\n macArray.push(msg.topic);\n scanArray.push(msg.payload);\n context.set('macArray', macArray);\n context.set('scanArray', scanArray);\n }\n}", "outputs": 1, "noerr": 0, "x": 1100, "y": 200, "wires": [ [ "73bb2bf7.f98814" ] ] }, { "id": "475fc654.79a7f8", "type": "http response", "z": "a564595f.642818", "name": "shows scans", "statusCode": "", "headers": {}, "x": 1490, "y": 180, "wires": [] }, { "id": "73bb2bf7.f98814", "type": "function", "z": "a564595f.642818", "name": "web response", "func": "if (Array.isArray(msg.payload)){\n context.set('tiltScan', msg.payload);\n }else{\n msg.payload = context.get('tiltScan')||{}\n return msg;\n }\n", "outputs": 1, "noerr": 0, "x": 1280, "y": 200, "wires": [ [ "c44ac237.da5", "475fc654.79a7f8" ] ] }, { "id": "9c10da15.1afcb8", "type": "ui_text_input", "z": "a564595f.642818", "name": "Add/Remove Ranger Hostname", "label": "Add/Remove Tilt Pi (ex. tiltpi-north)", "tooltip": "", "group": "90501bee.89d8c8", "order": 2, "width": 0, "height": 0, "passthru": true, "mode": "text", "delay": "0", "topic": "", "x": 610, "y": 4500, "wires": [ [ "6e4adf1e.b6e52" ] ] }, { "id": "6e4adf1e.b6e52", "type": "function", "z": "a564595f.642818", "name": "Validate Hostname", "func": "var prevHostname = context.get('prevHostname');\nif (msg.payload != prevHostname){\ncontext.set('prevHostname', msg.payload);\nvar regExpHostname = new RegExp(/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$/); // RFC 1123\nvar regResultHostname = regExpHostname.test(msg.payload);\nif (regResultHostname){\n var rangerHostnames = flow.get('rangerHostnames');\n if (rangerHostnames !== undefined){\n var rhIndex = rangerHostnames.indexOf(msg.payload);\n //node.warn(rhIndex);\n if (rhIndex < 0){\n rangerHostnames.unshift(msg.payload);\n flow.set('rangerHostnames', rangerHostnames);\n }else{\n rangerHostnames.splice(rhIndex,1);\n //node.warn(rangerHostnames);\n flow.set('rangerHostnames', rangerHostnames);\n }\n if (rangerHostnames.length > 4){\n rangerHostnames.pop();\n flow.set('rangerHostnames', rangerHostnames);\n }\n }else{\n rangerHostnames = [msg.payload];\n flow.set('rangerHostnames', rangerHostnames);\n }\n node.send([null,null,null,null,{payload: ''}]);\n}\n var msg0 = {};\n var msg1 = {};\n var msg2 = {};\n var msg3 = {};\n if (rangerHostnames === undefined) {\n var rangerHostnames = flow.get('rangerHostnames')||[];\n context.set('prevHostname', undefined);\n }\n for (var i = 0; i < rangerHostnames.length; i++){\n switch(i){\n case 0:\n msg0.url = 'http://' + rangerHostnames[0] + ':1880/tiltscan';\n msg0.payload = 'http://' + rangerHostnames[0] + ':1880/tiltscan';\n msg0.header = {};\n node.send([msg0,null,null,null,null]);\n break;\n case 1:\n msg1.url = 'http://' + rangerHostnames[1] + ':1880/tiltscan';\n msg1.payload = 'http://' + rangerHostnames[1] + ':1880/tiltscan';\n msg1.header = {};\n node.send([null,msg1,null,null,null]);\n break;\n case 2:\n msg2.url = 'http://' + rangerHostnames[2] + ':1880/tiltscan';\n msg2.payload = 'http://' + rangerHostnames[2] + ':1880/tiltscan';\n msg2.header = {};\n node.send([null,null,msg2,null,null]);\n break;\n case 3:\n msg3.url = 'http://' + rangerHostnames[3] + ':1880/tiltscan';\n msg3.payload = 'http://' + rangerHostnames[3] + ':1880/tiltscan';\n msg3.header = {};\n node.send([null,null,null,msg3,null]);\n }\n }\n}", "outputs": 5, "noerr": 0, "x": 850, "y": 4580, "wires": [ [ "8751aa88.16b028", "cdcc1439.cf9358" ], [ "1690b609.9f5d7a", "8751aa88.16b028" ], [ "25e6fb01.d0e524", "8751aa88.16b028" ], [ "2c5aeb76.35eaf4", "8751aa88.16b028" ], [ "cdcc1439.cf9358", "1690b609.9f5d7a", "25e6fb01.d0e524", "2c5aeb76.35eaf4", "97adc3fc.9c3ff" ] ] }, { "id": "8ef35d9f.cdc76", "type": "debug", "z": "a564595f.642818", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 1670, "y": 4620, "wires": [] }, { "id": "8751aa88.16b028", "type": "http request", "z": "a564595f.642818", "name": "", "method": "GET", "ret": "obj", "url": "", "tls": "", "x": 1330, "y": 4580, "wires": [ [ "dfab85da.b57c98" ] ] }, { "id": "cdcc1439.cf9358", "type": "ui_text", "z": "a564595f.642818", "group": "90501bee.89d8c8", "order": 3, "width": 0, "height": 0, "name": "", "label": "1st Tilt Pi URL", "format": "{{msg.payload}}", "layout": "col-center", "x": 1060, "y": 4640, "wires": [] }, { "id": "1690b609.9f5d7a", "type": "ui_text", "z": "a564595f.642818", "group": "90501bee.89d8c8", "order": 4, "width": 0, "height": 0, "name": "", "label": "2nd Tilt Pi URL", "format": "{{msg.payload}}", "layout": "col-center", "x": 1060, "y": 4680, "wires": [] }, { "id": "25e6fb01.d0e524", "type": "ui_text", "z": "a564595f.642818", "group": "90501bee.89d8c8", "order": 5, "width": 0, "height": 0, "name": "", "label": "3rd Tilt Pi URL", "format": "{{msg.payload}}", "layout": "col-center", "x": 1060, "y": 4720, "wires": [] }, { "id": "2c5aeb76.35eaf4", "type": "ui_text", "z": "a564595f.642818", "group": "90501bee.89d8c8", "order": 6, "width": 0, "height": 0, "name": "", "label": "4th Tilt Pi URL", "format": "{{msg.payload}}", "layout": "col-center", "x": 1060, "y": 4760, "wires": [] }, { "id": "2b0239bc.216726", "type": "link out", "z": "a564595f.642818", "name": "Range Booster", "links": [ "8f0fc0a7.9992a" ], "x": 1675, "y": 4480, "wires": [] }, { "id": "8f0fc0a7.9992a", "type": "link in", "z": "a564595f.642818", "name": "", "links": [ "2b0239bc.216726" ], "x": 595, "y": 240, "wires": [ [ "d504d607.384f48" ] ] }, { "id": "dfab85da.b57c98", "type": "function", "z": "a564595f.642818", "name": "Send each scan", "func": "for (var i = 0; i < msg.payload.length; i++){\n node.send({ payload : msg.payload[i]});\n}", "outputs": 1, "noerr": 0, "x": 1580, "y": 4540, "wires": [ [ "2b0239bc.216726", "8ef35d9f.cdc76" ] ] }, { "id": "1b902ce8.6e6b73", "type": "trigger", "z": "a564595f.642818", "op1": "", "op2": "0", "op1type": "pay", "op2type": "str", "duration": "-2.5", "extend": false, "units": "s", "reset": "false", "bytopic": "all", "name": "autorequest", "x": 670, "y": 4680, "wires": [ [ "6e4adf1e.b6e52" ] ] }, { "id": "73e64dc3.bd8b94", "type": "ui_switch", "z": "a564595f.642818", "name": "", "label": "Enable Range Booster Mode", "tooltip": "", "group": "90501bee.89d8c8", "order": 1, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "style": "", "onvalue": "%invalid_hostname", "onvalueType": "str", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "str", "officon": "", "offcolor": "", "x": 460, "y": 4620, "wires": [ [ "1b902ce8.6e6b73", "f73578d2.4bd018" ] ] }, { "id": "97adc3fc.9c3ff", "type": "delay", "z": "a564595f.642818", "name": "", "pauseType": "delay", "timeout": "300", "timeoutUnits": "milliseconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "x": 630, "y": 4560, "wires": [ [ "9c10da15.1afcb8" ] ] }, { "id": "e224933e.9bbde", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "enableRangeBoost", "payloadType": "flow", "repeat": "", "crontab": "", "once": true, "onceDelay": "5", "x": 130, "y": 4520, "wires": [ [ "88dee5c9.05f2c8" ] ] }, { "id": "f73578d2.4bd018", "type": "change", "z": "a564595f.642818", "name": "", "rules": [ { "t": "set", "p": "enableRangeBoost", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 680, "y": 4740, "wires": [ [] ] }, { "id": "88dee5c9.05f2c8", "type": "function", "z": "a564595f.642818", "name": "check hostnames", "func": "if (msg.payload == '%invalid_hostname'){\n context.set('check1', msg.payload);\n}else if (msg.payload !== undefined || msg.payload !== []) {\n msg.payload = context.get('check1');\n return msg;\n}\n", "outputs": 1, "noerr": 0, "x": 350, "y": 4740, "wires": [ [ "73e64dc3.bd8b94" ] ] }, { "id": "53aa3ae4.9a9f44", "type": "inject", "z": "a564595f.642818", "name": "", "topic": "", "payload": "rangerHostnames", "payloadType": "flow", "repeat": "", "crontab": "", "once": true, "onceDelay": "5", "x": 120, "y": 4580, "wires": [ [ "88dee5c9.05f2c8" ] ] }, { "id": "a20832e8.97a07", "type": "comment", "z": "a564595f.642818", "name": "RPi Connected Monitor or Touchscreen", "info": "", "x": 1281, "y": 4229, "wires": [] }, { "id": "ffa943f2.ecd36", "type": "template", "z": "a564595f.642818", "name": "Generate Autostart Text", "field": "payload", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "@lxpanel --profile LXDE-pi\n@pcmanfm --desktop --profile LXDE-pi\n@chromium-browser file:///home/pi/Desktop/tiltpi.html --start-fullscreen --incognito\n@xset s {{payload}} {{payload}}\n@unclutter -idle 0.5 -root", "output": "str", "x": 1638.752067565918, "y": 4280.54296875, "wires": [ [ "e1ed4c7c.5f433" ] ] }, { "id": "7aaa8c05.fb2704", "type": "template", "z": "a564595f.642818", "name": "Generate Autostart Text", "field": "payload", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "@lxpanel --profile LXDE-pi\n@pcmanfm --desktop --profile LXDE-pi\n@chromium-browser file:///home/pi/Desktop/tiltpi.html --start-fullscreen --incognito\n@xset s noblank\n@xset s noexpose\n@xset s off\n@xset -dpms\n@unclutter -idle 0.5 -root", "output": "str", "x": 1643.880859375, "y": 4335.375, "wires": [ [ "e1ed4c7c.5f433" ] ] }, { "id": "ac83e2cb.70f6f", "type": "ui_toast", "z": "a564595f.642818", "position": "top right", "displayTime": "3", "highlight": "", "outputs": 0, "ok": "OK", "cancel": "", "topic": "Alert", "name": "Restart Needed", "x": 2048.6290283203125, "y": 4251.371091842651, "wires": [] }, { "id": "65309d6f.39bdc4", "type": "change", "z": "a564595f.642818", "name": "Restart", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Restart Needed", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1860.6249961853027, "y": 4242.537107467651, "wires": [ [ "ac83e2cb.70f6f" ] ] }, { "id": "e1ed4c7c.5f433", "type": "file", "z": "a564595f.642818", "name": "Overwrite Autotstart", "filename": "/home/pi/autostart", "appendNewline": false, "createDir": false, "overwriteFile": "true", "x": 1933.2501182556152, "y": 4311.220702171326, "wires": [] }, { "id": "37fe8b20.e18ef4", "type": "exec", "z": "a564595f.642818", "command": "sudo mv ~/autostart /etc/xdg/lxsession//LXDE-pi/autostart", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "Update File", "x": 1612.6289291381836, "y": 4413.177800178528, "wires": [ [ "b8e24a29.8f4518" ], [ "b8e24a29.8f4518" ], [] ] }, { "id": "b8e24a29.8f4518", "type": "debug", "z": "a564595f.642818", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 1822.630859375, "y": 4396.576171875, "wires": [] }, { "id": "ff8b6e4d.02aeb", "type": "ui_dropdown", "z": "a564595f.642818", "name": "Timeout Dropdown", "label": "Screen Auto Off", "tooltip": "", "place": "Select Time Out", "group": "7e458eda.984cd", "order": 1, "width": 0, "height": 0, "passthru": true, "options": [ { "label": "Never", "value": 0, "type": "num" }, { "label": "1 minute", "value": 60, "type": "num" }, { "label": "10 minutes", "value": 600, "type": "num" }, { "label": "2 hours", "value": 7200, "type": "num" }, { "label": "8 hours", "value": 28800, "type": "num" }, { "label": "16 hours", "value": "57600", "type": "str" } ], "payload": "", "topic": "", "x": 1185, "y": 4319, "wires": [ [ "caa6b4c2.3751c8", "e3391916.895fa8" ] ] }, { "id": "caa6b4c2.3751c8", "type": "trigger", "z": "a564595f.642818", "op1": "", "op2": "", "op1type": "nul", "op2type": "payl", "duration": "1", "extend": true, "units": "s", "reset": "", "bytopic": "all", "name": "message control", "x": 1394, "y": 4388, "wires": [ [ "37fe8b20.e18ef4", "65309d6f.39bdc4" ] ] }, { "id": "e3391916.895fa8", "type": "switch", "z": "a564595f.642818", "name": "Never Case", "property": "payload", "propertyType": "msg", "rules": [ { "t": "gt", "v": "0", "vt": "num" }, { "t": "eq", "v": "0", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1388.7558822631836, "y": 4305.5352210998535, "wires": [ [ "ffa943f2.ecd36" ], [ "7aaa8c05.fb2704" ] ] }, { "id": "d9b0a4ac.d01fc8", "type": "inject", "z": "a564595f.642818", "name": "Check for WPA Supplicant", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": true, "onceDelay": "", "x": 160, "y": 4880, "wires": [ [ "38b78449.58c06c" ] ] }, { "id": "38b78449.58c06c", "type": "file in", "z": "a564595f.642818", "name": "", "filename": "/boot/firmware/wpa_supplicant.conf", "format": "lines", "chunk": false, "sendError": false, "x": 450, "y": 4880, "wires": [ [ "2e5e0c4c.5681d4" ] ] }, { "id": "fbba8479.0d5688", "type": "exec", "z": "a564595f.642818", "command": "sudo raspi-config nonint do_wifi_ssid_passphrase", "addpay": true, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "Set WiFi Cred", "x": 1120, "y": 4860, "wires": [ [], [], [ "66504390.89585c", "480f27a4.8cdbc8" ] ] }, { "id": "2e5e0c4c.5681d4", "type": "function", "z": "a564595f.642818", "name": "process wpa_supplicant.conf", "func": "if (msg.payload.indexOf('ssid') > -1){\n msg.payload = msg.payload.split('=')[1];\n context.set('ssid', msg.payload);\n}\nelse if (msg.payload.indexOf('psk') > -1) {\n msg.payload = msg.payload.split('=')[1];\n msg.payload = [context.get('ssid')||'ssid-not-specified', msg.payload];\n msg.payload = msg.payload[0] + ' ' + msg.payload[1] + ' 0 0';\n return msg;\n}", "outputs": 1, "noerr": 0, "x": 760, "y": 4880, "wires": [ [ "66504390.89585c", "fbba8479.0d5688" ] ] }, { "id": "66504390.89585c", "type": "debug", "z": "a564595f.642818", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 1670, "y": 4960, "wires": [] }, { "id": "cd3bfaef.fab628", "type": "exec", "z": "a564595f.642818", "command": "sudo rm /boot/firmware/wpa_supplicant.conf", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "oldrc": false, "name": "Remove Config File", "x": 1530, "y": 4840, "wires": [ [], [], [ "66504390.89585c" ] ] }, { "id": "480f27a4.8cdbc8", "type": "switch", "z": "a564595f.642818", "name": "check success", "property": "payload.code", "propertyType": "msg", "rules": [ { "t": "eq", "v": "0", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 1340, "y": 4840, "wires": [ [ "cd3bfaef.fab628" ] ] } ]