Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- {
- "id": "d6870949.5422d8",
- "type": "ui_template",
- "z": "e7f81119.1bd4",
- "group": "bd48728c.866f2",
- "name": "css etc",
- "order": 12,
- "width": "0",
- "height": "0",
- "format": "<style>\n\n.cellGreen \n{\nbackground-color: #ffdddd !important;\n}\n\n .filled { \n height: 100% !important;\n\n padding: 0 !important;\n margin: 0 !important;\n }\n .nr-dashboard-template {\n padding: 0;\n margin: 0;\n }\n \n .rounded {\n border-radius: 8px 8px 8px 8px;\n}\n \n .bigfont {\n font-size: 16px;\n}\n\n .smallfont {\n font-size: 12px;\n}\n \n\n \n.zui-table {\n border: solid 1px #DDEEEE;\n border-collapse: collapse;\n border-spacing: 0;\n font: bold 10px Arial, sans-serif;\n outline: none;\n}\n.zui-table thead th {\n width: 100%;\n height:50%;\n background-color: #99bbff;\n border: solid 1px #DDEEEE;\n color: #336B6B;\n font: normal 12px Arial, sans-serif;\n padding: 6px 3px 5px 3px;\n text-align: center;\n text-shadow: 1px 1px 1px #fff;\n}\n.zui-table tbody td {\n width: 100%;\n height:50%;\n border: solid 1px #333;\n color: #333;\n text-align: center;\n font: normal 15px Arial, sans-serif;\n padding: 2px 3px 2px 3px;\n text-shadow: 1px 1px 1px #fff;\n}\n.zui-table-rounded {\n border: none;\n}\n.zui-table-rounded thead th {\n background-color: #77aaff;\n border: none;\n text-shadow: 1px 1px 1px #ccc;\n color: #333;\n}\n.zui-table-rounded thead th:first-child {\n border-radius: 8px 0 0 0;\n}\n.zui-table-rounded thead th:last-child {\n border-radius: 8px 8px 0px 0px;\n}\n.zui-table-rounded tbody td {\n border: none;\n border-top: solid 1px #957030;\n background-color: #aaddff;\n}\n.zui-table-rounded tbody tr:last-child td:first-child {\n border-radius: 8px 8px 0 0;\n}\n.zui-table-rounded tbody tr:last-child td:last-child {\n border-radius: 0 0 8px 8px;\n} \n</style>\n\n<script>\nvar current=1;\n\n$('.vibrate').on('click', function() {\n navigator.vibrate(100);\n});\n\nfunction restore_bg(x) {\n $(this).css(\"background-color\", x);\n };\n\n$('.touched').on('mousedown', function() {\n \n var x= $(this).css(\"background-color\");\n $(this).css(\"background-color\", \"yellow\");\n \n setTimeout(restore_bg.bind(this,x),50);\n navigator.vibrate(80);\n });\n \n</script>",
- "storeOutMessages": true,
- "fwdInMessages": true,
- "templateScope": "local",
- "x": 620,
- "y": 40,
- "wires": [
- []
- ]
- },
- {
- "id": "5ddc1d3c.71b5d4",
- "type": "ui_template",
- "z": "e7f81119.1bd4",
- "group": "bd48728c.866f2",
- "name": "Settings section",
- "order": 2,
- "width": "6",
- "height": "6",
- "format": "<style>\n.thedays { vertical-align:bottom; height:66px; }\n.the2px { background-color:black; height:2px; }\n.theblocks {width:100%; height:0%; background-color:green; }\n.greybuttons { background-color:#dddddd !important; width:52px; }\n\n.thetemps { font-size:70%; color:orange !important; }\n.smallheadings { color:white; font-size:90%; }\n.smallfooter { color: white; font-size:100%; }\n.temptable { background-color:#444444; }\n\n</style>\n\n<script>\nvar thedays = [\"SUNDAY\", \"MONDAY\", \"TUESDAY\", \"WEDNESDAY\", \"THURSDAY\", \"FRIDAY\", \"SATURDAY\"];\n\nvar last = 1;\n\nfunction bar(mm, val) {\n if (val == 14) {\n $(mm).height(\"12%\");\n $(mm).css('background-color', '#6666ff');\n } //blue\n if (val == 15) {\n $(mm).height(\"16%\");\n $(mm).css('background-color', '#5577ff');\n }\n if (val == 16) {\n $(mm).height(\"20%\");\n $(mm).css('background-color', '#5599ff');\n }\n if (val == 17) {\n $(mm).height(\"24%\");\n $(mm).css('background-color', '#55ccdd');\n } // cyan\n if (val == 18) {\n $(mm).height(\"28%\");\n $(mm).css('background-color', '#55ddaa');\n }\n if (val == 19) {\n $(mm).height(\"32%\");\n $(mm).css('background-color', '#55dd55');\n }\n if (val == 20) {\n $(mm).height(\"36%\");\n $(mm).css('background-color', '#55dd55');\n } // green\n if (val == 21) {\n $(mm).height(\"40%\");\n $(mm).css('background-color', '#55dd55');\n }\n if (val == 22) {\n $(mm).height(\"44%\");\n $(mm).css('background-color', '#aadd55');\n }\n if (val == 23) {\n $(mm).height(\"48%\");\n $(mm).css('background-color', '#dddd55');\n } // yellow\n if (val == 24) {\n $(mm).height(\"52%\");\n $(mm).css('background-color', '#ffaa55');\n }\n if (val == 25) {\n $(mm).height(\"56%\");\n $(mm).css('background-color', '#ff8855');\n }\n if (val == 26) {\n $(mm).height(\"60%\");\n $(mm).css('background-color', '#ff7777');\n } // red\n\n}\n\nfunction stat(text) {\n $(\"#info\").text(text);\n var tm = setTimeout(function() {\n $(\"#info\").text(\"Ok\");\n clearTimeout(tm);\n }, 3000);\n}\n\nfunction selec(val, sta) {\n var w = \"#td\" + val;\n if (sta) $(w).css('background-color', 'magenta');\n else $(w).css('background-color', 'black');\n}\n\n(function(scope) {\n scope.$watch('msg', function(msg) {\n selec(last, 0);\n last = msg.selector;\n selec(last, 1);\n for (var x = 0; x < 24; x++) {\n var w = \"#t\" + x;\n bar(w, msg.timing[((msg.days - 1) * 24) + x]);\n var v = \"#v\" + x;\n $(v).text(msg.timing[((msg.days - 1) * 24) + x] + String.fromCharCode(176)+\"c\")\n }\n for (var x = 0; x < 2; x++) {\n var w = \"#s\" + x;\n $(w).text(msg.timing[168 + x] + String.fromCharCode(176)+\"c\");\n }\n $(\"#d0\").text(thedays[msg.days - 1]);\n if ((last > 4) && (last < 29))\n $(\"#current\").text(msg.timing[((msg.days - 1) * 24) + last - 5] + String.fromCharCode(176)+\"c\");\n else\n $(\"#current\").text(\"-\");\n\n if (msg.foryou != \"\") {\n stat(msg.foryou);\n }\n\n\n });\n\n})(scope);\n\n</script>\n<table width=\"100%\">\n\n <tr>\n <td colspan=12 height=\"4px\">\n \n </td>\n </tr>\n \n <tr>\n <td colspan=9 style=\"background-color:grey; border-radius: 8px 0 0 0;\">\n <center><span class=\"smallheadings\" >Day</span></center>\n </td>\n <td colspan=3 style=\"background-color:grey; border-radius: 0 8px 0 0;\">\n <center><span class=\"smallheadings\">Away</span></center>\n </td>\n </tr>\n\n <tr>\n <td style=\"background-color:grey\" ng-click=\"send({payload: '29'})\" colspan=9>\n <center><span id=\"d0\" style=\"color:yellow;font-size:150%\">MONDAY</span></center>\n </td>\n\n <td style=\"background-color:grey\" ng-click=\"send({payload: '2'})\" colspan=3>\n <center><span id=\"s1\" style=\"color:yellow;font-size:150%\">20</span></center>\n </td>\n </tr>\n\n <tr style=\"height:2px\">\n <td id=\"td29\" colspan=9 style=\"background-color:black;height:2px;\"></td>\n <td id=\"td2\" colspan=3 style=\"background-color:black;height:2px;\"></td>\n </tr>\n\n <tr class=\"temptable\">\n <td ng-click=\"send({payload: '5'})\" class=\"thedays\"><span id=\"v0\" class=\"thetemps\"></span>\n <div id=\"t0\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '6'})\" class=\"thedays\"><span id=\"v1\" class=\"thetemps\"></span>\n <div id=\"t1\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '7'})\" class=\"thedays\"><span id=\"v2\" class=\"thetemps\"></span>\n <div id=\"t2\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '8'})\" class=\"thedays\"><span id=\"v3\" class=\"thetemps\"></span>\n <div id=\"t3\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '9'})\" class=\"thedays\"><span id=\"v4\" class=\"thetemps\"></span>\n <div id=\"t4\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '10'})\" class=\"thedays\"><span id=\"v5\" class=\"thetemps\"></span>\n <div id=\"t5\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '11'})\" class=\"thedays\"><span id=\"v6\" class=\"thetemps\"></span>\n <div id=\"t6\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '12'})\" class=\"thedays\"><span id=\"v7\" class=\"thetemps\"></span>\n <div id=\"t7\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '13'})\" class=\"thedays\"><span id=\"v8\" class=\"thetemps\"></span>\n <div id=\"t8\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '14'})\" class=\"thedays\"><span id=\"v9\" class=\"thetemps\"></span>\n <div id=\"t9\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '15'})\" class=\"thedays\"><span id=\"v10\" class=\"thetemps\"></span>\n <div id=\"t10\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '16'})\" class=\"thedays\"><span id=\"v11\" class=\"thetemps\"></span>\n <div id=\"t11\" class=\"theblocks\"></div>\n </td>\n </tr>\n\n <tr style=\"height:2px\">\n <td id=\"td5\" class=\"the2px\"></td>\n <td id=\"td6\" class=\"the2px\"></td>\n <td id=\"td7\" class=\"the2px\"></td>\n <td id=\"td8\" class=\"the2px\"></td>\n <td id=\"td9\" class=\"the2px\"></td>\n <td id=\"td10\" class=\"the2px\"></td>\n <td id=\"td11\" class=\"the2px\"></td>\n <td id=\"td12\" class=\"the2px\"></td>\n <td id=\"td13\" class=\"the2px\"></td>\n <td id=\"td14\" class=\"the2px\"></td>\n <td id=\"td15\" class=\"the2px\"></td>\n <td id=\"td16\" class=\"the2px\"></td>\n </tr>\n\n <tr class=\"temptable\">\n <td>0</td>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>4</td>\n <td>5</td>\n <td>6</td>\n <td>7</td>\n <td>8</td>\n <td>9</td>\n <td>10</td>\n <td>11</td>\n </tr>\n\n <tr class=\"temptable\">\n <td ng-click=\"send({payload: '17'})\" class=\"thedays\"><span id=\"v12\" class=\"thetemps\"></span>\n <div id=\"t12\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '18'})\" class=\"thedays\"><span id=\"v13\" class=\"thetemps\"></span>\n <div id=\"t13\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '19'})\" class=\"thedays\"><span id=\"v14\" class=\"thetemps\"></span>\n <div id=\"t14\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '20'})\" class=\"thedays\"><span id=\"v15\" class=\"thetemps\"></span>\n <div id=\"t15\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '21'})\" class=\"thedays\"><span id=\"v16\" class=\"thetemps\"></span>\n <div id=\"t16\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '22'})\" class=\"thedays\"><span id=\"v17\" class=\"thetemps\"></span>\n <div id=\"t17\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '23'})\" class=\"thedays\"><span id=\"v18\" class=\"thetemps\"></span>\n <div id=\"t18\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '24'})\" class=\"thedays\"><span id=\"v19\" class=\"thetemps\"></span>\n <div id=\"t19\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '25'})\" class=\"thedays\"><span id=\"v20\" class=\"thetemps\"></span>\n <div id=\"t20\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '26'})\" class=\"thedays\"><span id=\"v21\" class=\"thetemps\"></span>\n <div id=\"t21\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '27'})\" class=\"thedays\"><span id=\"v22\" class=\"thetemps\"></span>\n <div id=\"t22\" class=\"theblocks\"></div>\n </td>\n <td ng-click=\"send({payload: '28'})\" class=\"thedays\"><span id=\"v23\" class=\"thetemps\"></span>\n <div id=\"t23\" class=\"theblocks\"></div>\n </td>\n </tr>\n\n <tr style=\"height:2px\">\n <td id=\"td17\" class=\"the2px\"></td>\n <td id=\"td18\" class=\"the2px\"></td>\n <td id=\"td19\" class=\"the2px\"></td>\n <td id=\"td20\" class=\"the2px\"></td>\n <td id=\"td21\" class=\"the2px\"></td>\n <td id=\"td22\" class=\"the2px\"></td>\n <td id=\"td23\" class=\"the2px\"></td>\n <td id=\"td24\" class=\"the2px\"></td>\n <td id=\"td25\" class=\"the2px\"></td>\n <td id=\"td26\" class=\"the2px\"></td>\n <td id=\"td27\" class=\"the2px\"></td>\n <td id=\"td28\" class=\"the2px\"></td>\n </tr>\n\n <tr class=\"temptable\">\n <td>12</td>\n <td>13</td>\n <td>14</td>\n <td>15</td>\n <td>16</td>\n <td>17</td>\n <td>18</td>\n <td>19</td>\n <td>20</td>\n <td>21</td>\n <td>22</td>\n <td>23</td>\n </tr>\n\n <tr style=\"height:6px\" class=\"temptable\">\n <td colspan=12 style=\"height:6px;\"></td>\n </tr>\n \n <tr height=\"30px\">\n <td colspan=2 style=\"background-color:grey; border-radius: 0 0 0 8px; \"><span class=\"smallfooter\"> Status:</span></td>\n\n <td colspan=10 style=\"background-color:grey; border-radius: 0 0 8px 0;\">\n <center><span id=\"info\" class=\"smallfooter\">OK</span></center>\n </td>\n </tr>\n\n <tr height=\"10px\">\n <td colspan=\"12\"></td>\n </tr>\n\n <tr style=\"height:48px\">\n <td colspan=2>\n <md-button class=\"vibrate filled touched smallfont rounded greybuttons\" ng-click=\"send({payload: 'd'})\">\n <img style=\"outline : none;\" ng-src=\"{{(msg.payload)?'/myicons/png/48x48/actions/arrow-left-double-2.png':'/myicons/png/48x48/actions/arrow-left-double-2.png'}}\" height=\"36px\" />\n </md-button>\n </td>\n\n <td colspan=2>\n <center><span id=\"current\" style=\"color:yellow;font-size:120%\">-</span></center>\n </td>\n\n <td colspan=2>\n <md-button class=\"vibrate filled touched smallfont rounded greybuttons\" ng-click=\"send({payload: 'u'})\">\n <img style=\"outline : none;\" ng-src=\"{{(msg.payload)?'/myicons/png/48x48/actions/arrow-right-double-2.png':'/myicons/png/48x48/actions/arrow-right-double-2.png'}}\" height=\"36px\" />\n </md-button>\n </td>\n\n <td colspan=2>\n <md-button class=\"vibrate filled touched smallfont rounded greybuttons\" ng-click=\"send({payload: 'r'})\">\n <img style=\"outline : none;\" ng-src=\"{{(msg.payload)?'/myicons/png/48x48/actions/edit-copy-4.png':'/myicons/png/48x48/actions/edit-copy-4.png'}}\" height=\"36px\" />\n </md-button>\n </td>\n\n <td colspan=2>\n <md-button class=\"vibrate filled touched smallfont rounded greybuttons\" ng-click=\"send({payload: 's'})\">\n <img style=\"outline : none;\" ng-src=\"{{(msg.payload)?'/myicons/png/48x48/actions/document-save-5.png':'/myicons/png/48x48/actions/document-save-5.png'}}\" height=\"36px\" />\n </md-button>\n </td>\n\n <td colspan=2>\n <md-button class=\"vibrate filled touched smallfont rounded greybuttons\" ng-click=\"send({payload: 'c'})\">\n <img style=\"outline : none;\" ng-src=\"{{(msg.payload)?'/myicons/png/48x48/actions/dialog-cancel-5.png':'/myicons/png/48x48/actions/dialog-cancel-5.png'}}\" height=\"36px\" />\n </md-button>\n </td>\n </tr>\n</table>\n",
- "storeOutMessages": false,
- "fwdInMessages": false,
- "templateScope": "local",
- "x": 800,
- "y": 40,
- "wires": [
- [
- "8f3e25e4.6dba38"
- ]
- ]
- },
- {
- "id": "8f3e25e4.6dba38",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Process controls",
- "func": "if ( typeof context.days == 'undefined' ) context.days=1;\nif ( typeof context.selector == 'undefined' ) context.selector=1;\nif ( typeof context.saving == 'undefined' ) context.saving=0;\n\nflow.set(\"incomingTemperature\", flow.get(\"incomingTemperature\") || 20);\nflow.set(\"incomingHumidity\", flow.get(\"incomingHumidity\") || 40);\n\nflow.set(\"hold\", flow.get(\"hold\") || 0);\nflow.set(\"away\", flow.get(\"away\") || 0);\nflow.set(\"manual\", flow.get(\"manual\") || 0);\nflow.set(\"setTemperature\", flow.get(\"setTemperature\") || 0);\nflow.set(\"manualTimer\", flow.get(\"manualTimer\") || 0);\n\nif ( typeof context.global.timing == 'undefined' ) \n {\n context.global.timing=[\n 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,\n 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,\n 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,\n 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,\n 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,\n 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,\n 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,\n 8,14\n ];\n context.saving=0;\n msg.payload=\"anything\"; msg.foryou=\"Restoring\"; return([null,null,msg]);\n }\n\nvar timing=global.get(\"timing\");\n\nswitch (msg.payload)\n {\n case \"u\" : if ((context.selector>4)&&(context.selector<29))\n {\n timing[((context.days-1)*24)+context.selector-5]++; \n if (timing[((context.days-1)*24)+context.selector-5]>26) timing[((context.days-1)*24)+context.selector-5]=26;\n msg.foryou=\"Incremented temperature\";\n }\n if (context.selector==1) { if (timing[168+(context.selector-1)]<26) { timing[168+(context.selector-1)]++; msg.foryou=\"Incremented frost setting 1 degree\"; } else msg.foryou=\"Hit limit\"; }\n if (context.selector==2) { if (timing[168+(context.selector-1)]<26) { timing[168+(context.selector-1)]++; msg.foryou=\"Incremented away setting 1 degree\"; } else msg.foryou=\"Hit limit\"; }\n if (context.selector==29) { if (context.days<7) { context.days++; msg.foryou=\"Forward one day\";} else msg.foryou=\"End of days!!\"; }\n break;\n case \"d\" : if ((context.selector>4)&&(context.selector<29))\n {\n timing[((context.days-1)*24)+context.selector-5]--; \n if (timing[((context.days-1)*24)+context.selector-5]<14) timing[((context.days-1)*24)+context.selector-5]=14;\n msg.foryou=\"Decremented temperature\";\n }\n if (context.selector==1) { if (timing[168+(context.selector-1)]>8) { timing[168+(context.selector-1)]--; msg.foryou=\"Decremented frost setting 1 degree\"; } else msg.foryou=\"Hit limit\"; }\n if (context.selector==2) { if (timing[168+(context.selector-1)]>8) { timing[168+(context.selector-1)]--; msg.foryou=\"Decremented away setting 1 degree\"; } else msg.foryou=\"Hit limit\"; }\n if (context.selector==29) { if (context.days>1) { context.days--; msg.foryou=\"Backward one day\";} else msg.foryou=\"Beginning of days!!\"; }\n break;\n case 'r' : if ((context.selector>=5)&&(context.selector<28))\n {\n timing[((context.days-1)*24)+context.selector-4]=timing[((context.days-1)*24)+context.selector-5]; \n context.selector++;\n msg.foryou=\"Copied settings to the next hour slot\";\n }\n if ((context.selector==29)&&(context.days<7))\n {\n for (var a=0;a<24;a++)\n {\n timing[((context.days)*24)+a]=timing[((context.days-1)*24)+a]; \n }\n context.days++;\n msg.foryou=\"Copied a complete day's settings\";\n }\n break;\n case 's': context.saving=0; msg.foryou=\"Settings saved to disk\"; break;\n case '1':\n case '2':\n case '3':\n case '4':\n case '5':\n case '6':\n case '7':\n case '8':\n case '9':\n case '10':\n case '11':\n case '12':\n case '13':\n case '14':\n case '15':\n case '16':\n case '17':\n case '18':\n case '19':\n case '20':\n case '21':\n case '22':\n case '23':\n case '24':\n case '25':\n case '26':\n case '27':\n case '28':\n case '29': context.selector=parseInt(msg.payload);\n if (msg.payload=='1') msg.foryou=\"Frost temperature selection\"; \n else if (msg.payload=='2') msg.foryou=\"Away temperature selection\";\n else if (msg.payload=='29') msg.foryou=\"Day selection\";\n else msg.foryou=\"Selected hour period \" + (parseInt(msg.payload)-4);\n break;\n case 'c' : msg.payload=\"anything\"; msg.foryou=\"Changes cancelled\"; node.send([null,null,msg]);\n }\n\nmsg.temperatures=context.temperatures;\nmsg.timing=timing;\nmsg.days=context.days;\nmsg.selector=context.selector;\n\nnode.send([msg,null,null]);\n\nif (context.saving===0) \n { \n msg.topic=\"\";\n msg.timing=\"\";\n msg.payload=JSON.stringify(timing);\n node.send([null,msg,null]); \n context.saving=1;\n }\n msg.foryou=\"\"",
- "outputs": "3",
- "noerr": 0,
- "x": 650,
- "y": 100,
- "wires": [
- [
- "5ddc1d3c.71b5d4"
- ],
- [
- "20a478fa.97b6c8"
- ],
- [
- "2012d6bc.e5bb8a"
- ]
- ]
- },
- {
- "id": "2ea4fbf9.b23304",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "Once only at power up",
- "topic": "",
- "payload": "once",
- "payloadType": "str",
- "repeat": "",
- "crontab": "",
- "once": true,
- "onceDelay": "",
- "x": 360,
- "y": 100,
- "wires": [
- [
- "8f3e25e4.6dba38"
- ]
- ]
- },
- {
- "id": "d9f5055c.d034d8",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Process heat",
- "func": "var timing=global.get(\"timing\");\nvar now = new Date();\nmsg.payload=timing[(now.getDay()*24)+now.getHours()];\nmsg.away=timing[169];\n\nmsg.temperature=flow.get(\"incomingTemperature\");\nmsg.humidity=flow.get(\"incomingHumidity\");\nmsg.set=msg.payload;\nif (flow.get(\"manualTimer\")) flow.set(\"manualTimer\",flow.get(\"manualTimer\")-1);\nelse flow.set(\"manual\",0);\nmsg.desired=msg.set;\nflow.set(\"setTemperature\",msg.desired);\nmsg.desired+=flow.get(\"manual\");\nif (flow.get(\"away\")) msg.desired=global.get(\"timing\")[169]; \nif (msg.desired>msg.temperature) msg.relay=1; else msg.relay=0;\n\nmsg.payload=flow.get(\"incomingTemperature\");\n\nnode.status({fill:\"blue\",shape:\"dot\",text:\"Set point \" + msg.desired + \"c - Actual \" + msg.temperature +\"c\"});\n\nnode.send([msg,null]);\nmsg.payload=msg.relay;\nnode.send([null,msg]);\n\n\n\n\n",
- "outputs": "2",
- "noerr": 0,
- "x": 770,
- "y": 420,
- "wires": [
- [
- "20503617.ac02ea",
- "be5056d3.ff22b8"
- ],
- [
- "95d1c267.b8f65",
- "4fac90e3.7885"
- ]
- ]
- },
- {
- "id": "2012d6bc.e5bb8a",
- "type": "file in",
- "z": "e7f81119.1bd4",
- "name": "Restore",
- "filename": "/home/pi/petesstatlog.log",
- "format": "utf8",
- "x": 540,
- "y": 180,
- "wires": [
- [
- "fa0025fe.752938"
- ]
- ]
- },
- {
- "id": "fa0025fe.752938",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Restore settings from SD on start after creating global array",
- "func": "context.global.timing=JSON.parse(msg.payload);\nmsg.payload=\"\";\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "x": 860,
- "y": 180,
- "wires": [
- [
- "8f3e25e4.6dba38"
- ]
- ]
- },
- {
- "id": "13e86fd8.0c3cd",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Store temperature",
- "func": " var date = new Date();\n\n var hour = date.getHours();\n hour = (hour < 10 ? \"0\" : \"\") + hour;\n\n var min = date.getMinutes();\n min = (min < 10 ? \"0\" : \"\") + min;\n\n var sec = date.getSeconds();\n sec = (sec < 10 ? \"0\" : \"\") + sec;\n\n var year = date.getFullYear();\n\n var month = date.getMonth() + 1;\n month = (month < 10 ? \"0\" : \"\") + month;\n\n var day = date.getDate();\n day = (day < 10 ? \"0\" : \"\") + day;\n\nif ((Number(msg.payload)>0) && (Number(msg.payload)<100)) \n{\n flow.set(\"incomingTemperature\",msg.payload);\n node.status({fill:\"red\",shape:\"dot\",text:msg.payload + \"c at \" + hour + \":\" + min + \":\" + sec + \" on \" + day + \":\" + month + \":\" + year }); \n}",
- "outputs": "0",
- "noerr": 0,
- "x": 450,
- "y": 700,
- "wires": []
- },
- {
- "id": "2cf1f54a.260b9a",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Store humidity",
- "func": "\n var date = new Date();\n\n var hour = date.getHours();\n hour = (hour < 10 ? \"0\" : \"\") + hour;\n\n var min = date.getMinutes();\n min = (min < 10 ? \"0\" : \"\") + min;\n\n var sec = date.getSeconds();\n sec = (sec < 10 ? \"0\" : \"\") + sec;\n\n var year = date.getFullYear();\n\n var month = date.getMonth() + 1;\n month = (month < 10 ? \"0\" : \"\") + month;\n\n var day = date.getDate();\n day = (day < 10 ? \"0\" : \"\") + day;\n\n flow.set(\"incomingHumidity\",msg.payload); \n node.status({fill:\"red\",shape:\"dot\",text:msg.payload + \"% at \" + hour + \":\" + min + \":\" + sec + \" on \" + day + \":\" + month + \":\" + year });",
- "outputs": "0",
- "noerr": 0,
- "x": 440,
- "y": 760,
- "wires": []
- },
- {
- "id": "53b4a878.d58478",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "Test \"Away\" 2 hours",
- "topic": "",
- "payload": "120",
- "payloadType": "str",
- "repeat": "",
- "crontab": "",
- "once": false,
- "onceDelay": "",
- "x": 150,
- "y": 180,
- "wires": [
- [
- "3cd37e2c.450362"
- ]
- ]
- },
- {
- "id": "d059cc6b.07d27",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "Test \"Away\" clear",
- "topic": "",
- "payload": "0",
- "payloadType": "str",
- "repeat": "",
- "crontab": "",
- "once": false,
- "x": 140,
- "y": 220,
- "wires": [
- [
- "3cd37e2c.450362"
- ]
- ]
- },
- {
- "id": "369d728d.9e145e",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "Test \"Frost\" 2 hours",
- "topic": "",
- "payload": "120",
- "payloadType": "str",
- "repeat": "",
- "crontab": "",
- "once": false,
- "onceDelay": "",
- "x": 150,
- "y": 260,
- "wires": [
- [
- "ee8c1336.e7829"
- ]
- ]
- },
- {
- "id": "bf4b8f74.9cb77",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "Test \"Frost\" clear",
- "topic": "",
- "payload": "0",
- "payloadType": "str",
- "repeat": "",
- "crontab": "",
- "once": false,
- "onceDelay": "",
- "x": 140,
- "y": 300,
- "wires": [
- [
- "ee8c1336.e7829"
- ]
- ]
- },
- {
- "id": "ee8c1336.e7829",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Store \"frost\"",
- "func": "flow.set(\"frost\",Number(msg.payload));\n\n",
- "outputs": 0,
- "noerr": 0,
- "x": 370,
- "y": 280,
- "wires": []
- },
- {
- "id": "3cd37e2c.450362",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Store \"Away\"",
- "func": "flow.set(\"away\",Number(msg.payload));\n",
- "outputs": 0,
- "noerr": 0,
- "x": 370,
- "y": 200,
- "wires": []
- },
- {
- "id": "cb2d0f09.47ffe",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "sample forecast",
- "topic": "",
- "payload": "Dry, 2c with chance of snow",
- "payloadType": "str",
- "repeat": "",
- "crontab": "",
- "once": false,
- "x": 140,
- "y": 340,
- "wires": [
- [
- "91caa4fb.1dfc38"
- ]
- ]
- },
- {
- "id": "e8456857.a45658",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "Sample forecast",
- "topic": "",
- "payload": "Wet, 12c, possibly rain tonight",
- "payloadType": "str",
- "repeat": "",
- "crontab": "",
- "once": false,
- "x": 140,
- "y": 380,
- "wires": [
- [
- "91caa4fb.1dfc38"
- ]
- ]
- },
- {
- "id": "91caa4fb.1dfc38",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Store forecast",
- "func": "flow.set(\"forecast\",msg.payload);",
- "outputs": "0",
- "noerr": 0,
- "x": 380,
- "y": 340,
- "wires": []
- },
- {
- "id": "95d1c267.b8f65",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Heating relay is called heating_relay",
- "func": "context.set(\"relayIndState\",context.get(\"relayIndState\") || 0);\ncontext.set(\"relayState\",context.get(\"relayState\") || 0);\n\n// gpio4 is relay output, gpio12 is power indicator, gpio15 is flashing heat indicator (relay)\nmsg.topic=\"heating_relay/toesp\";\nif (msg.payload==1)\n {\n context.set(\"relayState\",1);\n node.status({fill:\"red\",shape:\"dot\",text:\"Relay ON\"});\n msg.payload=\"{out4:6,5}\"; node.send(msg);\n\n}\nelse if (msg.payload==\"flash\")\n{\n context.set(\"relayIndState\",context.get(\"relayIndState\") ^ 1);\n if ((context.get(\"relayState\")==1) && (context.get(\"relayIndState\")==1)) msg.payload=\"{out15:1}\";\n else msg.payload=\"{out15:0}\";\n node.send(msg);\n}\nelse\n{\n context.set(\"relayState\",0);\n node.status({fill:\"blue\",shape:\"dot\",text:\"Relay OFF\"});\n msg.payload=\"{out4:0}\"; node.send(msg);\n msg.payload=\"{out15:0}\"; node.send(msg);\n}\n",
- "outputs": 1,
- "noerr": 0,
- "x": 1530,
- "y": 420,
- "wires": [
- [
- "aac34649.3905a8"
- ]
- ]
- },
- {
- "id": "262665c1.742ffa",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Handle SET",
- "func": "// here we set manual override controls - valid for 120 minutes after last change.\n\n\nif (flow.get(\"away\")===0)\n{\n if (msg.payload==\"u\") { flow.set(\"manualTimer\",120); if ((flow.get(\"manual\") + flow.get(\"setTemperature\"))<25) flow.set(\"manual\",flow.get(\"manual\")+1); }\n if (msg.payload==\"d\") { flow.set(\"manualTimer\",120); if ((flow.get(\"manual\") + flow.get(\"setTemperature\"))>17) flow.set(\"manual\",flow.get(\"manual\")-1); }\n if (msg.payload==\"a\") { flow.set(\"manualTimer\",0); flow.set(\"manual\",0); context.set(\"both\",0); node.status({fill:\"red\",shape:\"dot\",text:\"auto\"}); }\n}\n\nmsg.desired=flow.get(\"setTemperature\") + flow.get(\"manual\");\n\nif (flow.get(\"manual\")===0) msg.colour=\"#aaddff\"; else msg.colour=\"#aaffaa\";\n\n//if (flow.get(\"frost\")>0) { msg.desired=global.get(\"timing\")[168]; msg.colour=\"#ffbbbb\"; }\nif (flow.get(\"away\")>0) { msg.desired=global.get(\"timing\")[169]; msg.colour=\"#ffbbbb\"; }\n\nmsg.payload=msg.desired;\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "x": 790,
- "y": 360,
- "wires": [
- [
- "be5056d3.ff22b8",
- "e01b553b.23df18",
- "4fac90e3.7885",
- "20503617.ac02ea"
- ]
- ]
- },
- {
- "id": "2b777af3.c2e396",
- "type": "ui_template",
- "z": "e7f81119.1bd4",
- "group": "bd48728c.866f2",
- "name": "up",
- "order": 4,
- "width": "1",
- "height": "1",
- "format": " <md-button class=\"vibrate filled touched smallfont rounded greybuttons\" ng-click=\"send({payload: 'u'})\"> \n <img style=\"outline : none;\" \n ng-src=\"{{(msg.payload)?'/myicons/png/48x48/actions/arrow-right-2.png':'/myicons/png/48x48/actions/arrow-right-2.png'}}\" \n height=\"36px\"\n />\n</md-button> ",
- "storeOutMessages": false,
- "fwdInMessages": false,
- "templateScope": "local",
- "x": 570,
- "y": 240,
- "wires": [
- [
- "262665c1.742ffa",
- "da6571c9.80974",
- "7053f95f.644d58"
- ]
- ]
- },
- {
- "id": "e64c48be.5c4c08",
- "type": "ui_template",
- "z": "e7f81119.1bd4",
- "group": "bd48728c.866f2",
- "name": "down",
- "order": 3,
- "width": "1",
- "height": "1",
- "format": " <md-button class=\"vibrate filled touched smallfont rounded greybuttons\" ng-click=\"send({payload: 'd'})\"> \n <img style=\"outline : none;\" \n ng-src=\"{{(msg.payload)?'/myicons/png/48x48/actions/arrow-down-2.png':'/myicons/png/48x48/actions/arrow-left-2.png'}}\" \n height=\"36px\"\n />\n</md-button> ",
- "storeOutMessages": false,
- "fwdInMessages": false,
- "templateScope": "local",
- "x": 570,
- "y": 280,
- "wires": [
- [
- "262665c1.742ffa",
- "da6571c9.80974",
- "7053f95f.644d58"
- ]
- ]
- },
- {
- "id": "53cc9d53.254a54",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Handle AWAY",
- "func": "// here we set manual override controls - valid for 60 minutes after last change.\nif (msg.payload==\"u\") { flow.set(\"away\",flow.get(\"away\")+1); }\nif (msg.payload==\"uu\") { flow.set(\"away\",flow.get(\"away\")+24); }\nif (msg.payload==\"uuu\") { flow.set(\"away\",flow.get(\"away\")+24*7); }\nif (msg.payload==\"a\") { flow.set(\"away\",0); }\nmsg.away=flow.get(\"away\");\n\nif (flow.get(\"away\")===0) msg.colour=\"#aaddff\"; else msg.colour=\"#aaffaa\";\n\nvar t=parseInt(msg.away);\nif (t>23) t=((t/24).toFixed(1))+\"d\"; else t=t+\"h\";\nmsg.away=t;\n \nmsg.payload=\"\";\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "x": 760,
- "y": 540,
- "wires": [
- [
- "262665c1.742ffa",
- "44f446b0.acaa68"
- ]
- ]
- },
- {
- "id": "e9d4bcd7.1d9b3",
- "type": "ui_template",
- "z": "e7f81119.1bd4",
- "group": "bd48728c.866f2",
- "name": "more",
- "order": 7,
- "width": "1",
- "height": "1",
- "format": " <md-button class=\"vibrate filled touched smallfont rounded greybuttons\" ng-click=\"send({payload: 'u'})\"> \n <img style=\"outline : none;\" \n ng-src=\"{{(msg.payload)?'/myicons/png/48x48/actions/arrow-right-2.png':'/myicons/png/48x48/actions/arrow-right-2.png'}}\" \n height=\"36px\"\n />\n</md-button> ",
- "storeOutMessages": false,
- "fwdInMessages": false,
- "templateScope": "local",
- "x": 550,
- "y": 580,
- "wires": [
- [
- "53cc9d53.254a54",
- "da6571c9.80974"
- ]
- ]
- },
- {
- "id": "f6ceacbb.366e1",
- "type": "ui_template",
- "z": "e7f81119.1bd4",
- "group": "bd48728c.866f2",
- "name": "mmore",
- "order": 8,
- "width": "1",
- "height": "1",
- "format": " <md-button class=\"vibrate filled touched smallfont rounded greybuttons\" ng-click=\"send({payload: 'uu'})\"> \n <img style=\"outline : none;\" \n ng-src=\"{{(msg.payload)?'/myicons/png/48x48/actions/arrow-left-double-2.png':'/myicons/png/48x48/actions/arrow-right-double-2.png'}}\" \n height=\"36px\"\n />\n</md-button> ",
- "storeOutMessages": false,
- "fwdInMessages": false,
- "templateScope": "local",
- "x": 540,
- "y": 620,
- "wires": [
- [
- "53cc9d53.254a54",
- "da6571c9.80974"
- ]
- ]
- },
- {
- "id": "20503617.ac02ea",
- "type": "ui_template",
- "z": "e7f81119.1bd4",
- "group": "bd48728c.866f2",
- "name": "newergauge",
- "order": 1,
- "width": "3",
- "height": "3",
- "format": "<script type=\"text/javascript\" src=\"/myjs/gauge.min.js\"></script>\n<script>\n\n (function(scope){\n scope.$watch('msg', function(msg) {\n gauge.value=msg.payload;\n // if (msg.units!=\"\") gauge.units=msg.units;\n });\n \n })(scope);\nvar gauge = new RadialGauge({\n renderTo: 'canvas-id',\n width: 182,\n height: 182,\n units: \"Degrees C\",\n title: \"Temperature\",\n minValue: 10,\n maxValue: 40,\n majorTicks: [\n '10',\n '15',\n '20',\n '25',\n '30',\n '35',\n '40'\n ],\n minorTicks: 5,\n strokeTicks: true,\n highlights : [\n { from : 10, to : 15, color : '#8888ff' },\n { from : 15, to : 20, color : '#88ff88' },\n { from : 20, to : 25, color : '#ffff00' },\n { from : 25, to : 30, color : '#ffcc44' }, \n { from : 30, to : 40, color : '#ff8888' }\n ],\n\n colorPlate: \"#fff\",\n borderShadowWidth: 0,\n borders: true,\n needleType: \"arrow\",\n valueInt: 2,\n valueDec:0,\n needleWidth: 2,\n fontTitleSize: 42,\n needleCircleSize: 14,\n needleCircleOuter: true,\n needleCircleInner: false,\n animationDuration: 500,\n animationRule: \"linear\"\n}).draw();\n\ngauge.value = 18;\n\n</script>\n<table height=4px; width=\"100%\">\n <tr>\n <td>\n </td>\n </tr>\n</table>\n\n<canvas style=\"outline: none;\" ng-click=\"send({payload: ' '})\" id=\"canvas-id\">\n\n</canvas>",
- "storeOutMessages": false,
- "fwdInMessages": false,
- "templateScope": "local",
- "x": 1010,
- "y": 380,
- "wires": [
- [
- "d9f5055c.d034d8",
- "e5376b12.a08188"
- ]
- ]
- },
- {
- "id": "be5056d3.ff22b8",
- "type": "ui_template",
- "z": "e7f81119.1bd4",
- "group": "bd48728c.866f2",
- "name": "SET",
- "order": 5,
- "width": "1",
- "height": "1",
- "format": "<script>\n (function(scope){\n scope.$watch('msg', function(msg) {\n if (msg.desired!=\"\") $(\"#infor\").text(msg.desired+String.fromCharCode(176)+\"c\");\n if (msg.colour!=\"\") $(\"#infor\").css(\"background-color\",msg.colour);\n });\n \n })(scope);\n</script>\n<table ng-click=\"send({payload: 'a'})\" width=90% height=100% class=\"vibrate zui-table zui-table-rounded\">\n <thead>\n <tr>\n <th>SET</th>\n </tr>\n </thead>\n <tbody>\n <tr >\n <td id=\"infor\"></td>\n </tr>\n\n </tbody>\n</table>\n",
- "storeOutMessages": false,
- "fwdInMessages": false,
- "templateScope": "local",
- "x": 970,
- "y": 320,
- "wires": [
- [
- "262665c1.742ffa",
- "da6571c9.80974"
- ]
- ]
- },
- {
- "id": "44f446b0.acaa68",
- "type": "ui_template",
- "z": "e7f81119.1bd4",
- "group": "bd48728c.866f2",
- "name": "AWAY",
- "order": 10,
- "width": "1",
- "height": "1",
- "format": "<script>\n (function(scope){\n scope.$watch('msg', function(msg) {\n if (msg.away!=\"\") $(\"#awaytable\").text(msg.away);\n if (msg.colour!=\"\") $(\"#awaytable\").css(\"background-color\",msg.colour);\n });\n \n })(scope);\n</script>\n\n<table ng-click=\"send({payload: 'a'})\" width=90% height=100% class=\"vibrate zui-table zui-table-rounded\">\n <thead>\n <tr>\n <th>AWAY</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td id=\"awaytable\"></td>\n \n </tr>\n\n </tbody>\n</table>",
- "storeOutMessages": false,
- "fwdInMessages": false,
- "templateScope": "local",
- "x": 970,
- "y": 480,
- "wires": [
- [
- "53cc9d53.254a54",
- "da6571c9.80974"
- ]
- ]
- },
- {
- "id": "b05f8484.dc44e8",
- "type": "ui_template",
- "z": "e7f81119.1bd4",
- "group": "bd48728c.866f2",
- "name": "STATUS",
- "order": 11,
- "width": "3",
- "height": "1",
- "format": "<script>\n (function(scope){\n scope.$watch('msg', function(msg) {\n if (msg.topic!=\"\") $(\"#hdr1\").text(msg.topic);\n if (msg.payload!=\"\") $(\"#bod1\").text(msg.payload);\n if (msg.color!=\"\") $(\"#bod1\").css(\"background-color\",msg.color);\n });\n })(scope);\n</script>\n\n<table ng-click=\"send({payload: 'a'})\" width=97% height=100% class=\"zui-table zui-table-rounded\">\n <thead>\n <tr>\n <th id=\"hdr1\">></th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td id=\"bod1\"></td>\n \n </tr>\n\n </tbody>\n</table>",
- "storeOutMessages": false,
- "fwdInMessages": false,
- "templateScope": "local",
- "x": 980,
- "y": 560,
- "wires": [
- []
- ]
- },
- {
- "id": "6bf36df3.34e264",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "show humidity",
- "func": "function theNewDate()\n{\n var d = new Date(),\n minutes = d.getMinutes().toString().length == 1 ? '0'+d.getMinutes() : d.getMinutes();\n hours = d.getHours().toString().length == 1 ? '0'+d.getHours() : d.getHours();\n ampm = d.getHours() >= 12 ? 'pm' : 'am';\n months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];\n days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];\n var m= days[d.getDay()]+' '+months[d.getMonth()]+' '+d.getDate()+' '+d.getFullYear()+' '+hours+':'+minutes+ampm;\n return m;\n}\n\nmsg.topic=theNewDate();\nmsg.payload=\"Humidity: \" + flow.get(\"incomingHumidity\") +\"%\" ;\nmsg.color=\"#99ffaa\";\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "x": 780,
- "y": 660,
- "wires": [
- [
- "b05f8484.dc44e8"
- ]
- ]
- },
- {
- "id": "da6571c9.80974",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Showing settings",
- "func": "msg.payload=\"Showing settings\";\nmsg.color=\"#ffccaa\";\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "x": 790,
- "y": 280,
- "wires": [
- [
- "b05f8484.dc44e8"
- ]
- ]
- },
- {
- "id": "e5376b12.a08188",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Showing actual",
- "func": "msg.payload=\"Showing actual\";\nmsg.color=\"#bbddff\";\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "x": 780,
- "y": 600,
- "wires": [
- [
- "b05f8484.dc44e8"
- ]
- ]
- },
- {
- "id": "aac34649.3905a8",
- "type": "mqtt out",
- "z": "e7f81119.1bd4",
- "name": "mqtt",
- "topic": "",
- "qos": "",
- "retain": "",
- "broker": "4c682b3a.2ab5c4",
- "x": 1810,
- "y": 420,
- "wires": []
- },
- {
- "id": "a3e4c37f.d9a34",
- "type": "mqtt in",
- "z": "e7f81119.1bd4",
- "name": "",
- "topic": "stat3/fromesp/auto_temperature",
- "qos": "2",
- "broker": "4c682b3a.2ab5c4",
- "x": 190,
- "y": 700,
- "wires": [
- [
- "13e86fd8.0c3cd"
- ]
- ]
- },
- {
- "id": "560cc73c.96dcc8",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "",
- "topic": "",
- "payload": "u",
- "payloadType": "str",
- "repeat": "",
- "crontab": "",
- "once": false,
- "onceDelay": 0.1,
- "x": 110,
- "y": 440,
- "wires": [
- [
- "262665c1.742ffa",
- "da6571c9.80974",
- "7053f95f.644d58"
- ]
- ]
- },
- {
- "id": "e78f3ad8.06ad58",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "",
- "topic": "",
- "payload": "d",
- "payloadType": "str",
- "repeat": "",
- "crontab": "",
- "once": false,
- "onceDelay": 0.1,
- "x": 110,
- "y": 480,
- "wires": [
- [
- "262665c1.742ffa",
- "da6571c9.80974",
- "7053f95f.644d58"
- ]
- ]
- },
- {
- "id": "24495a14.24b616",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "",
- "topic": "",
- "payload": "a",
- "payloadType": "str",
- "repeat": "",
- "crontab": "",
- "once": false,
- "onceDelay": 0.1,
- "x": 110,
- "y": 520,
- "wires": [
- [
- "262665c1.742ffa",
- "da6571c9.80974",
- "7053f95f.644d58"
- ]
- ]
- },
- {
- "id": "f3351617.0119b8",
- "type": "comment",
- "z": "e7f81119.1bd4",
- "name": "global and flow vars used",
- "info": "flow vars: manual, manualTimer, setTemperature,\n frost, away, incomingTemperature, incomingHumidity\n\nglobal vars: timing",
- "x": 1090,
- "y": 40,
- "wires": []
- },
- {
- "id": "7053f95f.644d58",
- "type": "timeout",
- "z": "e7f81119.1bd4",
- "name": "My Timeout",
- "outtopic": "",
- "outsafe": "",
- "outwarning": "",
- "outunsafe": "1",
- "warning": "15",
- "timer": "30",
- "repeat": false,
- "again": true,
- "x": 710,
- "y": 480,
- "wires": [
- [
- "d9f5055c.d034d8",
- "6bf36df3.34e264"
- ]
- ]
- },
- {
- "id": "89d69293.366b7",
- "type": "link in",
- "z": "e7f81119.1bd4",
- "name": "",
- "links": [
- "910d0ff7.43b19"
- ],
- "x": 1215,
- "y": 600,
- "wires": [
- [
- "d0aafabe.673168",
- "d2ba92f3.0c776"
- ]
- ]
- },
- {
- "id": "8ad8fddf.97a19",
- "type": "mqtt in",
- "z": "e7f81119.1bd4",
- "name": "",
- "topic": "heating_relay/fromesp/auto_temperature",
- "qos": "2",
- "broker": "4c682b3a.2ab5c4",
- "x": 220,
- "y": 820,
- "wires": [
- [
- "8c66d671.5d06f8"
- ]
- ]
- },
- {
- "id": "8c66d671.5d06f8",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "heating_relay auto_temperature",
- "func": " var date = new Date();\n\n var hour = date.getHours();\n hour = (hour < 10 ? \"0\" : \"\") + hour;\n\n var min = date.getMinutes();\n min = (min < 10 ? \"0\" : \"\") + min;\n\n var sec = date.getSeconds();\n sec = (sec < 10 ? \"0\" : \"\") + sec;\n\n var year = date.getFullYear();\n\n var month = date.getMonth() + 1;\n month = (month < 10 ? \"0\" : \"\") + month;\n\n var day = date.getDate();\n day = (day < 10 ? \"0\" : \"\") + day;\n\n \n node.status({fill:\"red\",shape:\"dot\",text:msg.payload + \"c at \" + hour + \":\" + min + \":\" + sec + \" on \" + day + \":\" + month + \":\" + year });",
- "outputs": 0,
- "noerr": 0,
- "x": 570,
- "y": 820,
- "wires": []
- },
- {
- "id": "d0aafabe.673168",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "turn relay indicator off momentarily at relay power up",
- "func": "msg.payload=msg.payload.split(\" \");\nif ((msg.payload[0]==\"Logging\")&& (msg.payload[3]==\"heating_relay\")) \n{\n msg.topic=\"heating_relay/toesp\";\n msg.payload=msg.payload=\"{out12:0}\";\n return msg;\n}",
- "outputs": 1,
- "noerr": 0,
- "x": 1560,
- "y": 480,
- "wires": [
- [
- "aac34649.3905a8",
- "fde1e4b6.d1d838"
- ]
- ]
- },
- {
- "id": "fde1e4b6.d1d838",
- "type": "delay",
- "z": "e7f81119.1bd4",
- "name": "",
- "pauseType": "delay",
- "timeout": "2",
- "timeoutUnits": "seconds",
- "rate": "1",
- "nbRateUnits": "1",
- "rateUnits": "second",
- "randomFirst": "1",
- "randomLast": "5",
- "randomUnits": "seconds",
- "drop": false,
- "x": 1380,
- "y": 520,
- "wires": [
- [
- "720bfcdd.4d65d4"
- ]
- ]
- },
- {
- "id": "720bfcdd.4d65d4",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "turn relay indicator on at relay power up",
- "func": " msg.topic=\"heating_relay/toesp\";\n msg.payload=\"{out12:1}\";\n return msg;\n",
- "outputs": 1,
- "noerr": 0,
- "x": 1620,
- "y": 520,
- "wires": [
- [
- "aac34649.3905a8"
- ]
- ]
- },
- {
- "id": "e09e0589.a4cb98",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "clear ili",
- "func": "msg.payload=\"{ili:\\\"$S\\\"}\";\nmsg.topic=\"stat3/toesp\";\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "x": 1600,
- "y": 120,
- "wires": [
- [
- "4e9afa5.c960804",
- "68679a9b.889664"
- ]
- ]
- },
- {
- "id": "f24aab8d.d7ee58",
- "type": "comment",
- "z": "e7f81119.1bd4",
- "name": "il9341 display local stat",
- "info": "",
- "x": 1340,
- "y": 40,
- "wires": []
- },
- {
- "id": "d2ba92f3.0c776",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "",
- "func": "msg.payload=msg.payload.split(\" \");\nif ((msg.payload[0]==\"Logging\")&& (msg.payload[3]==\"stat3\")) \n{\n msg.payload=msg.payload[3];\n return msg;\n}",
- "outputs": 1,
- "noerr": 0,
- "x": 1190,
- "y": 300,
- "wires": [
- [
- "b764a722.9e1d98",
- "54c6248b.7913cc"
- ]
- ]
- },
- {
- "id": "b764a722.9e1d98",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "",
- "func": "msg.payload=\"Init\";\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "x": 1290,
- "y": 120,
- "wires": [
- [
- "4935af57.e0632"
- ]
- ]
- },
- {
- "id": "495c3a16.4f5a34",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "Set up disp at start also 4am",
- "topic": "",
- "payload": "",
- "payloadType": "date",
- "repeat": "",
- "crontab": "00 04 * * *",
- "once": false,
- "onceDelay": 0.1,
- "x": 1170,
- "y": 240,
- "wires": [
- [
- "b764a722.9e1d98"
- ]
- ]
- },
- {
- "id": "4935af57.e0632",
- "type": "delay",
- "z": "e7f81119.1bd4",
- "name": "",
- "pauseType": "delay",
- "timeout": "250",
- "timeoutUnits": "milliseconds",
- "rate": "1",
- "nbRateUnits": "1",
- "rateUnits": "second",
- "randomFirst": "1",
- "randomLast": "5",
- "randomUnits": "seconds",
- "drop": false,
- "x": 1430,
- "y": 120,
- "wires": [
- [
- "e09e0589.a4cb98"
- ]
- ]
- },
- {
- "id": "9fbb4e8d.7fa0b",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Frame",
- "func": "msg.topic=\"stat3/toesp\";\n\nmsg.payload=\"{ili:\\\"$C92,92,128;$E0,0,320,240\\\"}\"; node.send(msg);\nmsg.payload=\"{ili:\\\"$L1,100,318,100\\\"}\"; node.send(msg);\n",
- "outputs": 1,
- "noerr": 0,
- "x": 1590,
- "y": 160,
- "wires": [
- [
- "68679a9b.889664",
- "a07e4cf9.f288"
- ]
- ]
- },
- {
- "id": "4e9afa5.c960804",
- "type": "delay",
- "z": "e7f81119.1bd4",
- "name": "",
- "pauseType": "delay",
- "timeout": "300",
- "timeoutUnits": "milliseconds",
- "rate": "1",
- "nbRateUnits": "1",
- "rateUnits": "second",
- "randomFirst": "1",
- "randomLast": "5",
- "randomUnits": "seconds",
- "drop": false,
- "x": 1430,
- "y": 160,
- "wires": [
- [
- "9fbb4e8d.7fa0b"
- ]
- ]
- },
- {
- "id": "9bb63202.2d86d",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Fixed wording",
- "func": "msg.topic=\"stat3/toesp\";\nmsg.payload=\"{ili:\\\"$F4$P8,12;$C64,64,255Current room\\\"}\"; node.send(msg);\nmsg.payload=\"{ili:\\\"$F4$P8,36;Temperature\\\"}\"; node.send(msg);\nmsg.payload=\"{ili:\\\"$F4$P8,62;and humidity\\\"}\"; node.send(msg);\nmsg.payload=\"{ili:\\\"$F4$P8,208;Time\\\"}\"; node.send(msg);\nmsg.payload=\"{ili:\\\"$F4$P8,164;Status$C255,255,255\\\"}\"; node.send(msg);\nmsg.payload=\"{ili:\\\"$F4$P292,54;$C255,255,255C\\\"}\"; node.send(msg);\nmsg.payload=\"{ili:\\\"$F4$P292,120;C$C255,255,255\\\"}\"; node.send(msg);\nmsg.payload=\"{ili:\\\"$F4$P8,114;$C64,64,255Set temperature$C255,255,255\\\"}\"; node.send(msg);\n",
- "outputs": 1,
- "noerr": 0,
- "x": 1620,
- "y": 240,
- "wires": [
- [
- "68679a9b.889664"
- ]
- ]
- },
- {
- "id": "e62ca4f3.00c108",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "temperature",
- "func": "msg.topic=\"stat3/toesp\";\nmsg.payload=\"{ili:\\\"$F1$P220,12;\" + flow.get(\"incomingTemperature\") + \"\\\"}\"; node.send(msg);\nmsg.payload=\"{ili:\\\"$F2$P156,44;\" + Number(flow.get(\"incomingHumidity\")) + \"%\\\"}\"; node.send(msg);",
- "outputs": 1,
- "noerr": 0,
- "x": 1610,
- "y": 280,
- "wires": [
- [
- "68679a9b.889664"
- ]
- ]
- },
- {
- "id": "e01b553b.23df18",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "set temperature",
- "func": "msg.topic=\"stat3/toesp\";\nif (flow.get(\"away\")>0) msg.payload=\"{ili:\\\"$F4$C0,255,255;$P190,116;AWAY$C128,128,128$F2$P256,110;\" + (Number(global.get(\"timing\")[169])) + \"\\\"}\";\nelse msg.payload=\"{ili:\\\"$C0,0,0;$I190,116,69,20$F2$C255,255,255;$P256,110;\" + (Number(flow.get(\"setTemperature\")) + Number(flow.get(\"manual\"))) + \"\\\"}\"; \nnode.send(msg);\n",
- "outputs": 1,
- "noerr": 0,
- "x": 1620,
- "y": 320,
- "wires": [
- [
- "92d7692a.2e6018",
- "68679a9b.889664"
- ]
- ]
- },
- {
- "id": "92d7692a.2e6018",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Auto/manual",
- "func": "msg.topic=\"stat3/toesp\";\nif (flow.get(\"manual\"))\nmsg.payload=\"{ili:\\\"$F5$P206,158;$C255,255,0Manual$C255,255,255\\\"}\"; \nelse \nmsg.payload=\"{ili:\\\"$F5$P203,158;$C64,255,64 Auto$C255,255,255\\\"}\";\nnode.send(msg);",
- "outputs": 1,
- "noerr": 0,
- "x": 1610,
- "y": 380,
- "wires": [
- [
- "68679a9b.889664"
- ]
- ]
- },
- {
- "id": "39495a97.d17626",
- "type": "delay",
- "z": "e7f81119.1bd4",
- "name": "",
- "pauseType": "delay",
- "timeout": "200",
- "timeoutUnits": "milliseconds",
- "rate": "1",
- "nbRateUnits": "1",
- "rateUnits": "second",
- "randomFirst": "1",
- "randomLast": "5",
- "randomUnits": "seconds",
- "drop": false,
- "x": 1430,
- "y": 240,
- "wires": [
- [
- "9bb63202.2d86d",
- "db951651.f831f8"
- ]
- ]
- },
- {
- "id": "ca35d6c3.8d2b98",
- "type": "timeout",
- "z": "e7f81119.1bd4",
- "name": "My Timeout",
- "outtopic": "",
- "outsafe": "1",
- "outwarning": "",
- "outunsafe": "1",
- "warning": "15",
- "timer": "30",
- "repeat": false,
- "again": true,
- "x": 1430,
- "y": 320,
- "wires": [
- [
- "e62ca4f3.00c108",
- "e01b553b.23df18",
- "54c6248b.7913cc"
- ]
- ]
- },
- {
- "id": "db951651.f831f8",
- "type": "delay",
- "z": "e7f81119.1bd4",
- "name": "",
- "pauseType": "delay",
- "timeout": "150",
- "timeoutUnits": "milliseconds",
- "rate": "1",
- "nbRateUnits": "1",
- "rateUnits": "second",
- "randomFirst": "1",
- "randomLast": "5",
- "randomUnits": "seconds",
- "drop": false,
- "x": 1430,
- "y": 280,
- "wires": [
- [
- "ca35d6c3.8d2b98",
- "e62ca4f3.00c108",
- "e01b553b.23df18"
- ]
- ]
- },
- {
- "id": "54c6248b.7913cc",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Show Time",
- "func": " var date = new Date();\n\n var hour = date.getHours();\n hour = (hour < 10 ? \"0\" : \"\") + hour;\n\n var min = date.getMinutes();\n min = (min < 10 ? \"0\" : \"\") + min;\n\n var sec = date.getSeconds();\n sec = (sec < 10 ? \"0\" : \"\") + sec;\n\n var year = date.getFullYear();\n\n var month = date.getMonth() + 1;\n month = (month < 10 ? \"0\" : \"\") + month;\n\n var day = date.getDate();\n day = (day < 10 ? \"0\" : \"\") + day;\n \n var dayw=date.getDay(); // Current Day of week - 2\n\nvar dayarray=new Array(\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\n \"Fri\",\"Sat\");\n \n \nmsg.topic=\"stat3/toesp\";\nmsg.payload=\"{ili:\\\"$C0,0,0;$I80,200,238,38;$F4$P80,208;$C255,0,255;\" + hour + \":\" + min + \" \" + dayarray[dayw] + \" \" + day + \"/\" + month + \"/\" + year + \"$C255,255,255\\\"}\";\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "x": 1430,
- "y": 380,
- "wires": [
- [
- "68679a9b.889664"
- ]
- ]
- },
- {
- "id": "68679a9b.889664",
- "type": "mqtt out",
- "z": "e7f81119.1bd4",
- "name": "mqtt",
- "topic": "",
- "qos": "",
- "retain": "",
- "broker": "4c682b3a.2ab5c4",
- "x": 1770,
- "y": 140,
- "wires": []
- },
- {
- "id": "4fac90e3.7885",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "stat3 status on off",
- "func": "msg.topic=\"stat3/toesp\";\nif ( (flow.get(\"incomingTemperature\") < (flow.get(\"setTemperature\")+flow.get(\"manual\") )) )\n msg.payload=\"{ili:\\\"$C0,0,0$I100,162,80,24$F6$P100,162;$C255,0,0;LLL$C255,255,255\\\"}\";\nelse\n msg.payload=\"{ili:\\\"$C0,0,0$I100,162,80,24$F6$P100,162;$C0,128,255;kkk$C255,255,255\\\"}\";\n node.send(msg);\n",
- "outputs": 1,
- "noerr": 0,
- "x": 1630,
- "y": 80,
- "wires": [
- [
- "68679a9b.889664"
- ]
- ]
- },
- {
- "id": "c49f4738.247958",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Frame2",
- "func": "msg.topic=\"stat3/toesp\";\nmsg.payload=\"{ili:\\\"$C92,92,128;$L1,198,318,198$L1,152,318,152$C255,255,255\\\"}\"; node.send(msg);\n\n",
- "outputs": 1,
- "noerr": 0,
- "x": 1600,
- "y": 200,
- "wires": [
- [
- "39495a97.d17626",
- "68679a9b.889664"
- ]
- ]
- },
- {
- "id": "a07e4cf9.f288",
- "type": "delay",
- "z": "e7f81119.1bd4",
- "name": "",
- "pauseType": "delay",
- "timeout": "200",
- "timeoutUnits": "milliseconds",
- "rate": "1",
- "nbRateUnits": "1",
- "rateUnits": "second",
- "randomFirst": "1",
- "randomLast": "5",
- "randomUnits": "seconds",
- "drop": false,
- "x": 1430,
- "y": 200,
- "wires": [
- [
- "c49f4738.247958"
- ]
- ]
- },
- {
- "id": "510729b3.07a158",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "2 secs after start",
- "topic": "",
- "payload": "",
- "payloadType": "date",
- "repeat": "",
- "crontab": "",
- "once": true,
- "onceDelay": "2",
- "x": 1230,
- "y": 380,
- "wires": [
- [
- "54c6248b.7913cc"
- ]
- ]
- },
- {
- "id": "1506f11e.700d9f",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Button \"d\", \"u\" or both i.e. \"a\" for auto",
- "func": "context.set(\"batimer\",context.get(\"batimer\")||0);\nvar batimer=context.get(\"batimer\");\ncontext.set(\"bbtimer\",context.get(\"bbtimer\")||0);\nvar bbtimer=context.get(\"bbtimer\");\n\n\ncontext.set(\"both\",context.get(\"both\") || 0);\ncontext.set(\"ba\",context.get(\"ba\") || 0);\ncontext.set(\"bb\",context.get(\"bb\") || 0);\n\nflow.set(\"balp\",flow.get(\"balp\")||0);\nflow.set(\"bblp\",flow.get(\"bblp\")||0);\n\nif (msg.topic==\"stat3/fromesp/trigger4\") if (msg.payload===\"0\") { context.set(\"ba\",1); batimer= setTimeout(function(){ flow.set(\"balp\",1); },1000 ); }\n else { if (Math.ceil((batimer._idleStart + batimer._idleTimeout - Date.now()) / 1000)<800) clearTimeout(batimer); }\n\n\nif (msg.topic==\"stat3/fromesp/trigger5\") if (msg.payload===\"0\") { context.set(\"bb\",1); bbtimer= setTimeout(function(){ flow.set(\"bblp\",1); },1000 ); }\n else { if (Math.ceil((bbtimer._idleStart + bbtimer._idleTimeout - Date.now()) / 1000)<800) clearTimeout(bbtimer); }\n\ncontext.set(\"batimer\",batimer);\ncontext.set(\"bbtimer\",bbtimer);\n\nif (context.get(\"ba\")==1) context.set(\"both\",context.get(\"both\")|1); \nif (context.get(\"bb\")==1) context.set(\"both\",context.get(\"both\")|2);\n\nif (msg.topic==\"stat3/fromesp/trigger4\") if (msg.payload==\"1\") context.set(\"ba\",0);\nif (msg.topic==\"stat3/fromesp/trigger5\") if (msg.payload==\"1\") context.set(\"bb\",0);\n\n\nif ((context.get(\"ba\")===0) && (context.get(\"bb\")===0))\n{\n switch(context.get(\"both\"))\n {\n case 1 : msg.payload=\"d\"; context.set(\"both\",0); \n if (flow.get(\"balp\")) { flow.set(\"balp\",0); msg.payload=\"a\"; msg.lp=\"longpress D\"; node.status({fill:\"blue\",shape:\"ring\",text:msg.payload}); } \n else node.status({fill:\"red\",shape:\"dot\",text:msg.payload}); \n return msg;\n case 2 : msg.payload=\"u\"; context.set(\"both\",0);\n if (flow.get(\"bblp\")) { flow.set(\"bblp\",0); msg.payload=\"a\"; msg.lp=\"longpress U\"; node.status({fill:\"grey\",shape:\"ring\",text:msg.payload}); } \n else node.status({fill:\"yellow\",shape:\"dot\",text:msg.payload}); return msg;\n case 3 : msg.payload=\"a\"; context.set(\"both\",0); node.status({fill:\"green\",shape:\"ring\",text:msg.payload}); \n return msg;\n }\n}",
- "outputs": 1,
- "noerr": 0,
- "x": 1270,
- "y": 700,
- "wires": [
- [
- "1690e32b.09b06d",
- "7053f95f.644d58",
- "da6571c9.80974",
- "262665c1.742ffa"
- ]
- ]
- },
- {
- "id": "71a7f6c.8493208",
- "type": "comment",
- "z": "e7f81119.1bd4",
- "name": "2-button operation on stat3 ili esp-go",
- "info": "",
- "x": 1060,
- "y": 640,
- "wires": []
- },
- {
- "id": "2cd3029b.c1370e",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "",
- "topic": "stat3/toesp",
- "payload": "{temp_type:1}",
- "payloadType": "str",
- "repeat": "",
- "crontab": "",
- "once": true,
- "onceDelay": 0.1,
- "x": 1610,
- "y": 640,
- "wires": [
- [
- "68679a9b.889664"
- ]
- ]
- },
- {
- "id": "3b338b2a.835ea4",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "",
- "topic": "stat3/toesp",
- "payload": "{temperature_port:2}",
- "payloadType": "str",
- "repeat": "",
- "crontab": "",
- "once": true,
- "onceDelay": 0.1,
- "x": 1630,
- "y": 600,
- "wires": [
- [
- "68679a9b.889664"
- ]
- ]
- },
- {
- "id": "84752e65.edc4e",
- "type": "comment",
- "z": "e7f81119.1bd4",
- "name": "Set up stat3 board esp-go",
- "info": "",
- "x": 1590,
- "y": 560,
- "wires": []
- },
- {
- "id": "1690e32b.09b06d",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "up-down graphic u, d, a and a from long press either",
- "func": " msg.topic=\"stat3/toesp\";\n \n setTimeout(function(){\n msg['payload'] = \"{ili:\\\"$P166,104;$C0,0,0;$G3S$C255,255,255\\\"}\";\n node.send(msg);\n msg['payload'] = \"{ili:\\\"$P166,128;$C0,0,0;$G3P$C255,255,255\\\"}\";\n node.send(msg);\n }, 400);\n \n\nif (msg.payload=='u')\n {\n msg.payload=\"{ili:\\\"$P166,104;$C255,128,128;$G3S$C255,255,255\\\"}\"; \n node.send(msg);\n }\nelse\nif (msg.payload=='d')\n {\n msg.payload=\"{ili:\\\"$P166,128;$C128,128,255;$G3P$C255,255,255\\\"}\"; \n node.send(msg);\n }\n\nelse\nif (msg.payload=='a')\n {\n msg.payload=\"{ili:\\\"$P166,128;$C128,255,128;$G3P$P166,104;$G3S$C255,255,255\\\"}\"; \n node.send(msg);\n }\n",
- "outputs": 1,
- "noerr": 0,
- "x": 1720,
- "y": 40,
- "wires": [
- [
- "68679a9b.889664"
- ]
- ]
- },
- {
- "id": "7c34e0bf.87bd",
- "type": "mqtt in",
- "z": "e7f81119.1bd4",
- "name": "",
- "topic": "stat3/fromesp/auto_humidity",
- "qos": "2",
- "broker": "4c682b3a.2ab5c4",
- "x": 180,
- "y": 760,
- "wires": [
- [
- "2cf1f54a.260b9a"
- ]
- ]
- },
- {
- "id": "1fc16c61.579c14",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "Decrement AWAY every hour",
- "func": "if (flow.get(\"away\")) flow.set(\"away\",flow.get(\"away\")-1);\nif (flow.get(\"frost\")) flow.set(\"frost\",flow.get(\"frost\")-1);",
- "outputs": 0,
- "noerr": 0,
- "x": 340,
- "y": 600,
- "wires": []
- },
- {
- "id": "642ee25e.895edc",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "Hourly timer",
- "topic": "",
- "payload": "",
- "payloadType": "date",
- "repeat": "3600",
- "crontab": "",
- "once": false,
- "onceDelay": 0.1,
- "x": 130,
- "y": 560,
- "wires": [
- [
- "1fc16c61.579c14"
- ]
- ]
- },
- {
- "id": "c0e271bc.64638",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "Every minute",
- "topic": "",
- "payload": "",
- "payloadType": "date",
- "repeat": "60",
- "crontab": "",
- "once": false,
- "onceDelay": 0.1,
- "x": 520,
- "y": 540,
- "wires": [
- [
- "53cc9d53.254a54"
- ]
- ]
- },
- {
- "id": "20a478fa.97b6c8",
- "type": "file",
- "z": "e7f81119.1bd4",
- "name": "Store settings permanently after changes",
- "filename": "/home/pi/petesstatlog.log",
- "appendNewline": true,
- "createDir": true,
- "overwriteFile": "true",
- "x": 940,
- "y": 100,
- "wires": [
- []
- ]
- },
- {
- "id": "49633c6f.0a8434",
- "type": "mqtt in",
- "z": "e7f81119.1bd4",
- "name": "",
- "topic": "stat3/fromesp/trigger4",
- "qos": "2",
- "broker": "4c682b3a.2ab5c4",
- "x": 880,
- "y": 740,
- "wires": [
- [
- "cbd4e7b5.8246b8",
- "4cb65600.b87c38"
- ]
- ]
- },
- {
- "id": "f41b6fc7.9b923",
- "type": "mqtt in",
- "z": "e7f81119.1bd4",
- "name": "",
- "topic": "stat3/fromesp/trigger5",
- "qos": "2",
- "broker": "4c682b3a.2ab5c4",
- "x": 840,
- "y": 820,
- "wires": [
- [
- "158ec885.0313d7",
- "91ff8524.268528"
- ]
- ]
- },
- {
- "id": "de5abe51.5b23",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "",
- "topic": "stat3/toesp",
- "payload": "{input54:54}",
- "payloadType": "str",
- "repeat": "",
- "crontab": "",
- "once": true,
- "onceDelay": 0.1,
- "x": 1610,
- "y": 680,
- "wires": [
- [
- "68679a9b.889664"
- ]
- ]
- },
- {
- "id": "cbd4e7b5.8246b8",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "gpio4 button monitor",
- "func": " var date = new Date();\n\n var hour = date.getHours();\n hour = (hour < 10 ? \"0\" : \"\") + hour;\n\n var min = date.getMinutes();\n min = (min < 10 ? \"0\" : \"\") + min;\n\n var sec = date.getSeconds();\n sec = (sec < 10 ? \"0\" : \"\") + sec;\n\n var year = date.getFullYear();\n\n var month = date.getMonth() + 1;\n month = (month < 10 ? \"0\" : \"\") + month;\n\n var day = date.getDate();\n day = (day < 10 ? \"0\" : \"\") + day;\n\n \n node.status({fill:\"red\",shape:\"dot\",text:msg.payload + \" at \" + hour + \":\" + min + \":\" + sec + \" on \" + day + \":\" + month + \":\" + year });",
- "outputs": 0,
- "noerr": 0,
- "x": 1120,
- "y": 760,
- "wires": []
- },
- {
- "id": "91ff8524.268528",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "gpio5 button monitor",
- "func": " var date = new Date();\n\n var hour = date.getHours();\n hour = (hour < 10 ? \"0\" : \"\") + hour;\n\n var min = date.getMinutes();\n min = (min < 10 ? \"0\" : \"\") + min;\n\n var sec = date.getSeconds();\n sec = (sec < 10 ? \"0\" : \"\") + sec;\n\n var year = date.getFullYear();\n\n var month = date.getMonth() + 1;\n month = (month < 10 ? \"0\" : \"\") + month;\n\n var day = date.getDate();\n day = (day < 10 ? \"0\" : \"\") + day;\n\n \n node.status({fill:\"red\",shape:\"dot\",text:msg.payload + \" at \" + hour + \":\" + min + \":\" + sec + \" on \" + day + \":\" + month + \":\" + year });",
- "outputs": 0,
- "noerr": 0,
- "x": 1120,
- "y": 820,
- "wires": []
- },
- {
- "id": "3e5e55d0.c8671a",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "",
- "topic": "stat3/toesp",
- "payload": "{out13:1}",
- "payloadType": "str",
- "repeat": "",
- "crontab": "",
- "once": false,
- "onceDelay": 0.1,
- "x": 1670,
- "y": 760,
- "wires": [
- [
- "aac34649.3905a8"
- ]
- ]
- },
- {
- "id": "293ed676.34307a",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "",
- "topic": "stat3/toesp",
- "payload": "{out13:0}",
- "payloadType": "str",
- "repeat": "",
- "crontab": "",
- "once": false,
- "onceDelay": 0.1,
- "x": 1670,
- "y": 800,
- "wires": [
- [
- "aac34649.3905a8"
- ]
- ]
- },
- {
- "id": "813e930c.1bb6f",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "",
- "topic": "stat3/toesp",
- "payload": "{out13?}",
- "payloadType": "str",
- "repeat": "",
- "crontab": "",
- "once": false,
- "onceDelay": 0.1,
- "x": 1670,
- "y": 840,
- "wires": [
- [
- "aac34649.3905a8"
- ]
- ]
- },
- {
- "id": "d74c3408.7f6268",
- "type": "mqtt in",
- "z": "e7f81119.1bd4",
- "name": "",
- "topic": "stat3/fromesp/out13",
- "qos": "2",
- "broker": "4c682b3a.2ab5c4",
- "x": 1410,
- "y": 760,
- "wires": [
- [
- "fb14e2f4.3a133"
- ]
- ]
- },
- {
- "id": "fb14e2f4.3a133",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "input monitor 13",
- "func": " var date = new Date();\n\n var hour = date.getHours();\n hour = (hour < 10 ? \"0\" : \"\") + hour;\n\n var min = date.getMinutes();\n min = (min < 10 ? \"0\" : \"\") + min;\n\n var sec = date.getSeconds();\n sec = (sec < 10 ? \"0\" : \"\") + sec;\n\n var year = date.getFullYear();\n\n var month = date.getMonth() + 1;\n month = (month < 10 ? \"0\" : \"\") + month;\n\n var day = date.getDate();\n day = (day < 10 ? \"0\" : \"\") + day;\n\n \n node.status({fill:\"red\",shape:\"dot\",text:msg.payload + \" at \" + hour + \":\" + min + \":\" + sec + \" on \" + day + \":\" + month + \":\" + year });",
- "outputs": 0,
- "noerr": 0,
- "x": 1420,
- "y": 820,
- "wires": []
- },
- {
- "id": "a9b9cdc8.7aab8",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "flash every second if on",
- "topic": "",
- "payload": "flash",
- "payloadType": "str",
- "repeat": "1",
- "crontab": "",
- "once": false,
- "onceDelay": 0.1,
- "x": 1250,
- "y": 440,
- "wires": [
- [
- "95d1c267.b8f65"
- ]
- ]
- },
- {
- "id": "158ec885.0313d7",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "invert for touch switch",
- "func": "if (msg.payload==\"1\") msg.payload=\"0\"; else msg.payload=\"1\";\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "x": 1040,
- "y": 880,
- "wires": [
- [
- "1506f11e.700d9f"
- ]
- ]
- },
- {
- "id": "4cb65600.b87c38",
- "type": "function",
- "z": "e7f81119.1bd4",
- "name": "invert for touch switch",
- "func": "if (msg.payload==\"1\") msg.payload=\"0\"; else msg.payload=\"1\";\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "x": 980,
- "y": 700,
- "wires": [
- [
- "1506f11e.700d9f"
- ]
- ]
- },
- {
- "id": "50f4fa57.365054",
- "type": "inject",
- "z": "e7f81119.1bd4",
- "name": "",
- "topic": "stat3/toesp",
- "payload": "{input45:255}",
- "payloadType": "str",
- "repeat": "",
- "crontab": "",
- "once": true,
- "onceDelay": 0.1,
- "x": 1610,
- "y": 720,
- "wires": [
- [
- "68679a9b.889664"
- ]
- ]
- },
- {
- "id": "bd48728c.866f2",
- "type": "ui_group",
- "z": "",
- "name": "Stat",
- "tab": "1aa135a6.7197da",
- "disp": false,
- "width": "6"
- },
- {
- "id": "4c682b3a.2ab5c4",
- "type": "mqtt-broker",
- "z": "",
- "name": "",
- "broker": "127.0.0.1",
- "port": "1883",
- "clientid": "",
- "usetls": false,
- "compatmode": true,
- "keepalive": "60",
- "cleansession": true,
- "birthTopic": "",
- "birthQos": "0",
- "birthPayload": "",
- "closeTopic": "",
- "closeQos": "0",
- "closePayload": "",
- "willTopic": "",
- "willQos": "0",
- "willPayload": ""
- },
- {
- "id": "1aa135a6.7197da",
- "type": "ui_tab",
- "z": "",
- "name": "Stat",
- "icon": "dashboard",
- "order": 2
- }
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement