confbas 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <html><head>
  2. <meta charset='utf-8'><meta name='viewport' content='width=device-width,initial-scale=1,user-scalable=no'/>
  3. <link rel='stylesheet' href='style.css'>
  4. <title>WiFiThermostat - WTherm-T5WZ</title>
  5. <script>
  6. function g(i) { return document.getElementById(i) };
  7. function sp(i){g(i).type=(g(i).type==='text'?'password':'text');}
  8. var xhttp, reqTime, reqFin;
  9. function setCbx(el, da) {
  10. if(da == '1') {
  11. el.checked = true;
  12. el.style.visibility = 'visible';
  13. }
  14. else {
  15. el.checked = false;
  16. el.style.visibility = 'visible';
  17. }
  18. }
  19. function updCbxVal(el) {
  20. if (el.checked) el.value = '1';
  21. else {
  22. el.checked = true;
  23. el.value = '0';
  24. el.style.visibility = 'hidden';
  25. }
  26. }
  27. function transmit(f) {
  28. if (!xhttp) {
  29. reqTime = 0;
  30. reqFin = false;
  31. updCbxVal(g('autoSaveTemp'));
  32. updCbxVal(g('autoSaveMode'));
  33. updCbxVal(g('saveToMqttRet'));
  34. updCbxVal(g('PIRenDisp'));
  35. updCbxVal(g('PIRenDispPs0'));
  36. updCbxVal(g('togTHdisp'));
  37. xhttp = new XMLHttpRequest();
  38. xhttp.timeout = 1000;
  39. xhttp.overrideMimeType('application/json');
  40. xhttp.open('POST', 'confDataBas');
  41. xhttp.send(f ? (new FormData(f)) : '');
  42. xhttp.onreadystatechange = function () {
  43. if (xhttp.readyState === XMLHttpRequest.DONE && xhttp.status === 200) {
  44. var data = JSON.parse(xhttp.responseText);
  45. g('tempMin').value = data.tempMin;
  46. g('tempMax').value = data.tempMax;
  47. g('measInt').value = data.measInt;
  48. g('dispInt').value = data.dispInt;
  49. g('dispTout').value = data.dispTout;
  50. setCbx(g('autoSaveTemp'), data.autoSaveTemp);
  51. setCbx(g('autoSaveMode'), data.autoSaveMode);
  52. setCbx(g('saveToMqttRet'), data.saveToMqttRet);
  53. setCbx(g('PIRenDisp'), data.PIRenDisp);
  54. setCbx(g('PIRenDispPs0'), data.PIRenDispPs0);
  55. setCbx(g('togTHdisp'), data.togTHdisp);
  56. xhttp = null;
  57. reqFin = true;
  58. }
  59. else {
  60. if(!reqFin && reqTime > 10) {
  61. xhttp = null;
  62. reqFin = true;
  63. }
  64. }
  65. }
  66. }
  67. return false;
  68. }
  69. //transmit();
  70. function saveConf() {
  71. updCbxVal(g('autoSaveTemp'));
  72. updCbxVal(g('autoSaveMode'));
  73. updCbxVal(g('saveToMqttRet'));
  74. updCbxVal(g('PIRenDisp'));
  75. updCbxVal(g('PIRenDispPs0'));
  76. updCbxVal(g('togTHdisp'));
  77. g('frmConf').submit();
  78. }
  79. function init() {
  80. transmit();
  81. }
  82. setInterval(function () { ++reqTime; }, 1000);
  83. </script>
  84. </head>
  85. <body onload='init()'>
  86. <div id='main'>
  87. <div id='head'>WiFiThermostat - WTherm-T5WZ
  88. </div><hr>
  89. <div></div>
  90. <b>Configuration - Thermostat Basic</b>
  91. <div class='config'>
  92. <form id='frmConf' action='setConfBas' method='POST'>
  93. <br>
  94. <fieldset>
  95. <legend>Thermostat</legend>
  96. <p><b>Minimum Set Temperature [°C]</b><br><input type='text' name='tempMin' id='tempMin'></p>
  97. <p><b>Maximum Set Temperature [°C]</b><br><input type='text' name='tempMax' id='tempMax'></p>
  98. </fieldset>
  99. <div></div><br>
  100. <fieldset>
  101. <legend>Auto Save</legend>
  102. <p><b>Temperature *</b>&nbsp;<input type='checkbox' name='autoSaveTemp' id='autoSaveTemp'/></p>
  103. <p><b>Mode/Preset *</b>&nbsp;<input type='checkbox' name='autoSaveMode' id='autoSaveMode'/></p>
  104. <p class='n'>To minimize flash writes, this can also be <br>
  105. achieved by using MQTT with retain flag, when using <br>
  106. an external controller, especially for Mode/Preset, <br>
  107. as these will change frequently in most cases. <br>
  108. WiFiThermostat will receive the last value from retained MQTT <br>
  109. message automatically on startup/reconnect.</p>
  110. <p><b>Preserve States MQTT retained</b>&nbsp;<input type='checkbox' name='saveToMqttRet' id='saveToMqttRet'/></p>
  111. </fieldset>
  112. <div></div><br>
  113. <fieldset>
  114. <legend>Intervals / Timeouts</legend>
  115. <p><b>Measurement Interval [s]</b><br><input type='number' name='measInt' id='measInt'></p>
  116. <p><b>Display Update Interval [s]</b><br><input type='number' name='dispInt' id='dispInt'></p>
  117. <p><b>Display Timeout [s]</b><br><input type='number' name='dispTout' id='dispTout'></p>
  118. </fieldset>
  119. <div></div><br>
  120. <fieldset>
  121. <legend>Misc</legend>
  122. <p><b>PIR enables LCD backlight</b>&nbsp;<input type='checkbox' name='PIRenDisp' id='PIRenDisp'/></p>
  123. <p><b>&nbsp;&nbsp;only in normal heating mode</b>&nbsp;<input type='checkbox' name='PIRenDispPs0' id='PIRenDispPs0'/></p>
  124. <br>
  125. <p><b>Toggling I/O-Temp/Hum on LCD</b>&nbsp;<input type='checkbox' name='togTHdisp' id='togTHdisp'/></p>
  126. </fieldset>
  127. <br>
  128. </form>
  129. <div></div>
  130. <table style='width:100%'>
  131. <td style='width:50%'><button onclick='location="conf";' class='bgrey'>Cancel</button></td>
  132. <td style='width:50%'><button onclick='return saveConf()' class='bred'>Save</button></td>
  133. </tr></table>
  134. </div>
  135. <div style='text-align:right;font-size:0.7em;color:#AAA;'><hr/><a href='https://git.flokra.at/flo/WiFiThermostat' target='_blank' style='color:#AAA;'>WiFiThermostat</a> v0.6.0 by <a href='https://www.flokra.at/' target='_blank' style='color:#AAA;'>FloKra</a></div>
  136. </div></body></html>