[ { "id": "bd033c75.c97bd", "type": "tab", "label": "Blockchain", "disabled": false, "info": "" }, { "id": "b496f71c.546088", "type": "tab", "label": "Dashboard", "disabled": false, "info": "" }, { "id": "6b9de9e3.32ee28", "type": "tab", "label": "Gauge Simulator", "disabled": false, "info": "" }, { "id": "cbc61383.cc0f5", "type": "ui_group", "z": "", "name": "Blockchain", "tab": "70b558f5.711d68", "order": 2, "disp": true, "width": "6" }, { "id": "fa648df3.380e48", "type": "ui_group", "z": "", "name": "Thermostat", "tab": "70b558f5.711d68", "order": 4, "disp": true, "width": "6" }, { "id": "70b558f5.711d68", "type": "ui_tab", "z": "", "name": "Home", "icon": "dashboard", "order": 2 }, { "id": "7ca13b2c.9ab064", "type": "ui_base", "theme": { "name": "theme-light", "lightTheme": { "default": "#0094CE", "baseColor": "#0094CE", "baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif", "edited": true, "reset": false }, "darkTheme": { "default": "#097479", "baseColor": "#097479", "baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif", "edited": false }, "customTheme": { "name": "Untitled Theme 1", "default": "#4B7930", "baseColor": "#4B7930", "baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif" }, "themeState": { "base-color": { "default": "#0094CE", "value": "#0094CE", "edited": false }, "page-titlebar-backgroundColor": { "value": "#0094CE", "edited": false }, "page-backgroundColor": { "value": "#fafafa", "edited": false }, "page-sidebar-backgroundColor": { "value": "#ffffff", "edited": false }, "group-textColor": { "value": "#1bbfff", "edited": false }, "group-borderColor": { "value": "#ffffff", "edited": false }, "group-backgroundColor": { "value": "#ffffff", "edited": false }, "widget-textColor": { "value": "#111111", "edited": false }, "widget-backgroundColor": { "value": "#0094ce", "edited": false }, "widget-borderColor": { "value": "#ffffff", "edited": false }, "base-font": { "value": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif" } } }, "site": { "name": "Thermostat Control Board", "hideToolbar": "false", "allowSwipe": "false", "dateFormat": "DD/MM/YYYY", "sizes": { "sx": 40, "sy": 46, "gx": 6, "gy": 6, "cx": 6, "cy": 6, "px": 0, "py": 0 } } }, { "id": "95e44223.36123", "type": "ui_group", "z": "", "name": "Blockchain", "tab": "", "order": 2, "disp": true, "width": "6" }, { "id": "7266bb36.515e9c", "type": "ui_group", "z": "", "name": "Thermostat", "tab": "", "order": 4, "disp": true, "width": "6" }, { "id": "eea58c70.1b94b8", "type": "ui_group", "z": "", "name": "Blockchain", "tab": "", "order": 1, "disp": true, "width": "6" }, { "id": "a7a21e87.a706e8", "type": "ui_group", "z": "", "name": "Thermostat", "tab": "", "order": 2, "disp": true, "width": "6" }, { "id": "f0f2d9ea.cfc128", "type": "ui_group", "z": "", "name": "SenseHat", "tab": "70b558f5.711d68", "order": 1, "disp": true, "width": "6" }, { "id": "7746a15.5363de", "type": "ui_group", "z": "", "name": "Outside Temperatures", "tab": "70b558f5.711d68", "order": 3, "disp": true, "width": "6" }, { "id": "ad553691.7872c", "type": "ui_text_input", "z": "bd033c75.c97bd", "name": "", "label": "TeamName", "group": "cbc61383.cc0f5", "order": 1, "width": "6", "height": "1", "passthru": true, "mode": "text", "delay": "500", "topic": "", "x": 710, "y": 80, "wires": [ [ "2ce2b11f.d88526" ] ] }, { "id": "22812c61.b1fa64", "type": "http request", "z": "bd033c75.c97bd", "name": "Set Team Name", "method": "POST", "ret": "obj", "url": "http://localhost:3000/api/org.acme.sample.Sensor", "tls": "", "x": 720, "y": 260, "wires": [ [ "b04cf9c1.b7c388" ] ] }, { "id": "2ce2b11f.d88526", "type": "function", "z": "bd033c75.c97bd", "name": "setTeamname", "func": "n = msg.payload;\nglobal.set('teamName',n);\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 940, "y": 80, "wires": [ [] ] }, { "id": "b925ca63.09e588", "type": "ui_button", "z": "bd033c75.c97bd", "name": "", "group": "fa648df3.380e48", "order": 4, "width": 0, "height": 0, "passthru": false, "label": "Change Thermostat", "color": "Light Blue", "bgcolor": "", "icon": "", "payload": "", "payloadType": "str", "topic": "", "x": 180, "y": 420, "wires": [ [ "85198104.ad34a8" ] ] }, { "id": "85198104.ad34a8", "type": "function", "z": "bd033c75.c97bd", "name": "ChangeThermo", "func": "tid = global.get('teamName');\ntime = new Date().toISOString();\nthermo = global.get('TempThermostat');\nasset = \"resource:org.acme.sample.Sensor#\"+tid,\n\nmsg.payload = {\n \"$class\": \"org.acme.sample.ChangeThermostatTemp\",\n \"thermostat\": asset,\n \"newThermostatValue\": thermo,\n \"timestamp\": time\n}\nreturn msg;", "outputs": 1, "noerr": 0, "x": 480, "y": 420, "wires": [ [ "9bdcd882.70553" ] ] }, { "id": "9bdcd882.70553", "type": "http request", "z": "bd033c75.c97bd", "name": "Change Thermostat", "method": "POST", "ret": "obj", "url": "http://localhost:3000/api/org.acme.sample.ChangeThermostatTemp", "tls": "", "x": 740, "y": 420, "wires": [ [ "8b13fb14.afccb8" ] ] }, { "id": "9a37029f.23dcf8", "type": "ui_button", "z": "bd033c75.c97bd", "name": "", "group": "cbc61383.cc0f5", "order": 5, "width": "6", "height": "1", "passthru": false, "label": "Get Recommendation", "color": "", "bgcolor": "", "icon": "", "payload": "", "payloadType": "str", "topic": "", "x": 180, "y": 580, "wires": [ [ "c7e67669.78ebe8" ] ] }, { "id": "c7e67669.78ebe8", "type": "function", "z": "bd033c75.c97bd", "name": "getRecommendation", "func": "tid = global.get('teamName');\ntime = new Date().toISOString();\nweather = global.get('weather-observation');\nasset = \"resource:org.acme.sample.Sensor#\"+tid,\ntransid = global.get('lastTransID');\nmsg.payload = {\n \"$class\": \"org.acme.sample.CompareWeather\",\n \"transactionId\": transid,\n \"recommend\": asset,\n \"outsideTemp\": weather.current_observation.temp_c,\n \"feelsLike\": weather.current_observation.feelslike_c,\n \"timestamp\": time\n}\nreturn msg;", "outputs": 1, "noerr": 0, "x": 500, "y": 580, "wires": [ [ "5eb7e1b1.92b55" ] ] }, { "id": "5eb7e1b1.92b55", "type": "http request", "z": "bd033c75.c97bd", "name": "CompareWeather", "method": "POST", "ret": "obj", "url": "http://localhost:3000/api/org.acme.sample.CompareWeather", "tls": "", "x": 730, "y": 580, "wires": [ [ "6235ee0b.0f13d8", "fae23f77.a3ac98" ] ] }, { "id": "6235ee0b.0f13d8", "type": "function", "z": "bd033c75.c97bd", "name": "getTeamID", "func": "team = global.get('teamName');\nmsg = {};\nmsg.topic = team;\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 950, "y": 580, "wires": [ [ "dc00e5df.29e7e8" ] ] }, { "id": "dc00e5df.29e7e8", "type": "http request", "z": "bd033c75.c97bd", "name": "", "method": "GET", "ret": "obj", "url": "http://localhost:3000/api/org.acme.sample.Sensor/{{{topic}}}", "tls": "", "x": 1153, "y": 580, "wires": [ [ "d70b601b.57c898", "ed33ea5.1e9e518" ] ] }, { "id": "6c922609.93d0a", "type": "ui_toast", "z": "bd033c75.c97bd", "position": "dialog", "displayTime": "3", "highlight": "", "outputs": 1, "ok": "OK", "cancel": "", "topic": "", "name": "", "x": 710, "y": 160, "wires": [ [] ] }, { "id": "c0b10ee1.6df078", "type": "inject", "z": "bd033c75.c97bd", "name": "check team name", "topic": "Team Name is not set. Please add your team name and press the add team name button", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": true, "x": 170, "y": 120, "wires": [ [ "50ca4399.fd8844", "c7468c46.3b90b" ] ] }, { "id": "50ca4399.fd8844", "type": "function", "z": "bd033c75.c97bd", "name": "locatedTeamName", "func": "team = global.get(\"teamName\");\nif (team){\n msg.topic=\"Team Name is set\"\n msg.payload = team;\n}\nreturn msg;", "outputs": 1, "noerr": 0, "x": 490, "y": 160, "wires": [ [ "6c922609.93d0a" ] ] }, { "id": "fd9980ac.0060a", "type": "ui_button", "z": "bd033c75.c97bd", "name": "", "group": "cbc61383.cc0f5", "order": 2, "width": "6", "height": "1", "passthru": false, "label": "Add Team Name", "color": "", "bgcolor": "", "icon": "", "payload": "", "payloadType": "str", "topic": "", "x": 160, "y": 260, "wires": [ [ "e1194e5e.1bf628" ] ] }, { "id": "e1194e5e.1bf628", "type": "function", "z": "bd033c75.c97bd", "name": "getTeamName", "func": "global.set('Thermostat', 20);\ntherm = global.get('Thermostat');\nd = global.get('SenseHat');\nn = global.get('teamName');\nmsg.payload = {\n \"$class\": \"org.acme.sample.Sensor\",\n \"teamID\": n,\n \"teamName\": n,\n \"sensorTemp\":d,\n \"thermostatTemp\":therm,\n \"recommendation\":\"none\"\n};\nreturn msg;", "outputs": 1, "noerr": 0, "x": 480, "y": 260, "wires": [ [ "22812c61.b1fa64" ] ] }, { "id": "c7468c46.3b90b", "type": "function", "z": "bd033c75.c97bd", "name": "Find Team Name", "func": "n = global.get('teamName');\nif (n){\n msg.payload = n;\n}else{\n msg.payload=\"Please Add Team Name\";\n}\nreturn msg;", "outputs": 1, "noerr": 0, "x": 490, "y": 80, "wires": [ [ "ad553691.7872c" ] ] }, { "id": "13130a6a.b32d2e", "type": "ui_text", "z": "bd033c75.c97bd", "group": "cbc61383.cc0f5", "order": 4, "width": "6", "height": "1", "name": "", "label": "Ask Block Chain for Recommendation", "format": "{{msg.payload}}", "layout": "row-left", "x": 230, "y": 500, "wires": [] }, { "id": "efff5b2c.d8f298", "type": "link out", "z": "bd033c75.c97bd", "name": "Weather", "links": [ "df37e672.769ad8", "72f4d806.569918" ], "x": 895, "y": 880, "wires": [] }, { "id": "b04cf9c1.b7c388", "type": "link out", "z": "bd033c75.c97bd", "name": "Blockchain - teamname", "links": [ "59c983ad.e02524", "a7d68b81.eac738", "5652fca4.ecaf84" ], "x": 895, "y": 260, "wires": [] }, { "id": "8b13fb14.afccb8", "type": "link out", "z": "bd033c75.c97bd", "name": "Blockchain change thermo", "links": [ "59c983ad.e02524", "a7d68b81.eac738" ], "x": 895, "y": 420, "wires": [] }, { "id": "fae23f77.a3ac98", "type": "link out", "z": "bd033c75.c97bd", "name": "Blockchain Compare", "links": [ "a7d68b81.eac738" ], "x": 895, "y": 640, "wires": [] }, { "id": "d70b601b.57c898", "type": "link out", "z": "bd033c75.c97bd", "name": "Blockchain recommendation", "links": [ "26579818.2a28c8", "34c327fb.be62a8", "75de2a45.2df90c" ], "x": 1295, "y": 580, "wires": [] }, { "id": "a7d68b81.eac738", "type": "link in", "z": "b496f71c.546088", "name": "Blockchain Main Dash", "links": [ "8b13fb14.afccb8", "b04cf9c1.b7c388", "fae23f77.a3ac98" ], "x": 75, "y": 200, "wires": [ [ "39eb3686.e3066a" ] ] }, { "id": "758aeb3a.896444", "type": "ui_text", "z": "b496f71c.546088", "group": "cbc61383.cc0f5", "order": 3, "width": 0, "height": 0, "name": "block count", "label": "Blocks in Chain", "format": "{{msg.payload}}", "layout": "col-center", "x": 750, "y": 200, "wires": [] }, { "id": "39eb3686.e3066a", "type": "function", "z": "b496f71c.546088", "name": "Number of Blocks", "func": "\nif(global.get(\"blocks\") && global.get(\"blocks\")>0){\n val = global.get(\"blocks\") + 1;\n}else{\n val = 1;\n}\n\nglobal.set(\"blocks\",val);\nmsg.payload = val;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 250, "y": 200, "wires": [ [ "758aeb3a.896444" ] ] }, { "id": "5652fca4.ecaf84", "type": "link in", "z": "b496f71c.546088", "name": "status teamname", "links": [ "b04cf9c1.b7c388" ], "x": 75, "y": 280, "wires": [ [ "2ea5f9b9.26dd56" ] ] }, { "id": "59c983ad.e02524", "type": "link in", "z": "b496f71c.546088", "name": "status change thermostat", "links": [ "8b13fb14.afccb8", "b04cf9c1.b7c388" ], "x": 75, "y": 580, "wires": [ [ "776eaa4e.8c3204" ] ] }, { "id": "75de2a45.2df90c", "type": "link in", "z": "b496f71c.546088", "name": "status recommendation", "links": [ "d70b601b.57c898" ], "x": 75, "y": 440, "wires": [ [ "bd11342b.813db" ] ] }, { "id": "50fab72d.be44b8", "type": "ui_text", "z": "b496f71c.546088", "group": "cbc61383.cc0f5", "order": 6, "width": "6", "height": "3", "name": "Blockchain status line", "label": "Status", "format": "{{msg.message}}", "layout": "col-center", "x": 780, "y": 360, "wires": [] }, { "id": "2ea5f9b9.26dd56", "type": "function", "z": "b496f71c.546088", "name": "Status", "func": "if (msg.payload.error && msg.payload.error.statusCode == 500){\n msg.message = \"Team Exists\";\nreturn msg;\n \n}\n\n\nif (msg.payload.teamName){\n msg.message = msg.payload.teamName + \" added successfully\";\nreturn msg;\n \n}\n\n\nif (msg.payload.transactionId){\n msg.message = \"Transaction added:
\" + msg.payload.transactionId;\n global.set('lastTransID', msg.payload.transactionId);\n return msg;\n}\n\n\n//msg.payload = \"\";\nreturn msg.message;\n", "outputs": 1, "noerr": 0, "x": 210, "y": 280, "wires": [ [ "50fab72d.be44b8" ] ] }, { "id": "63416db1.05a4f4", "type": "ui_slider", "z": "b496f71c.546088", "name": "Thermostat", "label": "Thermostat Value", "group": "fa648df3.380e48", "order": 2, "width": "6", "height": "1", "passthru": true, "topic": "", "min": "15", "max": "40", "step": 1, "x": 730, "y": 520, "wires": [ [ "f0a27e3.1615c", "f35f97c2.94714" ] ] }, { "id": "f0a27e3.1615c", "type": "function", "z": "b496f71c.546088", "name": "Save Thermostat Global", "func": "global.set('TempThermostat',msg.payload);\nreturn msg;", "outputs": 1, "noerr": 0, "x": 970, "y": 500, "wires": [ [] ] }, { "id": "f35f97c2.94714", "type": "ui_gauge", "z": "b496f71c.546088", "name": "Thermostat Guage", "group": "fa648df3.380e48", "order": 3, "width": 0, "height": 0, "gtype": "gage", "title": "Thermostat", "label": "Celsius", "format": "{{value}}", "min": "15", "max": "40", "colors": [ "#00b500", "#e6e600", "#ca3838" ], "seg1": "", "seg2": "", "x": 950, "y": 540, "wires": [] }, { "id": "48802e7b.75655", "type": "ui_text", "z": "b496f71c.546088", "group": "fa648df3.380e48", "order": 5, "width": "6", "height": "1", "name": "Thermo Value", "label": "Current Thermostat Setting", "format": "{{msg.payload}}", "layout": "row-spread", "x": 740, "y": 580, "wires": [] }, { "id": "22d0590.e3b9a28", "type": "ui_text", "z": "b496f71c.546088", "group": "fa648df3.380e48", "order": 1, "width": "6", "height": "2", "name": "Thermostat status line", "label": "Status", "format": "{{msg.message}}", "layout": "col-center", "x": 760, "y": 640, "wires": [] }, { "id": "776eaa4e.8c3204", "type": "function", "z": "b496f71c.546088", "name": "Status", "func": "\nif (msg.payload.error){\n msg.message = \"Failed to change the Thermostat\";\n msg.payload = global.get('Thermostat');\n return msg;\n}\n\nif ((msg.payload.$class) && (msg.payload.$class === \"org.acme.sample.ChangeThermostatTemp\")){\n if(msg.payload.transactionId){\n msg.message = \"Changed Thermostat to \" + msg.payload.newThermostatValue;\n global.set('Thermostat',msg.payload.newThermostatValue );\n msg.payload = msg.payload.newThermostatValue;\n return msg;\n }\n msg.message = \"Failed to change the Thermostat\";\n msg.payload = global.get('Thermostat');\n return msg;\n}\nmsg.payload = global.get('Thermostat');\nmsg.message = \"\";\nreturn msg;\n", "outputs": 1, "noerr": 0, "x": 430, "y": 580, "wires": [ [ "48802e7b.75655", "22d0590.e3b9a28", "63416db1.05a4f4" ] ] }, { "id": "bd11342b.813db", "type": "function", "z": "b496f71c.546088", "name": "status", "func": "\nif ((msg.payload.$class) && (msg.payload.$class === \"org.acme.sample.Sensor\") && (msg.payload.recommendation)){\n msg.thermo = msg.payload.thermostatTemp;\n msg.message = msg.payload.recommendation;\n \nreturn msg;\n}\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 210, "y": 440, "wires": [ [ "50fab72d.be44b8", "22f9dbeb.a6bf64" ] ] }, { "id": "22f9dbeb.a6bf64", "type": "function", "z": "b496f71c.546088", "name": "update Thermostat", "func": "msg.payload = msg.thermo;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 470, "y": 480, "wires": [ [ "63416db1.05a4f4", "48802e7b.75655" ] ] }, { "id": "89e00c04.4638a8", "type": "ui_gauge", "z": "b496f71c.546088", "name": "", "group": "f0f2d9ea.cfc128", "order": 1, "width": 0, "height": 0, "gtype": "gage", "title": "Temperature", "label": "Celsius", "format": "{{value}}", "min": "25", "max": "45", "colors": [ "#00b500", "#e6e600", "#ca3838" ], "seg1": "", "seg2": "", "x": 750, "y": 40, "wires": [] }, { "id": "624a1a7d.1bbd0c", "type": "ui_chart", "z": "b496f71c.546088", "name": "", "group": "f0f2d9ea.cfc128", "order": 2, "width": 0, "height": 0, "label": "chart", "chartType": "line", "legend": "false", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "Waiting on temperature data", "dot": false, "ymin": "", "ymax": "", "removeOlder": 1, "removeOlderPoints": "", "removeOlderUnit": "3600", "cutout": 0, "colors": [ "#1f77b4", "#aec7e8", "#ff7f0e", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "x": 730, "y": 80, "wires": [ [], [] ] }, { "id": "d94cfb01.555b38", "type": "link in", "z": "b496f71c.546088", "name": "Temperature Gauges", "links": [ "4c1f9b80.19e904" ], "x": 75, "y": 80, "wires": [ [ "cc9b0365.051bc8" ] ] }, { "id": "cc9b0365.051bc8", "type": "function", "z": "b496f71c.546088", "name": "format: temperature", "func": "global.set('SenseHat', msg.payload.temperature);\nmsg.payload = msg.payload.temperature;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 260, "y": 80, "wires": [ [ "89e00c04.4638a8", "624a1a7d.1bbd0c", "93404d4e.04b83" ] ] }, { "id": "df37e672.769ad8", "type": "link in", "z": "b496f71c.546088", "name": "Weather Dashboard", "links": [ "efff5b2c.d8f298" ], "x": 29.005553245544434, "y": 926.2277479171753, "wires": [ [ "ccae86f2.ce4d18" ] ] }, { "id": "ccae86f2.ce4d18", "type": "function", "z": "b496f71c.546088", "name": "Cache Weather", "func": "global.set('weather-observation',msg.payload);\nmsg.payload = {\n feelslike: msg.payload.current_observation.feelslike_c,\n outside: msg.payload.current_observation.temp_c\n};\nreturn msg;", "outputs": 1, "noerr": 0, "x": 244.00555229187012, "y": 927.3388137817383, "wires": [ [ "b4ba5a9f.fd49c", "aec67bda.69224" ] ] }, { "id": "acbed7ec.a656d8", "type": "ui_gauge", "z": "b496f71c.546088", "name": "Feels like", "group": "7746a15.5363de", "order": 1, "width": 0, "height": 0, "gtype": "gage", "title": "Feels Like", "label": "Celsius", "format": "{{value}}", "min": "0", "max": "40", "colors": [ "#00b500", "#e6e600", "#ca3838" ], "seg1": "", "seg2": "", "x": 637.7833461761475, "y": 896.5610256195068, "wires": [] }, { "id": "5b62e5b8.98041c", "type": "ui_gauge", "z": "b496f71c.546088", "name": "Outside Temerature", "group": "7746a15.5363de", "order": 2, "width": 0, "height": 0, "gtype": "gage", "title": "Outside", "label": "Celsius", "format": "{{value|number:1}}", "min": "0", "max": "40", "colors": [ "#00b500", "#e6e600", "#ca3838" ], "seg1": "", "seg2": "", "x": 659.7833461761475, "y": 950.5610256195068, "wires": [] }, { "id": "b4ba5a9f.fd49c", "type": "function", "z": "b496f71c.546088", "name": "Get Feels Like", "func": "msg.payload = msg.payload.feelslike;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 438.78334617614746, "y": 898.5610256195068, "wires": [ [ "acbed7ec.a656d8" ] ] }, { "id": "aec67bda.69224", "type": "function", "z": "b496f71c.546088", "name": "Get Outside", "func": "msg.payload=msg.payload.outside;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 428.78334617614746, "y": 951.5610256195068, "wires": [ [ "5b62e5b8.98041c" ] ] }, { "id": "c99759a9.968038", "type": "rpi-sensehatsim in", "z": "6b9de9e3.32ee28", "name": "Sensor Gauge Simulator", "motion": false, "env": true, "stick": false, "x": 170, "y": 100, "wires": [ [ "4c1f9b80.19e904" ] ] }, { "id": "4c1f9b80.19e904", "type": "link out", "z": "6b9de9e3.32ee28", "name": "IoT Environment Source", "links": [ "d94cfb01.555b38" ], "x": 375, "y": 100, "wires": [] }, { "id": "95de857e.c2ecb8", "type": "ui_text_input", "z": "bd033c75.c97bd", "name": "", "label": "City", "group": "7746a15.5363de", "order": 3, "width": "6", "height": "1", "passthru": true, "mode": "text", "delay": "500", "topic": "", "x": 690, "y": 720, "wires": [ [ "8ae1fd6a.9f9758" ] ] }, { "id": "8ae1fd6a.9f9758", "type": "function", "z": "bd033c75.c97bd", "name": "setCity", "func": "n = msg.payload;\nglobal.set('city',n);\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 930, "y": 720, "wires": [ [] ] }, { "id": "3563fbce.58de4c", "type": "inject", "z": "bd033c75.c97bd", "name": "check City, State", "topic": "A City, State is note entered. Please add a City, State and then press the Get Current Temps button.", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": true, "x": 170, "y": 760, "wires": [ [ "6204516d.86b27", "81b39770.3c2818" ] ] }, { "id": "6204516d.86b27", "type": "function", "z": "bd033c75.c97bd", "name": "Find City", "func": "n = global.get('city');\nif (n){\n msg.payload = n;\n}else{\n msg.payload=\"Please enter a city.\";\n}\nreturn msg;", "outputs": 1, "noerr": 0, "x": 460, "y": 720, "wires": [ [ "95de857e.c2ecb8" ] ] }, { "id": "84228128.a5e1b", "type": "ui_text_input", "z": "bd033c75.c97bd", "name": "", "label": "State", "group": "7746a15.5363de", "order": 4, "width": "6", "height": "1", "passthru": true, "mode": "text", "delay": "500", "topic": "", "x": 690, "y": 800, "wires": [ [ "67eaf469.3870bc" ] ] }, { "id": "67eaf469.3870bc", "type": "function", "z": "bd033c75.c97bd", "name": "setState", "func": "n = msg.payload;\nglobal.set('state',n);\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 940, "y": 800, "wires": [ [] ] }, { "id": "81b39770.3c2818", "type": "function", "z": "bd033c75.c97bd", "name": "Find State", "func": "n = global.get('state');\nif (n){\n msg.payload = n;\n}else{\n msg.payload=\"Please enter the state your city is in.\";\n}\nreturn msg;", "outputs": 1, "noerr": 0, "x": 470, "y": 800, "wires": [ [ "84228128.a5e1b" ] ] }, { "id": "e69a87fc.92d228", "type": "ui_button", "z": "bd033c75.c97bd", "name": "", "group": "7746a15.5363de", "order": 5, "width": "6", "height": "1", "passthru": false, "label": "Get Current Temps", "color": "", "bgcolor": "", "icon": "", "payload": "", "payloadType": "str", "topic": "", "x": 170, "y": 880, "wires": [ [ "a99d4795.038198" ] ] }, { "id": "a99d4795.038198", "type": "function", "z": "bd033c75.c97bd", "name": "City,State", "func": "city = global.get('city');\nmsg = {};\nmsg.city=city;\nmsg.state = global.get('state');\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 460, "y": 880, "wires": [ [ "caa5002a.1f08b8" ] ] }, { "id": "caa5002a.1f08b8", "type": "http request", "z": "bd033c75.c97bd", "name": "", "method": "GET", "ret": "obj", "url": "http://api.wunderground.com/api/9648f5eaf4b568c9/conditions/q/{{{state}}}/{{{city}}}.json", "tls": "", "x": 710, "y": 880, "wires": [ [ "efff5b2c.d8f298" ] ] }, { "id": "ed33ea5.1e9e518", "type": "debug", "z": "bd033c75.c97bd", "name": "", "active": true, "console": "false", "complete": "false", "x": 1350, "y": 520, "wires": [] }, { "id": "93404d4e.04b83", "type": "link out", "z": "b496f71c.546088", "name": "SenseHat", "links": [ "9d79bb8d.383e6" ], "x": 695, "y": 120, "wires": [] }, { "id": "556ad488.4bbc3c", "type": "ui_button", "z": "bd033c75.c97bd", "name": "", "group": "f0f2d9ea.cfc128", "order": 0, "width": 0, "height": 0, "passthru": false, "label": "Get Sense Hat Temperature", "color": "", "bgcolor": "", "icon": "", "payload": "", "payloadType": "str", "topic": "", "x": 200, "y": 340, "wires": [ [ "8e1f9e1a.78568" ] ] }, { "id": "8e1f9e1a.78568", "type": "function", "z": "bd033c75.c97bd", "name": "getSenseHatValue", "func": "team = global.get('teamName');\nsenseHat = global.get('SenseHat');\nmsg.payload = {\n \"$class\": \"org.acme.sample.SetSensorTemp\",\n \"gauge\": team,\n \"newSensorValue\": senseHat\n};\nreturn msg;", "outputs": 1, "noerr": 0, "x": 490, "y": 340, "wires": [ [ "5242f271.f61cfc" ] ] }, { "id": "5242f271.f61cfc", "type": "http request", "z": "bd033c75.c97bd", "name": "setSensorTemp", "method": "POST", "ret": "obj", "url": "http://localhost:3000/api/org.acme.sample.SetSensorTemp", "tls": "", "x": 720, "y": 340, "wires": [ [ "9c50c2e1.04796" ] ] }, { "id": "9c50c2e1.04796", "type": "link out", "z": "bd033c75.c97bd", "name": "SetSensorTempStatus", "links": [ "600f0958.a80598" ], "x": 895, "y": 340, "wires": [] }, { "id": "600f0958.a80598", "type": "link in", "z": "b496f71c.546088", "name": "SetSensorStatus", "links": [ "9c50c2e1.04796" ], "x": 75, "y": 360, "wires": [ [ "76b3004c.50caa" ] ] }, { "id": "76b3004c.50caa", "type": "function", "z": "b496f71c.546088", "name": "SetSensorStatus", "func": "\nif (msg.payload.error){\n msg.message = \"An invalid team was specified.\";\nreturn msg;\n}\nelse {\n msg.message = \"Sense Hat temperature updated to \" + msg.payload.newSensorValue;\n return msg;\n}\n", "outputs": 1, "noerr": 0, "x": 250, "y": 360, "wires": [ [ "50fab72d.be44b8" ] ] } ]