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": "Edit SG Calibration Points",
        "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": "Specific Gravity",
        "tab": "75f710f5.16d2e",
        "order": 1,
        "disp": true,
        "width": "6"
    },
    {
        "id": "5ca7d250.c3938c",
        "type": "ui_group",
        "z": "",
        "name": "Time Zone",
        "tab": "c9c26b4a.4cde78",
        "order": 1,
        "disp": true,
        "width": "6"
    },
    {
        "id": "c8854cd2.f1773",
        "type": "ui_group",
        "z": "",
        "name": "App Admin",
        "tab": "c9c26b4a.4cde78",
        "order": 3,
        "disp": true,
        "width": "6"
    },
    {
        "id": "6fabad8a.3909f4",
        "type": "ui_group",
        "z": "",
        "name": "Units",
        "tab": "c9c26b4a.4cde78",
        "order": 2,
        "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": 50,
                "gx": 6,
                "gy": 6,
                "cx": 6,
                "cy": 6,
                "px": 0,
                "py": 0
            }
        }
    },
    {
        "id": "45fc2eae.52e02",
        "type": "scanBeacon",
        "z": "a564595f.642818",
        "name": "Tilt Scan",
        "beacon_uuid": "",
        "beacon_major": "",
        "beacon_minor": "",
        "x": 308,
        "y": 206,
        "wires": [
            [
                "8dc4fe46.fc364"
            ]
        ]
    },
    {
        "id": "f42fdaab.48a078",
        "type": "inject",
        "z": "a564595f.642818",
        "name": "start scanning",
        "topic": "",
        "payload": "on",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": true,
        "x": 126,
        "y": 245,
        "wires": [
            [
                "45fc2eae.52e02"
            ]
        ]
    },
    {
        "id": "8dc4fe46.fc364",
        "type": "json",
        "z": "a564595f.642818",
        "name": "to JSON Object",
        "x": 483,
        "y": 206,
        "wires": [
            [
                "e5652ef0.acaaf"
            ]
        ]
    },
    {
        "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": [
            [
                "f14feb76.aebb48",
                "6cbfa171.d2106",
                "f1d6da3e.a43598"
            ]
        ]
    },
    {
        "id": "7f2f1fbf.e1098",
        "type": "change",
        "z": "a564595f.642818",
        "name": "Decode Color",
        "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": ".*bb80.*",
                "fromt": "re",
                "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": 842.5,
        "y": 206.5,
        "wires": [
            [
                "7c18d8fe.188168"
            ]
        ]
    },
    {
        "id": "e5652ef0.acaaf",
        "type": "switch",
        "z": "a564595f.642818",
        "name": "Tilt Filter",
        "property": "payload.uuid",
        "propertyType": "msg",
        "rules": [
            {
                "t": "regex",
                "v": "a495bb..c5b14b44b5121370f02d74de",
                "vt": "str",
                "case": true
            }
        ],
        "checkall": "true",
        "outputs": 1,
        "x": 659.5,
        "y": 206,
        "wires": [
            [
                "7f2f1fbf.e1098"
            ]
        ]
    },
    {
        "id": "656f0cf9.e79cd4",
        "type": "ui_text_input",
        "z": "a564595f.642818",
        "name": "Beer Name",
        "label": "Set Beer Name",
        "group": "81394fa6.f9523",
        "order": 3,
        "width": 0,
        "height": 0,
        "passthru": false,
        "mode": "text",
        "delay": "2000",
        "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);",
        "outputs": 1,
        "noerr": 0,
        "x": 3897,
        "y": 508,
        "wires": [
            []
        ]
    },
    {
        "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    flow.set('options',options);\n}\n//set cal points\nactualArray = flow.get('actualSGpoints-' + msg.payload.Color)||[];\nuncalArray = flow.get('uncalSGpoints-' + msg.payload.Color)||[];\nmsg.payload.actualSGPoints = actualArray.toString();\nmsg.payload.unCalSGPoints = uncalArray.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\nmsg.payload.SG = msg.payload.minor;\nmsg.payload.SG/=1000;\n//add Temp parameter\nvar tempUnits = flow.get('tempUnits')||[0,1];\nmsg.payload.Temp = ((Number(msg.payload.major) + tempUnits[0])) * tempUnits[1];\nmsg.payload.tempunits = flow.get('displayUnits')||\"°F\";\nmsg.payload.doclongurl = flow.get(msg.payload.Color + '-URL')||\"\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 1069,
        "y": 205,
        "wires": [
            [
                "86447ba5.5d5b68"
            ]
        ]
    },
    {
        "id": "1aee8aa4.c92885",
        "type": "ui_template",
        "z": "a564595f.642818",
        "group": "b642e71.9697318",
        "name": "1",
        "order": 1,
        "width": "6",
        "height": "6",
        "format": "<style>\n    h1 {\n    font-size: .875em;\n    font-weight: normal;\n        \n    }\n    h2 {\n    font-size: 3.5em;\n    text-indent: .5em;\n    line-height: .5em;\n        \n    }\n    h3 {\n        font-family:\"Courier New\", Courier, monospace;\n        text-align: center;\n        font-size: .6em;\n    }\n    \n   #{{msg.topic}}-div {\n    visibility: {{msg.show}};\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</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>Specific Gravity: {{msg.payload.uncalSG | number:3}} (uncal.)</h1>\n<h2>{{msg.payload.SG | number:3}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.SG - 0.990)/0.00130}}%;\"></div>\n<h1>Temperature: {{msg.payload.Temp | number:1}} (uncal.)</h1>\n<h2>{{msg.payload.Temp | number:1}}{{msg.payload.tempunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.Temp - 30) / 1.85}}%;\"></div>\n<h3>{{msg.payload.formatteddate}}</h3>\n<h3>Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm</h3>\n</div>\n\n\n",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "templateScope": "local",
        "x": 2417,
        "y": 90,
        "wires": [
            [
                "394a5d3d.92fa72",
                "1ee5d27c.fa4e8e",
                "fcd6778b.dcc9f8",
                "2267309d.95b65"
            ]
        ]
    },
    {
        "id": "79bac478.35317c",
        "type": "ui_template",
        "z": "a564595f.642818",
        "group": "b914fb40.bc5c78",
        "name": "5",
        "order": 1,
        "width": "6",
        "height": "6",
        "format": "<style>\n    h1 {\n    font-size: .875em;\n    font-weight: normal;\n        \n    }\n    h2 {\n    font-size: 3.5em;\n    text-indent: .5em;\n    line-height: .5em;\n        \n    }\n    h3 {\n        font-family:\"Courier New\", Courier, monospace;\n        text-align: center;\n        font-size: .6em;\n    }\n    \n   #{{msg.topic}}-div {\n    visibility: {{msg.show}};\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</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>Specific Gravity: {{msg.payload.uncalSG | number:3}} (uncal.)</h1>\n<h2>{{msg.payload.SG | number:3}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.SG - 0.990)/0.00130}}%;\"></div>\n<h1>Temperature: {{msg.payload.Temp | number:1}} (uncal.)</h1>\n<h2>{{msg.payload.Temp | number:1}}{{msg.payload.tempunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.Temp - 30) / 1.85}}%;\"></div>\n<h3>{{msg.payload.formatteddate}}</h3>\n<h3>Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm</h3>\n</div>\n\n\n",
        "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 scanning",
        "topic": "",
        "payload": "off",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 121,
        "y": 186,
        "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": 1630.5,
        "y": 73,
        "wires": [
            []
        ]
    },
    {
        "id": "be15eceb.e8738",
        "type": "inject",
        "z": "a564595f.642818",
        "name": "",
        "topic": "",
        "payload": "storage-1",
        "payloadType": "flow",
        "repeat": "1",
        "crontab": "",
        "once": false,
        "x": 1808.5,
        "y": 68,
        "wires": [
            [
                "9628a72.af07d58"
            ]
        ]
    },
    {
        "id": "e0d6a855.d4e018",
        "type": "ui_template",
        "z": "a564595f.642818",
        "group": "4a85df35.41e16",
        "name": "6",
        "order": 1,
        "width": "6",
        "height": "6",
        "format": "<style>\n    h1 {\n    font-size: .875em;\n    font-weight: normal;\n        \n    }\n    h2 {\n    font-size: 3.5em;\n    text-indent: .5em;\n    line-height: .5em;\n        \n    }\n    h3 {\n        font-family:\"Courier New\", Courier, monospace;\n        text-align: center;\n        font-size: .6em;\n    }\n    \n   #{{msg.topic}}-div {\n    visibility: {{msg.show}};\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</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>Specific Gravity: {{msg.payload.uncalSG | number:3}} (uncal.)</h1>\n<h2>{{msg.payload.SG | number:3}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.SG - 0.990)/0.00130}}%;\"></div>\n<h1>Temperature: {{msg.payload.Temp | number:1}} (uncal.)</h1>\n<h2>{{msg.payload.Temp | number:1}}{{msg.payload.tempunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.Temp - 30) / 1.85}}%;\"></div>\n<h3>{{msg.payload.formatteddate}}</h3>\n<h3>Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm</h3>\n</div>\n\n\n",
        "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": 1432,
        "y": 207,
        "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": 2013,
        "y": 71,
        "wires": [
            [
                "14d297fb.15dbc8"
            ]
        ]
    },
    {
        "id": "86447ba5.5d5b68",
        "type": "function",
        "z": "a564595f.642818",
        "name": "Interpolate",
        "func": "//requires msg.payload.SG, msg.payload.actualSGPoints (a comma separated string of the actual values), and msg.payload.unCalSGPoints (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\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.SG = calSG.toFixed(3);\nreturn msg;",
        "outputs": "1",
        "noerr": 0,
        "x": 1255.5,
        "y": 206,
        "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": false,
        "options": [
            {
                "label": "",
                "value": "",
                "type": "str"
            }
        ],
        "payload": "",
        "topic": "",
        "x": 1032.5,
        "y": 553,
        "wires": [
            [
                "6aa75852.1e3068",
                "b418ce11.8981a"
            ]
        ]
    },
    {
        "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);\nmsg.payload = \"Sending: \" + comment;\nmsg.topic = \"TILT | \" + color;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 1521.5,
        "y": 671,
        "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": 1859.5,
        "y": 24,
        "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.tempunits === \"°C\"){\n            msg.payload.Temp = msg.payload.Temp * 1.8 + 32;\n        }\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        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.url = flow.get('cloudURL');\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": "Set Cloud URL",
        "group": "19fab5c2.199ffa",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": "1000",
        "topic": "",
        "x": 1262.5,
        "y": 721,
        "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 Current CloudURL",
        "func": "flow.set(\"cloudURL\",msg.payload);\n",
        "outputs": 1,
        "noerr": 0,
        "x": 1527,
        "y": 719,
        "wires": [
            []
        ]
    },
    {
        "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": 1302,
        "y": 552,
        "wires": [
            [
                "971574e0.783ba8",
                "df1c3ed0.bd3a9",
                "df1ac3a9.c4472",
                "de92b02f.5ebe1"
            ]
        ]
    },
    {
        "id": "c7a566a0.651948",
        "type": "comment",
        "z": "a564595f.642818",
        "name": "Set Current Time for Display",
        "info": "",
        "x": 2180,
        "y": 60,
        "wires": []
    },
    {
        "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.toFixed(3);\nreturn msg;\n}",
        "outputs": 1,
        "noerr": 0,
        "x": 1333,
        "y": 859,
        "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": 1519,
        "y": 956,
        "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": "<style>\n    h1 {\n    font-size: .875em;\n    font-weight: normal;\n        \n    }\n    h2 {\n    font-size: 3.5em;\n    text-indent: .5em;\n    line-height: .5em;\n        \n    }\n    h3 {\n        font-family:\"Courier New\", Courier, monospace;\n        text-align: center;\n        font-size: .6em;\n    }\n    \n   #{{msg.topic}}-div {\n    visibility: {{msg.show}};\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</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>Specific Gravity: {{msg.payload.uncalSG | number:3}} (uncal.)</h1>\n<h2>{{msg.payload.SG | number:3}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.SG - 0.990)/0.00130}}%;\"></div>\n<h1>Temperature: {{msg.payload.Temp | number:1}} (uncal.)</h1>\n<h2>{{msg.payload.Temp | number:1}}{{msg.payload.tempunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.Temp - 30) / 1.85}}%;\"></div>\n<h3>{{msg.payload.formatteddate}}</h3>\n<h3>Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm</h3>\n</div>\n\n\n",
        "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": "<style>\n    h1 {\n    font-size: .875em;\n    font-weight: normal;\n        \n    }\n    h2 {\n    font-size: 3.5em;\n    text-indent: .5em;\n    line-height: .5em;\n        \n    }\n    h3 {\n        font-family:\"Courier New\", Courier, monospace;\n        text-align: center;\n        font-size: .6em;\n    }\n    \n   #{{msg.topic}}-div {\n    visibility: {{msg.show}};\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</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>Specific Gravity: {{msg.payload.uncalSG | number:3}} (uncal.)</h1>\n<h2>{{msg.payload.SG | number:3}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.SG - 0.990)/0.00130}}%;\"></div>\n<h1>Temperature: {{msg.payload.Temp | number:1}} (uncal.)</h1>\n<h2>{{msg.payload.Temp | number:1}}{{msg.payload.tempunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.Temp - 30) / 1.85}}%;\"></div>\n<h3>{{msg.payload.formatteddate}}</h3>\n<h3>Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm</h3>\n</div>\n\n\n",
        "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": 1825,
        "y": 108,
        "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}\nmsg.topic = msg.payload.Color;\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 msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}",
        "outputs": 1,
        "noerr": 0,
        "x": 2220,
        "y": 87,
        "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": 1823.5,
        "y": 962,
        "wires": [
            [
                "1be76b3b.e111e5"
            ],
            [
                "e29d71bb.f0e81"
            ]
        ]
    },
    {
        "id": "63c7bb7c.317274",
        "type": "ui_button",
        "z": "a564595f.642818",
        "name": "",
        "group": "6acae0b0.a184",
        "order": 3,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Clear Calibration",
        "color": "",
        "bgcolor": "",
        "icon": "",
        "payload": "colordropdownSelect",
        "payloadType": "flow",
        "topic": "",
        "x": 1591.5,
        "y": 1082,
        "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": 1803.5,
        "y": 1083,
        "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": 1602.5,
        "y": 1019,
        "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",
                "f1d6da3e.a43598"
            ]
        ]
    },
    {
        "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": 2017,
        "y": 110,
        "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}\nmsg.topic = msg.payload.Color;\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 msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}",
        "outputs": 1,
        "noerr": 0,
        "x": 2218,
        "y": 127,
        "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": 2009,
        "y": 159,
        "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}\nmsg.topic = msg.payload.Color;\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 msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}",
        "outputs": 1,
        "noerr": 0,
        "x": 2225,
        "y": 167,
        "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": 2014,
        "y": 251,
        "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}\nmsg.topic = msg.payload.Color;\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 msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}",
        "outputs": 1,
        "noerr": 0,
        "x": 2222,
        "y": 256,
        "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": 2018,
        "y": 305,
        "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}\nmsg.topic = msg.payload.Color;\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 msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}",
        "outputs": 1,
        "noerr": 0,
        "x": 2222,
        "y": 311,
        "wires": [
            [
                "e0d6a855.d4e018"
            ]
        ]
    },
    {
        "id": "dd81e411.1cdd78",
        "type": "ui_template",
        "z": "a564595f.642818",
        "group": "b8d3bbbf.2c9cb8",
        "name": "4",
        "order": 1,
        "width": "6",
        "height": "6",
        "format": "<style>\n    h1 {\n    font-size: .875em;\n    font-weight: normal;\n        \n    }\n    h2 {\n    font-size: 3.5em;\n    text-indent: .5em;\n    line-height: .5em;\n        \n    }\n    h3 {\n        font-family:\"Courier New\", Courier, monospace;\n        text-align: center;\n        font-size: .6em;\n    }\n    \n   #{{msg.topic}}-div {\n    visibility: {{msg.show}};\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</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>Specific Gravity: {{msg.payload.uncalSG | number:3}} (uncal.)</h1>\n<h2>{{msg.payload.SG | number:3}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.SG - 0.990)/0.00130}}%;\"></div>\n<h1>Temperature: {{msg.payload.Temp | number:1}} (uncal.)</h1>\n<h2>{{msg.payload.Temp | number:1}}{{msg.payload.tempunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.Temp - 30) / 1.85}}%;\"></div>\n<h3>{{msg.payload.formatteddate}}</h3>\n<h3>Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm</h3>\n</div>\n\n\n",
        "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": 2012,
        "y": 210,
        "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}\nmsg.topic = msg.payload.Color;\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 msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}",
        "outputs": 1,
        "noerr": 0,
        "x": 2221,
        "y": 208,
        "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": "<style>\n    h1 {\n    font-size: .875em;\n    font-weight: normal;\n        \n    }\n    h2 {\n    font-size: 3.5em;\n    text-indent: .5em;\n    line-height: .5em;\n        \n    }\n    h3 {\n        font-family:\"Courier New\", Courier, monospace;\n        text-align: center;\n        font-size: .6em;\n    }\n    \n   #{{msg.topic}}-div {\n    visibility: {{msg.show}};\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</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>Specific Gravity: {{msg.payload.uncalSG | number:3}} (uncal.)</h1>\n<h2>{{msg.payload.SG | number:3}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.SG - 0.990)/0.00130}}%;\"></div>\n<h1>Temperature: {{msg.payload.Temp | number:1}} (uncal.)</h1>\n<h2>{{msg.payload.Temp | number:1}}{{msg.payload.tempunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.Temp - 30) / 1.85}}%;\"></div>\n<h3>{{msg.payload.formatteddate}}</h3>\n<h3>Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm</h3>\n</div>\n\n\n",
        "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": 2010,
        "y": 420,
        "wires": [
            [
                "ba5663bf.b7cd6"
            ]
        ]
    },
    {
        "id": "ba5663bf.b7cd6",
        "type": "function",
        "z": "a564595f.642818",
        "name": "check",
        "func": "if(msg.payload === undefined){\n msg.payload = {};\n msg.show = \"hidden\";\n return msg;   \n}\nmsg.topic = msg.payload.Color;\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 msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}",
        "outputs": 1,
        "noerr": 0,
        "x": 2225,
        "y": 416,
        "wires": [
            [
                "228b94fc.188afc"
            ]
        ]
    },
    {
        "id": "2cbc023f.86f2de",
        "type": "ui_template",
        "z": "a564595f.642818",
        "group": "a510f969.f28538",
        "name": "7",
        "order": 1,
        "width": "6",
        "height": "6",
        "format": "<style>\n    h1 {\n    font-size: .875em;\n    font-weight: normal;\n        \n    }\n    h2 {\n    font-size: 3.5em;\n    text-indent: .5em;\n    line-height: .5em;\n        \n    }\n    h3 {\n        font-family:\"Courier New\", Courier, monospace;\n        text-align: center;\n        font-size: .6em;\n    }\n    \n   #{{msg.topic}}-div {\n    visibility: {{msg.show}};\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</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>Specific Gravity: {{msg.payload.uncalSG | number:3}} (uncal.)</h1>\n<h2>{{msg.payload.SG | number:3}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.SG - 0.990)/0.00130}}%;\"></div>\n<h1>Temperature: {{msg.payload.Temp | number:1}} (uncal.)</h1>\n<h2>{{msg.payload.Temp | number:1}}{{msg.payload.tempunits}}</h2>\n<div style=\"background: {{msg.payload.Color}};height:10px;width:{{(msg.payload.Temp - 30) / 1.85}}%;\"></div>\n<h3>{{msg.payload.formatteddate}}</h3>\n<h3>Received {{(msg.payload.clock - msg.payload.timeStamp) / 1000 | number:1}} seconds ago {{msg.payload.rssi}} dBm</h3>\n</div>\n\n\n",
        "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": 2013,
        "y": 360,
        "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}\nmsg.topic = msg.payload.Color;\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 msg.show = \"hidden\";\n return msg;\n}\nelse{\n msg.show = \"visible\";\n return msg;\n}",
        "outputs": 1,
        "noerr": 0,
        "x": 2225,
        "y": 363,
        "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": "3",
        "format": "<div ng-bind-html=\"msg.payload.result + msg.cloudlink\"></div>\n<div ng-bind-html=\"msg.cloudwait\"></div>",
        "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": 0,
        "height": 0,
        "passthru": false,
        "mode": "text",
        "delay": "0",
        "topic": "",
        "x": 1247.5,
        "y": 640,
        "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    return msg;\n}\nif (msg.topic === color){\n    msg.cloudwait = \"\";\n    return msg;\n}\n",
        "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",
        "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": 770,
        "y": 700,
        "wires": [
            [
                "5d331f4.1bed9e"
            ]
        ]
    },
    {
        "id": "5d331f4.1bed9e",
        "type": "change",
        "z": "a564595f.642818",
        "name": "default cloud url",
        "rules": [
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "true",
                "fromt": "bool",
                "to": "https://script.google.com/macros/s/AKfycbwNXh6rEWoULd0vxWxDylG_PJwQwe0dn5hdtSkuC4k3D9AXBSA/exec",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "false",
                "fromt": "bool",
                "to": "",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1079.5,
        "y": 689,
        "wires": [
            [
                "edb75c90.8414"
            ]
        ]
    },
    {
        "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": 1789.5,
        "y": 802,
        "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": 2977.5,
        "y": 301,
        "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": "/csv",
        "method": "get",
        "swaggerDoc": "",
        "x": 2750.5,
        "y": 377,
        "wires": [
            [
                "898ef56a.365648"
            ]
        ]
    },
    {
        "id": "898ef56a.365648",
        "type": "file in",
        "z": "a564595f.642818",
        "name": "",
        "filename": "/home/pi/log.csv",
        "format": "utf8",
        "x": 2935.5,
        "y": 376,
        "wires": [
            [
                "6af4a20b.f5f3cc"
            ]
        ]
    },
    {
        "id": "681c2428.1c3a5c",
        "type": "ui_template",
        "z": "a564595f.642818",
        "group": "82607108.c5be8",
        "name": "Download Log Button",
        "order": 4,
        "width": 0,
        "height": 0,
        "format": "<style>\n    a:link {\n    color: white; \n    background-color: transparent; \n    text-decoration: none;\n}\n\n    a:visited {\n    color: white;\n    background-color: transparent;\n    text-decoration: none;\n}\n</style>\n<script>\nfunction download(filename, text) {\n    var element = document.createElement('a');\n    element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));\n    element.setAttribute('download', filename);\n    element.style.display = 'none';\n    document.body.appendChild(element);\n    element.click();\n    document.body.removeChild(element);\n}\n\n     // Start file download.\n    document.getElementById(\"dwn-btn\").addEventListener(\"click\", function(){\n    var xhttp = new XMLHttpRequest();\n    xhttp.onreadystatechange = function() {\n    if (this.readyState == 4 && this.status == 200) {\n      var text = this.responseText;\n      var filename = \"log.csv\";\n      download(filename, text);\n    }\n  };\n    xhttp.open(\"GET\", \"/csv\", true);\n    xhttp.send();\n }, false);\n</script>\n<center><a href=\"/csv\" target=\"_blank\">View Log (to copy/paste as CSV)</a></center><br>\n<input type=\"button\" id=\"dwn-btn\" value=\"Download Log\"/>\n\n",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "templateScope": "local",
        "x": 2955.5,
        "y": 428,
        "wires": [
            []
        ]
    },
    {
        "id": "2cabe65a.14f1ba",
        "type": "ui_text",
        "z": "a564595f.642818",
        "group": "82607108.c5be8",
        "order": 3,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "Minutes:",
        "format": "{{msg.payload}}",
        "layout": "row-left",
        "x": 1799,
        "y": 1186,
        "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": "0.25",
        "max": "60",
        "step": ".25",
        "x": 1553,
        "y": 1161,
        "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": 1785.5,
        "y": 1137,
        "wires": [
            []
        ]
    },
    {
        "id": "394a5d3d.92fa72",
        "type": "function",
        "z": "a564595f.642818",
        "name": "Setup Local Log",
        "func": "var postEnabled = (flow.get('logLocalDataCheck'))||false;\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        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;\n    return msg;\n}\n}",
        "outputs": 1,
        "noerr": 0,
        "x": 2747,
        "y": 301,
        "wires": [
            [
                "2f5685a6.76e34a",
                "dcc41bde.fc7208"
            ]
        ]
    },
    {
        "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": 1829,
        "y": 1256,
        "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": 1544,
        "y": 1253,
        "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": 2051,
        "y": 1255,
        "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",
        "name": "",
        "x": 2927.5,
        "y": 244.5,
        "wires": [
            [
                "5c5d0dab.293cc4"
            ],
            [],
            []
        ]
    },
    {
        "id": "5c5d0dab.293cc4",
        "type": "split",
        "z": "a564595f.642818",
        "name": "",
        "splt": "\\n",
        "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": false,
        "label": "Delete Log",
        "color": "white",
        "bgcolor": "red",
        "icon": "",
        "payload": "Time,Timepoint,Temp,SG,Beer,Color,Comment",
        "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": 1124,
        "y": 446,
        "wires": [
            [
                "93d9202c.d9c1e",
                "6aa75852.1e3068",
                "3eb6f3c4.588d1c"
            ]
        ]
    },
    {
        "id": "d9ea777.f3c9388",
        "type": "ui_text_input",
        "z": "a564595f.642818",
        "name": "",
        "label": "Actual SG [use RETURN to set]",
        "group": "eb4ab3d5.7b3f1",
        "order": 4,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": "0",
        "topic": "",
        "x": 1218,
        "y": 953,
        "wires": [
            [
                "84ffe685.150d58"
            ]
        ]
    },
    {
        "id": "ecfbe772.ba4cb8",
        "type": "ui_text",
        "z": "a564595f.642818",
        "group": "eb4ab3d5.7b3f1",
        "order": 3,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "Uncalibrated SG",
        "format": "{{msg.payload | number:3}}",
        "layout": "row-spread",
        "x": 1625,
        "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"
            ]
        ]
    },
    {
        "id": "1be76b3b.e111e5",
        "type": "ui_text_input",
        "z": "a564595f.642818",
        "name": "",
        "label": "Uncalibrated [use RETURN to set]",
        "group": "6acae0b0.a184",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": false,
        "mode": "text",
        "delay": "0",
        "topic": "",
        "x": 2185,
        "y": 1002,
        "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": 2,
        "width": 0,
        "height": 0,
        "passthru": false,
        "mode": "text",
        "delay": "0",
        "topic": "",
        "x": 2197,
        "y": 1069,
        "wires": [
            [
                "b36a946.3813e68"
            ]
        ]
    },
    {
        "id": "249f1e9c.6a1d42",
        "type": "inject",
        "z": "a564595f.642818",
        "name": "",
        "topic": "",
        "payload": "15",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": true,
        "x": 1302,
        "y": 1025,
        "wires": [
            [
                "7b1370e2.6e8c9"
            ]
        ]
    },
    {
        "id": "f9e2fc12.8340c",
        "type": "inject",
        "z": "a564595f.642818",
        "name": "",
        "topic": "",
        "payload": "15",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": true,
        "x": 1406,
        "y": 814,
        "wires": [
            [
                "88a2c98f.f38b08"
            ]
        ]
    },
    {
        "id": "b13cb5ba.f355b8",
        "type": "exec",
        "z": "a564595f.642818",
        "command": "sudo reboot",
        "addpay": false,
        "append": "",
        "useSpawn": false,
        "timer": "",
        "name": "Reboot",
        "x": 1295,
        "y": 1457,
        "wires": [
            [
                "2a36a03c.47d1f"
            ],
            [],
            []
        ]
    },
    {
        "id": "a85e96c5.56cc58",
        "type": "ui_button",
        "z": "a564595f.642818",
        "name": "",
        "group": "5ca7d250.c3938c",
        "order": 4,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Restart",
        "color": "",
        "bgcolor": "",
        "icon": "fa-refresh",
        "payload": "now",
        "payloadType": "str",
        "topic": "",
        "x": 1055,
        "y": 1454,
        "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": 1521,
        "y": 1448,
        "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": 1157.5,
        "y": 1558,
        "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": 1609.5,
        "y": 1552,
        "wires": [
            [
                "a6b43763.a12aa8"
            ]
        ]
    },
    {
        "id": "f49b2576.99e1d8",
        "type": "inject",
        "z": "a564595f.642818",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": true,
        "x": 683.5,
        "y": 1552,
        "wires": [
            [
                "9fa076ac.17f568",
                "a1357f50.ee57a"
            ]
        ]
    },
    {
        "id": "a1357f50.ee57a",
        "type": "file in",
        "z": "a564595f.642818",
        "name": "",
        "filename": "/etc/timezone",
        "format": "utf8",
        "x": 1163.5,
        "y": 1651,
        "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": 1370.5,
        "y": 1650,
        "wires": [
            [
                "9bb86c18.f0deb"
            ]
        ]
    },
    {
        "id": "a6b43763.a12aa8",
        "type": "file",
        "z": "a564595f.642818",
        "name": "",
        "filename": "/home/pi/timezone",
        "appendNewline": false,
        "createDir": false,
        "overwriteFile": "true",
        "x": 1825.5,
        "y": 1561,
        "wires": []
    },
    {
        "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": "go",
        "payloadType": "str",
        "topic": "",
        "x": 1165.5,
        "y": 1733,
        "wires": [
            [
                "c542fa3.77cb308"
            ]
        ]
    },
    {
        "id": "c542fa3.77cb308",
        "type": "exec",
        "z": "a564595f.642818",
        "command": "sudo cp -f /home/pi/timezone /etc/timezone",
        "addpay": false,
        "append": "",
        "useSpawn": "",
        "timer": "",
        "name": "set timezone file",
        "x": 1371.5,
        "y": 1723.5,
        "wires": [
            [
                "c21dbb0e.93a778"
            ],
            [],
            []
        ]
    },
    {
        "id": "c21dbb0e.93a778",
        "type": "exec",
        "z": "a564595f.642818",
        "command": "sudo dpkg-reconfigure -f noninteractive tzdata",
        "addpay": false,
        "append": "",
        "useSpawn": "",
        "timer": "",
        "name": "confirm update",
        "x": 1612.5,
        "y": 1728.5,
        "wires": [
            [
                "be6c33c3.62e8a"
            ],
            [],
            []
        ]
    },
    {
        "id": "8ee3b7e3.1833a8",
        "type": "ui_toast",
        "z": "a564595f.642818",
        "position": "top right",
        "displayTime": "3",
        "highlight": "",
        "outputs": 0,
        "ok": "OK",
        "cancel": "",
        "topic": "",
        "name": "",
        "x": 2030.5,
        "y": 1694,
        "wires": []
    },
    {
        "id": "be6c33c3.62e8a",
        "type": "change",
        "z": "a564595f.642818",
        "name": "",
        "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": 1816.5,
        "y": 1708,
        "wires": [
            [
                "8ee3b7e3.1833a8",
                "c08f3c8c.b6e87"
            ]
        ]
    },
    {
        "id": "c08f3c8c.b6e87",
        "type": "ui_text",
        "z": "a564595f.642818",
        "group": "5ca7d250.c3938c",
        "order": 3,
        "width": 0,
        "height": 0,
        "name": "status",
        "label": "",
        "format": "{{msg.payload}}",
        "layout": "col-center",
        "x": 1991.5,
        "y": 1751,
        "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": "ifconfig wlan0",
        "addpay": false,
        "append": "",
        "useSpawn": false,
        "timer": "",
        "name": "ifconfig",
        "x": 899,
        "y": 1879,
        "wires": [
            [
                "14ae9022.89c4b"
            ],
            [],
            []
        ]
    },
    {
        "id": "58a4e2b2.11320c",
        "type": "inject",
        "z": "a564595f.642818",
        "name": "get ip",
        "topic": "ip",
        "payload": "etho",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": true,
        "x": 710,
        "y": 1878.5,
        "wires": [
            [
                "7496a044.dd719"
            ]
        ]
    },
    {
        "id": "14ae9022.89c4b",
        "type": "function",
        "z": "a564595f.642818",
        "name": "Extract network config",
        "func": "// Initialize variables\nvar input, tokens, inet, outString;\n\n// Parse the entire string by spaces, and put each item into an array called tokens\n\ninput = msg.payload;\ntokens = input.split(\":\", 10);\n\n// Get the 7th token (example: \"addr:192.168.0.120\")\n// and get the substring from character 6 to the end\ninet = tokens[7].split(\" \", 1);\noutString = \"http://\" + inet[0] + \":1880/ui\";\n\n// Don't send a message if the IF is the known default. Change to default ip.\nif (inet==\"192.168.0.120\") { \n//outString = \"\"; // set output to null if ip is the same so no message is sent\nreturn null;\n}else{\n// return the final output\nflow.set('ipaddress',outString);\nreturn {payload: outString};\n}\n",
        "outputs": 1,
        "noerr": 0,
        "x": 1126,
        "y": 1864,
        "wires": [
            [
                "a4a5a7ed.d59958"
            ]
        ]
    },
    {
        "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": 1447,
        "y": 1884,
        "wires": []
    },
    {
        "id": "5312bf4.09fd44",
        "type": "ui_switch",
        "z": "a564595f.642818",
        "name": "",
        "label": "Use Celsius",
        "group": "6fabad8a.3909f4",
        "order": 0,
        "width": 0,
        "height": 0,
        "passthru": true,
        "decouple": "false",
        "topic": "",
        "style": "",
        "onvalue": "true",
        "onvalueType": "bool",
        "onicon": "",
        "oncolor": "",
        "offvalue": "false",
        "offvalueType": "bool",
        "officon": "",
        "offcolor": "",
        "x": 1009,
        "y": 316,
        "wires": [
            [
                "b58e5805.5d5928"
            ]
        ]
    },
    {
        "id": "b58e5805.5d5928",
        "type": "function",
        "z": "a564595f.642818",
        "name": "Change Temp Units",
        "func": "if (msg.payload){\nflow.set('tempUnits',[-32,0.555]);\nflow.set('displayUnits',\"°C\")\n}\nif (!msg.payload){\nflow.set('tempUnits',[0,1]);\nflow.set('displayUnits',\"°F\")\n}",
        "outputs": 1,
        "noerr": 0,
        "x": 1237,
        "y": 310,
        "wires": [
            []
        ]
    },
    {
        "id": "5a69b142.f96b6",
        "type": "exec",
        "z": "a564595f.642818",
        "command": "sudo shutdown",
        "addpay": true,
        "append": "",
        "useSpawn": false,
        "timer": "",
        "name": "Shutdown",
        "x": 1298,
        "y": 1380,
        "wires": [
            [
                "f2bdbc36.5644d"
            ],
            [],
            []
        ]
    },
    {
        "id": "2bcbe8c9.eefe28",
        "type": "ui_button",
        "z": "a564595f.642818",
        "name": "",
        "group": "5ca7d250.c3938c",
        "order": 5,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Shutdown",
        "color": "",
        "bgcolor": "",
        "icon": "fa-power-off",
        "payload": "now",
        "payloadType": "str",
        "topic": "",
        "x": 1058,
        "y": 1377,
        "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": 1514,
        "y": 1371,
        "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": 1198,
        "y": 1308,
        "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": 947,
        "y": 1310,
        "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": 1482.5,
        "y": 1313,
        "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": 1708,
        "y": 1313,
        "wires": [
            [
                "69a120c2.08e33"
            ],
            [],
            []
        ]
    },
    {
        "id": "69a120c2.08e33",
        "type": "debug",
        "z": "a564595f.642818",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 1890.7142857142856,
        "y": 1314.2857142857142,
        "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": 2508.5,
        "y": 999,
        "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": 2507,
        "y": 1059,
        "wires": [
            []
        ]
    },
    {
        "id": "f1d6da3e.a43598",
        "type": "debug",
        "z": "a564595f.642818",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 3417.5,
        "y": 58,
        "wires": []
    },
    {
        "id": "640f9404.72d27c",
        "type": "file in",
        "z": "a564595f.642818",
        "name": "Cloud Log Config",
        "filename": "",
        "format": "utf8",
        "sendError": false,
        "x": 2645.5,
        "y": 20,
        "wires": [
            [
                "a4b482e4.388e7"
            ]
        ]
    },
    {
        "id": "a4b482e4.388e7",
        "type": "json",
        "z": "a564595f.642818",
        "name": "",
        "x": 2804.5,
        "y": 21,
        "wires": [
            [
                "3c8572c8.6a4b1e"
            ]
        ]
    },
    {
        "id": "3c8572c8.6a4b1e",
        "type": "function",
        "z": "a564595f.642818",
        "name": "Set Up Tilt Pi",
        "func": "//load context storage from text file\nvar count = flow.get('setupmanager')||0;\n//node.warn(count);\n//allow 60 seconds for beer name to be updated, then send IP address\nif (count < 60 ){\nif (msg.payload.beer !== undefined){\ncontext.set('beerArray',[msg.payload.beer,true]);\ncontext.set('comment',msg.payload.email);\n}\nif (msg.payload.Color !== undefined){\nvar beerArray = context.get('beerArray');\nvar comment = context.get('comment');\ncount++;\nif (count === 1){\n    flow.set('cloudURL',\"https://script.google.com/macros/s/AKfycbwNXh6rEWoULd0vxWxDylG_PJwQwe0dn5hdtSkuC4k3D9AXBSA/exec\");\n    flow.set(msg.payload.Color + \"-Comment\",comment);\n    flow.set('logCloudDataCheck',true);\n    flow.set(msg.payload.Color + \"-Beer\",beerArray);\n    flow.set('lastpost-' + msg.payload.Color,0);\n}\nif (count > 1 && count < 61 && flow.get(msg.payload.Color + \"-Beer\")[1] !== true){\n//node.warn(count);\nvar ipAddress = flow.get('ipaddress');\nflow.set(msg.payload.Color + \"-Comment\",ipAddress);\nflow.set('lastpost-' + msg.payload.Color,0);\ncount = 61;\nmsg.payload = \"success\"\nnode.send(msg);\n}\nflow.set('setupmanager',count);\n}\n}",
        "outputs": 1,
        "noerr": 0,
        "x": 2988.5,
        "y": 76,
        "wires": [
            [
                "7b880cec.674314"
            ]
        ]
    },
    {
        "id": "84c05058.79f0d",
        "type": "inject",
        "z": "a564595f.642818",
        "name": "",
        "topic": "",
        "payload": "/boot/cloud_log.json",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": true,
        "x": 2220,
        "y": 20,
        "wires": [
            [
                "4a3d87ba.8dff08",
                "cd073a.aab1a8c8"
            ]
        ]
    },
    {
        "id": "cd073a.aab1a8c8",
        "type": "change",
        "z": "a564595f.642818",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "setupmanager",
                "pt": "flow",
                "to": "0",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2440,
        "y": 60,
        "wires": [
            []
        ]
    },
    {
        "id": "7b880cec.674314",
        "type": "exec",
        "z": "a564595f.642818",
        "command": "sudo rm /boot/cloud_log.json",
        "addpay": false,
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "oldrc": false,
        "name": "Remove Cloud Config File",
        "x": 3220,
        "y": 20,
        "wires": [
            [],
            [],
            []
        ]
    },
    {
        "id": "4a3d87ba.8dff08",
        "type": "change",
        "z": "a564595f.642818",
        "name": "filename",
        "rules": [
            {
                "t": "move",
                "p": "payload",
                "pt": "msg",
                "to": "filename",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2440,
        "y": 20,
        "wires": [
            [
                "640f9404.72d27c"
            ]
        ]
    },
    {
        "id": "f663d5d8.9f9448",
        "type": "change",
        "z": "a564595f.642818",
        "name": "",
        "rules": [
            {
                "t": "move",
                "p": "payload",
                "pt": "msg",
                "to": "options",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "colordropdownSelect",
                "tot": "flow"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 840,
        "y": 480,
        "wires": [
            [
                "93d9202c.d9c1e",
                "b418ce11.8981a"
            ]
        ]
    },
    {
        "id": "c7d23677.6a67f8",
        "type": "inject",
        "z": "a564595f.642818",
        "name": "update options",
        "topic": "",
        "payload": "options",
        "payloadType": "flow",
        "repeat": "10",
        "crontab": "",
        "once": false,
        "x": 580,
        "y": 480,
        "wires": [
            [
                "f663d5d8.9f9448"
            ]
        ]
    },
    {
        "id": "fcd6778b.dcc9f8",
        "type": "debug",
        "z": "a564595f.642818",
        "name": "",
        "active": false,
        "console": "false",
        "complete": "payload.Beer",
        "x": 2723.265625,
        "y": 152.26953125,
        "wires": []
    },
    {
        "id": "2267309d.95b65",
        "type": "function",
        "z": "a564595f.642818",
        "name": "Wait for Tilt Scan",
        "func": "//wait until all colors have been scanned\nvar color = context.get('color')||\"\";\nvar counter = context.get('counter')||0;\nif(color === msg.payload.Color && counter < 5){\ncounter++;\ncontext.set('counter',counter);\n}\ncontext.set('color',msg.payload.Color);\nif (counter === 5){\n    return msg;\n}\n",
        "outputs": "1",
        "noerr": 0,
        "x": 2650,
        "y": 80,
        "wires": [
            [
                "3c8572c8.6a4b1e"
            ]
        ]
    }
]
noahbaron

Flow Info

created 1 month ago

Node Types

Core
  • change (x24)
  • comment (x2)
  • debug (x3)
  • delay (x2)
  • exec (x9)
  • file (x3)
  • file in (x3)
  • function (x39)
  • http in (x1)
  • http request (x1)
  • http response (x1)
  • inject (x17)
  • json (x2)
  • switch (x3)
Other
  • scanBeacon (x1)
  • split (x1)
  • tab (x1)
  • ui_base (x1)
  • ui_button (x6)
  • ui_dropdown (x3)
  • ui_group (x16)
  • ui_slider (x2)
  • ui_switch (x4)
  • ui_tab (x4)
  • ui_template (x10)
  • ui_text (x6)
  • ui_text_input (x7)
  • ui_toast (x5)

Tags

  • Tilt
  • TiltPi
  • brew
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option