Skip to content

Instantly share code, notes, and snippets.

@noahbaron
Last active April 3, 2018 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noahbaron/0cc3b1d4f7e159800c01c650c30752ae to your computer and use it in GitHub Desktop.
Save noahbaron/0cc3b1d4f7e159800c01c650c30752ae to your computer and use it in GitHub Desktop.
Tilt Pi

Uses bluetooth to scan for Tilt hydrometers (http://tilthydrometer.com) and report data in a dashboard and log data to the cloud and locally.

[
{
"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": "Set SG Calibration Points (SG only)",
"tab": "75f710f5.16d2e",
"order": 2,
"disp": true,
"width": "6"
},
{
"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": "Calibrate",
"tab": "75f710f5.16d2e",
"order": 1,
"disp": true,
"width": "6"
},
{
"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 v.2.1)",
"tab": "c9c26b4a.4cde78",
"order": 4,
"disp": true,
"width": "6"
},
{
"id": "6529e313.74108c",
"type": "ui_tab",
"z": "",
"name": "Logging",
"icon": "fa-line-chart",
"order": 2
},
{
"id": "4ede131f.f2e09c",
"type": "ui_tab",
"z": "",
"name": "Tilt Pi",
"icon": "fa-tachometer",
"order": 1
},
{
"id": "75f710f5.16d2e",
"type": "ui_tab",
"z": "",
"name": "Calibration",
"icon": "fa-bullseye",
"order": 3
},
{
"id": "c9c26b4a.4cde78",
"type": "ui_tab",
"z": "",
"name": "System",
"icon": "fa-clock-o",
"order": 4
},
{
"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": "#666666",
"edited": false
},
"widget-borderColor": {
"value": "#333333",
"edited": false
},
"base-font": {
"value": "Tahoma,Geneva,sans-serif"
}
}
},
"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": "Set Temp. Calibration Points",
"tab": "75f710f5.16d2e",
"order": 4,
"disp": true,
"width": "6"
},
{
"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": 5,
"disp": false,
"width": "6"
},
{
"id": "2f8a7619.951f3a",
"type": "ui_group",
"z": "",
"name": "Filter Tilt by Signal Strength",
"tab": "c9c26b4a.4cde78",
"order": 3,
"disp": true,
"width": "6"
},
{
"id": "822d1243.fc995",
"type": "ui_link",
"z": "",
"name": "Tilt Shop",
"link": "http://tilthydrometer.com",
"icon": "open_in_browser",
"target": "newtab",
"order": 5
},
{
"id": "45fc2eae.52e02",
"type": "scanBeacon",
"z": "a564595f.642818",
"name": "Tilt Scan",
"beacon_uuid": "",
"beacon_major": "",
"beacon_minor": "",
"x": 372.00004959106445,
"y": 124.00001430511475,
"wires": [
[
"8dc4fe46.fc364"
]
]
},
{
"id": "f42fdaab.48a078",
"type": "inject",
"z": "a564595f.642818",
"name": "Start",
"topic": "",
"payload": "on",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": true,
"x": 79.00001525878906,
"y": 200.00000381469727,
"wires": [
[
"b42102fe.e4abd",
"c0f36d.ab686c9"
]
]
},
{
"id": "8dc4fe46.fc364",
"type": "json",
"z": "a564595f.642818",
"name": "json",
"pretty": false,
"x": 498.0000114440918,
"y": 125.00001239776611,
"wires": [
[
"d504d607.384f48"
]
]
},
{
"id": "2836e0e1.4ea9c",
"type": "http request",
"z": "a564595f.642818",
"name": "Cloud Service",
"method": "POST",
"ret": "obj",
"url": "",
"tls": "",
"x": 3207.5,
"y": 117.5,
"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": 896.2778701782227,
"y": 130.5000057220459,
"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",
"outputs": 1,
"x": 746.5001220703125,
"y": 130.00000858306885,
"wires": [
[
"7f2f1fbf.e1098"
]
]
},
{
"id": "656f0cf9.e79cd4",
"type": "ui_text_input",
"z": "a564595f.642818",
"name": "Beer Name",
"label": "Set Beer Name [use RETURN to set]",
"group": "81394fa6.f9523",
"order": 3,
"width": 0,
"height": 0,
"passthru": false,
"mode": "text",
"delay": "0",
"topic": "",
"x": 3675,
"y": 509,
"wires": [
[
"6040e73e.fa2088"
]
]
},
{
"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\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": 3897,
"y": 508,
"wires": [
[
"2f84bf9f.847b6"
]
]
},
{
"id": "7c18d8fe.188168",
"type": "function",
"z": "a564595f.642818",
"name": "Add Parameters",
"func": "//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}\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');\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1048.666732788086,
"y": 129.6666898727417,
"wires": [
[
"86447ba5.5d5b68",
"b90d01ad.44d08"
]
]
},
{
"id": "1aee8aa4.c92885",
"type": "ui_template",
"z": "a564595f.642818",
"group": "b642e71.9697318",
"name": "1",
"order": 1,
"width": "6",
"height": "6",
"format": "<style>\n .nr-dashboard-template h1 {\n font-size: .875em;\n font-weight: normal;\n margin-top: .1;\n margin-bottom: .1;\n }\n \n .nr-dashboard-template h2 {\n font-size: 3.5em;\n text-indent: .5em;\n margin-top: 0;\n margin-bottom: 0;\n }\n \n h5 {\n font-family:\"Courier New\", Courier, monospace;\n text-align: center;\n font-size: .6em;\n margin-top: .2em;\n margin-bottom: 0;\n }\n \n \n div {\n max-width: 100%;\n }\n \n a:link {\n color: white; \n background-color: transparent; \n text-decoration: none;\n}\n\na:visited {\n color: white;\n background-color: transparent;\n text-decoration: none;\n}\n\n#{{msg.topic}}-div {\n visibility: {{msg.show}};\n } \n</style>\n\n<div id = \"{{msg.topic}}-div\">\n<h1>{{msg.payload.Beer[0]}}</h1>\n<h1><strong>TILT | {{msg.payload.Color}}</strong><span ng-bind-html=\"msg.payload.doclongurl\"></span></h1>\n<div style=\"background: {{msg.payload.Color}};height:40px;width:100%;\"></div>\n<h1>Uncal. SG/Concentration: {{msg.payload.uncalferm}}</h1>\n<h2>{{msg.payload.ferm}}{{msg.payload.fermunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.SG - 0.990)/0.00130}}%;\"></div>\n<h1>Uncal. Temperature: {{msg.payload.displayuncalTemp | number:1}}</h1>\n<h2>{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.Temp - 30) / 1.85}}%;\"></div>\n<h5>{{msg.payload.formatteddate}}</h5>\n<h5>Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm</h5>\n</div>",
"storeOutMessages": true,
"fwdInMessages": true,
"templateScope": "local",
"x": 2417,
"y": 90,
"wires": [
[
"394a5d3d.92fa72",
"1ee5d27c.fa4e8e"
]
]
},
{
"id": "79bac478.35317c",
"type": "ui_template",
"z": "a564595f.642818",
"group": "b914fb40.bc5c78",
"name": "5",
"order": 1,
"width": "6",
"height": "6",
"format": "<!DOCTYPE html>\n<style>\n #{{msg.topic}}-div {\n visibility: {{msg.show}};\n } \n</style>\n<div id = \"{{msg.topic}}-div\">\n<h1>{{msg.payload.Beer[0]}}</h1>\n<h1><strong>TILT | {{msg.payload.Color}}</strong><span ng-bind-html=\"msg.payload.doclongurl\"></span></h1>\n<div style=\"background: {{msg.payload.Color}};height:40px;width:100%;\"></div>\n<h1>Uncal. SG/Concentration: {{msg.payload.uncalferm}}</h1>\n<h2>{{msg.payload.ferm}}{{msg.payload.fermunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.SG - 0.990)/0.00130}}%;\"></div>\n<h1>Uncal. Temperature: {{msg.payload.displayuncalTemp | number:1}}</h1>\n<h2>{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.Temp - 30) / 1.85}}%;\"></div>\n<h5>{{msg.payload.formatteddate}}</h5>\n<h5>Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm</h5>\n</div>",
"storeOutMessages": true,
"fwdInMessages": true,
"templateScope": "local",
"x": 2423,
"y": 257,
"wires": [
[
"1ee5d27c.fa4e8e",
"394a5d3d.92fa72"
]
]
},
{
"id": "2ddd6c1f.7838e4",
"type": "inject",
"z": "a564595f.642818",
"name": "Stop",
"topic": "",
"payload": "off",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"x": 95.00000762939453,
"y": 122.00000190734863,
"wires": [
[
"45fc2eae.52e02"
]
]
},
{
"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": 1623.5,
"y": 62,
"wires": [
[
"5006138a.18932c"
]
]
},
{
"id": "be15eceb.e8738",
"type": "inject",
"z": "a564595f.642818",
"name": "",
"topic": "",
"payload": "storage-1",
"payloadType": "flow",
"repeat": "1",
"crontab": "",
"once": false,
"x": 1816.5,
"y": 76,
"wires": [
[
"9628a72.af07d58"
]
]
},
{
"id": "e0d6a855.d4e018",
"type": "ui_template",
"z": "a564595f.642818",
"group": "4a85df35.41e16",
"name": "6",
"order": 1,
"width": "6",
"height": "6",
"format": "<!DOCTYPE html>\n<style>\n #{{msg.topic}}-div {\n visibility: {{msg.show}};\n } \n</style>\n<div id = \"{{msg.topic}}-div\">\n<h1>{{msg.payload.Beer[0]}}</h1>\n<h1><strong>TILT | {{msg.payload.Color}}</strong><span ng-bind-html=\"msg.payload.doclongurl\"></span></h1>\n<div style=\"background: {{msg.payload.Color}};height:40px;width:100%;\"></div>\n<h1>Uncal. SG/Concentration: {{msg.payload.uncalferm}}</h1>\n<h2>{{msg.payload.ferm}}{{msg.payload.fermunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.SG - 0.990)/0.00130}}%;\"></div>\n<h1>Uncal. Temperature: {{msg.payload.displayuncalTemp | number:1}}</h1>\n<h2>{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.Temp - 30) / 1.85}}%;\"></div>\n<h5>{{msg.payload.formatteddate}}</h5>\n<h5>Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm</h5>\n</div>",
"storeOutMessages": true,
"fwdInMessages": true,
"templateScope": "local",
"x": 2423,
"y": 315,
"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"
}
],
"checkall": "false",
"outputs": 8,
"x": 1426.4443740844727,
"y": 235.88890075683594,
"wires": [
[
"64f10179.474c9"
],
[
"45da85de.0a884c"
],
[
"4c140999.2a7428"
],
[
"561c3f7f.1b8ab"
],
[
"2e45b69e.abf3fa"
],
[
"8803bae2.740958"
],
[
"5ea7f34.5181f0c"
],
[
"eba532a9.2afe3"
]
]
},
{
"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": 1645,
"y": 256,
"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": 1644,
"y": 356,
"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": 1645,
"y": 306,
"wires": [
[]
]
},
{
"id": "2c53503.d97f0b",
"type": "inject",
"z": "a564595f.642818",
"name": "",
"topic": "",
"payload": "storage-5",
"payloadType": "flow",
"repeat": "1",
"crontab": "",
"once": false,
"x": 1827,
"y": 257,
"wires": [
[
"97228e52.47232"
]
]
},
{
"id": "d66a9ebe.70d94",
"type": "inject",
"z": "a564595f.642818",
"name": "",
"topic": "",
"payload": "storage-6",
"payloadType": "flow",
"repeat": "1",
"crontab": "",
"once": false,
"x": 1820,
"y": 303,
"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": 2021.0000190734863,
"y": 64,
"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, SG, Number.MAX_VALUE);\nunCalSGPoints.push(0, Number.MAX_VALUE);\nactualSGPoints.push(0, 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": 1233.2778091430664,
"y": 130.44444465637207,
"wires": [
[
"c4b0f249.af093"
]
]
},
{
"id": "93d9202c.d9c1e",
"type": "ui_dropdown",
"z": "a564595f.642818",
"name": "Logging Dropdown",
"label": "TILT | ",
"place": "Select Tilt Color",
"group": "81394fa6.f9523",
"order": 1,
"width": 0,
"height": 0,
"passthru": true,
"options": [
{
"label": "",
"value": "",
"type": "str"
}
],
"payload": "",
"topic": "",
"x": 911.5000762939453,
"y": 489.0000104904175,
"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){\nvar beerArray = flow.get(color + \"-Beer\")||[\"\",true];\nif (beerArray[1] === true){\n msg.payload = beerArray[0];\n}\nelse {\n msg.payload = beerArray;\n}\nreturn msg;\n}",
"outputs": 1,
"noerr": 0,
"x": 1580,
"y": 500,
"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": 1668.5,
"y": 609,
"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": 1724.5,
"y": 21,
"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 //node.warn(msg.payload.timeStamp - lastPost);\n //node.warn(msg.payload.Color);\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 if (msg.payload.Beer[1] === true){\n msg.payload.Beer = msg.payload.Beer[0];\n }\n flow.set('lastpost-' + msg.payload.Color,msg.payload.timeStamp);\n msg.headers = {};\n msg.headers['content-type'] = 'application/x-www-form-urlencoded; charset=utf-8';\n if (flow.get('cloudURL')[1] === true){\n msg.url = flow.get('cloudURL')[0];\n }\n else{\n msg.url = flow.get('cloudURL-' + msg.payload.Color);\n }\n //node.warn(msg.payload.Color + \" \" + msg.url);\n msg.payload = \"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 msg.cloudwait = \"Contacting Cloud...<br>(allow up to 30 seconds)\";\n return msg;\n}\n}",
"outputs": 1,
"noerr": 0,
"x": 2757.5,
"y": 226,
"wires": [
[
"bac24b5.6a220b8"
]
]
},
{
"id": "edb75c90.8414",
"type": "ui_text_input",
"z": "a564595f.642818",
"name": "Cloud URL",
"label": "Cloud URL [use RETURN to save]",
"group": "19fab5c2.199ffa",
"order": 1,
"width": 0,
"height": 0,
"passthru": false,
"mode": "text",
"delay": "0",
"topic": "",
"x": 1179.5003280639648,
"y": 699.000057220459,
"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": 1313.5,
"y": 773,
"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;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1367.0002326965332,
"y": 694.0000705718994,
"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": 1596.5,
"y": 762,
"wires": [
[
"8dec8962.63e398"
]
]
},
{
"id": "777f1a14.1b3e44",
"type": "function",
"z": "a564595f.642818",
"name": "set Uncal SG Value",
"func": "flow.set('uncalSGpoint',Number(msg.payload).toFixed(3));",
"outputs": 1,
"noerr": 0,
"x": 1829.5,
"y": 839,
"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": 1255.1428833007812,
"y": 468.0000057220459,
"wires": [
[
"971574e0.783ba8",
"df1c3ed0.bd3a9",
"de92b02f.5ebe1",
"5933654f.572e0c"
]
]
},
{
"id": "3eb6f3c4.588d1c",
"type": "function",
"z": "a564595f.642818",
"name": "Get Current SG",
"func": "var 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){\nmsg.payload = msg.payload.uncalSG;\nreturn msg;\n}",
"outputs": 1,
"noerr": 0,
"x": 1340,
"y": 860,
"wires": [
[
"777f1a14.1b3e44",
"ecfbe772.ba4cb8"
]
]
},
{
"id": "84ffe685.150d58",
"type": "function",
"z": "a564595f.642818",
"name": "set Actual SG Value",
"func": "var value = Number(msg.payload);\nflow.set('actualSGpoint',value.toFixed(3));\nmsg.payload = flow.get('colordropdownSelect');\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1400,
"y": 1120,
"wires": [
[
"6c6270ad.ae742"
]
]
},
{
"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": 1631,
"y": 109,
"wires": [
[]
]
},
{
"id": "4dbe6177.1028",
"type": "ui_template",
"z": "a564595f.642818",
"group": "307e2bd0.e69514",
"name": "2",
"order": 1,
"width": "6",
"height": "6",
"format": "<!DOCTYPE html>\n<style>\n #{{msg.topic}}-div {\n visibility: {{msg.show}};\n } \n</style>\n<div id = \"{{msg.topic}}-div\">\n<h1>{{msg.payload.Beer[0]}}</h1>\n<h1><strong>TILT | {{msg.payload.Color}}</strong><span ng-bind-html=\"msg.payload.doclongurl\"></span></h1>\n<div style=\"background: {{msg.payload.Color}};height:40px;width:100%;\"></div>\n<h1>Uncal. SG/Concentration: {{msg.payload.uncalferm}}</h1>\n<h2>{{msg.payload.ferm}}{{msg.payload.fermunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.SG - 0.990)/0.00130}}%;\"></div>\n<h1>Uncal. Temperature: {{msg.payload.displayuncalTemp | number:1}}</h1>\n<h2>{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.Temp - 30) / 1.85}}%;\"></div>\n<h5>{{msg.payload.formatteddate}}</h5>\n<h5>Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm</h5>\n</div>",
"storeOutMessages": true,
"fwdInMessages": true,
"templateScope": "local",
"x": 2418,
"y": 134,
"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": 1630,
"y": 155,
"wires": [
[]
]
},
{
"id": "7c6f1c01.297234",
"type": "ui_template",
"z": "a564595f.642818",
"group": "8de27cf2.dbd6a",
"name": "3",
"order": 1,
"width": "6",
"height": "6",
"format": "<!DOCTYPE html>\n<style>\n #{{msg.topic}}-div {\n visibility: {{msg.show}};\n } \n</style>\n<div id = \"{{msg.topic}}-div\">\n<h1>{{msg.payload.Beer[0]}}</h1>\n<h1><strong>TILT | {{msg.payload.Color}}</strong><span ng-bind-html=\"msg.payload.doclongurl\"></span></h1>\n<div style=\"background: {{msg.payload.Color}};height:40px;width:100%;\"></div>\n<h1>Uncal. SG/Concentration: {{msg.payload.uncalferm}}</h1>\n<h2>{{msg.payload.ferm}}{{msg.payload.fermunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.SG - 0.990)/0.00130}}%;\"></div>\n<h1>Uncal. Temperature: {{msg.payload.displayuncalTemp | number:1}}</h1>\n<h2>{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.Temp - 30) / 1.85}}%;\"></div>\n<h5>{{msg.payload.formatteddate}}</h5>\n<h5>Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm</h5>\n</div>",
"storeOutMessages": true,
"fwdInMessages": true,
"templateScope": "local",
"x": 2417,
"y": 172,
"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,
"x": 1821.5,
"y": 153,
"wires": [
[
"455abe60.6afd4"
]
]
},
{
"id": "e767b4ca.6228c8",
"type": "inject",
"z": "a564595f.642818",
"name": "",
"topic": "",
"payload": "storage-2",
"payloadType": "flow",
"repeat": "1",
"crontab": "",
"once": false,
"x": 1827,
"y": 114,
"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}\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 > 2*60*1000){\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('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": 2181.0000534057617,
"y": 70.00000476837158,
"wires": [
[
"1aee8aa4.c92885"
]
]
},
{
"id": "6c6270ad.ae742",
"type": "function",
"z": "a564595f.642818",
"name": "Add SG Cal Point",
"func": "var color = msg.payload;\nvar uncalSGcalPoint = flow.get('uncalSGpoint')||0;\nvar actualSGcalPoint = flow.get('actualSGpoint')||0;\nvar uncalpointsArray = flow.get('uncalSGpoints-' + color)||[];\nvar actualpointsArray = flow.get('actualSGpoints-' + color)||[];\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);\nvar msg1 = {payload:uncalpointsArray.toString()};\nvar msg2 = {payload:actualpointsArray.toString()};\nreturn [msg1, msg2];",
"outputs": "2",
"noerr": 0,
"x": 1704.5,
"y": 1126,
"wires": [
[
"1be76b3b.e111e5"
],
[
"e29d71bb.f0e81"
]
]
},
{
"id": "63c7bb7c.317274",
"type": "ui_button",
"z": "a564595f.642818",
"name": "",
"group": "6acae0b0.a184",
"order": 5,
"width": 0,
"height": 0,
"passthru": false,
"label": "Clear Calibration",
"color": "",
"bgcolor": "",
"icon": "",
"payload": "colordropdownSelect",
"payloadType": "flow",
"topic": "",
"x": 1472.5,
"y": 1246,
"wires": [
[
"e38fab7c.6f34e8"
]
]
},
{
"id": "e38fab7c.6f34e8",
"type": "function",
"z": "a564595f.642818",
"name": "clear calibration",
"func": "var color = msg.payload;\nvar uncalpointsArray = flow.set('uncalSGpoints-' + color,[]);\nvar actualpointsArray = flow.set('actualSGpoints-' + color,[]);\nmsg.payload = [];\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1684.5,
"y": 1247,
"wires": [
[
"1be76b3b.e111e5",
"e29d71bb.f0e81"
]
]
},
{
"id": "df1c3ed0.bd3a9",
"type": "function",
"z": "a564595f.642818",
"name": "update display",
"func": "var color = flow.get('colordropdownSelect')||\"\";\nvar uncalpointsArray = flow.get('uncalSGpoints-' + color)||[];\nvar actualpointsArray = flow.get('actualSGpoints-' + color)||[];\nvar msg1 = {payload:uncalpointsArray.toString()};\nvar msg2 = {payload:actualpointsArray.toString()};\nreturn [msg1, msg2];",
"outputs": "2",
"noerr": 0,
"x": 1483.5,
"y": 1183,
"wires": [
[
"1be76b3b.e111e5"
],
[
"e29d71bb.f0e81"
]
]
},
{
"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": 2995,
"y": 183,
"wires": [
[
"2836e0e1.4ea9c",
"6cbfa171.d2106"
]
]
},
{
"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": 2019.00004196167,
"y": 106.0000057220459,
"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}\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 > 2*60*1000){\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('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": 2183.0001068115234,
"y": 113.00000047683716,
"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": 2017.000015258789,
"y": 153.00000476837158,
"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}\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 > 2*60*1000){\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('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": 2187.0000534057617,
"y": 158.00001621246338,
"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": 2021.999984741211,
"y": 251.00000190734863,
"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}\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 > 2*60*1000){\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('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": 2198.000102996826,
"y": 255.00001525878906,
"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": 2021.0000686645508,
"y": 300.00002574920654,
"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}\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 > 2*60*1000){\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('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": 2193.9999961853027,
"y": 313.00002670288086,
"wires": [
[
"e0d6a855.d4e018"
]
]
},
{
"id": "dd81e411.1cdd78",
"type": "ui_template",
"z": "a564595f.642818",
"group": "b8d3bbbf.2c9cb8",
"name": "4",
"order": 1,
"width": "6",
"height": "6",
"format": "<!DOCTYPE html>\n<style>\n #{{msg.topic}}-div {\n visibility: {{msg.show}};\n } \n</style>\n<div id = \"{{msg.topic}}-div\">\n<h1>{{msg.payload.Beer[0]}}</h1>\n<h1><strong>TILT | {{msg.payload.Color}}</strong><span ng-bind-html=\"msg.payload.doclongurl\"></span></h1>\n<div style=\"background: {{msg.payload.Color}};height:40px;width:100%;\"></div>\n<h1>Uncal. SG/Concentration: {{msg.payload.uncalferm}}</h1>\n<h2>{{msg.payload.ferm}}{{msg.payload.fermunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.SG - 0.990)/0.00130}}%;\"></div>\n<h1>Uncal. Temperature: {{msg.payload.displayuncalTemp | number:1}}</h1>\n<h2>{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.Temp - 30) / 1.85}}%;\"></div>\n<h5>{{msg.payload.formatteddate}}</h5>\n<h5>Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm</h5>\n</div>",
"storeOutMessages": true,
"fwdInMessages": true,
"templateScope": "local",
"x": 2424,
"y": 216,
"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": 2028.00004196167,
"y": 203.0000057220459,
"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}\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 > 2*60*1000){\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('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": 2189.0000495910645,
"y": 205.00000953674316,
"wires": [
[
"dd81e411.1cdd78"
]
]
},
{
"id": "e2227000.fd309",
"type": "inject",
"z": "a564595f.642818",
"name": "",
"topic": "",
"payload": "storage-4",
"payloadType": "flow",
"repeat": "1",
"crontab": "",
"once": false,
"x": 1813.5,
"y": 207,
"wires": [
[
"29f2062c.9eafea"
]
]
},
{
"id": "228b94fc.188afc",
"type": "ui_template",
"z": "a564595f.642818",
"group": "ab6da67f.a47fa8",
"name": "8",
"order": 1,
"width": "6",
"height": "6",
"format": "<!DOCTYPE html>\n<style>\n #{{msg.topic}}-div {\n visibility: {{msg.show}};\n } \n</style>\n<div id = \"{{msg.topic}}-div\">\n<h1>{{msg.payload.Beer[0]}}</h1>\n<h1><strong>TILT | {{msg.payload.Color}}</strong><span ng-bind-html=\"msg.payload.doclongurl\"></span></h1>\n<div style=\"background: {{msg.payload.Color}};height:40px;width:100%;\"></div>\n<h1>Uncal. SG/Concentration: {{msg.payload.uncalferm}}</h1>\n<h2>{{msg.payload.ferm}}{{msg.payload.fermunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.SG - 0.990)/0.00130}}%;\"></div>\n<h1>Uncal. Temperature: {{msg.payload.displayuncalTemp | number:1}}</h1>\n<h2>{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.Temp - 30) / 1.85}}%;\"></div>\n<h5>{{msg.payload.formatteddate}}</h5>\n<h5>Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm</h5>\n</div>",
"storeOutMessages": true,
"fwdInMessages": true,
"templateScope": "local",
"x": 2429,
"y": 426,
"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": 1816,
"y": 427,
"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": 2027.00004196167,
"y": 421.0000276565552,
"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}\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 > 2*60*1000){\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('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": 2198.0000228881836,
"y": 421.00000762939453,
"wires": [
[
"228b94fc.188afc"
]
]
},
{
"id": "2cbc023f.86f2de",
"type": "ui_template",
"z": "a564595f.642818",
"group": "a510f969.f28538",
"name": "7",
"order": 1,
"width": "6",
"height": "6",
"format": "<!DOCTYPE html>\n<style>\n #{{msg.topic}}-div {\n visibility: {{msg.show}};\n } \n</style>\n<div id = \"{{msg.topic}}-div\">\n<h1>{{msg.payload.Beer[0]}}</h1>\n<h1><strong>TILT | {{msg.payload.Color}}</strong><span ng-bind-html=\"msg.payload.doclongurl\"></span></h1>\n<div style=\"background: {{msg.payload.Color}};height:40px;width:100%;\"></div>\n<h1>Uncal. SG/Concentration: {{msg.payload.uncalferm}}</h1>\n<h2>{{msg.payload.ferm}}{{msg.payload.fermunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.SG - 0.990)/0.00130}}%;\"></div>\n<h1>Uncal. Temperature: {{msg.payload.displayuncalTemp | number:1}}</h1>\n<h2>{{msg.payload.displayTemp | number:1}}{{msg.payload.tempunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.Temp - 30) / 1.85}}%;\"></div>\n<h5>{{msg.payload.formatteddate}}</h5>\n<h5>Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm</h5>\n</div>",
"storeOutMessages": true,
"fwdInMessages": true,
"templateScope": "local",
"x": 2418,
"y": 370,
"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": 2029.00004196167,
"y": 356.00001525878906,
"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}\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 > 2*60*1000){\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('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": 2199.0001068115234,
"y": 360.00000286102295,
"wires": [
[
"2cbc023f.86f2de"
]
]
},
{
"id": "153b404.67792c",
"type": "inject",
"z": "a564595f.642818",
"name": "",
"topic": "",
"payload": "storage-7",
"payloadType": "flow",
"repeat": "1",
"crontab": "",
"once": false,
"x": 1823.5,
"y": 357,
"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": "<!DOCTYPE HTML>\n<style>\n a:link {\n color: white; \n background-color: transparent; \n text-decoration: none;\n}\n\na:visited {\n color: white;\n background-color: transparent;\n text-decoration: none;\n}\n</style>\n<div ng-bind-html=\"'<strong>Cloud Status: </strong>' + msg.cloudwait\"></div>\n<div ng-bind-html=\"msg.payload.result + msg.cloudlink\"></div>\n<div ng-bind-html=\"msg.payload.this\"></div>\n",
"storeOutMessages": false,
"fwdInMessages": true,
"templateScope": "local",
"x": 3502,
"y": 566,
"wires": [
[]
]
},
{
"id": "f14feb76.aebb48",
"type": "function",
"z": "a564595f.642818",
"name": "update name, clear comment",
"func": "if (msg.payload.beername !== undefined){\nif (msg.payload.beername.indexOf(\",\") > -1){\nbeerArray = msg.payload.beername.split(\",\");\n//node.warn(msg.payload.beername[1]);\nflow.set(msg.payload.tiltcolor + \"-Beer\",beerArray);\n//node.warn(flow.get(msg.payload.tiltcolor + \"-Beer\"));\nflow.set(msg.payload.tiltcolor + \"-Comment\",\"\");\nif (msg.payload.doclongurl !== undefined) {\nflow.set(msg.payload.tiltcolor + \"-URL\",'<a href=\"' + msg.payload.doclongurl + '\" target=\"_blank\"> | View Cloud Log</a>');\n}\nmsg.payload = beerArray;\nreturn msg;\n}\n}",
"outputs": 1,
"noerr": 0,
"x": 3555,
"y": 155,
"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": 1869,
"y": 704,
"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": 1641,
"y": 207,
"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": 1645,
"y": 420,
"wires": [
[]
]
},
{
"id": "de92b02f.5ebe1",
"type": "ui_text_input",
"z": "a564595f.642818",
"name": "",
"label": "Comment [use RETURN to send]",
"group": "19fab5c2.199ffa",
"order": 6,
"width": "6",
"height": "2",
"passthru": false,
"mode": "text",
"delay": "0",
"topic": "",
"x": 1337.5,
"y": 605,
"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": 3418,
"y": 414,
"wires": [
[
"df1ac3a9.c4472"
]
]
},
{
"id": "b1836d66.f976c",
"type": "ui_switch",
"z": "a564595f.642818",
"name": "",
"label": "Use Default Cloud URL for All",
"group": "19fab5c2.199ffa",
"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": 706,
"y": 688.0000095367432,
"wires": [
[
"d599e3c9.1ae09"
]
]
},
{
"id": "88a2c98f.f38b08",
"type": "ui_slider",
"z": "a564595f.642818",
"name": "",
"label": "Time Interval",
"group": "19fab5c2.199ffa",
"order": 4,
"width": 0,
"height": 0,
"passthru": true,
"topic": "",
"min": "5",
"max": "60",
"step": "5",
"x": 1584.5,
"y": 798,
"wires": [
[
"e95c8a86.0f73c8",
"1a5d2031.88af3"
]
]
},
{
"id": "e95c8a86.0f73c8",
"type": "ui_text",
"z": "a564595f.642818",
"group": "19fab5c2.199ffa",
"order": 5,
"width": 0,
"height": 0,
"name": "",
"label": "Minutes:",
"format": "{{msg.payload}}",
"layout": "row-left",
"x": 1980,
"y": 800,
"wires": []
},
{
"id": "1a5d2031.88af3",
"type": "function",
"z": "a564595f.642818",
"name": "Save Interval",
"func": "flow.set('loggingInterval',msg.payload);",
"outputs": 1,
"noerr": 0,
"x": 1848,
"y": 759,
"wires": [
[]
]
},
{
"id": "2f5685a6.76e34a",
"type": "file",
"z": "a564595f.642818",
"name": "",
"filename": "/home/pi/log.csv",
"appendNewline": true,
"createDir": false,
"overwriteFile": "false",
"x": 3129.5007934570312,
"y": 331.00007247924805,
"wires": []
},
{
"id": "6af4a20b.f5f3cc",
"type": "http response",
"z": "a564595f.642818",
"name": "Show Local Data",
"x": 3140.5,
"y": 375,
"wires": []
},
{
"id": "dd2bec42.f4069",
"type": "http in",
"z": "a564595f.642818",
"name": "",
"url": "/log.csv",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 2740.5,
"y": 374,
"wires": [
[
"898ef56a.365648"
]
]
},
{
"id": "898ef56a.365648",
"type": "file in",
"z": "a564595f.642818",
"name": "",
"filename": "/home/pi/log.csv",
"format": "",
"sendError": false,
"x": 2931.5,
"y": 372,
"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": 1570,
"y": 980,
"wires": []
},
{
"id": "7b1370e2.6e8c9",
"type": "ui_slider",
"z": "a564595f.642818",
"name": "",
"label": "Time Interval",
"group": "82607108.c5be8",
"order": 2,
"width": 0,
"height": 0,
"passthru": true,
"topic": "",
"min": ".1",
"max": "60",
"step": ".1",
"x": 1350,
"y": 960,
"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": 1550,
"y": 940,
"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.measuredPower;\n msg.payload.measuredPower = 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.measuredPower;\n return msg;\n}\n}",
"outputs": 1,
"noerr": 0,
"x": 2740,
"y": 280,
"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);\nmsg.topic = \"TILT | \" + color;\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": 1769,
"y": 1036,
"wires": [
[
"cd2573a4.64137"
]
]
},
{
"id": "c7601414.73cf68",
"type": "ui_switch",
"z": "a564595f.642818",
"name": "",
"label": "Start Logging to Tilt Pi",
"group": "82607108.c5be8",
"order": 1,
"width": 0,
"height": 0,
"passthru": false,
"decouple": "false",
"topic": "",
"style": "",
"onvalue": "true",
"onvalueType": "bool",
"onicon": "",
"oncolor": "",
"offvalue": "false",
"offvalueType": "bool",
"officon": "",
"offcolor": "",
"x": 1484,
"y": 1033,
"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": 1991,
"y": 1035,
"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": 3512.5,
"y": 291,
"wires": []
},
{
"id": "dcc41bde.fc7208",
"type": "exec",
"z": "a564595f.642818",
"command": "stat",
"addpay": false,
"append": "log.csv",
"useSpawn": "true",
"timer": "5",
"oldrc": false,
"name": "",
"x": 2930,
"y": 260,
"wires": [
[
"5c5d0dab.293cc4"
],
[],
[]
]
},
{
"id": "5c5d0dab.293cc4",
"type": "split",
"z": "a564595f.642818",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": "1",
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 3075,
"y": 253,
"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": 3218,
"y": 286,
"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": 3363.5,
"y": 290,
"wires": [
[
"644a5410.3ea0bc"
]
]
},
{
"id": "9b51bae9.bed728",
"type": "file",
"z": "a564595f.642818",
"name": "",
"filename": "/home/pi/log.csv",
"appendNewline": true,
"createDir": false,
"overwriteFile": "true",
"x": 2976.5,
"y": 474,
"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",
"color": "white",
"bgcolor": "red",
"icon": "",
"payload": "Time,Timepoint,Temp,SG,Beer,Color,Comment,RSSI,Uptime",
"payloadType": "str",
"topic": "",
"x": 2727.5,
"y": 477,
"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": 927.7778167724609,
"y": 401.6666793823242,
"wires": [
[
"6aa75852.1e3068"
]
]
},
{
"id": "d9ea777.f3c9388",
"type": "ui_text_input",
"z": "a564595f.642818",
"name": "",
"label": "Actual [use RETURN to set]",
"group": "6acae0b0.a184",
"order": 2,
"width": 0,
"height": 0,
"passthru": true,
"mode": "text",
"delay": "0",
"topic": "",
"x": 1089,
"y": 1117,
"wires": [
[
"84ffe685.150d58"
]
]
},
{
"id": "ecfbe772.ba4cb8",
"type": "ui_text",
"z": "a564595f.642818",
"group": "6acae0b0.a184",
"order": 1,
"width": 0,
"height": 0,
"name": "",
"label": "Uncal. SG",
"format": "{{msg.payload}}",
"layout": "row-spread",
"x": 1605,
"y": 865,
"wires": []
},
{
"id": "9bdc1db3.4ceaa",
"type": "inject",
"z": "a564595f.642818",
"name": "Get Color Selection",
"topic": "",
"payload": "colordropdownSelect",
"payloadType": "flow",
"repeat": "2",
"crontab": "",
"once": false,
"x": 1096,
"y": 878,
"wires": [
[
"3eb6f3c4.588d1c",
"d6de2020.56974"
]
]
},
{
"id": "1be76b3b.e111e5",
"type": "ui_text_input",
"z": "a564595f.642818",
"name": "",
"label": "Uncalibrated Points [use RETURN to set]",
"group": "6acae0b0.a184",
"order": 3,
"width": 0,
"height": 0,
"passthru": false,
"mode": "text",
"delay": "0",
"topic": "",
"x": 2086,
"y": 1166,
"wires": [
[
"88f0f33d.110ab"
]
]
},
{
"id": "e29d71bb.f0e81",
"type": "ui_text_input",
"z": "a564595f.642818",
"name": "",
"label": "Actual Points [use RETURN to set]",
"group": "6acae0b0.a184",
"order": 4,
"width": 0,
"height": 0,
"passthru": false,
"mode": "text",
"delay": "0",
"topic": "",
"x": 2078,
"y": 1233,
"wires": [
[
"b36a946.3813e68"
]
]
},
{
"id": "f9e2fc12.8340c",
"type": "inject",
"z": "a564595f.642818",
"name": "Logging Interval",
"topic": "",
"payload": "loggingInterval",
"payloadType": "flow",
"repeat": "15",
"crontab": "",
"once": false,
"x": 1263.0002059936523,
"y": 815.0000438690186,
"wires": [
[
"88a2c98f.f38b08"
]
]
},
{
"id": "b13cb5ba.f355b8",
"type": "exec",
"z": "a564595f.642818",
"command": "sudo reboot",
"addpay": false,
"append": "",
"useSpawn": false,
"timer": "",
"name": "Reboot",
"x": 460,
"y": 2140,
"wires": [
[
"2a36a03c.47d1f"
],
[],
[]
]
},
{
"id": "a85e96c5.56cc58",
"type": "ui_button",
"z": "a564595f.642818",
"name": "",
"group": "7e458eda.984cd",
"order": 2,
"width": 0,
"height": 0,
"passthru": false,
"label": "Restart",
"color": "",
"bgcolor": "",
"icon": "fa-refresh",
"payload": "now",
"payloadType": "str",
"topic": "",
"x": 220,
"y": 2137,
"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": 686,
"y": 2131,
"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": 610,
"y": 1600,
"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": 1062,
"y": 1594,
"wires": [
[
"a6b43763.a12aa8",
"90a37ef8.2317d"
]
]
},
{
"id": "f49b2576.99e1d8",
"type": "inject",
"z": "a564595f.642818",
"name": "",
"topic": "",
"payload": "",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": true,
"x": 55,
"y": 1597,
"wires": [
[
"9fa076ac.17f568",
"a1357f50.ee57a"
]
]
},
{
"id": "a1357f50.ee57a",
"type": "file in",
"z": "a564595f.642818",
"name": "",
"filename": "/etc/timezone",
"format": "utf8",
"sendError": true,
"x": 616,
"y": 1693,
"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": 823,
"y": 1692,
"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": 619,
"y": 1758,
"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": 840,
"y": 1760,
"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": 1473,
"y": 1796,
"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": 1280,
"y": 1720,
"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": 1450,
"y": 1746,
"wires": []
},
{
"id": "1dc3fc9e.e1f193",
"type": "ui_text_input",
"z": "a564595f.642818",
"name": "",
"label": "GMAIL email [use RETURN to start log]",
"group": "81394fa6.f9523",
"order": 4,
"width": 0,
"height": 0,
"passthru": false,
"mode": "text",
"delay": "0",
"topic": "",
"x": 585,
"y": 782,
"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": 894.5,
"y": 823,
"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": "hostname",
"x": 320,
"y": 1880,
"wires": [
[
"deb9c4fc.20c098"
],
[],
[]
]
},
{
"id": "58a4e2b2.11320c",
"type": "inject",
"z": "a564595f.642818",
"name": "get ip",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": true,
"x": 131,
"y": 1879.5,
"wires": [
[
"7496a044.dd719"
]
]
},
{
"id": "a4a5a7ed.d59958",
"type": "ui_text",
"z": "a564595f.642818",
"group": "c8854cd2.f1773",
"order": 2,
"width": 0,
"height": 0,
"name": "",
"label": "Tilt Pi Local Address",
"format": "{{msg.payload}}",
"layout": "col-center",
"x": 868,
"y": 1885,
"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": "false",
"topic": "",
"style": "",
"onvalue": "°C",
"onvalueType": "str",
"onicon": "",
"oncolor": "",
"offvalue": "°F",
"offvalueType": "str",
"officon": "",
"offcolor": "",
"x": 1914.0002632141113,
"y": 1670.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": 2167.99991607666,
"y": 1635.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": 463,
"y": 2063,
"wires": [
[
"f2bdbc36.5644d"
],
[],
[]
]
},
{
"id": "2bcbe8c9.eefe28",
"type": "ui_button",
"z": "a564595f.642818",
"name": "",
"group": "7e458eda.984cd",
"order": 3,
"width": 0,
"height": 0,
"passthru": false,
"label": "Shutdown",
"color": "",
"bgcolor": "",
"icon": "fa-power-off",
"payload": "now",
"payloadType": "str",
"topic": "",
"x": 223,
"y": 2060,
"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": 679,
"y": 2054,
"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": 544.5,
"y": 942,
"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": 650.5,
"y": 852,
"wires": [
[
"510190df.5876c"
]
]
},
{
"id": "13f0085a.0d5178",
"type": "exec",
"z": "a564595f.642818",
"command": "wget -O /home/pi/flow.json https://raw.githubusercontent.com/baronbrew/TILTpi/master/flow.json",
"addpay": false,
"append": "",
"useSpawn": "true",
"timer": "",
"oldrc": false,
"name": "Download Update from GitHub",
"x": 363,
"y": 1991,
"wires": [
[],
[],
[
"ef8b11d3.ed055"
]
]
},
{
"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": "https://raw.githubusercontent.com/baronbrew/TILTpi/master/flow.json",
"payloadType": "str",
"topic": "",
"x": 112,
"y": 1993,
"wires": [
[
"13f0085a.0d5178"
]
]
},
{
"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": 647.5,
"y": 1996,
"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": 873,
"y": 1996,
"wires": [
[],
[],
[]
]
},
{
"id": "88f0f33d.110ab",
"type": "function",
"z": "a564595f.642818",
"name": "Set Uncal Calibration Array",
"func": "var color = flow.get('colordropdownSelect')||\"\";\nvar uncalArray = msg.payload.split(\",\");\nflow.set('uncalSGpoints-' + color,uncalArray);",
"outputs": 1,
"noerr": 0,
"x": 2389.5,
"y": 1163,
"wires": [
[]
]
},
{
"id": "b36a946.3813e68",
"type": "function",
"z": "a564595f.642818",
"name": "Set Actual Calibration Array",
"func": "var color = flow.get('colordropdownSelect')||\"\";\nvar uncalArray = msg.payload.split(\",\");\nflow.set('actualSGpoints-' + color,uncalArray);",
"outputs": 1,
"noerr": 0,
"x": 2388,
"y": 1223,
"wires": [
[]
]
},
{
"id": "640f9404.72d27c",
"type": "file in",
"z": "a564595f.642818",
"name": "cloud_log_color",
"filename": "",
"format": "utf8",
"sendError": false,
"x": 2580.5,
"y": 21,
"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": 2686.5,
"y": 132,
"wires": [
[
"cdf7a5f1.e44358"
],
[
"da1dd72.c86df28"
]
]
},
{
"id": "84c05058.79f0d",
"type": "inject",
"z": "a564595f.642818",
"name": "",
"topic": "",
"payload": "boot",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": true,
"x": 1974,
"y": 20,
"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": 3120,
"y": 27.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": 967.0000381469727,
"y": 690.0000305175781,
"wires": [
[
"edb75c90.8414"
]
]
},
{
"id": "ecffbfac.2fc53",
"type": "ui_toast",
"z": "a564595f.642818",
"position": "top right",
"displayTime": "3",
"highlight": "",
"outputs": 0,
"ok": "OK",
"cancel": "",
"topic": "",
"name": "Cloud URL Status",
"x": 1577.5000076293945,
"y": 688.0000019073486,
"wires": []
},
{
"id": "5b24e16f.7eab",
"type": "http in",
"z": "a564595f.642818",
"name": "",
"url": "/data/:color",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 2065.75057220459,
"y": 552.57643699646,
"wires": [
[
"dc9ecd32.25037"
]
]
},
{
"id": "bdb5caad.d3dba8",
"type": "file in",
"z": "a564595f.642818",
"name": "",
"filename": "",
"format": "utf8",
"chunk": false,
"sendError": false,
"x": 2419.9690017700195,
"y": 557.607741355896,
"wires": [
[
"7b788221.059a2c"
]
]
},
{
"id": "60f15c0d.04a0b4",
"type": "http response",
"z": "a564595f.642818",
"name": "",
"statusCode": "",
"headers": {
"Access-Control-Allow-Origin": "*"
},
"x": 2711.861789703369,
"y": 557.6458740234375,
"wires": []
},
{
"id": "cdc2a491.47b908",
"type": "file in",
"z": "a564595f.642818",
"name": "Tilt Color",
"filename": "",
"format": "utf8",
"chunk": false,
"sendError": false,
"x": 608,
"y": 276,
"wires": [
[
"543d2dd7.2fe974"
]
]
},
{
"id": "b42102fe.e4abd",
"type": "function",
"z": "a564595f.642818",
"name": "Send Tilt Colors",
"func": "//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:\"/home/pi/\" + colors[i] + \".json\"});\n}\n",
"outputs": 1,
"noerr": 0,
"x": 285,
"y": 279,
"wires": [
[
"2c73dfce.b79cc"
]
]
},
{
"id": "543d2dd7.2fe974",
"type": "json",
"z": "a564595f.642818",
"name": "",
"pretty": false,
"x": 739,
"y": 276,
"wires": [
[
"a2f14292.5b0f3"
]
]
},
{
"id": "a2f14292.5b0f3",
"type": "function",
"z": "a564595f.642818",
"name": "Restore Tilt Settings",
"func": "flow.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);\nmsg.payload = \"on\";\nreturn msg;",
"outputs": "1",
"noerr": 0,
"x": 914,
"y": 277,
"wires": [
[
"45fc2eae.52e02"
]
]
},
{
"id": "be46656.b2ed298",
"type": "inject",
"z": "a564595f.642818",
"name": "Check Active Tilts",
"topic": "",
"payload": "options",
"payloadType": "flow",
"repeat": "4",
"crontab": "",
"once": false,
"x": 330,
"y": 460,
"wires": [
[
"423412c2.1b104c"
]
]
},
{
"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": 463.74999237060547,
"y": 683.9097318649292,
"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": 4135.181529998779,
"y": 507.5486431121826,
"wires": []
},
{
"id": "982240ba.f2f5",
"type": "inject",
"z": "a564595f.642818",
"name": "Clear Responses",
"topic": "",
"payload": "{\"result\":\"Waiting for next time point...\"}",
"payloadType": "json",
"repeat": "20",
"crontab": "",
"once": false,
"x": 3210.2008361816406,
"y": 566.4970045089722,
"wires": [
[
"df1ac3a9.c4472"
]
]
},
{
"id": "e56d18b9.6cbc88",
"type": "file",
"z": "a564595f.642818",
"name": "Backup Tilt Specific Settings",
"filename": "",
"appendNewline": false,
"createDir": false,
"overwriteFile": "true",
"x": 1429.0565185546875,
"y": 20,
"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": 2255.3934783935547,
"y": 555.4592838287354,
"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": 1180.746826171875,
"y": 32.618064880371094,
"wires": [
[
"c6fd016d.ab4a7",
"e56d18b9.6cbc88"
]
]
},
{
"id": "7b788221.059a2c",
"type": "json",
"z": "a564595f.642818",
"name": "",
"pretty": false,
"x": 2558.406379699707,
"y": 557.3056106567383,
"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;\nmsg.payload = flow.get('colordropdownSelect')||msg.options[0];\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 570,
"y": 460,
"wires": [
[
"93d9202c.d9c1e",
"b418ce11.8981a"
]
]
},
{
"id": "f0097da4.edc54",
"type": "function",
"z": "a564595f.642818",
"name": "set Actual Temp Value",
"func": "var value = Number(msg.payload);\nflow.set('actualTemppoint',value.toFixed(1));\nmsg.payload = flow.get('colordropdownSelect');\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1400,
"y": 1340,
"wires": [
[
"a9cf2c6b.4d7f9"
]
]
},
{
"id": "a9cf2c6b.4d7f9",
"type": "function",
"z": "a564595f.642818",
"name": "Add Temp Cal Point",
"func": "var color = msg.payload;\nvar uncalTempcalPoint = flow.get('uncalTemppoint')||0;\nvar actualTempcalPoint = flow.get('actualTemppoint')||0;\nvar uncalpointsArray = flow.get('uncalTemppoints-' + color)||[];\nvar actualpointsArray = flow.get('actualTemppoints-' + color)||[];\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);\nvar msg1 = {payload:uncalpointsArray.toString()};\nvar msg2 = {payload:actualpointsArray.toString()};\nreturn [msg1, msg2];",
"outputs": "2",
"noerr": 0,
"x": 1714.5,
"y": 1346,
"wires": [
[
"10bda9c0.3dcf66"
],
[
"d521fc1b.3653a"
]
]
},
{
"id": "17e6c4c8.0d7e1b",
"type": "ui_button",
"z": "a564595f.642818",
"name": "",
"group": "c12bcb12.dbd0d8",
"order": 5,
"width": 0,
"height": 0,
"passthru": false,
"label": "Clear Calibration",
"color": "",
"bgcolor": "",
"icon": "",
"payload": "colordropdownSelect",
"payloadType": "flow",
"topic": "",
"x": 1472.5,
"y": 1466,
"wires": [
[
"721c929.10edb6c"
]
]
},
{
"id": "721c929.10edb6c",
"type": "function",
"z": "a564595f.642818",
"name": "clear calibration",
"func": "var color = msg.payload;\nvar uncalpointsArray = flow.set('uncalTemppoints-' + color,[]);\nvar actualpointsArray = flow.set('actualTemppoints-' + color,[]);\nmsg.payload = [];\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1684.5,
"y": 1467,
"wires": [
[
"10bda9c0.3dcf66",
"d521fc1b.3653a"
]
]
},
{
"id": "5933654f.572e0c",
"type": "function",
"z": "a564595f.642818",
"name": "update display",
"func": "var color = flow.get('colordropdownSelect')||\"\";\nvar uncalpointsArray = flow.get('uncalTemppoints-' + color)||[];\nvar actualpointsArray = flow.get('actualTemppoints-' + color)||[];\nvar msg1 = {payload:uncalpointsArray.toString()};\nvar msg2 = {payload:actualpointsArray.toString()};\nreturn [msg1, msg2];",
"outputs": "2",
"noerr": 0,
"x": 1483.5,
"y": 1403,
"wires": [
[
"10bda9c0.3dcf66"
],
[
"d521fc1b.3653a"
]
]
},
{
"id": "4b7531fb.46829",
"type": "ui_text_input",
"z": "a564595f.642818",
"name": "",
"label": "Actual [use RETURN to set]",
"group": "c12bcb12.dbd0d8",
"order": 2,
"width": 0,
"height": 0,
"passthru": true,
"mode": "text",
"delay": "0",
"topic": "",
"x": 1089,
"y": 1337,
"wires": [
[
"f0097da4.edc54"
]
]
},
{
"id": "10bda9c0.3dcf66",
"type": "ui_text_input",
"z": "a564595f.642818",
"name": "",
"label": "Uncalibrated Points [use RETURN to set]",
"group": "c12bcb12.dbd0d8",
"order": 3,
"width": 0,
"height": 0,
"passthru": false,
"mode": "text",
"delay": "0",
"topic": "",
"x": 2086,
"y": 1386,
"wires": [
[
"a5ca25c7.fd8c98"
]
]
},
{
"id": "d521fc1b.3653a",
"type": "ui_text_input",
"z": "a564595f.642818",
"name": "",
"label": "Actual Points [use RETURN to set]",
"group": "c12bcb12.dbd0d8",
"order": 4,
"width": 0,
"height": 0,
"passthru": false,
"mode": "text",
"delay": "0",
"topic": "",
"x": 2078,
"y": 1453,
"wires": [
[
"19ca9195.29599e"
]
]
},
{
"id": "a5ca25c7.fd8c98",
"type": "function",
"z": "a564595f.642818",
"name": "Set Uncal Calibration Array",
"func": "var color = flow.get('colordropdownSelect')||\"\";\nvar uncalArray = msg.payload.split(\",\");\nflow.set('uncalTemppoints-' + color,uncalArray);",
"outputs": 1,
"noerr": 0,
"x": 2389.5,
"y": 1383,
"wires": [
[]
]
},
{
"id": "19ca9195.29599e",
"type": "function",
"z": "a564595f.642818",
"name": "Set Actual Calibration Array",
"func": "var color = flow.get('colordropdownSelect')||\"\";\nvar uncalArray = msg.payload.split(\",\");\nflow.set('actualTemppoints-' + color,uncalArray);",
"outputs": 1,
"noerr": 0,
"x": 2388,
"y": 1443,
"wires": [
[]
]
},
{
"id": "d6de2020.56974",
"type": "function",
"z": "a564595f.642818",
"name": "Get Current Temp",
"func": "var 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){\nmsg.payload = msg.payload.displayuncalTemp;\nreturn msg;\n}",
"outputs": 1,
"noerr": 0,
"x": 1350,
"y": 900,
"wires": [
[
"854dec23.fee5f",
"67b168fa.e90078"
]
]
},
{
"id": "854dec23.fee5f",
"type": "ui_text",
"z": "a564595f.642818",
"group": "c12bcb12.dbd0d8",
"order": 1,
"width": 0,
"height": 0,
"name": "",
"label": "Uncal. Temp.",
"format": "{{msg.payload | number:1}}",
"layout": "row-spread",
"x": 1610,
"y": 900,
"wires": []
},
{
"id": "67b168fa.e90078",
"type": "function",
"z": "a564595f.642818",
"name": "set Uncal Temp Value",
"func": "flow.set('uncalTemppoint',Number(msg.payload).toFixed(1));",
"outputs": 1,
"noerr": 0,
"x": 1840,
"y": 940,
"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": 2204,
"y": 1803.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": "false",
"topic": "",
"style": "",
"onvalue": "plato",
"onvalueType": "str",
"onicon": "",
"oncolor": "",
"offvalue": "false",
"offvalueType": "bool",
"officon": "",
"offcolor": "",
"x": 2025.000690460205,
"y": 1892.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": "false",
"topic": "",
"style": "",
"onvalue": "brix",
"onvalueType": "str",
"onicon": "",
"oncolor": "",
"offvalue": "false",
"offvalueType": "bool",
"officon": "",
"offcolor": "",
"x": 2029.7503128051758,
"y": 1979.7501392364502,
"wires": [
[
"15afce7c.5604d2"
]
]
},
{
"id": "2bb152f1.d1cbee",
"type": "inject",
"z": "a564595f.642818",
"name": "Local Logging Interval",
"topic": "",
"payload": "localloggingInterval",
"payloadType": "flow",
"repeat": "15",
"crontab": "",
"once": false,
"x": 1116.7953567504883,
"y": 960.0105171203613,
"wires": [
[
"7b1370e2.6e8c9"
]
]
},
{
"id": "c0f36d.ab686c9",
"type": "file in",
"z": "a564595f.642818",
"name": "",
"filename": "/home/pi/global.json",
"format": "utf8",
"chunk": false,
"sendError": false,
"x": 253,
"y": 336,
"wires": [
[
"aa94ced8.4cb66"
]
]
},
{
"id": "326af4b8.42494c",
"type": "json",
"z": "a564595f.642818",
"name": "",
"pretty": false,
"x": 581,
"y": 338,
"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);\n//return msg;",
"outputs": "3",
"noerr": 0,
"x": 728,
"y": 338,
"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": 1418.239501953125,
"y": 68.01043319702148,
"wires": []
},
{
"id": "dc0ffeac.632b6",
"type": "http in",
"z": "a564595f.642818",
"name": "",
"url": "/data/",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 2052.6841583251953,
"y": 618.4548597335815,
"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": "false",
"topic": "",
"style": "",
"onvalue": "sg",
"onvalueType": "str",
"onicon": "",
"oncolor": "",
"offvalue": "false",
"offvalueType": "bool",
"officon": "",
"offcolor": "",
"x": 2132.688522338867,
"y": 1702.2629280090332,
"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": "false",
"topic": "",
"style": "",
"onvalue": "°F",
"onvalueType": "str",
"onicon": "",
"oncolor": "",
"offvalue": "°C",
"offvalueType": "str",
"officon": "",
"offcolor": "",
"x": 1920.3509521484375,
"y": 1596.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": "<script>\nfunction download(){\n window.location='/log.csv';\n }\n</script>\n\n<button onclick=\"download();\" class=\"md-raised md-button md-ink-ripple\" type=\"button\">Download Log</button>\n\n",
"storeOutMessages": true,
"fwdInMessages": true,
"templateScope": "local",
"x": 2703.5,
"y": 338,
"wires": [
[]
]
},
{
"id": "ba245bd3.026ab8",
"type": "inject",
"z": "a564595f.642818",
"name": "",
"topic": "",
"payload": "displayUnits",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": true,
"x": 1389.5208740234375,
"y": 1644.8509521484375,
"wires": [
[
"cd091791.668ca8"
]
]
},
{
"id": "69cfcfd8.b2018",
"type": "inject",
"z": "a564595f.642818",
"name": "",
"topic": "",
"payload": "fermdisplayUnits",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": true,
"x": 1462.7951202392578,
"y": 1916.6775169372559,
"wires": [
[
"e0d9c78e.ee0138"
]
]
},
{
"id": "cd091791.668ca8",
"type": "delay",
"z": "a564595f.642818",
"name": "",
"pauseType": "delay",
"timeout": "3",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 1588.3023681640625,
"y": 1644.0592041015625,
"wires": [
[
"fd49eb70.32ff38"
]
]
},
{
"id": "e0d9c78e.ee0138",
"type": "delay",
"z": "a564595f.642818",
"name": "",
"pauseType": "delay",
"timeout": "3",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 1644.2396240234375,
"y": 1916.6771240234375,
"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": 1839.6248779296875,
"y": 1911.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.SG + \nmsg.payload.Temp + \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;\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": 974.8472900390625,
"y": 35.68404006958008,
"wires": [
[
"6a77b965.400cc8"
]
]
},
{
"id": "a4d1964e.cb4f78",
"type": "ui_slider",
"z": "a564595f.642818",
"name": "RSSI Filter",
"label": "RSSI Filter",
"group": "2f8a7619.951f3a",
"order": 3,
"width": 0,
"height": 0,
"passthru": true,
"topic": "",
"min": "-105",
"max": "-35",
"step": 1,
"x": 290,
"y": 2200,
"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": 470,
"y": 2200,
"wires": [
[
"3505363e.8a498a"
]
]
},
{
"id": "3505363e.8a498a",
"type": "ui_text",
"z": "a564595f.642818",
"group": "2f8a7619.951f3a",
"order": 4,
"width": 0,
"height": 0,
"name": "",
"label": "Minimum RSSI in dBm",
"format": "{{msg.payload}}",
"layout": "row-spread",
"x": 685.017333984375,
"y": 2212.232798576355,
"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": 2940.96915435791,
"y": 318.01389932632446,
"wires": [
[
"2f5685a6.76e34a"
]
]
},
{
"id": "c908bac9.7cfc38",
"type": "watch",
"z": "a564595f.642818",
"name": "watch for USB drive",
"files": "/dev",
"recursive": "",
"x": 95,
"y": 2370.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": 286.52423095703125,
"y": 2312.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": 815.6322784423828,
"y": 2373.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": 1413.8790435791016,
"y": 2369.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": 697.4063987731934,
"y": 2308.469259262085,
"wires": [
[
"32967fe2.78f"
]
]
},
{
"id": "d9e2bf6d.bccc7",
"type": "catch",
"z": "a564595f.642818",
"name": "No URL Provided Errors",
"scope": [
"2836e0e1.4ea9c"
],
"x": 3254.517433166504,
"y": 184.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": 1113.684310913086,
"y": 2369.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": 926.4617309570312,
"y": 2474.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": 1306.1284408569336,
"y": 2449.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": 580.5173492431641,
"y": 2623.125386238098,
"wires": [
[
"1c2730c3.d43b4f"
]
]
},
{
"id": "34b160f1.5b1ee",
"type": "exec",
"z": "a564595f.642818",
"command": "sudo mkdir /mnt/usb",
"addpay": false,
"append": "",
"useSpawn": "false",
"timer": "",
"oldrc": false,
"name": "",
"x": 274.52085876464844,
"y": 2441.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": 424.01747131347656,
"y": 2535.12242603302,
"wires": [
[
"11f93581.985a8a"
]
]
},
{
"id": "39a9e291.1fe1fe",
"type": "inject",
"z": "a564595f.642818",
"name": "",
"topic": "",
"payload": "Mount Point",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": true,
"x": 75,
"y": 2439.0731925964355,
"wires": [
[
"34b160f1.5b1ee"
]
]
},
{
"id": "235307e4.347e18",
"type": "exec",
"z": "a564595f.642818",
"command": "",
"addpay": true,
"append": "",
"useSpawn": "false",
"timer": "",
"oldrc": false,
"name": "",
"x": 929.0173301696777,
"y": 2619.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": 778.5139389038086,
"y": 2620.732711791992,
"wires": [
[
"235307e4.347e18"
]
]
},
{
"id": "e37566b2.2c78f8",
"type": "catch",
"z": "a564595f.642818",
"name": "",
"scope": [
"c0f36d.ab686c9"
],
"x": 140,
"y": 400,
"wires": [
[
"410f235c.c1f2ac"
]
]
},
{
"id": "410f235c.c1f2ac",
"type": "change",
"z": "a564595f.642818",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "on",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 300,
"y": 400,
"wires": [
[
"45fc2eae.52e02"
]
]
},
{
"id": "6308b03a.25d4a",
"type": "catch",
"z": "a564595f.642818",
"name": "",
"scope": [
"c0f36d.ab686c9"
],
"x": 60,
"y": 2180,
"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": 162.5,
"y": 2255,
"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": 3627.999954223633,
"y": 206.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": 3440.6319465637207,
"y": 196.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": 622.1944885253906,
"y": 128.69444465637207,
"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": 1870.2500305175781,
"y": 2316.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": 498.5,
"y": 2299,
"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": 1394.375,
"y": 2225,
"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": 1646.2500228881836,
"y": 2381.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": 953.1250152587891,
"y": 2263.7500343322754,
"wires": [
[
"eef04124.0438f"
]
]
},
{
"id": "68ec71d.2dec29",
"type": "json",
"z": "a564595f.642818",
"name": "",
"pretty": false,
"x": 2727.5,
"y": 20,
"wires": [
[
"3c8572c8.6a4b1e",
"dd8b62f0.c52ca"
]
]
},
{
"id": "780b4fd0.c274b",
"type": "function",
"z": "a564595f.642818",
"name": "Send IP Addr",
"func": "var ipAddress = flow.get('ipaddress');\nflow.set(msg.payload.Color + \"-Comment\",ipAddress);\nflow.set('lastpost-' + msg.payload.Color,0);",
"outputs": 1,
"noerr": 0,
"x": 3013,
"y": 112,
"wires": [
[]
]
},
{
"id": "cdf7a5f1.e44358",
"type": "delay",
"z": "a564595f.642818",
"name": "",
"pauseType": "delay",
"timeout": "30",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "5",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 2844.5,
"y": 112,
"wires": [
[
"780b4fd0.c274b"
]
]
},
{
"id": "51590585.1fbfec",
"type": "catch",
"z": "a564595f.642818",
"name": "",
"scope": [
"cdc2a491.47b908"
],
"x": 233,
"y": 188,
"wires": [
[]
]
},
{
"id": "fd48b85c.2f1918",
"type": "catch",
"z": "a564595f.642818",
"name": "",
"scope": [
"640f9404.72d27c"
],
"x": 3284,
"y": 48,
"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/cloud_log_\" + colors[i] + \".json\"});\n}\ncontext.set('startup',false);\n}",
"outputs": 1,
"noerr": 0,
"x": 2189,
"y": 20,
"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": 2400,
"y": 20,
"wires": [
[
"640f9404.72d27c"
]
]
},
{
"id": "2c73dfce.b79cc",
"type": "delay",
"z": "a564595f.642818",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 458,
"y": 275,
"wires": [
[
"cdc2a491.47b908"
]
]
},
{
"id": "d5884cdc.50b47",
"type": "debug",
"z": "a564595f.642818",
"name": "",
"active": false,
"console": "false",
"complete": "false",
"x": 3439,
"y": 88,
"wires": []
},
{
"id": "aa94ced8.4cb66",
"type": "delay",
"z": "a564595f.642818",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 443,
"y": 337,
"wires": [
[
"326af4b8.42494c"
]
]
},
{
"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": 2907.5,
"y": 22,
"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": 1732,
"y": 1644,
"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": 278.25,
"y": 1803.5000267028809,
"wires": [
[
"437432fd.79dbbc"
],
[],
[]
]
},
{
"id": "437432fd.79dbbc",
"type": "ui_text_input",
"z": "a564595f.642818",
"name": "",
"label": "System Time [use RETURN to set manually]",
"group": "5ca7d250.c3938c",
"order": 3,
"width": 0,
"height": 0,
"passthru": false,
"mode": "text",
"delay": "0",
"topic": "",
"x": 574.0000076293945,
"y": 1809.2500267028809,
"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": 880,
"y": 1840,
"wires": [
[
"673f8112.35a61"
],
[
"8ee3b7e3.1833a8"
],
[]
]
},
{
"id": "669c32ed.8030ac",
"type": "inject",
"z": "a564595f.642818",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "60",
"crontab": "",
"once": true,
"x": 97.5,
"y": 1793.7500267028809,
"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": 1050,
"y": 1800,
"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": 630,
"y": 1880,
"wires": [
[
"a4a5a7ed.d59958"
]
]
},
{
"id": "deb9c4fc.20c098",
"type": "csv",
"z": "a564595f.642818",
"name": "",
"sep": " ",
"hdrin": "",
"hdrout": "",
"multi": "one",
"ret": "\\n",
"temp": "ipv4,ipv6",
"x": 470,
"y": 1880,
"wires": [
[
"375008fe.27a988"
]
]
},
{
"id": "a6b43763.a12aa8",
"type": "file",
"z": "a564595f.642818",
"name": "",
"filename": "/home/pi/timezone",
"appendNewline": false,
"createDir": false,
"overwriteFile": "true",
"x": 1250,
"y": 1560,
"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": 1260,
"y": 1600,
"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": 1080,
"y": 1700,
"wires": [
[],
[],
[
"be6c33c3.62e8a"
]
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment