scargill

Original Thermostat QDTECH Flow before Frb 27 2019 - bugs

Feb 26th, 2019
586
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": 10,
  9. "width": "0",
  10. "height": "0",
  11. "format": "<style>
  12.  
  13. .cellGreen
  14. {
  15. background-color: #ffdddd !important;
  16. }
  17.  
  18. .filled {
  19. height: 100% !important;
  20.  
  21. padding: 0 !important;
  22. margin: 0 !important;
  23. }
  24. .nr-dashboard-template {
  25. padding: 0;
  26. margin: 0;
  27. }
  28.  
  29. .rounded {
  30. border-radius: 12px 12px 12px 12px;
  31. }
  32.  
  33. .bigfont {
  34. font-size: 18px;
  35. }
  36.  
  37. .smallfont {
  38. font-size: 12px;
  39. }
  40.  
  41. .zui-table {
  42. border: solid 1px #DDEEEE;
  43. border-collapse: collapse;
  44. border-spacing: 0;
  45. font: normal 10px Arial, sans-serif;
  46. outline: none;
  47. }
  48. .zui-table thead th {
  49. width: 100%;
  50. height:50%;
  51. background-color: #99bbff;
  52. border: solid 1px #DDEEEE;
  53. color: #336B6B;
  54. padding: 7px 3px 5px 3px;
  55. text-align: center;
  56. text-shadow: 1px 1px 1px #fff;
  57. }
  58. .zui-table tbody td {
  59. width: 100%;
  60. height:50%;
  61. border: solid 1px #333;
  62. color: #333;
  63. text-align: center;
  64. padding: 6px 3px 9px 3px;
  65. text-shadow: 1px 1px 1px #fff;
  66. }
  67. .zui-table-rounded {
  68. border: none;
  69. }
  70. .zui-table-rounded thead th {
  71. background-color: #77aaff;
  72. border: none;
  73. text-shadow: 1px 1px 1px #ccc;
  74. color: #333;
  75. }
  76. .zui-table-rounded thead th:first-child {
  77. border-radius: 10px 0 0 0;
  78. }
  79. .zui-table-rounded thead th:last-child {
  80. border-radius: 10px 10px 0px 0px;
  81. }
  82. .zui-table-rounded tbody td {
  83. border: none;
  84. border-top: solid 1px #957030;
  85. background-color: #aaddff;
  86. }
  87. .zui-table-rounded tbody tr:last-child td:first-child {
  88. border-radius: 10px 10px 0 0;
  89. }
  90. .zui-table-rounded tbody tr:last-child td:last-child {
  91. border-radius: 0 0 10px 10px;
  92. }
  93. </style>
  94.  
  95. <script>
  96. var current=1;
  97.  
  98. $('.vibrate').on('click', function() {
  99. navigator.vibrate(100);
  100. });
  101.  
  102. function restore_bg(x) {
  103. $(this).css(\"background-color\", x);
  104. };
  105.  
  106. $('.touched').on('mousedown', function() {
  107.  
  108. var x= $(this).css(\"background-color\");
  109. $(this).css(\"background-color\", \"yellow\");
  110.  
  111. setTimeout(restore_bg.bind(this,x),50);
  112. navigator.vibrate(80);
  113. });
  114.  
  115. </script>",
  116. "storeOutMessages": true,
  117. "fwdInMessages": true,
  118. "templateScope": "local",
  119. "x": 600,
  120. "y": 120,
  121. "wires": [
  122. []
  123. ]
  124. },
  125. {
  126. "id": "5ddc1d3c.71b5d4",
  127. "type": "ui_template",
  128. "z": "e7f81119.1bd4",
  129. "group": "bd48728c.866f2",
  130. "name": "Settings section",
  131. "order": 2,
  132. "width": "6",
  133. "height": "6",
  134. "format": "<style>
  135. .thedays { vertical-align:bottom; height:48px; }
  136. .the2px  { background-color:black; height:2px; }
  137. .theblocks {width:100%; height:0%; background-color:green; }
  138. .greybuttons { background-color:#dddddd !important; width:48px; }
  139. .thetemps { font-size:70%; color:#888888 !important; }
  140. .smallheadings { color:black; font-size:80%; }
  141.  
  142. </style>
  143.  
  144. <script>
  145. var thedays = [\"SUNDAY\", \"MONDAY\", \"TUESDAY\", \"WEDNESDAY\", \"THURSDAY\", \"FRIDAY\", \"SATURDAY\"];
  146.  
  147. var last = 1;
  148.  
  149. function bar(mm, val) {
  150. if (val == 14) {
  151. $(mm).height(\"12%\");
  152. $(mm).css('background-color', '#6666ff');
  153. } //blue
  154. if (val == 15) {
  155. $(mm).height(\"16%\");
  156. $(mm).css('background-color', '#5577ff');
  157. }
  158. if (val == 16) {
  159. $(mm).height(\"20%\");
  160. $(mm).css('background-color', '#5599ff');
  161. }
  162. if (val == 17) {
  163. $(mm).height(\"24%\");
  164. $(mm).css('background-color', '#55ccdd');
  165. } // cyan
  166. if (val == 18) {
  167. $(mm).height(\"28%\");
  168. $(mm).css('background-color', '#55ddaa');
  169. }
  170. if (val == 19) {
  171. $(mm).height(\"32%\");
  172. $(mm).css('background-color', '#55dd55');
  173. }
  174. if (val == 20) {
  175. $(mm).height(\"36%\");
  176. $(mm).css('background-color', '#55dd55');
  177. } // green
  178. if (val == 21) {
  179. $(mm).height(\"40%\");
  180. $(mm).css('background-color', '#55dd55');
  181. }
  182. if (val == 22) {
  183. $(mm).height(\"44%\");
  184. $(mm).css('background-color', '#aadd55');
  185. }
  186. if (val == 23) {
  187. $(mm).height(\"48%\");
  188. $(mm).css('background-color', '#dddd55');
  189. } // yellow
  190. if (val == 24) {
  191. $(mm).height(\"52%\");
  192. $(mm).css('background-color', '#ffaa55');
  193. }
  194. if (val == 25) {
  195. $(mm).height(\"56%\");
  196. $(mm).css('background-color', '#ff8855');
  197. }
  198. if (val == 26) {
  199. $(mm).height(\"60%\");
  200. $(mm).css('background-color', '#ff7777');
  201. } // red
  202.  
  203. }
  204.  
  205. function stat(text) {
  206. $(\"#info\").text(text);
  207. var tm = setTimeout(function() {
  208. $(\"#info\").text(\"Ok\");
  209. clearTimeout(tm);
  210. }, 3000);
  211. }
  212.  
  213. function selec(val, sta) {
  214. var w = \"#td\" + val;
  215. if (sta) $(w).css('background-color', 'magenta');
  216. else $(w).css('background-color', 'black');
  217. }
  218.  
  219. (function(scope) {
  220. scope.$watch('msg', function(msg) {
  221. selec(last, 0);
  222. last = msg.selector;
  223. selec(last, 1);
  224. for (var x = 0; x < 24; x++) {
  225. var w = \"#t\" + x;
  226. bar(w, msg.timing[((msg.days - 1) * 24) + x]);
  227. var v = \"#v\" + x;
  228. $(v).text(msg.timing[((msg.days - 1) * 24) + x] + \"C\")
  229. }
  230. for (var x = 0; x < 2; x++) {
  231. var w = \"#s\" + x;
  232. $(w).text(msg.timing[168 + x] + \"C\");
  233. }
  234. $(\"#d0\").text(thedays[msg.days - 1]);
  235. if ((last > 4) && (last < 29))
  236. $(\"#current\").text(msg.timing[((msg.days - 1) * 24) + last - 5] + \"C\");
  237. else
  238. $(\"#current\").text(\"-\");
  239.  
  240. if (msg.foryou != \"\") {
  241. stat(msg.foryou);
  242. }
  243.  
  244. });
  245.  
  246. })(scope);
  247.  
  248. </script>
  249. <table width=\"100%\">
  250. <tr style=\"height:2px\">
  251. <td colspan=12 style=\"background-color:black;height:5px;\"></td>
  252. </tr>
  253.  
  254. <tr>
  255. <td colspan=6>
  256. <center><span class=\"smallheadings\">Day</span></center>
  257. </td>
  258. <td colspan=3>
  259. <center><span class=\"smallheadings\">Frost</span></center>
  260. </td>
  261. <td colspan=3>
  262. <center><span class=\"smallheadings\">Away</span></center>
  263. </td>
  264. </tr>
  265.  
  266. <tr>
  267. <td ng-click=\"send({payload: '29'})\" colspan=6>
  268. <center><span id=\"d0\" style=\"color:blue;font-size:120%\">MONDAY</span></center>
  269. </td>
  270. <td ng-click=\"send({payload: '1'})\" colspan=3>
  271. <center><span id=\"s0\" style=\"color:blue;font-size:120%\">14</span></center>
  272. </td>
  273. <td ng-click=\"send({payload: '2'})\" colspan=3>
  274. <center><span id=\"s1\" style=\"color:blue;font-size:120%\">20</span></center>
  275. </td>
  276. </tr>
  277.  
  278. <tr style=\"height:2px\">
  279. <td id=\"td29\" colspan=6 style=\"background-color:black;height:2px;\"></td>
  280. <td id=\"td1\" colspan=3 style=\"background-color:black;height:2px;\"></td>
  281. <td id=\"td2\" colspan=3 style=\"background-color:black;height:2px;\"></td>
  282. </tr>
  283.  
  284. <tr>
  285. <td ng-click=\"send({payload: '5'})\" class=\"thedays\"><span id=\"v0\" class=\"thetemps\"></span>
  286. <div id=\"t0\" class=\"theblocks\"></div>
  287. </td>
  288. <td ng-click=\"send({payload: '6'})\" class=\"thedays\"><span id=\"v1\" class=\"thetemps\"></span>
  289. <div id=\"t1\" class=\"theblocks\"></div>
  290. </td>
  291. <td ng-click=\"send({payload: '7'})\" class=\"thedays\"><span id=\"v2\" class=\"thetemps\"></span>
  292. <div id=\"t2\" class=\"theblocks\"></div>
  293. </td>
  294. <td ng-click=\"send({payload: '8'})\" class=\"thedays\"><span id=\"v3\" class=\"thetemps\"></span>
  295. <div id=\"t3\" class=\"theblocks\"></div>
  296. </td>
  297. <td ng-click=\"send({payload: '9'})\" class=\"thedays\"><span id=\"v4\" class=\"thetemps\"></span>
  298. <div id=\"t4\" class=\"theblocks\"></div>
  299. </td>
  300. <td ng-click=\"send({payload: '10'})\" class=\"thedays\"><span id=\"v5\" class=\"thetemps\"></span>
  301. <div id=\"t5\" class=\"theblocks\"></div>
  302. </td>
  303. <td ng-click=\"send({payload: '11'})\" class=\"thedays\"><span id=\"v6\" class=\"thetemps\"></span>
  304. <div id=\"t6\" class=\"theblocks\"></div>
  305. </td>
  306. <td ng-click=\"send({payload: '12'})\" class=\"thedays\"><span id=\"v7\" class=\"thetemps\"></span>
  307. <div id=\"t7\" class=\"theblocks\"></div>
  308. </td>
  309. <td ng-click=\"send({payload: '13'})\" class=\"thedays\"><span id=\"v8\" class=\"thetemps\"></span>
  310. <div id=\"t8\" class=\"theblocks\"></div>
  311. </td>
  312. <td ng-click=\"send({payload: '14'})\" class=\"thedays\"><span id=\"v9\" class=\"thetemps\"></span>
  313. <div id=\"t9\" class=\"theblocks\"></div>
  314. </td>
  315. <td ng-click=\"send({payload: '15'})\" class=\"thedays\"><span id=\"v10\" class=\"thetemps\"></span>
  316. <div id=\"t10\" class=\"theblocks\"></div>
  317. </td>
  318. <td ng-click=\"send({payload: '16'})\" class=\"thedays\"><span id=\"v11\" class=\"thetemps\"></span>
  319. <div id=\"t11\" class=\"theblocks\"></div>
  320. </td>
  321. </tr>
  322.  
  323. <tr style=\"height:2px\">
  324. <td id=\"td5\" class=\"the2px\"></td>
  325. <td id=\"td6\" class=\"the2px\"></td>
  326. <td id=\"td7\" class=\"the2px\"></td>
  327. <td id=\"td8\" class=\"the2px\"></td>
  328. <td id=\"td9\" class=\"the2px\"></td>
  329. <td id=\"td10\" class=\"the2px\"></td>
  330. <td id=\"td11\" class=\"the2px\"></td>
  331. <td id=\"td12\" class=\"the2px\"></td>
  332. <td id=\"td13\" class=\"the2px\"></td>
  333. <td id=\"td14\" class=\"the2px\"></td>
  334. <td id=\"td15\" class=\"the2px\"></td>
  335. <td id=\"td16\" class=\"the2px\"></td>
  336. </tr>
  337.  
  338. <tr>
  339. <td>0</td>
  340. <td>1</td>
  341. <td>2</td>
  342. <td>3</td>
  343. <td>4</td>
  344. <td>5</td>
  345. <td>6</td>
  346. <td>7</td>
  347. <td>8</td>
  348. <td>9</td>
  349. <td>10</td>
  350. <td>11</td>
  351. </tr>
  352.  
  353. <tr>
  354. <td ng-click=\"send({payload: '17'})\" class=\"thedays\"><span id=\"v12\" class=\"thetemps\"></span>
  355. <div id=\"t12\" class=\"theblocks\"></div>
  356. </td>
  357. <td ng-click=\"send({payload: '18'})\" class=\"thedays\"><span id=\"v13\" class=\"thetemps\"></span>
  358. <div id=\"t13\" class=\"theblocks\"></div>
  359. </td>
  360. <td ng-click=\"send({payload: '19'})\" class=\"thedays\"><span id=\"v14\" class=\"thetemps\"></span>
  361. <div id=\"t14\" class=\"theblocks\"></div>
  362. </td>
  363. <td ng-click=\"send({payload: '20'})\" class=\"thedays\"><span id=\"v15\" class=\"thetemps\"></span>
  364. <div id=\"t15\" class=\"theblocks\"></div>
  365. </td>
  366. <td ng-click=\"send({payload: '21'})\" class=\"thedays\"><span id=\"v16\" class=\"thetemps\"></span>
  367. <div id=\"t16\" class=\"theblocks\"></div>
  368. </td>
  369. <td ng-click=\"send({payload: '22'})\" class=\"thedays\"><span id=\"v17\" class=\"thetemps\"></span>
  370. <div id=\"t17\" class=\"theblocks\"></div>
  371. </td>
  372. <td ng-click=\"send({payload: '23'})\" class=\"thedays\"><span id=\"v18\" class=\"thetemps\"></span>
  373. <div id=\"t18\" class=\"theblocks\"></div>
  374. </td>
  375. <td ng-click=\"send({payload: '24'})\" class=\"thedays\"><span id=\"v19\" class=\"thetemps\"></span>
  376. <div id=\"t19\" class=\"theblocks\"></div>
  377. </td>
  378. <td ng-click=\"send({payload: '25'})\" class=\"thedays\"><span id=\"v20\" class=\"thetemps\"></span>
  379. <div id=\"t20\" class=\"theblocks\"></div>
  380. </td>
  381. <td ng-click=\"send({payload: '26'})\" class=\"thedays\"><span id=\"v21\" class=\"thetemps\"></span>
  382. <div id=\"t21\" class=\"theblocks\"></div>
  383. </td>
  384. <td ng-click=\"send({payload: '27'})\" class=\"thedays\"><span id=\"v22\" class=\"thetemps\"></span>
  385. <div id=\"t22\" class=\"theblocks\"></div>
  386. </td>
  387. <td ng-click=\"send({payload: '28'})\" class=\"thedays\"><span id=\"v23\" class=\"thetemps\"></span>
  388. <div id=\"t23\" class=\"theblocks\"></div>
  389. </td>
  390. </tr>
  391.  
  392. <tr style=\"height:2px\">
  393. <td id=\"td17\" class=\"the2px\"></td>
  394. <td id=\"td18\" class=\"the2px\"></td>
  395. <td id=\"td19\" class=\"the2px\"></td>
  396. <td id=\"td20\" class=\"the2px\"></td>
  397. <td id=\"td21\" class=\"the2px\"></td>
  398. <td id=\"td22\" class=\"the2px\"></td>
  399. <td id=\"td23\" class=\"the2px\"></td>
  400. <td id=\"td24\" class=\"the2px\"></td>
  401. <td id=\"td25\" class=\"the2px\"></td>
  402. <td id=\"td26\" class=\"the2px\"></td>
  403. <td id=\"td27\" class=\"the2px\"></td>
  404. <td id=\"td28\" class=\"the2px\"></td>
  405. </tr>
  406.  
  407. <tr>
  408. <td>12</td>
  409. <td>13</td>
  410. <td>14</td>
  411. <td>15</td>
  412. <td>16</td>
  413. <td>17</td>
  414. <td>18</td>
  415. <td>19</td>
  416. <td>20</td>
  417. <td>21</td>
  418. <td>22</td>
  419. <td>23</td>
  420. </tr>
  421.  
  422. <tr height=\"20px\">
  423. <td colspan=2 bgcolor=\"#dddddd\"><span class=\"smallheadings\"> Status:</span></td>
  424.  
  425. <td colspan=10 bgcolor=\"#dddddd\">
  426. <center><span id=\"info\" class=\"smallheadings\">OK</span></center>
  427. </td>
  428. </tr>
  429.  
  430. <tr height=\"10px\">
  431. <td colspan=\"12\"></td>
  432. </tr>
  433.  
  434. <tr style=\"height:48px\">
  435. <td colspan=2>
  436. <md-button class=\"vibrate filled touched smallfont rounded greybuttons\" ng-click=\"send({payload: 'd'})\">
  437. <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\" />
  438. </md-button>
  439. </td>
  440.  
  441. <td colspan=2>
  442. <center><span id=\"current\" style=\"color:black;font-size:120%\">-</span></center>
  443. </td>
  444.  
  445. <td colspan=2>
  446. <md-button class=\"vibrate filled touched smallfont rounded greybuttons\" ng-click=\"send({payload: 'u'})\">
  447. <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\" />
  448. </md-button>
  449. </td>
  450.  
  451. <td colspan=2>
  452. <md-button class=\"vibrate filled touched smallfont rounded greybuttons\" ng-click=\"send({payload: 'r'})\">
  453. <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\" />
  454. </md-button>
  455. </td>
  456.  
  457. <td colspan=2>
  458. <md-button class=\"vibrate filled touched smallfont rounded greybuttons\" ng-click=\"send({payload: 's'})\">
  459. <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\" />
  460. </md-button>
  461. </td>
  462.  
  463. <td colspan=2>
  464. <md-button class=\"vibrate filled touched smallfont rounded greybuttons\" ng-click=\"send({payload: 'c'})\">
  465. <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\" />
  466. </md-button>
  467. </td>
  468. <td colspan=1></td>
  469. </tr>
  470.  
  471. </table>
  472. ",
  473. "storeOutMessages": false,
  474. "fwdInMessages": false,
  475. "templateScope": "local",
  476. "x": 780,
  477. "y": 120,
  478. "wires": [
  479. [
  480. "8f3e25e4.6dba38"
  481. ]
  482. ]
  483. },
  484. {
  485. "id": "8f3e25e4.6dba38",
  486. "type": "function",
  487. "z": "e7f81119.1bd4",
  488. "name": "Process controls",
  489. "func": "if ( typeof context.days == 'undefined' ) context.days=1;
  490. if ( typeof context.selector == 'undefined' ) context.selector=1;
  491. if ( typeof context.saving == 'undefined' ) context.saving=0;
  492.  
  493. //context.set(\"days\",context.get(\"days\") || 1) ;
  494. //context.set(\"selector\",context.get(\"selector\") || 1);
  495. //context.set(\"saving\",context.get(\"saving\") || 0);
  496.  
  497. // if ( typeof context.global.incomingTemperature == 'undefined' ) context.global.incomingTemperature=0;
  498.  
  499. flow.set(\"incomingTemperature\", flow.get(\"incomingTemperature\") || 20);
  500. flow.set(\"incomingHumidity\", flow.get(\"incomingHumidity\") || 40);
  501. // if ( typeof context.global.incomingHumidity == 'undefined' ) context.global.incomingHumidity=0;
  502.  
  503. flow.set(\"hold\", flow.get(\"hold\") || 0);
  504. flow.set(\"away\", flow.get(\"away\") || 0);
  505. flow.set(\"manual\", flow.get(\"manual\") || 0);
  506. flow.set(\"setTemperature\", flow.get(\"setTemperature\") || 0);
  507. flow.set(\"manualTimer\", flow.get(\"manualTimer\") || 0);
  508.  
  509. //if ( typeof context.flow.hold == 'undefined' ) context.flow.hold=0;
  510. //if ( typeof context.flow.away == 'undefined' ) context.flow.away=0;
  511. //if ( typeof context.flow.manual == 'undefined' ) context.flow.manual=0;
  512. //if ( typeof context.flow.setTemperature == 'undefined' ) context.flow.setTemperature=0;
  513. //if ( typeof context.flow.manualTimer == 'undefined' ) context.flow.manualTimer=0;
  514. if ( typeof context.global.timing == 'undefined' )
  515. {
  516. context.global.timing=[
  517. 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
  518. 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
  519. 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
  520. 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
  521. 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
  522. 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
  523. 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
  524. 8,14
  525. ];
  526. context.saving=0;
  527. msg.payload=\"anything\";  msg.foryou=\"Restoring\"; return([null,null,msg]);
  528. }
  529. var timing=global.get(\"timing\");
  530.  
  531. switch (msg.payload)
  532. {
  533. case \"u\" :  if ((context.selector>4)&&(context.selector<29))
  534. {
  535. timing[((context.days-1)*24)+context.selector-5]++;
  536. if (timing[((context.days-1)*24)+context.selector-5]>26) timing[((context.days-1)*24)+context.selector-5]=26;
  537. msg.foryou=\"Incremented temperature\";
  538. }
  539. 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\"; }
  540. 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\"; }
  541. if (context.selector==29) { if (context.days<7) { context.days++; msg.foryou=\"Forward one day\";} else msg.foryou=\"End of days!!\"; }
  542. break;
  543. case \"d\" :  if ((context.selector>4)&&(context.selector<29))
  544. {
  545. timing[((context.days-1)*24)+context.selector-5]--;
  546. if (timing[((context.days-1)*24)+context.selector-5]<14) timing[((context.days-1)*24)+context.selector-5]=14;
  547. msg.foryou=\"Decremented temperature\";
  548. }
  549. 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\"; }
  550. 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\"; }
  551. if (context.selector==29) { if (context.days>1) { context.days--;  msg.foryou=\"Backward one day\";} else msg.foryou=\"Beginning of days!!\";  }
  552. break;
  553. case 'r' :  if ((context.selector>=5)&&(context.selector<28))
  554. {
  555. timing[((context.days-1)*24)+context.selector-4]=timing[((context.days-1)*24)+context.selector-5];
  556. context.selector++;
  557. msg.foryou=\"Copied settings to the next hour slot\";
  558. }
  559. if ((context.selector==29)&&(context.days<7))
  560. {
  561. for (var a=0;a<24;a++)
  562. {
  563. timing[((context.days)*24)+a]=timing[((context.days-1)*24)+a];
  564. }
  565. context.days++;
  566. msg.foryou=\"Copied a complete day's settings\";
  567. }
  568. break;
  569. case 's': context.saving=0;  msg.foryou=\"Settings saved to disk\"; break;
  570. case '1':
  571. case '2':
  572. case '3':
  573. case '4':
  574. case '5':
  575. case '6':
  576. case '7':
  577. case '8':
  578. case '9':
  579. case '10':
  580. case '11':
  581. case '12':
  582. case '13':
  583. case '14':
  584. case '15':
  585. case '16':
  586. case '17':
  587. case '18':
  588. case '19':
  589. case '20':
  590. case '21':
  591. case '22':
  592. case '23':
  593. case '24':
  594. case '25':
  595. case '26':
  596. case '27':
  597. case '28':
  598. case '29': context.selector=parseInt(msg.payload);
  599. if (msg.payload=='1') msg.foryou=\"Frost temperature selection\";
  600. else if (msg.payload=='2') msg.foryou=\"Away temperature selection\";
  601. else if (msg.payload=='29') msg.foryou=\"Day selection\";
  602. else  msg.foryou=\"Selected hour period \" + (parseInt(msg.payload)-4);
  603. break;
  604. case 'c' : msg.payload=\"anything\";  msg.foryou=\"Changes cancelled\"; node.send([null,null,msg]);
  605. }
  606.  
  607. msg.temperatures=context.temperatures;
  608. msg.timing=timing;
  609. msg.days=context.days;
  610. msg.selector=context.selector;
  611.  
  612. node.send([msg,null,null]);
  613.  
  614. if (context.saving===0)
  615. {
  616. msg.topic=\"\";
  617. msg.timing=\"\";
  618. msg.payload=JSON.stringify(timing);
  619. node.send([null,msg,null]);
  620. context.saving=1;
  621. }
  622. msg.foryou=\"\"",
  623. "outputs": "3",
  624. "noerr": 0,
  625. "x": 630,
  626. "y": 180,
  627. "wires": [
  628. [
  629. "5ddc1d3c.71b5d4"
  630. ],
  631. [
  632. "20a478fa.97b6c8"
  633. ],
  634. [
  635. "2012d6bc.e5bb8a"
  636. ]
  637. ]
  638. },
  639. {
  640. "id": "2ea4fbf9.b23304",
  641. "type": "inject",
  642. "z": "e7f81119.1bd4",
  643. "name": "Once only",
  644. "topic": "",
  645. "payload": "",
  646. "payloadType": "str",
  647. "repeat": "",
  648. "crontab": "",
  649. "once": true,
  650. "x": 130,
  651. "y": 220,
  652. "wires": [
  653. [
  654. "8f3e25e4.6dba38",
  655. "2012d6bc.e5bb8a"
  656. ]
  657. ]
  658. },
  659. {
  660. "id": "d9f5055c.d034d8",
  661. "type": "function",
  662. "z": "e7f81119.1bd4",
  663. "name": "Process heat",
  664. "func": "var timing=global.get(\"timing\");
  665. var now = new Date();
  666. msg.payload=timing[(now.getDay()*24)+now.getHours()];
  667. msg.frost=timing[168];
  668. msg.away=timing[169];
  669.  
  670. msg.temperature=flow.get(\"incomingTemperature\");
  671. msg.humidity=flow.get(\"incomingHumidity\");
  672. msg.set=msg.payload;
  673. if (flow.get(\"manualTimer\")) flow.set(\"manualTimer\",flow.get(\"manualTimer\")-1);
  674. else flow.set(\"manual\",0);
  675. msg.desired=msg.set;
  676. flow.set(\"setTemperature\",msg.desired);
  677. msg.desired+=flow.get(\"manual\");
  678. if (flow.get(\"frost\")) { msg.desired=global.get(\"timing\")[168]; flow.set(\"frost\",flow.get(\"frost\")-1); }
  679. if (flow.get(\"away\")) { msg.desired=global.get(\"timing\")[169]; flow.set(\"away\",flow.get(\"away\")-1); }
  680. if (msg.desired>msg.temperature) msg.relay=1; else msg.relay=0;
  681.  
  682. msg.payload=flow.get(\"incomingTemperature\");
  683.  
  684. node.status({fill:\"blue\",shape:\"dot\",text:\"Set point \" + msg.desired + \"c - Actual \" + msg.temperature +\"c\"});
  685.  
  686. node.send([msg,null]);
  687. msg.payload=msg.relay;
  688. node.send([null,msg]);
  689.  
  690. ",
  691. "outputs": "2",
  692. "noerr": 0,
  693. "x": 750,
  694. "y": 500,
  695. "wires": [
  696. [
  697. "20503617.ac02ea",
  698. "be5056d3.ff22b8"
  699. ],
  700. [
  701. "95d1c267.b8f65",
  702. "bae11d44.599fc",
  703. "4fac90e3.7885"
  704. ]
  705. ]
  706. },
  707. {
  708. "id": "20a478fa.97b6c8",
  709. "type": "file",
  710. "z": "e7f81119.1bd4",
  711. "name": "backup",
  712. "filename": "/home/pi/petesstatlog.log",
  713. "appendNewline": true,
  714. "createDir": true,
  715. "overwriteFile": "true",
  716. "x": 820,
  717. "y": 180,
  718. "wires": [
  719. []
  720. ]
  721. },
  722. {
  723. "id": "2012d6bc.e5bb8a",
  724. "type": "file in",
  725. "z": "e7f81119.1bd4",
  726. "name": "Restore",
  727. "filename": "/home/pi/petesstatlog.log",
  728. "format": "utf8",
  729. "x": 400,
  730. "y": 220,
  731. "wires": [
  732. [
  733. "fa0025fe.752938"
  734. ]
  735. ]
  736. },
  737. {
  738. "id": "fa0025fe.752938",
  739. "type": "function",
  740. "z": "e7f81119.1bd4",
  741. "name": "Restore data from SD",
  742. "func": "context.flow.timing=JSON.parse(msg.payload);
  743. msg.payload=\"\";
  744. return msg;",
  745. "outputs": 1,
  746. "noerr": 0,
  747. "x": 540,
  748. "y": 260,
  749. "wires": [
  750. [
  751. "8f3e25e4.6dba38"
  752. ]
  753. ]
  754. },
  755. {
  756. "id": "4176dabf.ac7cd4",
  757. "type": "inject",
  758. "z": "e7f81119.1bd4",
  759. "name": "dummy temperature 20c",
  760. "topic": "",
  761. "payload": "20",
  762. "payloadType": "str",
  763. "repeat": "",
  764. "crontab": "",
  765. "once": true,
  766. "onceDelay": "",
  767. "x": 170,
  768. "y": 120,
  769. "wires": [
  770. [
  771. "13e86fd8.0c3cd"
  772. ]
  773. ]
  774. },
  775. {
  776. "id": "2e36966.df2ac6a",
  777. "type": "inject",
  778. "z": "e7f81119.1bd4",
  779. "name": "dummy humidity 40%",
  780. "topic": "",
  781. "payload": "40",
  782. "payloadType": "str",
  783. "repeat": "",
  784. "crontab": "",
  785. "once": true,
  786. "onceDelay": "",
  787. "x": 160,
  788. "y": 160,
  789. "wires": [
  790. [
  791. "2cf1f54a.260b9a"
  792. ]
  793. ]
  794. },
  795. {
  796. "id": "13e86fd8.0c3cd",
  797. "type": "function",
  798. "z": "e7f81119.1bd4",
  799. "name": "Store temperature",
  800. "func": "if ((Number(msg.payload)>0) && (Number(msg.payload)<100)) flow.set(\"incomingTemperature\",msg.payload);",
  801. "outputs": "0",
  802. "noerr": 0,
  803. "x": 410,
  804. "y": 100,
  805. "wires": []
  806. },
  807. {
  808. "id": "2cf1f54a.260b9a",
  809. "type": "function",
  810. "z": "e7f81119.1bd4",
  811. "name": "Store humidity",
  812. "func": "flow.set(\"incomingHumidity\",msg.payload);",
  813. "outputs": "0",
  814. "noerr": 0,
  815. "x": 400,
  816. "y": 140,
  817. "wires": []
  818. },
  819. {
  820. "id": "53b4a878.d58478",
  821. "type": "inject",
  822. "z": "e7f81119.1bd4",
  823. "name": "Test \"Away\" 2 hours",
  824. "topic": "",
  825. "payload": "120",
  826. "payloadType": "str",
  827. "repeat": "",
  828. "crontab": "",
  829. "once": false,
  830. "onceDelay": "",
  831. "x": 150,
  832. "y": 280,
  833. "wires": [
  834. [
  835. "3cd37e2c.450362"
  836. ]
  837. ]
  838. },
  839. {
  840. "id": "d059cc6b.07d27",
  841. "type": "inject",
  842. "z": "e7f81119.1bd4",
  843. "name": "Test \"Away\" clear",
  844. "topic": "",
  845. "payload": "0",
  846. "payloadType": "str",
  847. "repeat": "",
  848. "crontab": "",
  849. "once": false,
  850. "x": 140,
  851. "y": 320,
  852. "wires": [
  853. [
  854. "3cd37e2c.450362"
  855. ]
  856. ]
  857. },
  858. {
  859. "id": "369d728d.9e145e",
  860. "type": "inject",
  861. "z": "e7f81119.1bd4",
  862. "name": "Test \"Frost\" 2 hours",
  863. "topic": "",
  864. "payload": "120",
  865. "payloadType": "str",
  866. "repeat": "",
  867. "crontab": "",
  868. "once": false,
  869. "onceDelay": "",
  870. "x": 150,
  871. "y": 360,
  872. "wires": [
  873. [
  874. "ee8c1336.e7829"
  875. ]
  876. ]
  877. },
  878. {
  879. "id": "bf4b8f74.9cb77",
  880. "type": "inject",
  881. "z": "e7f81119.1bd4",
  882. "name": "Test \"Frost\" clear",
  883. "topic": "",
  884. "payload": "0",
  885. "payloadType": "str",
  886. "repeat": "",
  887. "crontab": "",
  888. "once": false,
  889. "onceDelay": "",
  890. "x": 140,
  891. "y": 400,
  892. "wires": [
  893. [
  894. "ee8c1336.e7829"
  895. ]
  896. ]
  897. },
  898. {
  899. "id": "ee8c1336.e7829",
  900. "type": "function",
  901. "z": "e7f81119.1bd4",
  902. "name": "Store \"frost\"",
  903. "func": "flow.set(\"frost\",Number(msg.payload));
  904.  
  905. ",
  906. "outputs": 0,
  907. "noerr": 0,
  908. "x": 410,
  909. "y": 360,
  910. "wires": []
  911. },
  912. {
  913. "id": "3cd37e2c.450362",
  914. "type": "function",
  915. "z": "e7f81119.1bd4",
  916. "name": "Store \"Away\"",
  917. "func": "flow.set(\"away\",Number(msg.payload));
  918. ",
  919. "outputs": 0,
  920. "noerr": 0,
  921. "x": 410,
  922. "y": 320,
  923. "wires": []
  924. },
  925. {
  926. "id": "cb2d0f09.47ffe",
  927. "type": "inject",
  928. "z": "e7f81119.1bd4",
  929. "name": "sample forecast",
  930. "topic": "",
  931. "payload": "Dry, 2c with chance of snow",
  932. "payloadType": "str",
  933. "repeat": "",
  934. "crontab": "",
  935. "once": false,
  936. "x": 140,
  937. "y": 440,
  938. "wires": [
  939. [
  940. "91caa4fb.1dfc38"
  941. ]
  942. ]
  943. },
  944. {
  945. "id": "e8456857.a45658",
  946. "type": "inject",
  947. "z": "e7f81119.1bd4",
  948. "name": "Sample forecast",
  949. "topic": "",
  950. "payload": "Wet, 12c, possibly rain tonight",
  951. "payloadType": "str",
  952. "repeat": "",
  953. "crontab": "",
  954. "once": false,
  955. "x": 140,
  956. "y": 480,
  957. "wires": [
  958. [
  959. "91caa4fb.1dfc38"
  960. ]
  961. ]
  962. },
  963. {
  964. "id": "91caa4fb.1dfc38",
  965. "type": "function",
  966. "z": "e7f81119.1bd4",
  967. "name": "Store forecast",
  968. "func": "flow.set(\"forecast\",msg.payload);",
  969. "outputs": "0",
  970. "noerr": 0,
  971. "x": 420,
  972. "y": 440,
  973. "wires": []
  974. },
  975. {
  976. "id": "95d1c267.b8f65",
  977. "type": "function",
  978. "z": "e7f81119.1bd4",
  979. "name": "Heating relay is called heating_relay",
  980. "func": "msg.topic=\"heating_relay/toesp\";
  981. if (msg.payload==1)
  982. {
  983. node.status({fill:\"red\",shape:\"dot\",text:\"Relay ON\"});
  984. msg.payload=\"{out4:6,5}\"; node.send(msg);
  985. msg.payload=\"{out15:1}\"; node.send(msg);
  986. }
  987. else
  988. {
  989. node.status({fill:\"black\",shape:\"dot\",text:\"Relay OFF\"});
  990. msg.payload=\"{out4:0}\"; node.send(msg);
  991. msg.payload=\"{out15:0}\"; node.send(msg);
  992. }
  993. ",
  994. "outputs": 1,
  995. "noerr": 0,
  996. "x": 1810,
  997. "y": 500,
  998. "wires": [
  999. [
  1000. "aac34649.3905a8"
  1001. ]
  1002. ]
  1003. },
  1004. {
  1005. "id": "262665c1.742ffa",
  1006. "type": "function",
  1007. "z": "e7f81119.1bd4",
  1008. "name": "Handle SET",
  1009. "func": "// here we set manual override controls - valid for 120 minutes after last change.
  1010.  
  1011. if (flow.get(\"away\")===0)
  1012. {
  1013. if (msg.payload==\"u\") { flow.set(\"manualTimer\",120); if ((flow.get(\"manual\") + flow.get(\"setTemperature\"))<25)   flow.set(\"manual\",flow.get(\"manual\")+1); }
  1014. if (msg.payload==\"d\") { flow.set(\"manualTimer\",120); if ((flow.get(\"manual\") + flow.get(\"setTemperature\"))>17)   flow.set(\"manual\",flow.get(\"manual\")-1); }
  1015. if (msg.payload==\"a\") { flow.set(\"manualTimer\",0); flow.set(\"manual\",0);     context.set(\"both\",0); node.status({fill:\"red\",shape:\"dot\",text:\"auto\"});  }
  1016. }
  1017.  
  1018. msg.desired=flow.get(\"setTemperature\") + flow.get(\"manual\");
  1019.  
  1020. if (flow.get(\"manual\")===0) msg.colour=\"#aaddff\"; else msg.colour=\"#aaffaa\";
  1021.  
  1022. if (flow.get(\"frost\")) { msg.desired=global.get(\"timing\")[168]; msg.colour=\"#ffbbbb\"; }
  1023. if (flow.get(\"away\"))  { msg.desired=global.get(\"timing\")[169];msg.colour=\"#ffbbbb\";  }
  1024.  
  1025. msg.payload=msg.desired;
  1026. return msg;",
  1027. "outputs": 1,
  1028. "noerr": 0,
  1029. "x": 750,
  1030. "y": 440,
  1031. "wires": [
  1032. [
  1033. "be5056d3.ff22b8",
  1034. "20503617.ac02ea",
  1035. "2be4e5f.c5b761a",
  1036. "bae11d44.599fc",
  1037. "e01b553b.23df18",
  1038. "4fac90e3.7885"
  1039. ]
  1040. ]
  1041. },
  1042. {
  1043. "id": "2b777af3.c2e396",
  1044. "type": "ui_template",
  1045. "z": "e7f81119.1bd4",
  1046. "group": "bd48728c.866f2",
  1047. "name": "up",
  1048. "order": 4,
  1049. "width": "1",
  1050. "height": "1",
  1051. "format": "  <md-button  class=\"vibrate filled touched smallfont rounded greybuttons\" ng-click=\"send({payload: 'u'})\">
  1052. <img style=\"outline : none;\"
  1053. ng-src=\"{{(msg.payload)?'/myicons/png/48x48/actions/arrow-right-2.png':'/myicons/png/48x48/actions/arrow-right-2.png'}}\"
  1054. height=\"36px\"
  1055. />
  1056. </md-button> ",
  1057. "storeOutMessages": false,
  1058. "fwdInMessages": false,
  1059. "templateScope": "local",
  1060. "x": 550,
  1061. "y": 320,
  1062. "wires": [
  1063. [
  1064. "262665c1.742ffa",
  1065. "da6571c9.80974",
  1066. "7053f95f.644d58"
  1067. ]
  1068. ]
  1069. },
  1070. {
  1071. "id": "e64c48be.5c4c08",
  1072. "type": "ui_template",
  1073. "z": "e7f81119.1bd4",
  1074. "group": "bd48728c.866f2",
  1075. "name": "down",
  1076. "order": 3,
  1077. "width": "1",
  1078. "height": "1",
  1079. "format": "  <md-button  class=\"vibrate filled touched smallfont rounded greybuttons\" ng-click=\"send({payload: 'd'})\">
  1080. <img style=\"outline : none;\"
  1081. ng-src=\"{{(msg.payload)?'/myicons/png/48x48/actions/arrow-down-2.png':'/myicons/png/48x48/actions/arrow-left-2.png'}}\"
  1082. height=\"36px\"
  1083. />
  1084. </md-button> ",
  1085. "storeOutMessages": false,
  1086. "fwdInMessages": false,
  1087. "templateScope": "local",
  1088. "x": 550,
  1089. "y": 380,
  1090. "wires": [
  1091. [
  1092. "262665c1.742ffa",
  1093. "da6571c9.80974",
  1094. "7053f95f.644d58"
  1095. ]
  1096. ]
  1097. },
  1098. {
  1099. "id": "53cc9d53.254a54",
  1100. "type": "function",
  1101. "z": "e7f81119.1bd4",
  1102. "name": "Handle AWAY",
  1103. "func": "// here we set manual override controls - valid for 60 minutes after last change.
  1104. if (msg.payload==\"u\") {  flow.set(\"away\",flow.get(\"away\")+1); }
  1105. if (msg.payload==\"uu\") { flow.set(\"away\",flow.get(\"away\")+24); }
  1106. if (msg.payload==\"a\") { flow.set(\"away\",0);  }
  1107. msg.away=flow.get(\"away\");
  1108.  
  1109. if (flow.get(\"away\")===0) msg.colour=\"#aaddff\"; else msg.colour=\"#aaffaa\";
  1110.  
  1111. var t=parseInt(msg.away);
  1112. if (t>23) t=((t/24).toFixed(1))+\"d\"; else t=t+\"h\";
  1113. msg.away=t;
  1114.  
  1115. msg.payload=\"\";
  1116. return msg;",
  1117. "outputs": 1,
  1118. "noerr": 0,
  1119. "x": 760,
  1120. "y": 620,
  1121. "wires": [
  1122. [
  1123. "262665c1.742ffa",
  1124. "44f446b0.acaa68"
  1125. ]
  1126. ]
  1127. },
  1128. {
  1129. "id": "e9d4bcd7.1d9b3",
  1130. "type": "ui_template",
  1131. "z": "e7f81119.1bd4",
  1132. "group": "bd48728c.866f2",
  1133. "name": "more",
  1134. "order": 6,
  1135. "width": "1",
  1136. "height": "1",
  1137. "format": "  <md-button  class=\"vibrate filled touched smallfont rounded greybuttons\" ng-click=\"send({payload: 'u'})\">
  1138. <img style=\"outline : none;\"
  1139. ng-src=\"{{(msg.payload)?'/myicons/png/48x48/actions/arrow-right-2.png':'/myicons/png/48x48/actions/arrow-right-2.png'}}\"
  1140. height=\"36px\"
  1141. />
  1142. </md-button> ",
  1143. "storeOutMessages": false,
  1144. "fwdInMessages": false,
  1145. "x": 510,
  1146. "y": 660,
  1147. "wires": [
  1148. [
  1149. "53cc9d53.254a54",
  1150. "da6571c9.80974"
  1151. ]
  1152. ]
  1153. },
  1154. {
  1155. "id": "f6ceacbb.366e1",
  1156. "type": "ui_template",
  1157. "z": "e7f81119.1bd4",
  1158. "group": "bd48728c.866f2",
  1159. "name": "mmore",
  1160. "order": 7,
  1161. "width": "1",
  1162. "height": "1",
  1163. "format": "  <md-button  class=\"vibrate filled touched smallfont rounded greybuttons\" ng-click=\"send({payload: 'uu'})\">
  1164. <img style=\"outline : none;\"
  1165. ng-src=\"{{(msg.payload)?'/myicons/png/48x48/actions/arrow-left-double-2.png':'/myicons/png/48x48/actions/arrow-right-double-2.png'}}\"
  1166. height=\"36px\"
  1167. />
  1168. </md-button> ",
  1169. "storeOutMessages": false,
  1170. "fwdInMessages": false,
  1171. "x": 520,
  1172. "y": 700,
  1173. "wires": [
  1174. [
  1175. "53cc9d53.254a54",
  1176. "da6571c9.80974"
  1177. ]
  1178. ]
  1179. },
  1180. {
  1181. "id": "20503617.ac02ea",
  1182. "type": "ui_template",
  1183. "z": "e7f81119.1bd4",
  1184. "group": "bd48728c.866f2",
  1185. "name": "newergauge",
  1186. "order": 1,
  1187. "width": "3",
  1188. "height": "3",
  1189. "format": "<script type=\"text/javascript\" src=\"/myjs/gauge.min.js\"></script>
  1190. <script>
  1191.  
  1192. (function(scope){
  1193. scope.$watch('msg', function(msg) {
  1194. gauge.value=msg.payload;
  1195. // if (msg.units!=\"\") gauge.units=msg.units;
  1196. });
  1197.  
  1198. })(scope);
  1199. var gauge = new RadialGauge({
  1200. renderTo: 'canvas-id',
  1201. width: 160,
  1202. height: 160,
  1203. units: \"Degrees C\",
  1204. title: \"Thermostat\",
  1205. minValue: 10,
  1206. maxValue: 30,
  1207. majorTicks: [
  1208. '10',
  1209. '15',
  1210. '20',
  1211. '25',
  1212. '30'
  1213. ],
  1214. minorTicks: 5,
  1215. strokeTicks: true,
  1216. highlights  : [
  1217. { from : 10,  to : 15, color : '#8888ff' },
  1218. { from : 15, to : 20, color :  '#88ff88' },
  1219. { from : 20, to : 25, color :  '#ffff00' },
  1220. { from : 25, to : 30, color :  '#ff8888' }
  1221. ],
  1222.  
  1223. colorPlate: \"#fff\",
  1224. borderShadowWidth: 0,
  1225. borders: true,
  1226. needleType: \"arrow\",
  1227. valueInt: 2,
  1228. valueDec:0,
  1229. needleWidth: 2,
  1230. fontTitleSize: 42,
  1231. needleCircleSize: 14,
  1232. needleCircleOuter: true,
  1233. needleCircleInner: false,
  1234. animationDuration: 500,
  1235. animationRule: \"linear\"
  1236. }).draw();
  1237.  
  1238. gauge.value = 18;
  1239.  
  1240. </script>
  1241. <canvas style=\"outline: none;\" ng-click=\"send({payload: ' '})\" id=\"canvas-id\">
  1242.  
  1243. </canvas>",
  1244. "storeOutMessages": false,
  1245. "fwdInMessages": false,
  1246. "templateScope": "local",
  1247. "x": 1010,
  1248. "y": 440,
  1249. "wires": [
  1250. [
  1251. "d9f5055c.d034d8",
  1252. "e5376b12.a08188"
  1253. ]
  1254. ]
  1255. },
  1256. {
  1257. "id": "be5056d3.ff22b8",
  1258. "type": "ui_template",
  1259. "z": "e7f81119.1bd4",
  1260. "group": "bd48728c.866f2",
  1261. "name": "SET",
  1262. "order": 5,
  1263. "width": "1",
  1264. "height": "1",
  1265. "format": "<script>
  1266. (function(scope){
  1267. scope.$watch('msg', function(msg) {
  1268. if (msg.desired!=\"\") $(\"#infor\").text(msg.desired+\"C\");
  1269. if (msg.colour!=\"\") $(\"#infor\").css(\"background-color\",msg.colour);
  1270. });
  1271.  
  1272. })(scope);
  1273. </script>
  1274. <table  ng-click=\"send({payload: 'a'})\" width=100% height=100% class=\"vibrate zui-table zui-table-rounded\">
  1275. <thead>
  1276. <tr>
  1277. <th>SET</th>
  1278. </tr>
  1279. </thead>
  1280. <tbody>
  1281. <tr >
  1282. <td id=\"infor\"></td>
  1283. </tr>
  1284.  
  1285. </tbody>
  1286. </table>
  1287. ",
  1288. "storeOutMessages": false,
  1289. "fwdInMessages": false,
  1290. "templateScope": "local",
  1291. "x": 990,
  1292. "y": 400,
  1293. "wires": [
  1294. [
  1295. "262665c1.742ffa",
  1296. "da6571c9.80974"
  1297. ]
  1298. ]
  1299. },
  1300. {
  1301. "id": "44f446b0.acaa68",
  1302. "type": "ui_template",
  1303. "z": "e7f81119.1bd4",
  1304. "group": "bd48728c.866f2",
  1305. "name": "AWAY",
  1306. "order": 8,
  1307. "width": "1",
  1308. "height": "1",
  1309. "format": "<script>
  1310. (function(scope){
  1311. scope.$watch('msg', function(msg) {
  1312. if (msg.away!=\"\") $(\"#awaytable\").text(msg.away);
  1313. if (msg.colour!=\"\") $(\"#awaytable\").css(\"background-color\",msg.colour);
  1314. });
  1315.  
  1316. })(scope);
  1317. </script>
  1318.  
  1319. <table ng-click=\"send({payload: 'a'})\" width=100% height=100% class=\"vibrate zui-table zui-table-rounded\">
  1320. <thead>
  1321. <tr>
  1322. <th>AWAY</th>
  1323. </tr>
  1324. </thead>
  1325. <tbody>
  1326. <tr>
  1327. <td id=\"awaytable\"></td>
  1328.  
  1329. </tr>
  1330.  
  1331. </tbody>
  1332. </table>",
  1333. "storeOutMessages": false,
  1334. "fwdInMessages": false,
  1335. "templateScope": "local",
  1336. "x": 990,
  1337. "y": 560,
  1338. "wires": [
  1339. [
  1340. "53cc9d53.254a54",
  1341. "da6571c9.80974"
  1342. ]
  1343. ]
  1344. },
  1345. {
  1346. "id": "b05f8484.dc44e8",
  1347. "type": "ui_template",
  1348. "z": "e7f81119.1bd4",
  1349. "group": "bd48728c.866f2",
  1350. "name": "STATUS",
  1351. "order": 9,
  1352. "width": "3",
  1353. "height": "1",
  1354. "format": "<script>
  1355. (function(scope){
  1356. scope.$watch('msg', function(msg) {
  1357. if (msg.topic!=\"\") $(\"#hdr1\").text(msg.topic);
  1358. if (msg.payload!=\"\") $(\"#bod1\").text(msg.payload);
  1359. if (msg.color!=\"\") $(\"#bod1\").css(\"background-color\",msg.color);
  1360. });
  1361. })(scope);
  1362. </script>
  1363.  
  1364. <table ng-click=\"send({payload: 'a'})\" width=100% height=100% class=\"zui-table zui-table-rounded\">
  1365. <thead>
  1366. <tr>
  1367. <th id=\"hdr1\">></th>
  1368. </tr>
  1369. </thead>
  1370. <tbody>
  1371. <tr>
  1372. <td id=\"bod1\"></td>
  1373.  
  1374. </tr>
  1375.  
  1376. </tbody>
  1377. </table>",
  1378. "storeOutMessages": false,
  1379. "fwdInMessages": false,
  1380. "templateScope": "local",
  1381. "x": 1000,
  1382. "y": 660,
  1383. "wires": [
  1384. []
  1385. ]
  1386. },
  1387. {
  1388. "id": "6bf36df3.34e264",
  1389. "type": "function",
  1390. "z": "e7f81119.1bd4",
  1391. "name": "show humidity",
  1392. "func": "function theNewDate()
  1393. {
  1394. var d = new Date(),
  1395. minutes = d.getMinutes().toString().length == 1 ? '0'+d.getMinutes() : d.getMinutes();
  1396. hours = d.getHours().toString().length == 1 ? '0'+d.getHours() : d.getHours();
  1397. ampm = d.getHours() >= 12 ? 'pm' : 'am';
  1398. months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
  1399. days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
  1400. var m= days[d.getDay()]+' '+months[d.getMonth()]+' '+d.getDate()+' '+d.getFullYear()+' '+hours+':'+minutes+ampm;
  1401. return m;
  1402. }
  1403.  
  1404. msg.topic=theNewDate();
  1405. msg.payload=\"Humidity: \" + flow.get(\"incomingHumidity\") +\"%\" ;
  1406. msg.color=\"#99ffaa\";
  1407. return msg;",
  1408. "outputs": 1,
  1409. "noerr": 0,
  1410. "x": 760,
  1411. "y": 740,
  1412. "wires": [
  1413. [
  1414. "b05f8484.dc44e8"
  1415. ]
  1416. ]
  1417. },
  1418. {
  1419. "id": "da6571c9.80974",
  1420. "type": "function",
  1421. "z": "e7f81119.1bd4",
  1422. "name": "Showing settings",
  1423. "func": "msg.payload=\"Showing settings\";
  1424. msg.color=\"#ffccaa\";
  1425. return msg;",
  1426. "outputs": 1,
  1427. "noerr": 0,
  1428. "x": 770,
  1429. "y": 360,
  1430. "wires": [
  1431. [
  1432. "b05f8484.dc44e8"
  1433. ]
  1434. ]
  1435. },
  1436. {
  1437. "id": "e5376b12.a08188",
  1438. "type": "function",
  1439. "z": "e7f81119.1bd4",
  1440. "name": "Showing actual",
  1441. "func": "msg.payload=\"Showing actual\";
  1442. msg.color=\"#bbddff\";
  1443. return msg;",
  1444. "outputs": 1,
  1445. "noerr": 0,
  1446. "x": 760,
  1447. "y": 680,
  1448. "wires": [
  1449. [
  1450. "b05f8484.dc44e8"
  1451. ]
  1452. ]
  1453. },
  1454. {
  1455. "id": "aac34649.3905a8",
  1456. "type": "mqtt out",
  1457. "z": "e7f81119.1bd4",
  1458. "name": "mqtt",
  1459. "topic": "",
  1460. "qos": "",
  1461. "retain": "",
  1462. "broker": "4c682b3a.2ab5c4",
  1463. "x": 2070,
  1464. "y": 500,
  1465. "wires": []
  1466. },
  1467. {
  1468. "id": "a3e4c37f.d9a34",
  1469. "type": "mqtt in",
  1470. "z": "e7f81119.1bd4",
  1471. "name": "",
  1472. "topic": "stat2/fromesp/auto_temperature",
  1473. "qos": "2",
  1474. "broker": "4c682b3a.2ab5c4",
  1475. "x": 150,
  1476. "y": 60,
  1477. "wires": [
  1478. [
  1479. "9e791f5e.3404c"
  1480. ]
  1481. ]
  1482. },
  1483. {
  1484. "id": "24a57ca8.900ab4",
  1485. "type": "inject",
  1486. "z": "e7f81119.1bd4",
  1487. "name": "",
  1488. "topic": "stat2/toesp",
  1489. "payload": "{temp_type:0}",
  1490. "payloadType": "str",
  1491. "repeat": "",
  1492. "crontab": "",
  1493. "once": true,
  1494. "onceDelay": 0.1,
  1495. "x": 1110,
  1496. "y": 260,
  1497. "wires": [
  1498. [
  1499. "8db55877.4776e8"
  1500. ]
  1501. ]
  1502. },
  1503. {
  1504. "id": "d848a947.d3cc98",
  1505. "type": "inject",
  1506. "z": "e7f81119.1bd4",
  1507. "name": "",
  1508. "topic": "stat2/toesp",
  1509. "payload": "{temperature_port:2}",
  1510. "payloadType": "str",
  1511. "repeat": "",
  1512. "crontab": "",
  1513. "once": true,
  1514. "onceDelay": 0.1,
  1515. "x": 1130,
  1516. "y": 220,
  1517. "wires": [
  1518. [
  1519. "8db55877.4776e8"
  1520. ]
  1521. ]
  1522. },
  1523. {
  1524. "id": "560cc73c.96dcc8",
  1525. "type": "inject",
  1526. "z": "e7f81119.1bd4",
  1527. "name": "",
  1528. "topic": "",
  1529. "payload": "u",
  1530. "payloadType": "str",
  1531. "repeat": "",
  1532. "crontab": "",
  1533. "once": false,
  1534. "onceDelay": 0.1,
  1535. "x": 110,
  1536. "y": 580,
  1537. "wires": [
  1538. [
  1539. "262665c1.742ffa",
  1540. "da6571c9.80974",
  1541. "7053f95f.644d58"
  1542. ]
  1543. ]
  1544. },
  1545. {
  1546. "id": "e78f3ad8.06ad58",
  1547. "type": "inject",
  1548. "z": "e7f81119.1bd4",
  1549. "name": "",
  1550. "topic": "",
  1551. "payload": "d",
  1552. "payloadType": "str",
  1553. "repeat": "",
  1554. "crontab": "",
  1555. "once": false,
  1556. "onceDelay": 0.1,
  1557. "x": 110,
  1558. "y": 620,
  1559. "wires": [
  1560. [
  1561. "262665c1.742ffa",
  1562. "da6571c9.80974",
  1563. "7053f95f.644d58"
  1564. ]
  1565. ]
  1566. },
  1567. {
  1568. "id": "24495a14.24b616",
  1569. "type": "inject",
  1570. "z": "e7f81119.1bd4",
  1571. "name": "",
  1572. "topic": "",
  1573. "payload": "a",
  1574. "payloadType": "str",
  1575. "repeat": "",
  1576. "crontab": "",
  1577. "once": false,
  1578. "onceDelay": 0.1,
  1579. "x": 110,
  1580. "y": 660,
  1581. "wires": [
  1582. [
  1583. "262665c1.742ffa",
  1584. "da6571c9.80974",
  1585. "7053f95f.644d58"
  1586. ]
  1587. ]
  1588. },
  1589. {
  1590. "id": "43c561dc.040d",
  1591. "type": "mqtt in",
  1592. "z": "e7f81119.1bd4",
  1593. "name": "",
  1594. "topic": "stat2/fromesp/trigger4",
  1595. "qos": "2",
  1596. "broker": "4c682b3a.2ab5c4",
  1597. "x": 840,
  1598. "y": 880,
  1599. "wires": [
  1600. [
  1601. "f147606e.42b57"
  1602. ]
  1603. ]
  1604. },
  1605. {
  1606. "id": "8db55877.4776e8",
  1607. "type": "mqtt out",
  1608. "z": "e7f81119.1bd4",
  1609. "name": "mqtt",
  1610. "topic": "",
  1611. "qos": "",
  1612. "retain": "",
  1613. "broker": "4c682b3a.2ab5c4",
  1614. "x": 1410,
  1615. "y": 640,
  1616. "wires": []
  1617. },
  1618. {
  1619. "id": "ec0e60b7.332a6",
  1620. "type": "inject",
  1621. "z": "e7f81119.1bd4",
  1622. "name": "",
  1623. "topic": "stat2/toesp",
  1624. "payload": "{input45:45}",
  1625. "payloadType": "str",
  1626. "repeat": "",
  1627. "crontab": "",
  1628. "once": true,
  1629. "onceDelay": 0.1,
  1630. "x": 1110,
  1631. "y": 180,
  1632. "wires": [
  1633. [
  1634. "8db55877.4776e8"
  1635. ]
  1636. ]
  1637. },
  1638. {
  1639. "id": "934de2d7.273a6",
  1640. "type": "mqtt in",
  1641. "z": "e7f81119.1bd4",
  1642. "name": "",
  1643. "topic": "stat2/fromesp/trigger5",
  1644. "qos": "2",
  1645. "broker": "4c682b3a.2ab5c4",
  1646. "x": 840,
  1647. "y": 940,
  1648. "wires": [
  1649. [
  1650. "f147606e.42b57"
  1651. ]
  1652. ]
  1653. },
  1654. {
  1655. "id": "793c8386.43e04c",
  1656. "type": "comment",
  1657. "z": "e7f81119.1bd4",
  1658. "name": "qd display user stat",
  1659. "info": "",
  1660. "x": 1170,
  1661. "y": 40,
  1662. "wires": []
  1663. },
  1664. {
  1665. "id": "f3351617.0119b8",
  1666. "type": "comment",
  1667. "z": "e7f81119.1bd4",
  1668. "name": "global and flow vars",
  1669. "info": "Globals: manual, manualTimer, setTemperature,
  1670. timing, frost and away
  1671.  
  1672. flow vars: incomingTemperature, incomingHumidity",
  1673. "x": 690,
  1674. "y": 40,
  1675. "wires": []
  1676. },
  1677. {
  1678. "id": "7d90d7c6.f76048",
  1679. "type": "function",
  1680. "z": "e7f81119.1bd4",
  1681. "name": "Init",
  1682. "func": "global.set(\"buttonA\",\"released\");
  1683. global.set(\"buttonB\",\"released\");
  1684. global.set(\"aWasPressed\",0);
  1685. global.set(\"bWasPressed\",0);
  1686. global.set(\"lastCommand\",\"\");
  1687. msg.topic=\"stat2/toesp\";
  1688. msg.payload=\"{qd_string:\\\"$S\\\"}\"
  1689. return msg;",
  1690. "outputs": 1,
  1691. "noerr": 0,
  1692. "x": 1570,
  1693. "y": 560,
  1694. "wires": [
  1695. [
  1696. "8db55877.4776e8"
  1697. ]
  1698. ]
  1699. },
  1700. {
  1701. "id": "98f7bd13.222f",
  1702. "type": "inject",
  1703. "z": "e7f81119.1bd4",
  1704. "name": "Set up disp",
  1705. "topic": "",
  1706. "payload": "",
  1707. "payloadType": "date",
  1708. "repeat": "",
  1709. "crontab": "",
  1710. "once": true,
  1711. "onceDelay": 0.1,
  1712. "x": 1150,
  1713. "y": 740,
  1714. "wires": [
  1715. [
  1716. "1d7cd6ae.b65159"
  1717. ]
  1718. ]
  1719. },
  1720. {
  1721. "id": "aad2dc5e.1d693",
  1722. "type": "function",
  1723. "z": "e7f81119.1bd4",
  1724. "name": "Frame",
  1725. "func": "msg.topic=\"stat2/toesp\";
  1726.  
  1727. msg.payload=\"{qd_string:\\\"$E0,0,160,128\\\"}\"; node.send(msg);
  1728. msg.payload=\"{qd_string:\\\"$L1,72,159,72\\\"}\"; node.send(msg);
  1729. msg.payload=\"{qd_string:\\\"$L40,73,40,127$C255,255,255\\\"}\"; node.send(msg);",
  1730. "outputs": 1,
  1731. "noerr": 0,
  1732. "x": 1650,
  1733. "y": 780,
  1734. "wires": [
  1735. [
  1736. "8db55877.4776e8",
  1737. "ab357709.06d1b8"
  1738. ]
  1739. ]
  1740. },
  1741. {
  1742. "id": "4e512370.323b6c",
  1743. "type": "delay",
  1744. "z": "e7f81119.1bd4",
  1745. "name": "",
  1746. "pauseType": "delay",
  1747. "timeout": "700",
  1748. "timeoutUnits": "milliseconds",
  1749. "rate": "1",
  1750. "nbRateUnits": "1",
  1751. "rateUnits": "second",
  1752. "randomFirst": "1",
  1753. "randomLast": "5",
  1754. "randomUnits": "seconds",
  1755. "drop": false,
  1756. "x": 1490,
  1757. "y": 780,
  1758. "wires": [
  1759. [
  1760. "aad2dc5e.1d693"
  1761. ]
  1762. ]
  1763. },
  1764. {
  1765. "id": "24266ddc.42f282",
  1766. "type": "function",
  1767. "z": "e7f81119.1bd4",
  1768. "name": "Fixed wording",
  1769. "func": "msg.topic=\"stat2/toesp\";
  1770. msg.payload=\"{qd_string:\\\"$F8$P4,12;$C64,64,255Actual\\\"}\"; node.send(msg);
  1771. msg.payload=\"{qd_string:\\\"$F8$P4,28;Room\\\"}\"; node.send(msg);
  1772. msg.payload=\"{qd_string:\\\"$F8$P4,44;Temp\\\"}\"; node.send(msg);
  1773. msg.payload=\"{qd_string:\\\"$F8$P140,48;$C255,255,0C\\\"}\"; node.send(msg);
  1774. msg.payload=\"{qd_string:\\\"$F8$P140,106;C$C255,255,255\\\"}\"; node.send(msg);
  1775. msg.payload=\"{qd_string:\\\"$F8$P43,78;Set\\\"}\"; node.send(msg);
  1776. ",
  1777. "outputs": 1,
  1778. "noerr": 0,
  1779. "x": 1680,
  1780. "y": 820,
  1781. "wires": [
  1782. [
  1783. "8db55877.4776e8"
  1784. ]
  1785. ]
  1786. },
  1787. {
  1788. "id": "fbe71509.14ab18",
  1789. "type": "function",
  1790. "z": "e7f81119.1bd4",
  1791. "name": "temperature",
  1792. "func": "msg.topic=\"stat2/toesp\";
  1793. msg.payload=\"{qd_string:\\\"$F1$P70,2;\" + flow.get(\"incomingTemperature\") + \"\\\"}\"; node.send(msg);
  1794. ",
  1795. "outputs": 1,
  1796. "noerr": 0,
  1797. "x": 1670,
  1798. "y": 860,
  1799. "wires": [
  1800. [
  1801. "8db55877.4776e8"
  1802. ]
  1803. ]
  1804. },
  1805. {
  1806. "id": "2be4e5f.c5b761a",
  1807. "type": "function",
  1808. "z": "e7f81119.1bd4",
  1809. "name": "set temperature",
  1810. "func": "msg.topic=\"stat2/toesp\";
  1811.  
  1812. msg.payload=\"{qd_string:\\\"$F2$P104,92;\" + (Number(flow.get(\"setTemperature\")) + Number(flow.get(\"manual\"))) + \"\\\"}\"; node.send(msg);
  1813. ",
  1814. "outputs": 1,
  1815. "noerr": 0,
  1816. "x": 1680,
  1817. "y": 900,
  1818. "wires": [
  1819. [
  1820. "8db55877.4776e8",
  1821. "54858b06.dc2e14"
  1822. ]
  1823. ]
  1824. },
  1825. {
  1826. "id": "bae11d44.599fc",
  1827. "type": "function",
  1828. "z": "e7f81119.1bd4",
  1829. "name": "stat2 status on off",
  1830. "func": "msg.topic=\"stat2/toesp\";
  1831. if ( (flow.get(\"incomingTemperature\") < (flow.get(\"setTemperature\")+flow.get(\"manual\") )) )
  1832. msg.payload=\"{qd_string:\\\"$C0,0,0$I45,95,24,24$F6$P45,95;$C255,0,0;L$C255,255,255\\\"}\";
  1833. else
  1834. msg.payload=\"{qd_string:\\\"$C0,0,0$I45,95,24,24$F6$P45,95;$C0,128,255;k$C255,255,255\\\"}\";
  1835. node.send(msg);
  1836. ",
  1837. "outputs": 1,
  1838. "noerr": 0,
  1839. "x": 1290,
  1840. "y": 440,
  1841. "wires": [
  1842. [
  1843. "8db55877.4776e8"
  1844. ]
  1845. ]
  1846. },
  1847. {
  1848. "id": "7053f95f.644d58",
  1849. "type": "timeout",
  1850. "z": "e7f81119.1bd4",
  1851. "name": "My Timeout",
  1852. "outtopic": "",
  1853. "outsafe": "",
  1854. "outwarning": "",
  1855. "outunsafe": "1",
  1856. "warning": "15",
  1857. "timer": "30",
  1858. "repeat": false,
  1859. "again": true,
  1860. "x": 690,
  1861. "y": 560,
  1862. "wires": [
  1863. [
  1864. "d9f5055c.d034d8",
  1865. "6bf36df3.34e264"
  1866. ]
  1867. ]
  1868. },
  1869. {
  1870. "id": "54858b06.dc2e14",
  1871. "type": "function",
  1872. "z": "e7f81119.1bd4",
  1873. "name": "Auto/manual",
  1874. "func": "msg.topic=\"stat2/toesp\";
  1875. if (flow.get(\"manual\"))
  1876. msg.payload=\"{qd_string:\\\"$F8$P100,78;$C255,128,0Manual$C255,255,255\\\"}\";
  1877. else
  1878. msg.payload=\"{qd_string:\\\"$F8$P100,78;$C64,64,255Auto  $C255,255,255\\\"}\";
  1879. node.send(msg);",
  1880. "outputs": 1,
  1881. "noerr": 0,
  1882. "x": 1670,
  1883. "y": 960,
  1884. "wires": [
  1885. [
  1886. "8db55877.4776e8"
  1887. ]
  1888. ]
  1889. },
  1890. {
  1891. "id": "ab357709.06d1b8",
  1892. "type": "delay",
  1893. "z": "e7f81119.1bd4",
  1894. "name": "",
  1895. "pauseType": "delay",
  1896. "timeout": "200",
  1897. "timeoutUnits": "milliseconds",
  1898. "rate": "1",
  1899. "nbRateUnits": "1",
  1900. "rateUnits": "second",
  1901. "randomFirst": "1",
  1902. "randomLast": "5",
  1903. "randomUnits": "seconds",
  1904. "drop": false,
  1905. "x": 1490,
  1906. "y": 820,
  1907. "wires": [
  1908. [
  1909. "24266ddc.42f282",
  1910. "463ea388.c14d5c"
  1911. ]
  1912. ]
  1913. },
  1914. {
  1915. "id": "64696acd.013ba4",
  1916. "type": "timeout",
  1917. "z": "e7f81119.1bd4",
  1918. "name": "My Timeout",
  1919. "outtopic": "",
  1920. "outsafe": "1",
  1921. "outwarning": "",
  1922. "outunsafe": "1",
  1923. "warning": "15",
  1924. "timer": "30",
  1925. "repeat": false,
  1926. "again": true,
  1927. "x": 1490,
  1928. "y": 900,
  1929. "wires": [
  1930. [
  1931. "fbe71509.14ab18",
  1932. "2be4e5f.c5b761a",
  1933. "12a1217c.785b2f"
  1934. ]
  1935. ]
  1936. },
  1937. {
  1938. "id": "463ea388.c14d5c",
  1939. "type": "delay",
  1940. "z": "e7f81119.1bd4",
  1941. "name": "",
  1942. "pauseType": "delay",
  1943. "timeout": "500",
  1944. "timeoutUnits": "milliseconds",
  1945. "rate": "1",
  1946. "nbRateUnits": "1",
  1947. "rateUnits": "second",
  1948. "randomFirst": "1",
  1949. "randomLast": "5",
  1950. "randomUnits": "seconds",
  1951. "drop": false,
  1952. "x": 1490,
  1953. "y": 860,
  1954. "wires": [
  1955. [
  1956. "64696acd.013ba4",
  1957. "fbe71509.14ab18",
  1958. "2be4e5f.c5b761a"
  1959. ]
  1960. ]
  1961. },
  1962. {
  1963. "id": "f147606e.42b57",
  1964. "type": "function",
  1965. "z": "e7f81119.1bd4",
  1966. "name": "Button \"d\", \"u\" or both i.e. \"a\" for auto",
  1967. "func": "context.set(\"batimer\",context.get(\"batimer\")||0);
  1968. var batimer=context.get(\"batimer\");
  1969. context.set(\"bbtimer\",context.get(\"bbtimer\")||0);
  1970. var bbtimer=context.get(\"bbtimer\");
  1971.  
  1972. context.set(\"both\",context.get(\"both\") || 0);
  1973. context.set(\"ba\",context.get(\"ba\") || 0);
  1974. context.set(\"bb\",context.get(\"bb\") || 0);
  1975.  
  1976. flow.set(\"balp\",flow.get(\"balp\")||0);
  1977. flow.set(\"bblp\",flow.get(\"bblp\")||0);
  1978.  
  1979. if (msg.topic==\"stat2/fromesp/trigger4\") if (msg.payload==\"0\") { context.set(\"ba\",1);  batimer= setTimeout(function(){ flow.set(\"balp\",1);  },1000 ); }
  1980. else { if (Math.ceil((batimer._idleStart + batimer._idleTimeout - Date.now()) / 1000)<800) clearTimeout(batimer);   }
  1981.  
  1982. if (msg.topic==\"stat2/fromesp/trigger5\") if (msg.payload==\"0\") { context.set(\"bb\",1); bbtimer= setTimeout(function(){ flow.set(\"bblp\",1);  },1000 ); }
  1983. else { if (Math.ceil((bbtimer._idleStart + bbtimer._idleTimeout - Date.now()) / 1000)<800) clearTimeout(bbtimer);   }
  1984.  
  1985. context.set(\"batimer\",batimer);
  1986. context.set(\"bbtimer\",bbtimer);
  1987.  
  1988. if (context.get(\"ba\")==1) context.set(\"both\",context.get(\"both\")|1);
  1989. if (context.get(\"bb\")==1)  context.set(\"both\",context.get(\"both\")|2);
  1990.  
  1991. if (msg.topic==\"stat2/fromesp/trigger4\") if (msg.payload==\"1\") context.set(\"ba\",0);
  1992. if (msg.topic==\"stat2/fromesp/trigger5\") if (msg.payload==\"1\") context.set(\"bb\",0);
  1993.  
  1994. if ((context.get(\"ba\")===0) && (context.get(\"bb\")===0))
  1995. {
  1996. switch(context.get(\"both\"))
  1997. {
  1998. case 1 :   msg.payload=\"d\";  context.set(\"both\",0); node.status({fill:\"red\",shape:\"dot\",text:msg.payload}); return msg;
  1999. case 2 :   msg.payload=\"u\";  context.set(\"both\",0); node.status({fill:\"yellow\",shape:\"dot\",text:msg.payload}); return msg;
  2000. case 3 :   msg.payload=\"a\";  context.set(\"both\",0); node.status({fill:\"green\",shape:\"dot\",text:msg.payload}); return msg;
  2001. }
  2002. }",
  2003. "outputs": 1,
  2004. "noerr": 0,
  2005. "x": 1190,
  2006. "y": 920,
  2007. "wires": [
  2008. [
  2009. "da6571c9.80974",
  2010. "262665c1.742ffa",
  2011. "7053f95f.644d58",
  2012. "639c06eb.e9ca98",
  2013. "6e0f16f2.3c12a8",
  2014. "a037f04e.a4aee"
  2015. ]
  2016. ]
  2017. },
  2018. {
  2019. "id": "ed88705b.8813f",
  2020. "type": "comment",
  2021. "z": "e7f81119.1bd4",
  2022. "name": "Set up stat2 board esp-go",
  2023. "info": "",
  2024. "x": 1090,
  2025. "y": 100,
  2026. "wires": []
  2027. },
  2028. {
  2029. "id": "7ffc52e3.88479c",
  2030. "type": "comment",
  2031. "z": "e7f81119.1bd4",
  2032. "name": "2-button operation on stat2 qdtech esp-go",
  2033. "info": "",
  2034. "x": 900,
  2035. "y": 840,
  2036. "wires": []
  2037. },
  2038. {
  2039. "id": "639c06eb.e9ca98",
  2040. "type": "function",
  2041. "z": "e7f81119.1bd4",
  2042. "name": "up-down graphic",
  2043. "func": "    msg.topic=\"stat2/toesp\";
  2044.  
  2045. setTimeout(function(){
  2046. msg['payload'] = \"{qd_string:\\\"$F1$P11,75;$C0,0,0$G3S$C255,255,255\\\"}\";
  2047. node.send(msg);
  2048. msg['payload'] = \"{qd_string:\\\"$F1$P11,106;$C0,0,0$G3S$C255,255,255\\\"}\";
  2049. node.send(msg);
  2050. }, 300);
  2051. if (msg.payload=='u')
  2052. {
  2053. msg.payload=\"{qd_string:\\\"$F1$P11,75;$C255,192,192$G3S$C255,255,255\\\"}\";
  2054. node.send(msg);
  2055. }
  2056. else
  2057. if (msg.payload=='d')
  2058. {
  2059. msg.payload=\"{qd_string:\\\"$F1$P11,106;$C192,192,255$G3P$C255,255,255\\\"}\";
  2060. node.send(msg);
  2061. }",
  2062. "outputs": 1,
  2063. "noerr": 0,
  2064. "x": 1190,
  2065. "y": 660,
  2066. "wires": [
  2067. [
  2068. "8db55877.4776e8"
  2069. ]
  2070. ]
  2071. },
  2072. {
  2073. "id": "12a1217c.785b2f",
  2074. "type": "function",
  2075. "z": "e7f81119.1bd4",
  2076. "name": "Show Time",
  2077. "func": "var date = new Date();
  2078.  
  2079. var hour = date.getHours();
  2080. hour = (hour < 10 ? \"0\" : \"\") + hour;
  2081.  
  2082. var min  = date.getMinutes();
  2083. min = (min < 10 ? \"0\" : \"\") + min;
  2084.  
  2085. msg.topic=\"stat2/toesp\";
  2086. msg.payload=\"{qd_string:\\\"$C0,0,0;$I1,97,39,8;$F9$P6,97;$C255,0,255;\" + hour + \":\" + min + \"$C255,255,255\\\"}\";
  2087. return msg;",
  2088. "outputs": 1,
  2089. "noerr": 0,
  2090. "x": 1490,
  2091. "y": 960,
  2092. "wires": [
  2093. [
  2094. "8db55877.4776e8"
  2095. ]
  2096. ]
  2097. },
  2098. {
  2099. "id": "8bdc84e9.882118",
  2100. "type": "inject",
  2101. "z": "e7f81119.1bd4",
  2102. "name": "",
  2103. "topic": "stat2/toesp",
  2104. "payload": "{temperature?}",
  2105. "payloadType": "str",
  2106. "repeat": "",
  2107. "crontab": "",
  2108. "once": false,
  2109. "onceDelay": 0.1,
  2110. "x": 1110,
  2111. "y": 140,
  2112. "wires": [
  2113. [
  2114. "8db55877.4776e8"
  2115. ]
  2116. ]
  2117. },
  2118. {
  2119. "id": "d4efd089.fb7b7",
  2120. "type": "function",
  2121. "z": "e7f81119.1bd4",
  2122. "name": "",
  2123. "func": "msg.payload=msg.payload.split(\" \");
  2124. if ((msg.payload[0]==\"Logging\")&& (msg.payload[3]==\"stat2\"))
  2125. {
  2126. msg.payload=msg.payload[3];
  2127. return msg;
  2128. }",
  2129. "outputs": 1,
  2130. "noerr": 0,
  2131. "x": 1170,
  2132. "y": 780,
  2133. "wires": [
  2134. [
  2135. "1d7cd6ae.b65159"
  2136. ]
  2137. ]
  2138. },
  2139. {
  2140. "id": "89d69293.366b7",
  2141. "type": "link in",
  2142. "z": "e7f81119.1bd4",
  2143. "name": "",
  2144. "links": [
  2145. "910d0ff7.43b19"
  2146. ],
  2147. "x": 1235,
  2148. "y": 580,
  2149. "wires": [
  2150. [
  2151. "d4efd089.fb7b7",
  2152. "d0aafabe.673168",
  2153. "d2ba92f3.0c776"
  2154. ]
  2155. ]
  2156. },
  2157. {
  2158. "id": "1d7cd6ae.b65159",
  2159. "type": "function",
  2160. "z": "e7f81119.1bd4",
  2161. "name": "",
  2162. "func": "msg.payload=\"Init\";
  2163. return msg;",
  2164. "outputs": 1,
  2165. "noerr": 0,
  2166. "x": 1310,
  2167. "y": 780,
  2168. "wires": [
  2169. [
  2170. "4e512370.323b6c",
  2171. "34404e86.00a0f2"
  2172. ]
  2173. ]
  2174. },
  2175. {
  2176. "id": "a037f04e.a4aee",
  2177. "type": "debug",
  2178. "z": "e7f81119.1bd4",
  2179. "name": "",
  2180. "active": true,
  2181. "tosidebar": true,
  2182. "console": false,
  2183. "tostatus": false,
  2184. "complete": "false",
  2185. "x": 1410,
  2186. "y": 1080,
  2187. "wires": []
  2188. },
  2189. {
  2190. "id": "6e0f16f2.3c12a8",
  2191. "type": "function",
  2192. "z": "e7f81119.1bd4",
  2193. "name": "",
  2194. "func": "if (flow.get(\"balp\"))
  2195. {
  2196. flow.set(\"balp\",0);
  2197. msg.payload=\"Got longpress A\";
  2198. node.send(msg);
  2199. }
  2200. if (flow.get(\"bblp\"))
  2201. {
  2202. flow.set(\"bblp\",0);
  2203. msg.payload=\"Got longpress B\";
  2204. node.send(msg);
  2205. }",
  2206. "outputs": 1,
  2207. "noerr": 0,
  2208. "x": 1190,
  2209. "y": 1080,
  2210. "wires": [
  2211. [
  2212. "a037f04e.a4aee"
  2213. ]
  2214. ]
  2215. },
  2216. {
  2217. "id": "df6f96e7.a1fb48",
  2218. "type": "comment",
  2219. "z": "e7f81119.1bd4",
  2220. "name": "test long press",
  2221. "info": "",
  2222. "x": 1300,
  2223. "y": 1040,
  2224. "wires": []
  2225. },
  2226. {
  2227. "id": "8ad8fddf.97a19",
  2228. "type": "mqtt in",
  2229. "z": "e7f81119.1bd4",
  2230. "name": "",
  2231. "topic": "heating_relay/fromesp/auto_temperature",
  2232. "qos": "2",
  2233. "broker": "4c682b3a.2ab5c4",
  2234. "x": 940,
  2235. "y": 300,
  2236. "wires": [
  2237. [
  2238. "8c66d671.5d06f8"
  2239. ]
  2240. ]
  2241. },
  2242. {
  2243. "id": "8c66d671.5d06f8",
  2244. "type": "function",
  2245. "z": "e7f81119.1bd4",
  2246. "name": "heating_relay auto_temperature",
  2247. "func": "    var date = new Date();
  2248.  
  2249. var hour = date.getHours();
  2250. hour = (hour < 10 ? \"0\" : \"\") + hour;
  2251.  
  2252. var min  = date.getMinutes();
  2253. min = (min < 10 ? \"0\" : \"\") + min;
  2254.  
  2255. var sec  = date.getSeconds();
  2256. sec = (sec < 10 ? \"0\" : \"\") + sec;
  2257.  
  2258. var year = date.getFullYear();
  2259.  
  2260. var month = date.getMonth() + 1;
  2261. month = (month < 10 ? \"0\" : \"\") + month;
  2262.  
  2263. var day  = date.getDate();
  2264. day = (day < 10 ? \"0\" : \"\") + day;
  2265.  
  2266. node.status({fill:\"red\",shape:\"dot\",text:msg.payload + \"c at \" + hour + \":\" + min + \":\" + sec + \" on \" + day + \":\" + month + \":\" + year  });",
  2267. "outputs": 0,
  2268. "noerr": 0,
  2269. "x": 1270,
  2270. "y": 300,
  2271. "wires": []
  2272. },
  2273. {
  2274. "id": "d0aafabe.673168",
  2275. "type": "function",
  2276. "z": "e7f81119.1bd4",
  2277. "name": "turn relay indicator off momentarily at relay power up",
  2278. "func": "msg.payload=msg.payload.split(\" \");
  2279. if ((msg.payload[0]==\"Logging\")&& (msg.payload[3]==\"heating_relay\"))
  2280. {
  2281. msg.topic=\"heating_relay/toesp\";
  2282. msg.payload=msg.payload=\"{out12:0}\";
  2283. return msg;
  2284. }",
  2285. "outputs": 1,
  2286. "noerr": 0,
  2287. "x": 1900,
  2288. "y": 600,
  2289. "wires": [
  2290. [
  2291. "aac34649.3905a8",
  2292. "fde1e4b6.d1d838"
  2293. ]
  2294. ]
  2295. },
  2296. {
  2297. "id": "fde1e4b6.d1d838",
  2298. "type": "delay",
  2299. "z": "e7f81119.1bd4",
  2300. "name": "",
  2301. "pauseType": "delay",
  2302. "timeout": "2",
  2303. "timeoutUnits": "seconds",
  2304. "rate": "1",
  2305. "nbRateUnits": "1",
  2306. "rateUnits": "second",
  2307. "randomFirst": "1",
  2308. "randomLast": "5",
  2309. "randomUnits": "seconds",
  2310. "drop": false,
  2311. "x": 1720,
  2312. "y": 640,
  2313. "wires": [
  2314. [
  2315. "720bfcdd.4d65d4"
  2316. ]
  2317. ]
  2318. },
  2319. {
  2320. "id": "720bfcdd.4d65d4",
  2321. "type": "function",
  2322. "z": "e7f81119.1bd4",
  2323. "name": "turn relay indicator on at relay power up",
  2324. "func": "    msg.topic=\"heating_relay/toesp\";
  2325. msg.payload=\"{out12:1}\";
  2326. return msg;
  2327. ",
  2328. "outputs": 1,
  2329. "noerr": 0,
  2330. "x": 1960,
  2331. "y": 640,
  2332. "wires": [
  2333. [
  2334. "aac34649.3905a8"
  2335. ]
  2336. ]
  2337. },
  2338. {
  2339. "id": "9e791f5e.3404c",
  2340. "type": "function",
  2341. "z": "e7f81119.1bd4",
  2342. "name": "stat2 auto_temperature",
  2343. "func": "    var date = new Date();
  2344.  
  2345. var hour = date.getHours();
  2346. hour = (hour < 10 ? \"0\" : \"\") + hour;
  2347.  
  2348. var min  = date.getMinutes();
  2349. min = (min < 10 ? \"0\" : \"\") + min;
  2350.  
  2351. var sec  = date.getSeconds();
  2352. sec = (sec < 10 ? \"0\" : \"\") + sec;
  2353.  
  2354. var year = date.getFullYear();
  2355.  
  2356. var month = date.getMonth() + 1;
  2357. month = (month < 10 ? \"0\" : \"\") + month;
  2358.  
  2359. var day  = date.getDate();
  2360. day = (day < 10 ? \"0\" : \"\") + day;
  2361.  
  2362. node.status({fill:\"red\",shape:\"dot\",text:msg.payload + \"c at \" + hour + \":\" + min + \":\" + sec + \" on \" + day + \":\" + month + \":\" + year  });",
  2363. "outputs": 0,
  2364. "noerr": 0,
  2365. "x": 430,
  2366. "y": 40,
  2367. "wires": []
  2368. },
  2369. {
  2370. "id": "e09e0589.a4cb98",
  2371. "type": "function",
  2372. "z": "e7f81119.1bd4",
  2373. "name": "clear ili",
  2374. "func": "msg.payload=\"{ili:\\\"$S\\\"}\";
  2375. msg.topic=\"stat3/toesp\";
  2376. return msg;",
  2377. "outputs": 1,
  2378. "noerr": 0,
  2379. "x": 1940,
  2380. "y": 180,
  2381. "wires": [
  2382. [
  2383. "4e9afa5.c960804",
  2384. "68679a9b.889664"
  2385. ]
  2386. ]
  2387. },
  2388. {
  2389. "id": "34404e86.00a0f2",
  2390. "type": "delay",
  2391. "z": "e7f81119.1bd4",
  2392. "name": "",
  2393. "pauseType": "delay",
  2394. "timeout": "250",
  2395. "timeoutUnits": "milliseconds",
  2396. "rate": "1",
  2397. "nbRateUnits": "1",
  2398. "rateUnits": "second",
  2399. "randomFirst": "1",
  2400. "randomLast": "5",
  2401. "randomUnits": "seconds",
  2402. "drop": false,
  2403. "x": 1750,
  2404. "y": 560,
  2405. "wires": [
  2406. [
  2407. "7d90d7c6.f76048"
  2408. ]
  2409. ]
  2410. },
  2411. {
  2412. "id": "f24aab8d.d7ee58",
  2413. "type": "comment",
  2414. "z": "e7f81119.1bd4",
  2415. "name": "test clearing alternative ili display",
  2416. "info": "",
  2417. "x": 1570,
  2418. "y": 120,
  2419. "wires": []
  2420. },
  2421. {
  2422. "id": "d2ba92f3.0c776",
  2423. "type": "function",
  2424. "z": "e7f81119.1bd4",
  2425. "name": "",
  2426. "func": "msg.payload=msg.payload.split(\" \");
  2427. if ((msg.payload[0]==\"Logging\")&& (msg.payload[3]==\"stat3\"))
  2428. {
  2429. msg.payload=msg.payload[3];
  2430. return msg;
  2431. }",
  2432. "outputs": 1,
  2433. "noerr": 0,
  2434. "x": 1490,
  2435. "y": 200,
  2436. "wires": [
  2437. [
  2438. "b764a722.9e1d98"
  2439. ]
  2440. ]
  2441. },
  2442. {
  2443. "id": "b764a722.9e1d98",
  2444. "type": "function",
  2445. "z": "e7f81119.1bd4",
  2446. "name": "",
  2447. "func": "msg.payload=\"Init\";
  2448. return msg;",
  2449. "outputs": 1,
  2450. "noerr": 0,
  2451. "x": 1630,
  2452. "y": 180,
  2453. "wires": [
  2454. [
  2455. "4935af57.e0632"
  2456. ]
  2457. ]
  2458. },
  2459. {
  2460. "id": "495c3a16.4f5a34",
  2461. "type": "inject",
  2462. "z": "e7f81119.1bd4",
  2463. "name": "Set up disp",
  2464. "topic": "",
  2465. "payload": "",
  2466. "payloadType": "date",
  2467. "repeat": "",
  2468. "crontab": "",
  2469. "once": true,
  2470. "onceDelay": 0.1,
  2471. "x": 1470,
  2472. "y": 160,
  2473. "wires": [
  2474. [
  2475. "b764a722.9e1d98"
  2476. ]
  2477. ]
  2478. },
  2479. {
  2480. "id": "4935af57.e0632",
  2481. "type": "delay",
  2482. "z": "e7f81119.1bd4",
  2483. "name": "",
  2484. "pauseType": "delay",
  2485. "timeout": "250",
  2486. "timeoutUnits": "milliseconds",
  2487. "rate": "1",
  2488. "nbRateUnits": "1",
  2489. "rateUnits": "second",
  2490. "randomFirst": "1",
  2491. "randomLast": "5",
  2492. "randomUnits": "seconds",
  2493. "drop": false,
  2494. "x": 1770,
  2495. "y": 180,
  2496. "wires": [
  2497. [
  2498. "e09e0589.a4cb98"
  2499. ]
  2500. ]
  2501. },
  2502. {
  2503. "id": "9fbb4e8d.7fa0b",
  2504. "type": "function",
  2505. "z": "e7f81119.1bd4",
  2506. "name": "Frame",
  2507. "func": "msg.topic=\"stat3/toesp\";
  2508.  
  2509. msg.payload=\"{ili:\\\"$E0,0,160,128\\\"}\"; node.send(msg);
  2510. msg.payload=\"{ili:\\\"$L1,72,159,72\\\"}\"; node.send(msg);
  2511. msg.payload=\"{ili:\\\"$L40,73,40,127$C255,255,255\\\"}\"; node.send(msg);",
  2512. "outputs": 1,
  2513. "noerr": 0,
  2514. "x": 1930,
  2515. "y": 220,
  2516. "wires": [
  2517. [
  2518. "39495a97.d17626",
  2519. "68679a9b.889664"
  2520. ]
  2521. ]
  2522. },
  2523. {
  2524. "id": "4e9afa5.c960804",
  2525. "type": "delay",
  2526. "z": "e7f81119.1bd4",
  2527. "name": "",
  2528. "pauseType": "delay",
  2529. "timeout": "700",
  2530. "timeoutUnits": "milliseconds",
  2531. "rate": "1",
  2532. "nbRateUnits": "1",
  2533. "rateUnits": "second",
  2534. "randomFirst": "1",
  2535. "randomLast": "5",
  2536. "randomUnits": "seconds",
  2537. "drop": false,
  2538. "x": 1770,
  2539. "y": 220,
  2540. "wires": [
  2541. [
  2542. "9fbb4e8d.7fa0b"
  2543. ]
  2544. ]
  2545. },
  2546. {
  2547. "id": "9bb63202.2d86d",
  2548. "type": "function",
  2549. "z": "e7f81119.1bd4",
  2550. "name": "Fixed wording",
  2551. "func": "msg.topic=\"stat3/toesp\";
  2552. msg.payload=\"{ili:\\\"$F8$P4,12;$C64,64,255Actual\\\"}\"; node.send(msg);
  2553. msg.payload=\"{ili:\\\"$F8$P4,28;Room\\\"}\"; node.send(msg);
  2554. msg.payload=\"{ili:\\\"$F8$P4,44;Temp\\\"}\"; node.send(msg);
  2555. msg.payload=\"{ili:\\\"$F8$P140,48;$C255,255,0C\\\"}\"; node.send(msg);
  2556. msg.payload=\"{ili:\\\"$F8$P140,106;C$C255,255,255\\\"}\"; node.send(msg);
  2557. msg.payload=\"{ili:\\\"$F8$P43,78;Set\\\"}\"; node.send(msg);
  2558. ",
  2559. "outputs": 1,
  2560. "noerr": 0,
  2561. "x": 1960,
  2562. "y": 260,
  2563. "wires": [
  2564. [
  2565. "68679a9b.889664"
  2566. ]
  2567. ]
  2568. },
  2569. {
  2570. "id": "e62ca4f3.00c108",
  2571. "type": "function",
  2572. "z": "e7f81119.1bd4",
  2573. "name": "temperature",
  2574. "func": "msg.topic=\"stat3/toesp\";
  2575. msg.payload=\"{ili:\\\"$F1$P70,2;\" + flow.get(\"incomingTemperature\") + \"\\\"}\"; node.send(msg);
  2576. ",
  2577. "outputs": 1,
  2578. "noerr": 0,
  2579. "x": 1950,
  2580. "y": 300,
  2581. "wires": [
  2582. [
  2583. "68679a9b.889664"
  2584. ]
  2585. ]
  2586. },
  2587. {
  2588. "id": "e01b553b.23df18",
  2589. "type": "function",
  2590. "z": "e7f81119.1bd4",
  2591. "name": "set temperature",
  2592. "func": "msg.topic=\"stat3/toesp\";
  2593.  
  2594. msg.payload=\"{ili:\\\"$F2$P104,92;\" + (Number(flow.get(\"setTemperature\")) + Number(flow.get(\"manual\"))) + \"\\\"}\"; node.send(msg);
  2595. ",
  2596. "outputs": 1,
  2597. "noerr": 0,
  2598. "x": 1960,
  2599. "y": 340,
  2600. "wires": [
  2601. [
  2602. "92d7692a.2e6018",
  2603. "68679a9b.889664"
  2604. ]
  2605. ]
  2606. },
  2607. {
  2608. "id": "92d7692a.2e6018",
  2609. "type": "function",
  2610. "z": "e7f81119.1bd4",
  2611. "name": "Auto/manual",
  2612. "func": "msg.topic=\"stat3/toesp\";
  2613. if (flow.get(\"manual\"))
  2614. msg.payload=\"{ili:\\\"$F8$P100,78;$C255,128,0Manual$C255,255,255\\\"}\";
  2615. else
  2616. msg.payload=\"{ili:\\\"$F8$P100,78;$C64,64,255Auto  $C255,255,255\\\"}\";
  2617. node.send(msg);",
  2618. "outputs": 1,
  2619. "noerr": 0,
  2620. "x": 1950,
  2621. "y": 400,
  2622. "wires": [
  2623. [
  2624. "68679a9b.889664"
  2625. ]
  2626. ]
  2627. },
  2628. {
  2629. "id": "39495a97.d17626",
  2630. "type": "delay",
  2631. "z": "e7f81119.1bd4",
  2632. "name": "",
  2633. "pauseType": "delay",
  2634. "timeout": "200",
  2635. "timeoutUnits": "milliseconds",
  2636. "rate": "1",
  2637. "nbRateUnits": "1",
  2638. "rateUnits": "second",
  2639. "randomFirst": "1",
  2640. "randomLast": "5",
  2641. "randomUnits": "seconds",
  2642. "drop": false,
  2643. "x": 1770,
  2644. "y": 260,
  2645. "wires": [
  2646. [
  2647. "9bb63202.2d86d",
  2648. "db951651.f831f8"
  2649. ]
  2650. ]
  2651. },
  2652. {
  2653. "id": "ca35d6c3.8d2b98",
  2654. "type": "timeout",
  2655. "z": "e7f81119.1bd4",
  2656. "name": "My Timeout",
  2657. "outtopic": "",
  2658. "outsafe": "1",
  2659. "outwarning": "",
  2660. "outunsafe": "1",
  2661. "warning": "15",
  2662. "timer": "30",
  2663. "repeat": false,
  2664. "again": true,
  2665. "x": 1770,
  2666. "y": 340,
  2667. "wires": [
  2668. [
  2669. "e62ca4f3.00c108",
  2670. "e01b553b.23df18",
  2671. "54c6248b.7913cc"
  2672. ]
  2673. ]
  2674. },
  2675. {
  2676. "id": "db951651.f831f8",
  2677. "type": "delay",
  2678. "z": "e7f81119.1bd4",
  2679. "name": "",
  2680. "pauseType": "delay",
  2681. "timeout": "500",
  2682. "timeoutUnits": "milliseconds",
  2683. "rate": "1",
  2684. "nbRateUnits": "1",
  2685. "rateUnits": "second",
  2686. "randomFirst": "1",
  2687. "randomLast": "5",
  2688. "randomUnits": "seconds",
  2689. "drop": false,
  2690. "x": 1770,
  2691. "y": 300,
  2692. "wires": [
  2693. [
  2694. "ca35d6c3.8d2b98",
  2695. "e62ca4f3.00c108",
  2696. "e01b553b.23df18"
  2697. ]
  2698. ]
  2699. },
  2700. {
  2701. "id": "54c6248b.7913cc",
  2702. "type": "function",
  2703. "z": "e7f81119.1bd4",
  2704. "name": "Show Time",
  2705. "func": "var date = new Date();
  2706.  
  2707. var hour = date.getHours();
  2708. hour = (hour < 10 ? \"0\" : \"\") + hour;
  2709.  
  2710. var min  = date.getMinutes();
  2711. min = (min < 10 ? \"0\" : \"\") + min;
  2712.  
  2713. msg.topic=\"stat3/toesp\";
  2714. msg.payload=\"{ili:\\\"$C0,0,0;$I1,97,39,8;$F9$P6,97;$C255,0,255;\" + hour + \":\" + min + \"$C255,255,255\\\"}\";
  2715. return msg;",
  2716. "outputs": 1,
  2717. "noerr": 0,
  2718. "x": 1770,
  2719. "y": 400,
  2720. "wires": [
  2721. [
  2722. "68679a9b.889664"
  2723. ]
  2724. ]
  2725. },
  2726. {
  2727. "id": "68679a9b.889664",
  2728. "type": "mqtt out",
  2729. "z": "e7f81119.1bd4",
  2730. "name": "mqtt",
  2731. "topic": "",
  2732. "qos": "",
  2733. "retain": "",
  2734. "broker": "4c682b3a.2ab5c4",
  2735. "x": 2160,
  2736. "y": 200,
  2737. "wires": []
  2738. },
  2739. {
  2740. "id": "4fac90e3.7885",
  2741. "type": "function",
  2742. "z": "e7f81119.1bd4",
  2743. "name": "stat3 status on off",
  2744. "func": "msg.topic=\"stat3/toesp\";
  2745. if ( (flow.get(\"incomingTemperature\") < (flow.get(\"setTemperature\")+flow.get(\"manual\") )) )
  2746. msg.payload=\"{ili:\\\"$C0,0,0$I45,95,24,24$F6$P45,95;$C255,0,0;L$C255,255,255\\\"}\";
  2747. else
  2748. msg.payload=\"{ili:\\\"$C0,0,0$I45,95,24,24$F6$P45,95;$C0,128,255;k$C255,255,255\\\"}\";
  2749. node.send(msg);
  2750. ",
  2751. "outputs": 1,
  2752. "noerr": 0,
  2753. "x": 1970,
  2754. "y": 140,
  2755. "wires": [
  2756. [
  2757. "68679a9b.889664"
  2758. ]
  2759. ]
  2760. },
  2761. {
  2762. "id": "bd48728c.866f2",
  2763. "type": "ui_group",
  2764. "z": "",
  2765. "name": "Stat",
  2766. "tab": "1aa135a6.7197da",
  2767. "disp": false,
  2768. "width": "6"
  2769. },
  2770. {
  2771. "id": "4c682b3a.2ab5c4",
  2772. "type": "mqtt-broker",
  2773. "z": "",
  2774. "name": "",
  2775. "broker": "127.0.0.1",
  2776. "port": "1883",
  2777. "clientid": "",
  2778. "usetls": false,
  2779. "compatmode": true,
  2780. "keepalive": "60",
  2781. "cleansession": true,
  2782. "birthTopic": "",
  2783. "birthQos": "0",
  2784. "birthPayload": "",
  2785. "closeTopic": "",
  2786. "closeQos": "0",
  2787. "closePayload": "",
  2788. "willTopic": "",
  2789. "willQos": "0",
  2790. "willPayload": ""
  2791. },
  2792. {
  2793. "id": "1aa135a6.7197da",
  2794. "type": "ui_tab",
  2795. "z": "",
  2796. "name": "Stat",
  2797. "icon": "dashboard",
  2798. "order": 2
  2799. }
  2800. ]
RAW Paste Data