scargill

Thermostat ILI9341 Feb 28 2019

Feb 26th, 2019
926
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [
  2.     {
  3.         "id": "d6870949.5422d8",
  4.         "type": "ui_template",
  5.         "z": "e7f81119.1bd4",
  6.         "group": "bd48728c.866f2",
  7.         "name": "css etc",
  8.         "order": 12,
  9.         "width": "0",
  10.         "height": "0",
  11.         "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>",
  12.         "storeOutMessages": true,
  13.         "fwdInMessages": true,
  14.         "templateScope": "local",
  15.         "x": 620,
  16.         "y": 40,
  17.         "wires": [
  18.             []
  19.         ]
  20.     },
  21.     {
  22.         "id": "5ddc1d3c.71b5d4",
  23.         "type": "ui_template",
  24.         "z": "e7f81119.1bd4",
  25.         "group": "bd48728c.866f2",
  26.         "name": "Settings section",
  27.         "order": 2,
  28.         "width": "6",
  29.         "height": "6",
  30.         "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\">&nbsp;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",
  31.         "storeOutMessages": false,
  32.         "fwdInMessages": false,
  33.         "templateScope": "local",
  34.         "x": 800,
  35.         "y": 40,
  36.         "wires": [
  37.             [
  38.                 "8f3e25e4.6dba38"
  39.             ]
  40.         ]
  41.     },
  42.     {
  43.         "id": "8f3e25e4.6dba38",
  44.         "type": "function",
  45.         "z": "e7f81119.1bd4",
  46.         "name": "Process controls",
  47.         "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=\"\"",
  48.         "outputs": "3",
  49.         "noerr": 0,
  50.         "x": 650,
  51.         "y": 100,
  52.         "wires": [
  53.             [
  54.                 "5ddc1d3c.71b5d4"
  55.             ],
  56.             [
  57.                 "20a478fa.97b6c8"
  58.             ],
  59.             [
  60.                 "2012d6bc.e5bb8a"
  61.             ]
  62.         ]
  63.     },
  64.     {
  65.         "id": "2ea4fbf9.b23304",
  66.         "type": "inject",
  67.         "z": "e7f81119.1bd4",
  68.         "name": "Once only at power up",
  69.         "topic": "",
  70.         "payload": "once",
  71.         "payloadType": "str",
  72.         "repeat": "",
  73.         "crontab": "",
  74.         "once": true,
  75.         "onceDelay": "",
  76.         "x": 360,
  77.         "y": 100,
  78.         "wires": [
  79.             [
  80.                 "8f3e25e4.6dba38"
  81.             ]
  82.         ]
  83.     },
  84.     {
  85.         "id": "d9f5055c.d034d8",
  86.         "type": "function",
  87.         "z": "e7f81119.1bd4",
  88.         "name": "Process heat",
  89.         "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",
  90.         "outputs": "2",
  91.         "noerr": 0,
  92.         "x": 770,
  93.         "y": 420,
  94.         "wires": [
  95.             [
  96.                 "20503617.ac02ea",
  97.                 "be5056d3.ff22b8"
  98.             ],
  99.             [
  100.                 "95d1c267.b8f65",
  101.                 "4fac90e3.7885"
  102.             ]
  103.         ]
  104.     },
  105.     {
  106.         "id": "2012d6bc.e5bb8a",
  107.         "type": "file in",
  108.         "z": "e7f81119.1bd4",
  109.         "name": "Restore",
  110.         "filename": "/home/pi/petesstatlog.log",
  111.         "format": "utf8",
  112.         "x": 540,
  113.         "y": 180,
  114.         "wires": [
  115.             [
  116.                 "fa0025fe.752938"
  117.             ]
  118.         ]
  119.     },
  120.     {
  121.         "id": "fa0025fe.752938",
  122.         "type": "function",
  123.         "z": "e7f81119.1bd4",
  124.         "name": "Restore settings from SD on start after creating global array",
  125.         "func": "context.global.timing=JSON.parse(msg.payload);\nmsg.payload=\"\";\nreturn msg;",
  126.         "outputs": 1,
  127.         "noerr": 0,
  128.         "x": 860,
  129.         "y": 180,
  130.         "wires": [
  131.             [
  132.                 "8f3e25e4.6dba38"
  133.             ]
  134.         ]
  135.     },
  136.     {
  137.         "id": "13e86fd8.0c3cd",
  138.         "type": "function",
  139.         "z": "e7f81119.1bd4",
  140.         "name": "Store temperature",
  141.         "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}",
  142.         "outputs": "0",
  143.         "noerr": 0,
  144.         "x": 450,
  145.         "y": 700,
  146.         "wires": []
  147.     },
  148.     {
  149.         "id": "2cf1f54a.260b9a",
  150.         "type": "function",
  151.         "z": "e7f81119.1bd4",
  152.         "name": "Store humidity",
  153.         "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  });",
  154.         "outputs": "0",
  155.         "noerr": 0,
  156.         "x": 440,
  157.         "y": 760,
  158.         "wires": []
  159.     },
  160.     {
  161.         "id": "53b4a878.d58478",
  162.         "type": "inject",
  163.         "z": "e7f81119.1bd4",
  164.         "name": "Test \"Away\" 2 hours",
  165.         "topic": "",
  166.         "payload": "120",
  167.         "payloadType": "str",
  168.         "repeat": "",
  169.         "crontab": "",
  170.         "once": false,
  171.         "onceDelay": "",
  172.         "x": 150,
  173.         "y": 180,
  174.         "wires": [
  175.             [
  176.                 "3cd37e2c.450362"
  177.             ]
  178.         ]
  179.     },
  180.     {
  181.         "id": "d059cc6b.07d27",
  182.         "type": "inject",
  183.         "z": "e7f81119.1bd4",
  184.         "name": "Test \"Away\" clear",
  185.         "topic": "",
  186.         "payload": "0",
  187.         "payloadType": "str",
  188.         "repeat": "",
  189.         "crontab": "",
  190.         "once": false,
  191.         "x": 140,
  192.         "y": 220,
  193.         "wires": [
  194.             [
  195.                 "3cd37e2c.450362"
  196.             ]
  197.         ]
  198.     },
  199.     {
  200.         "id": "369d728d.9e145e",
  201.         "type": "inject",
  202.         "z": "e7f81119.1bd4",
  203.         "name": "Test \"Frost\" 2 hours",
  204.         "topic": "",
  205.         "payload": "120",
  206.         "payloadType": "str",
  207.         "repeat": "",
  208.         "crontab": "",
  209.         "once": false,
  210.         "onceDelay": "",
  211.         "x": 150,
  212.         "y": 260,
  213.         "wires": [
  214.             [
  215.                 "ee8c1336.e7829"
  216.             ]
  217.         ]
  218.     },
  219.     {
  220.         "id": "bf4b8f74.9cb77",
  221.         "type": "inject",
  222.         "z": "e7f81119.1bd4",
  223.         "name": "Test \"Frost\" clear",
  224.         "topic": "",
  225.         "payload": "0",
  226.         "payloadType": "str",
  227.         "repeat": "",
  228.         "crontab": "",
  229.         "once": false,
  230.         "onceDelay": "",
  231.         "x": 140,
  232.         "y": 300,
  233.         "wires": [
  234.             [
  235.                 "ee8c1336.e7829"
  236.             ]
  237.         ]
  238.     },
  239.     {
  240.         "id": "ee8c1336.e7829",
  241.         "type": "function",
  242.         "z": "e7f81119.1bd4",
  243.         "name": "Store \"frost\"",
  244.         "func": "flow.set(\"frost\",Number(msg.payload));\n\n",
  245.         "outputs": 0,
  246.         "noerr": 0,
  247.         "x": 370,
  248.         "y": 280,
  249.         "wires": []
  250.     },
  251.     {
  252.         "id": "3cd37e2c.450362",
  253.         "type": "function",
  254.         "z": "e7f81119.1bd4",
  255.         "name": "Store \"Away\"",
  256.         "func": "flow.set(\"away\",Number(msg.payload));\n",
  257.         "outputs": 0,
  258.         "noerr": 0,
  259.         "x": 370,
  260.         "y": 200,
  261.         "wires": []
  262.     },
  263.     {
  264.         "id": "cb2d0f09.47ffe",
  265.         "type": "inject",
  266.         "z": "e7f81119.1bd4",
  267.         "name": "sample forecast",
  268.         "topic": "",
  269.         "payload": "Dry, 2c with chance of snow",
  270.         "payloadType": "str",
  271.         "repeat": "",
  272.         "crontab": "",
  273.         "once": false,
  274.         "x": 140,
  275.         "y": 340,
  276.         "wires": [
  277.             [
  278.                 "91caa4fb.1dfc38"
  279.             ]
  280.         ]
  281.     },
  282.     {
  283.         "id": "e8456857.a45658",
  284.         "type": "inject",
  285.         "z": "e7f81119.1bd4",
  286.         "name": "Sample forecast",
  287.         "topic": "",
  288.         "payload": "Wet, 12c, possibly rain tonight",
  289.         "payloadType": "str",
  290.         "repeat": "",
  291.         "crontab": "",
  292.         "once": false,
  293.         "x": 140,
  294.         "y": 380,
  295.         "wires": [
  296.             [
  297.                 "91caa4fb.1dfc38"
  298.             ]
  299.         ]
  300.     },
  301.     {
  302.         "id": "91caa4fb.1dfc38",
  303.         "type": "function",
  304.         "z": "e7f81119.1bd4",
  305.         "name": "Store forecast",
  306.         "func": "flow.set(\"forecast\",msg.payload);",
  307.         "outputs": "0",
  308.         "noerr": 0,
  309.         "x": 380,
  310.         "y": 340,
  311.         "wires": []
  312.     },
  313.     {
  314.         "id": "95d1c267.b8f65",
  315.         "type": "function",
  316.         "z": "e7f81119.1bd4",
  317.         "name": "Heating relay is called heating_relay",
  318.         "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",
  319.         "outputs": 1,
  320.         "noerr": 0,
  321.         "x": 1530,
  322.         "y": 420,
  323.         "wires": [
  324.             [
  325.                 "aac34649.3905a8"
  326.             ]
  327.         ]
  328.     },
  329.     {
  330.         "id": "262665c1.742ffa",
  331.         "type": "function",
  332.         "z": "e7f81119.1bd4",
  333.         "name": "Handle SET",
  334.         "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;",
  335.         "outputs": 1,
  336.         "noerr": 0,
  337.         "x": 790,
  338.         "y": 360,
  339.         "wires": [
  340.             [
  341.                 "be5056d3.ff22b8",
  342.                 "e01b553b.23df18",
  343.                 "4fac90e3.7885",
  344.                 "20503617.ac02ea"
  345.             ]
  346.         ]
  347.     },
  348.     {
  349.         "id": "2b777af3.c2e396",
  350.         "type": "ui_template",
  351.         "z": "e7f81119.1bd4",
  352.         "group": "bd48728c.866f2",
  353.         "name": "up",
  354.         "order": 4,
  355.         "width": "1",
  356.         "height": "1",
  357.         "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> ",
  358.         "storeOutMessages": false,
  359.         "fwdInMessages": false,
  360.         "templateScope": "local",
  361.         "x": 570,
  362.         "y": 240,
  363.         "wires": [
  364.             [
  365.                 "262665c1.742ffa",
  366.                 "da6571c9.80974",
  367.                 "7053f95f.644d58"
  368.             ]
  369.         ]
  370.     },
  371.     {
  372.         "id": "e64c48be.5c4c08",
  373.         "type": "ui_template",
  374.         "z": "e7f81119.1bd4",
  375.         "group": "bd48728c.866f2",
  376.         "name": "down",
  377.         "order": 3,
  378.         "width": "1",
  379.         "height": "1",
  380.         "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> ",
  381.         "storeOutMessages": false,
  382.         "fwdInMessages": false,
  383.         "templateScope": "local",
  384.         "x": 570,
  385.         "y": 280,
  386.         "wires": [
  387.             [
  388.                 "262665c1.742ffa",
  389.                 "da6571c9.80974",
  390.                 "7053f95f.644d58"
  391.             ]
  392.         ]
  393.     },
  394.     {
  395.         "id": "53cc9d53.254a54",
  396.         "type": "function",
  397.         "z": "e7f81119.1bd4",
  398.         "name": "Handle AWAY",
  399.         "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;",
  400.         "outputs": 1,
  401.         "noerr": 0,
  402.         "x": 760,
  403.         "y": 540,
  404.         "wires": [
  405.             [
  406.                 "262665c1.742ffa",
  407.                 "44f446b0.acaa68"
  408.             ]
  409.         ]
  410.     },
  411.     {
  412.         "id": "e9d4bcd7.1d9b3",
  413.         "type": "ui_template",
  414.         "z": "e7f81119.1bd4",
  415.         "group": "bd48728c.866f2",
  416.         "name": "more",
  417.         "order": 7,
  418.         "width": "1",
  419.         "height": "1",
  420.         "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> ",
  421.         "storeOutMessages": false,
  422.         "fwdInMessages": false,
  423.         "templateScope": "local",
  424.         "x": 550,
  425.         "y": 580,
  426.         "wires": [
  427.             [
  428.                 "53cc9d53.254a54",
  429.                 "da6571c9.80974"
  430.             ]
  431.         ]
  432.     },
  433.     {
  434.         "id": "f6ceacbb.366e1",
  435.         "type": "ui_template",
  436.         "z": "e7f81119.1bd4",
  437.         "group": "bd48728c.866f2",
  438.         "name": "mmore",
  439.         "order": 8,
  440.         "width": "1",
  441.         "height": "1",
  442.         "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> ",
  443.         "storeOutMessages": false,
  444.         "fwdInMessages": false,
  445.         "templateScope": "local",
  446.         "x": 540,
  447.         "y": 620,
  448.         "wires": [
  449.             [
  450.                 "53cc9d53.254a54",
  451.                 "da6571c9.80974"
  452.             ]
  453.         ]
  454.     },
  455.     {
  456.         "id": "20503617.ac02ea",
  457.         "type": "ui_template",
  458.         "z": "e7f81119.1bd4",
  459.         "group": "bd48728c.866f2",
  460.         "name": "newergauge",
  461.         "order": 1,
  462.         "width": "3",
  463.         "height": "3",
  464.         "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>",
  465.         "storeOutMessages": false,
  466.         "fwdInMessages": false,
  467.         "templateScope": "local",
  468.         "x": 1010,
  469.         "y": 380,
  470.         "wires": [
  471.             [
  472.                 "d9f5055c.d034d8",
  473.                 "e5376b12.a08188"
  474.             ]
  475.         ]
  476.     },
  477.     {
  478.         "id": "be5056d3.ff22b8",
  479.         "type": "ui_template",
  480.         "z": "e7f81119.1bd4",
  481.         "group": "bd48728c.866f2",
  482.         "name": "SET",
  483.         "order": 5,
  484.         "width": "1",
  485.         "height": "1",
  486.         "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",
  487.         "storeOutMessages": false,
  488.         "fwdInMessages": false,
  489.         "templateScope": "local",
  490.         "x": 970,
  491.         "y": 320,
  492.         "wires": [
  493.             [
  494.                 "262665c1.742ffa",
  495.                 "da6571c9.80974"
  496.             ]
  497.         ]
  498.     },
  499.     {
  500.         "id": "44f446b0.acaa68",
  501.         "type": "ui_template",
  502.         "z": "e7f81119.1bd4",
  503.         "group": "bd48728c.866f2",
  504.         "name": "AWAY",
  505.         "order": 10,
  506.         "width": "1",
  507.         "height": "1",
  508.         "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>",
  509.         "storeOutMessages": false,
  510.         "fwdInMessages": false,
  511.         "templateScope": "local",
  512.         "x": 970,
  513.         "y": 480,
  514.         "wires": [
  515.             [
  516.                 "53cc9d53.254a54",
  517.                 "da6571c9.80974"
  518.             ]
  519.         ]
  520.     },
  521.     {
  522.         "id": "b05f8484.dc44e8",
  523.         "type": "ui_template",
  524.         "z": "e7f81119.1bd4",
  525.         "group": "bd48728c.866f2",
  526.         "name": "STATUS",
  527.         "order": 11,
  528.         "width": "3",
  529.         "height": "1",
  530.         "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>",
  531.         "storeOutMessages": false,
  532.         "fwdInMessages": false,
  533.         "templateScope": "local",
  534.         "x": 980,
  535.         "y": 560,
  536.         "wires": [
  537.             []
  538.         ]
  539.     },
  540.     {
  541.         "id": "6bf36df3.34e264",
  542.         "type": "function",
  543.         "z": "e7f81119.1bd4",
  544.         "name": "show humidity",
  545.         "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;",
  546.         "outputs": 1,
  547.         "noerr": 0,
  548.         "x": 780,
  549.         "y": 660,
  550.         "wires": [
  551.             [
  552.                 "b05f8484.dc44e8"
  553.             ]
  554.         ]
  555.     },
  556.     {
  557.         "id": "da6571c9.80974",
  558.         "type": "function",
  559.         "z": "e7f81119.1bd4",
  560.         "name": "Showing settings",
  561.         "func": "msg.payload=\"Showing settings\";\nmsg.color=\"#ffccaa\";\nreturn msg;",
  562.         "outputs": 1,
  563.         "noerr": 0,
  564.         "x": 790,
  565.         "y": 280,
  566.         "wires": [
  567.             [
  568.                 "b05f8484.dc44e8"
  569.             ]
  570.         ]
  571.     },
  572.     {
  573.         "id": "e5376b12.a08188",
  574.         "type": "function",
  575.         "z": "e7f81119.1bd4",
  576.         "name": "Showing actual",
  577.         "func": "msg.payload=\"Showing actual\";\nmsg.color=\"#bbddff\";\nreturn msg;",
  578.         "outputs": 1,
  579.         "noerr": 0,
  580.         "x": 780,
  581.         "y": 600,
  582.         "wires": [
  583.             [
  584.                 "b05f8484.dc44e8"
  585.             ]
  586.         ]
  587.     },
  588.     {
  589.         "id": "aac34649.3905a8",
  590.         "type": "mqtt out",
  591.         "z": "e7f81119.1bd4",
  592.         "name": "mqtt",
  593.         "topic": "",
  594.         "qos": "",
  595.         "retain": "",
  596.         "broker": "4c682b3a.2ab5c4",
  597.         "x": 1810,
  598.         "y": 420,
  599.         "wires": []
  600.     },
  601.     {
  602.         "id": "a3e4c37f.d9a34",
  603.         "type": "mqtt in",
  604.         "z": "e7f81119.1bd4",
  605.         "name": "",
  606.         "topic": "stat3/fromesp/auto_temperature",
  607.         "qos": "2",
  608.         "broker": "4c682b3a.2ab5c4",
  609.         "x": 190,
  610.         "y": 700,
  611.         "wires": [
  612.             [
  613.                 "13e86fd8.0c3cd"
  614.             ]
  615.         ]
  616.     },
  617.     {
  618.         "id": "560cc73c.96dcc8",
  619.         "type": "inject",
  620.         "z": "e7f81119.1bd4",
  621.         "name": "",
  622.         "topic": "",
  623.         "payload": "u",
  624.         "payloadType": "str",
  625.         "repeat": "",
  626.         "crontab": "",
  627.         "once": false,
  628.         "onceDelay": 0.1,
  629.         "x": 110,
  630.         "y": 440,
  631.         "wires": [
  632.             [
  633.                 "262665c1.742ffa",
  634.                 "da6571c9.80974",
  635.                 "7053f95f.644d58"
  636.             ]
  637.         ]
  638.     },
  639.     {
  640.         "id": "e78f3ad8.06ad58",
  641.         "type": "inject",
  642.         "z": "e7f81119.1bd4",
  643.         "name": "",
  644.         "topic": "",
  645.         "payload": "d",
  646.         "payloadType": "str",
  647.         "repeat": "",
  648.         "crontab": "",
  649.         "once": false,
  650.         "onceDelay": 0.1,
  651.         "x": 110,
  652.         "y": 480,
  653.         "wires": [
  654.             [
  655.                 "262665c1.742ffa",
  656.                 "da6571c9.80974",
  657.                 "7053f95f.644d58"
  658.             ]
  659.         ]
  660.     },
  661.     {
  662.         "id": "24495a14.24b616",
  663.         "type": "inject",
  664.         "z": "e7f81119.1bd4",
  665.         "name": "",
  666.         "topic": "",
  667.         "payload": "a",
  668.         "payloadType": "str",
  669.         "repeat": "",
  670.         "crontab": "",
  671.         "once": false,
  672.         "onceDelay": 0.1,
  673.         "x": 110,
  674.         "y": 520,
  675.         "wires": [
  676.             [
  677.                 "262665c1.742ffa",
  678.                 "da6571c9.80974",
  679.                 "7053f95f.644d58"
  680.             ]
  681.         ]
  682.     },
  683.     {
  684.         "id": "f3351617.0119b8",
  685.         "type": "comment",
  686.         "z": "e7f81119.1bd4",
  687.         "name": "global and flow vars used",
  688.         "info": "flow vars: manual, manualTimer, setTemperature,\n           frost, away, incomingTemperature, incomingHumidity\n\nglobal vars: timing",
  689.         "x": 1090,
  690.         "y": 40,
  691.         "wires": []
  692.     },
  693.     {
  694.         "id": "7053f95f.644d58",
  695.         "type": "timeout",
  696.         "z": "e7f81119.1bd4",
  697.         "name": "My Timeout",
  698.         "outtopic": "",
  699.         "outsafe": "",
  700.         "outwarning": "",
  701.         "outunsafe": "1",
  702.         "warning": "15",
  703.         "timer": "30",
  704.         "repeat": false,
  705.         "again": true,
  706.         "x": 710,
  707.         "y": 480,
  708.         "wires": [
  709.             [
  710.                 "d9f5055c.d034d8",
  711.                 "6bf36df3.34e264"
  712.             ]
  713.         ]
  714.     },
  715.     {
  716.         "id": "89d69293.366b7",
  717.         "type": "link in",
  718.         "z": "e7f81119.1bd4",
  719.         "name": "",
  720.         "links": [
  721.             "910d0ff7.43b19"
  722.         ],
  723.         "x": 1215,
  724.         "y": 600,
  725.         "wires": [
  726.             [
  727.                 "d0aafabe.673168",
  728.                 "d2ba92f3.0c776"
  729.             ]
  730.         ]
  731.     },
  732.     {
  733.         "id": "8ad8fddf.97a19",
  734.         "type": "mqtt in",
  735.         "z": "e7f81119.1bd4",
  736.         "name": "",
  737.         "topic": "heating_relay/fromesp/auto_temperature",
  738.         "qos": "2",
  739.         "broker": "4c682b3a.2ab5c4",
  740.         "x": 220,
  741.         "y": 820,
  742.         "wires": [
  743.             [
  744.                 "8c66d671.5d06f8"
  745.             ]
  746.         ]
  747.     },
  748.     {
  749.         "id": "8c66d671.5d06f8",
  750.         "type": "function",
  751.         "z": "e7f81119.1bd4",
  752.         "name": "heating_relay auto_temperature",
  753.         "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  });",
  754.         "outputs": 0,
  755.         "noerr": 0,
  756.         "x": 570,
  757.         "y": 820,
  758.         "wires": []
  759.     },
  760.     {
  761.         "id": "d0aafabe.673168",
  762.         "type": "function",
  763.         "z": "e7f81119.1bd4",
  764.         "name": "turn relay indicator off momentarily at relay power up",
  765.         "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}",
  766.         "outputs": 1,
  767.         "noerr": 0,
  768.         "x": 1560,
  769.         "y": 480,
  770.         "wires": [
  771.             [
  772.                 "aac34649.3905a8",
  773.                 "fde1e4b6.d1d838"
  774.             ]
  775.         ]
  776.     },
  777.     {
  778.         "id": "fde1e4b6.d1d838",
  779.         "type": "delay",
  780.         "z": "e7f81119.1bd4",
  781.         "name": "",
  782.         "pauseType": "delay",
  783.         "timeout": "2",
  784.         "timeoutUnits": "seconds",
  785.         "rate": "1",
  786.         "nbRateUnits": "1",
  787.         "rateUnits": "second",
  788.         "randomFirst": "1",
  789.         "randomLast": "5",
  790.         "randomUnits": "seconds",
  791.         "drop": false,
  792.         "x": 1380,
  793.         "y": 520,
  794.         "wires": [
  795.             [
  796.                 "720bfcdd.4d65d4"
  797.             ]
  798.         ]
  799.     },
  800.     {
  801.         "id": "720bfcdd.4d65d4",
  802.         "type": "function",
  803.         "z": "e7f81119.1bd4",
  804.         "name": "turn relay indicator on at relay power up",
  805.         "func": "    msg.topic=\"heating_relay/toesp\";\n    msg.payload=\"{out12:1}\";\n    return msg;\n",
  806.         "outputs": 1,
  807.         "noerr": 0,
  808.         "x": 1620,
  809.         "y": 520,
  810.         "wires": [
  811.             [
  812.                 "aac34649.3905a8"
  813.             ]
  814.         ]
  815.     },
  816.     {
  817.         "id": "e09e0589.a4cb98",
  818.         "type": "function",
  819.         "z": "e7f81119.1bd4",
  820.         "name": "clear ili",
  821.         "func": "msg.payload=\"{ili:\\\"$S\\\"}\";\nmsg.topic=\"stat3/toesp\";\nreturn msg;",
  822.         "outputs": 1,
  823.         "noerr": 0,
  824.         "x": 1600,
  825.         "y": 120,
  826.         "wires": [
  827.             [
  828.                 "4e9afa5.c960804",
  829.                 "68679a9b.889664"
  830.             ]
  831.         ]
  832.     },
  833.     {
  834.         "id": "f24aab8d.d7ee58",
  835.         "type": "comment",
  836.         "z": "e7f81119.1bd4",
  837.         "name": "il9341 display local stat",
  838.         "info": "",
  839.         "x": 1340,
  840.         "y": 40,
  841.         "wires": []
  842.     },
  843.     {
  844.         "id": "d2ba92f3.0c776",
  845.         "type": "function",
  846.         "z": "e7f81119.1bd4",
  847.         "name": "",
  848.         "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}",
  849.         "outputs": 1,
  850.         "noerr": 0,
  851.         "x": 1190,
  852.         "y": 300,
  853.         "wires": [
  854.             [
  855.                 "b764a722.9e1d98",
  856.                 "54c6248b.7913cc"
  857.             ]
  858.         ]
  859.     },
  860.     {
  861.         "id": "b764a722.9e1d98",
  862.         "type": "function",
  863.         "z": "e7f81119.1bd4",
  864.         "name": "",
  865.         "func": "msg.payload=\"Init\";\nreturn msg;",
  866.         "outputs": 1,
  867.         "noerr": 0,
  868.         "x": 1290,
  869.         "y": 120,
  870.         "wires": [
  871.             [
  872.                 "4935af57.e0632"
  873.             ]
  874.         ]
  875.     },
  876.     {
  877.         "id": "495c3a16.4f5a34",
  878.         "type": "inject",
  879.         "z": "e7f81119.1bd4",
  880.         "name": "Set up disp at start also 4am",
  881.         "topic": "",
  882.         "payload": "",
  883.         "payloadType": "date",
  884.         "repeat": "",
  885.         "crontab": "00 04 * * *",
  886.         "once": false,
  887.         "onceDelay": 0.1,
  888.         "x": 1170,
  889.         "y": 240,
  890.         "wires": [
  891.             [
  892.                 "b764a722.9e1d98"
  893.             ]
  894.         ]
  895.     },
  896.     {
  897.         "id": "4935af57.e0632",
  898.         "type": "delay",
  899.         "z": "e7f81119.1bd4",
  900.         "name": "",
  901.         "pauseType": "delay",
  902.         "timeout": "250",
  903.         "timeoutUnits": "milliseconds",
  904.         "rate": "1",
  905.         "nbRateUnits": "1",
  906.         "rateUnits": "second",
  907.         "randomFirst": "1",
  908.         "randomLast": "5",
  909.         "randomUnits": "seconds",
  910.         "drop": false,
  911.         "x": 1430,
  912.         "y": 120,
  913.         "wires": [
  914.             [
  915.                 "e09e0589.a4cb98"
  916.             ]
  917.         ]
  918.     },
  919.     {
  920.         "id": "9fbb4e8d.7fa0b",
  921.         "type": "function",
  922.         "z": "e7f81119.1bd4",
  923.         "name": "Frame",
  924.         "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",
  925.         "outputs": 1,
  926.         "noerr": 0,
  927.         "x": 1590,
  928.         "y": 160,
  929.         "wires": [
  930.             [
  931.                 "68679a9b.889664",
  932.                 "a07e4cf9.f288"
  933.             ]
  934.         ]
  935.     },
  936.     {
  937.         "id": "4e9afa5.c960804",
  938.         "type": "delay",
  939.         "z": "e7f81119.1bd4",
  940.         "name": "",
  941.         "pauseType": "delay",
  942.         "timeout": "300",
  943.         "timeoutUnits": "milliseconds",
  944.         "rate": "1",
  945.         "nbRateUnits": "1",
  946.         "rateUnits": "second",
  947.         "randomFirst": "1",
  948.         "randomLast": "5",
  949.         "randomUnits": "seconds",
  950.         "drop": false,
  951.         "x": 1430,
  952.         "y": 160,
  953.         "wires": [
  954.             [
  955.                 "9fbb4e8d.7fa0b"
  956.             ]
  957.         ]
  958.     },
  959.     {
  960.         "id": "9bb63202.2d86d",
  961.         "type": "function",
  962.         "z": "e7f81119.1bd4",
  963.         "name": "Fixed wording",
  964.         "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",
  965.         "outputs": 1,
  966.         "noerr": 0,
  967.         "x": 1620,
  968.         "y": 240,
  969.         "wires": [
  970.             [
  971.                 "68679a9b.889664"
  972.             ]
  973.         ]
  974.     },
  975.     {
  976.         "id": "e62ca4f3.00c108",
  977.         "type": "function",
  978.         "z": "e7f81119.1bd4",
  979.         "name": "temperature",
  980.         "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);",
  981.         "outputs": 1,
  982.         "noerr": 0,
  983.         "x": 1610,
  984.         "y": 280,
  985.         "wires": [
  986.             [
  987.                 "68679a9b.889664"
  988.             ]
  989.         ]
  990.     },
  991.     {
  992.         "id": "e01b553b.23df18",
  993.         "type": "function",
  994.         "z": "e7f81119.1bd4",
  995.         "name": "set temperature",
  996.         "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",
  997.         "outputs": 1,
  998.         "noerr": 0,
  999.         "x": 1620,
  1000.         "y": 320,
  1001.         "wires": [
  1002.             [
  1003.                 "92d7692a.2e6018",
  1004.                 "68679a9b.889664"
  1005.             ]
  1006.         ]
  1007.     },
  1008.     {
  1009.         "id": "92d7692a.2e6018",
  1010.         "type": "function",
  1011.         "z": "e7f81119.1bd4",
  1012.         "name": "Auto/manual",
  1013.         "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);",
  1014.         "outputs": 1,
  1015.         "noerr": 0,
  1016.         "x": 1610,
  1017.         "y": 380,
  1018.         "wires": [
  1019.             [
  1020.                 "68679a9b.889664"
  1021.             ]
  1022.         ]
  1023.     },
  1024.     {
  1025.         "id": "39495a97.d17626",
  1026.         "type": "delay",
  1027.         "z": "e7f81119.1bd4",
  1028.         "name": "",
  1029.         "pauseType": "delay",
  1030.         "timeout": "200",
  1031.         "timeoutUnits": "milliseconds",
  1032.         "rate": "1",
  1033.         "nbRateUnits": "1",
  1034.         "rateUnits": "second",
  1035.         "randomFirst": "1",
  1036.         "randomLast": "5",
  1037.         "randomUnits": "seconds",
  1038.         "drop": false,
  1039.         "x": 1430,
  1040.         "y": 240,
  1041.         "wires": [
  1042.             [
  1043.                 "9bb63202.2d86d",
  1044.                 "db951651.f831f8"
  1045.             ]
  1046.         ]
  1047.     },
  1048.     {
  1049.         "id": "ca35d6c3.8d2b98",
  1050.         "type": "timeout",
  1051.         "z": "e7f81119.1bd4",
  1052.         "name": "My Timeout",
  1053.         "outtopic": "",
  1054.         "outsafe": "1",
  1055.         "outwarning": "",
  1056.         "outunsafe": "1",
  1057.         "warning": "15",
  1058.         "timer": "30",
  1059.         "repeat": false,
  1060.         "again": true,
  1061.         "x": 1430,
  1062.         "y": 320,
  1063.         "wires": [
  1064.             [
  1065.                 "e62ca4f3.00c108",
  1066.                 "e01b553b.23df18",
  1067.                 "54c6248b.7913cc"
  1068.             ]
  1069.         ]
  1070.     },
  1071.     {
  1072.         "id": "db951651.f831f8",
  1073.         "type": "delay",
  1074.         "z": "e7f81119.1bd4",
  1075.         "name": "",
  1076.         "pauseType": "delay",
  1077.         "timeout": "150",
  1078.         "timeoutUnits": "milliseconds",
  1079.         "rate": "1",
  1080.         "nbRateUnits": "1",
  1081.         "rateUnits": "second",
  1082.         "randomFirst": "1",
  1083.         "randomLast": "5",
  1084.         "randomUnits": "seconds",
  1085.         "drop": false,
  1086.         "x": 1430,
  1087.         "y": 280,
  1088.         "wires": [
  1089.             [
  1090.                 "ca35d6c3.8d2b98",
  1091.                 "e62ca4f3.00c108",
  1092.                 "e01b553b.23df18"
  1093.             ]
  1094.         ]
  1095.     },
  1096.     {
  1097.         "id": "54c6248b.7913cc",
  1098.         "type": "function",
  1099.         "z": "e7f81119.1bd4",
  1100.         "name": "Show Time",
  1101.         "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;",
  1102.         "outputs": 1,
  1103.         "noerr": 0,
  1104.         "x": 1430,
  1105.         "y": 380,
  1106.         "wires": [
  1107.             [
  1108.                 "68679a9b.889664"
  1109.             ]
  1110.         ]
  1111.     },
  1112.     {
  1113.         "id": "68679a9b.889664",
  1114.         "type": "mqtt out",
  1115.         "z": "e7f81119.1bd4",
  1116.         "name": "mqtt",
  1117.         "topic": "",
  1118.         "qos": "",
  1119.         "retain": "",
  1120.         "broker": "4c682b3a.2ab5c4",
  1121.         "x": 1770,
  1122.         "y": 140,
  1123.         "wires": []
  1124.     },
  1125.     {
  1126.         "id": "4fac90e3.7885",
  1127.         "type": "function",
  1128.         "z": "e7f81119.1bd4",
  1129.         "name": "stat3 status on off",
  1130.         "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",
  1131.         "outputs": 1,
  1132.         "noerr": 0,
  1133.         "x": 1630,
  1134.         "y": 80,
  1135.         "wires": [
  1136.             [
  1137.                 "68679a9b.889664"
  1138.             ]
  1139.         ]
  1140.     },
  1141.     {
  1142.         "id": "c49f4738.247958",
  1143.         "type": "function",
  1144.         "z": "e7f81119.1bd4",
  1145.         "name": "Frame2",
  1146.         "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",
  1147.         "outputs": 1,
  1148.         "noerr": 0,
  1149.         "x": 1600,
  1150.         "y": 200,
  1151.         "wires": [
  1152.             [
  1153.                 "39495a97.d17626",
  1154.                 "68679a9b.889664"
  1155.             ]
  1156.         ]
  1157.     },
  1158.     {
  1159.         "id": "a07e4cf9.f288",
  1160.         "type": "delay",
  1161.         "z": "e7f81119.1bd4",
  1162.         "name": "",
  1163.         "pauseType": "delay",
  1164.         "timeout": "200",
  1165.         "timeoutUnits": "milliseconds",
  1166.         "rate": "1",
  1167.         "nbRateUnits": "1",
  1168.         "rateUnits": "second",
  1169.         "randomFirst": "1",
  1170.         "randomLast": "5",
  1171.         "randomUnits": "seconds",
  1172.         "drop": false,
  1173.         "x": 1430,
  1174.         "y": 200,
  1175.         "wires": [
  1176.             [
  1177.                 "c49f4738.247958"
  1178.             ]
  1179.         ]
  1180.     },
  1181.     {
  1182.         "id": "510729b3.07a158",
  1183.         "type": "inject",
  1184.         "z": "e7f81119.1bd4",
  1185.         "name": "2 secs after start",
  1186.         "topic": "",
  1187.         "payload": "",
  1188.         "payloadType": "date",
  1189.         "repeat": "",
  1190.         "crontab": "",
  1191.         "once": true,
  1192.         "onceDelay": "2",
  1193.         "x": 1230,
  1194.         "y": 380,
  1195.         "wires": [
  1196.             [
  1197.                 "54c6248b.7913cc"
  1198.             ]
  1199.         ]
  1200.     },
  1201.     {
  1202.         "id": "1506f11e.700d9f",
  1203.         "type": "function",
  1204.         "z": "e7f81119.1bd4",
  1205.         "name": "Button \"d\", \"u\" or both i.e. \"a\" for auto",
  1206.         "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}",
  1207.         "outputs": 1,
  1208.         "noerr": 0,
  1209.         "x": 1270,
  1210.         "y": 700,
  1211.         "wires": [
  1212.             [
  1213.                 "1690e32b.09b06d",
  1214.                 "7053f95f.644d58",
  1215.                 "da6571c9.80974",
  1216.                 "262665c1.742ffa"
  1217.             ]
  1218.         ]
  1219.     },
  1220.     {
  1221.         "id": "71a7f6c.8493208",
  1222.         "type": "comment",
  1223.         "z": "e7f81119.1bd4",
  1224.         "name": "2-button operation on stat3 ili esp-go",
  1225.         "info": "",
  1226.         "x": 1060,
  1227.         "y": 640,
  1228.         "wires": []
  1229.     },
  1230.     {
  1231.         "id": "2cd3029b.c1370e",
  1232.         "type": "inject",
  1233.         "z": "e7f81119.1bd4",
  1234.         "name": "",
  1235.         "topic": "stat3/toesp",
  1236.         "payload": "{temp_type:1}",
  1237.         "payloadType": "str",
  1238.         "repeat": "",
  1239.         "crontab": "",
  1240.         "once": true,
  1241.         "onceDelay": 0.1,
  1242.         "x": 1610,
  1243.         "y": 640,
  1244.         "wires": [
  1245.             [
  1246.                 "68679a9b.889664"
  1247.             ]
  1248.         ]
  1249.     },
  1250.     {
  1251.         "id": "3b338b2a.835ea4",
  1252.         "type": "inject",
  1253.         "z": "e7f81119.1bd4",
  1254.         "name": "",
  1255.         "topic": "stat3/toesp",
  1256.         "payload": "{temperature_port:2}",
  1257.         "payloadType": "str",
  1258.         "repeat": "",
  1259.         "crontab": "",
  1260.         "once": true,
  1261.         "onceDelay": 0.1,
  1262.         "x": 1630,
  1263.         "y": 600,
  1264.         "wires": [
  1265.             [
  1266.                 "68679a9b.889664"
  1267.             ]
  1268.         ]
  1269.     },
  1270.     {
  1271.         "id": "84752e65.edc4e",
  1272.         "type": "comment",
  1273.         "z": "e7f81119.1bd4",
  1274.         "name": "Set up stat3 board esp-go",
  1275.         "info": "",
  1276.         "x": 1590,
  1277.         "y": 560,
  1278.         "wires": []
  1279.     },
  1280.     {
  1281.         "id": "1690e32b.09b06d",
  1282.         "type": "function",
  1283.         "z": "e7f81119.1bd4",
  1284.         "name": "up-down graphic u, d, a and a from long press either",
  1285.         "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",
  1286.         "outputs": 1,
  1287.         "noerr": 0,
  1288.         "x": 1720,
  1289.         "y": 40,
  1290.         "wires": [
  1291.             [
  1292.                 "68679a9b.889664"
  1293.             ]
  1294.         ]
  1295.     },
  1296.     {
  1297.         "id": "7c34e0bf.87bd",
  1298.         "type": "mqtt in",
  1299.         "z": "e7f81119.1bd4",
  1300.         "name": "",
  1301.         "topic": "stat3/fromesp/auto_humidity",
  1302.         "qos": "2",
  1303.         "broker": "4c682b3a.2ab5c4",
  1304.         "x": 180,
  1305.         "y": 760,
  1306.         "wires": [
  1307.             [
  1308.                 "2cf1f54a.260b9a"
  1309.             ]
  1310.         ]
  1311.     },
  1312.     {
  1313.         "id": "1fc16c61.579c14",
  1314.         "type": "function",
  1315.         "z": "e7f81119.1bd4",
  1316.         "name": "Decrement AWAY every hour",
  1317.         "func": "if (flow.get(\"away\")) flow.set(\"away\",flow.get(\"away\")-1);\nif (flow.get(\"frost\")) flow.set(\"frost\",flow.get(\"frost\")-1);",
  1318.         "outputs": 0,
  1319.         "noerr": 0,
  1320.         "x": 340,
  1321.         "y": 600,
  1322.         "wires": []
  1323.     },
  1324.     {
  1325.         "id": "642ee25e.895edc",
  1326.         "type": "inject",
  1327.         "z": "e7f81119.1bd4",
  1328.         "name": "Hourly timer",
  1329.         "topic": "",
  1330.         "payload": "",
  1331.         "payloadType": "date",
  1332.         "repeat": "3600",
  1333.         "crontab": "",
  1334.         "once": false,
  1335.         "onceDelay": 0.1,
  1336.         "x": 130,
  1337.         "y": 560,
  1338.         "wires": [
  1339.             [
  1340.                 "1fc16c61.579c14"
  1341.             ]
  1342.         ]
  1343.     },
  1344.     {
  1345.         "id": "c0e271bc.64638",
  1346.         "type": "inject",
  1347.         "z": "e7f81119.1bd4",
  1348.         "name": "Every minute",
  1349.         "topic": "",
  1350.         "payload": "",
  1351.         "payloadType": "date",
  1352.         "repeat": "60",
  1353.         "crontab": "",
  1354.         "once": false,
  1355.         "onceDelay": 0.1,
  1356.         "x": 520,
  1357.         "y": 540,
  1358.         "wires": [
  1359.             [
  1360.                 "53cc9d53.254a54"
  1361.             ]
  1362.         ]
  1363.     },
  1364.     {
  1365.         "id": "20a478fa.97b6c8",
  1366.         "type": "file",
  1367.         "z": "e7f81119.1bd4",
  1368.         "name": "Store settings permanently after changes",
  1369.         "filename": "/home/pi/petesstatlog.log",
  1370.         "appendNewline": true,
  1371.         "createDir": true,
  1372.         "overwriteFile": "true",
  1373.         "x": 940,
  1374.         "y": 100,
  1375.         "wires": [
  1376.             []
  1377.         ]
  1378.     },
  1379.     {
  1380.         "id": "49633c6f.0a8434",
  1381.         "type": "mqtt in",
  1382.         "z": "e7f81119.1bd4",
  1383.         "name": "",
  1384.         "topic": "stat3/fromesp/trigger4",
  1385.         "qos": "2",
  1386.         "broker": "4c682b3a.2ab5c4",
  1387.         "x": 880,
  1388.         "y": 740,
  1389.         "wires": [
  1390.             [
  1391.                 "cbd4e7b5.8246b8",
  1392.                 "4cb65600.b87c38"
  1393.             ]
  1394.         ]
  1395.     },
  1396.     {
  1397.         "id": "f41b6fc7.9b923",
  1398.         "type": "mqtt in",
  1399.         "z": "e7f81119.1bd4",
  1400.         "name": "",
  1401.         "topic": "stat3/fromesp/trigger5",
  1402.         "qos": "2",
  1403.         "broker": "4c682b3a.2ab5c4",
  1404.         "x": 840,
  1405.         "y": 820,
  1406.         "wires": [
  1407.             [
  1408.                 "158ec885.0313d7",
  1409.                 "91ff8524.268528"
  1410.             ]
  1411.         ]
  1412.     },
  1413.     {
  1414.         "id": "de5abe51.5b23",
  1415.         "type": "inject",
  1416.         "z": "e7f81119.1bd4",
  1417.         "name": "",
  1418.         "topic": "stat3/toesp",
  1419.         "payload": "{input54:54}",
  1420.         "payloadType": "str",
  1421.         "repeat": "",
  1422.         "crontab": "",
  1423.         "once": true,
  1424.         "onceDelay": 0.1,
  1425.         "x": 1610,
  1426.         "y": 680,
  1427.         "wires": [
  1428.             [
  1429.                 "68679a9b.889664"
  1430.             ]
  1431.         ]
  1432.     },
  1433.     {
  1434.         "id": "cbd4e7b5.8246b8",
  1435.         "type": "function",
  1436.         "z": "e7f81119.1bd4",
  1437.         "name": "gpio4 button monitor",
  1438.         "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  });",
  1439.         "outputs": 0,
  1440.         "noerr": 0,
  1441.         "x": 1120,
  1442.         "y": 760,
  1443.         "wires": []
  1444.     },
  1445.     {
  1446.         "id": "91ff8524.268528",
  1447.         "type": "function",
  1448.         "z": "e7f81119.1bd4",
  1449.         "name": "gpio5 button monitor",
  1450.         "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  });",
  1451.         "outputs": 0,
  1452.         "noerr": 0,
  1453.         "x": 1120,
  1454.         "y": 820,
  1455.         "wires": []
  1456.     },
  1457.     {
  1458.         "id": "3e5e55d0.c8671a",
  1459.         "type": "inject",
  1460.         "z": "e7f81119.1bd4",
  1461.         "name": "",
  1462.         "topic": "stat3/toesp",
  1463.         "payload": "{out13:1}",
  1464.         "payloadType": "str",
  1465.         "repeat": "",
  1466.         "crontab": "",
  1467.         "once": false,
  1468.         "onceDelay": 0.1,
  1469.         "x": 1670,
  1470.         "y": 760,
  1471.         "wires": [
  1472.             [
  1473.                 "aac34649.3905a8"
  1474.             ]
  1475.         ]
  1476.     },
  1477.     {
  1478.         "id": "293ed676.34307a",
  1479.         "type": "inject",
  1480.         "z": "e7f81119.1bd4",
  1481.         "name": "",
  1482.         "topic": "stat3/toesp",
  1483.         "payload": "{out13:0}",
  1484.         "payloadType": "str",
  1485.         "repeat": "",
  1486.         "crontab": "",
  1487.         "once": false,
  1488.         "onceDelay": 0.1,
  1489.         "x": 1670,
  1490.         "y": 800,
  1491.         "wires": [
  1492.             [
  1493.                 "aac34649.3905a8"
  1494.             ]
  1495.         ]
  1496.     },
  1497.     {
  1498.         "id": "813e930c.1bb6f",
  1499.         "type": "inject",
  1500.         "z": "e7f81119.1bd4",
  1501.         "name": "",
  1502.         "topic": "stat3/toesp",
  1503.         "payload": "{out13?}",
  1504.         "payloadType": "str",
  1505.         "repeat": "",
  1506.         "crontab": "",
  1507.         "once": false,
  1508.         "onceDelay": 0.1,
  1509.         "x": 1670,
  1510.         "y": 840,
  1511.         "wires": [
  1512.             [
  1513.                 "aac34649.3905a8"
  1514.             ]
  1515.         ]
  1516.     },
  1517.     {
  1518.         "id": "d74c3408.7f6268",
  1519.         "type": "mqtt in",
  1520.         "z": "e7f81119.1bd4",
  1521.         "name": "",
  1522.         "topic": "stat3/fromesp/out13",
  1523.         "qos": "2",
  1524.         "broker": "4c682b3a.2ab5c4",
  1525.         "x": 1410,
  1526.         "y": 760,
  1527.         "wires": [
  1528.             [
  1529.                 "fb14e2f4.3a133"
  1530.             ]
  1531.         ]
  1532.     },
  1533.     {
  1534.         "id": "fb14e2f4.3a133",
  1535.         "type": "function",
  1536.         "z": "e7f81119.1bd4",
  1537.         "name": "input monitor 13",
  1538.         "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  });",
  1539.         "outputs": 0,
  1540.         "noerr": 0,
  1541.         "x": 1420,
  1542.         "y": 820,
  1543.         "wires": []
  1544.     },
  1545.     {
  1546.         "id": "a9b9cdc8.7aab8",
  1547.         "type": "inject",
  1548.         "z": "e7f81119.1bd4",
  1549.         "name": "flash every second if on",
  1550.         "topic": "",
  1551.         "payload": "flash",
  1552.         "payloadType": "str",
  1553.         "repeat": "1",
  1554.         "crontab": "",
  1555.         "once": false,
  1556.         "onceDelay": 0.1,
  1557.         "x": 1250,
  1558.         "y": 440,
  1559.         "wires": [
  1560.             [
  1561.                 "95d1c267.b8f65"
  1562.             ]
  1563.         ]
  1564.     },
  1565.     {
  1566.         "id": "158ec885.0313d7",
  1567.         "type": "function",
  1568.         "z": "e7f81119.1bd4",
  1569.         "name": "invert for touch switch",
  1570.         "func": "if (msg.payload==\"1\") msg.payload=\"0\"; else msg.payload=\"1\";\nreturn msg;",
  1571.         "outputs": 1,
  1572.         "noerr": 0,
  1573.         "x": 1040,
  1574.         "y": 880,
  1575.         "wires": [
  1576.             [
  1577.                 "1506f11e.700d9f"
  1578.             ]
  1579.         ]
  1580.     },
  1581.     {
  1582.         "id": "4cb65600.b87c38",
  1583.         "type": "function",
  1584.         "z": "e7f81119.1bd4",
  1585.         "name": "invert for touch switch",
  1586.         "func": "if (msg.payload==\"1\") msg.payload=\"0\"; else msg.payload=\"1\";\nreturn msg;",
  1587.         "outputs": 1,
  1588.         "noerr": 0,
  1589.         "x": 980,
  1590.         "y": 700,
  1591.         "wires": [
  1592.             [
  1593.                 "1506f11e.700d9f"
  1594.             ]
  1595.         ]
  1596.     },
  1597.     {
  1598.         "id": "50f4fa57.365054",
  1599.         "type": "inject",
  1600.         "z": "e7f81119.1bd4",
  1601.         "name": "",
  1602.         "topic": "stat3/toesp",
  1603.         "payload": "{input45:255}",
  1604.         "payloadType": "str",
  1605.         "repeat": "",
  1606.         "crontab": "",
  1607.         "once": true,
  1608.         "onceDelay": 0.1,
  1609.         "x": 1610,
  1610.         "y": 720,
  1611.         "wires": [
  1612.             [
  1613.                 "68679a9b.889664"
  1614.             ]
  1615.         ]
  1616.     },
  1617.     {
  1618.         "id": "bd48728c.866f2",
  1619.         "type": "ui_group",
  1620.         "z": "",
  1621.         "name": "Stat",
  1622.         "tab": "1aa135a6.7197da",
  1623.         "disp": false,
  1624.         "width": "6"
  1625.     },
  1626.     {
  1627.         "id": "4c682b3a.2ab5c4",
  1628.         "type": "mqtt-broker",
  1629.         "z": "",
  1630.         "name": "",
  1631.         "broker": "127.0.0.1",
  1632.         "port": "1883",
  1633.         "clientid": "",
  1634.         "usetls": false,
  1635.         "compatmode": true,
  1636.         "keepalive": "60",
  1637.         "cleansession": true,
  1638.         "birthTopic": "",
  1639.         "birthQos": "0",
  1640.         "birthPayload": "",
  1641.         "closeTopic": "",
  1642.         "closeQos": "0",
  1643.         "closePayload": "",
  1644.         "willTopic": "",
  1645.         "willQos": "0",
  1646.         "willPayload": ""
  1647.     },
  1648.     {
  1649.         "id": "1aa135a6.7197da",
  1650.         "type": "ui_tab",
  1651.         "z": "",
  1652.         "name": "Stat",
  1653.         "icon": "dashboard",
  1654.         "order": 2
  1655.     }
  1656. ]
RAW Paste Data