html_confadv.ino 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. static const char html_confadv_script[] PROGMEM = R"=====(
  2. <script>
  3. function g(i) { return document.getElementById(i) };
  4. function sp(i){g(i).type=(g(i).type==='text'?'password':'text');}
  5. var xhttp, reqTime, reqFin;
  6. function setCbx(el, da) {
  7. if(da == '1') {
  8. el.checked = true;
  9. el.style.visibility = 'visible';
  10. }
  11. else {
  12. el.checked = false;
  13. el.style.visibility = 'visible';
  14. }
  15. }
  16. function updCbxVal(el) {
  17. if (el.checked) el.value = '1';
  18. else {
  19. el.checked = true;
  20. el.value = '0';
  21. el.style.visibility = 'hidden';
  22. }
  23. }
  24. function transmit(f) {
  25. if (!xhttp) {
  26. reqTime = 0;
  27. reqFin = false;
  28. xhttp = new XMLHttpRequest();
  29. xhttp.timeout = 1000;
  30. xhttp.overrideMimeType('application/json');
  31. xhttp.open('POST', 'confdadv');
  32. xhttp.send(f ? (new FormData(f)) : '');
  33. xhttp.onreadystatechange = function () {
  34. if (xhttp.readyState === XMLHttpRequest.DONE && xhttp.status === 200) {
  35. var data = JSON.parse(xhttp.responseText);
  36. g('tempDec').value = data.tempDec;
  37. g('hyst').value = data.hyst;
  38. g('minOffTime').value = data.minOffTime;
  39. g('tempCorr').value = data.tempCorr;
  40. g('humCorr').value = data.humCorr;
  41. g('offMsg').value = data.offMsg;
  42. g('itemplab').value = data.itemplab;
  43. g('otemplab').value = data.otemplab;
  44. g('modename1').value = data.modename1;
  45. g('modename0').value = data.modename0;
  46. g('psetname0').value = data.psetname0;
  47. g('psetname1').value = data.psetname1;
  48. g('psetname2').value = data.psetname2;
  49. xhttp = null;
  50. reqFin = true;
  51. }
  52. else {
  53. if(!reqFin && reqTime > 10) {
  54. xhttp = null;
  55. reqFin = true;
  56. }
  57. }
  58. }
  59. }
  60. return false;
  61. }
  62. //transmit();
  63. function saveConf() {
  64. g('frmConf').submit();
  65. }
  66. function init() {
  67. transmit();
  68. }
  69. setInterval(function () { ++reqTime; }, 1000);
  70. </script>
  71. )====="; // html_confadv_script
  72. static const char html_confadv_body[] PROGMEM = R"=====(
  73. <b>Configuration - Thermostat Advanced</b>
  74. <div class='config'>
  75. <form id='frmConf' action='setConfAdv' method='POST'>
  76. <br>
  77. <fieldset>
  78. <legend>Thermostat - Advanced</legend>
  79. <p><b>Hysteresis [°C]</b><br><input type='text' name='hyst' id='hyst'></p><br>
  80. <p><b>Min. Heating Off-Time [s]</b><br><input type='number' name='minOffTime' id='minOffTime'></p>
  81. <p style='font-weight:normal;font-size:0.8em;'>Heating stays off for at least [x] seconds before it <br>can start again.</p><br>
  82. <p><b>Measured Temp Correction [°C] *</b><br><input type='text' name='tempCorr' id='tempCorr'></p>
  83. <p><b>Measured Hum Correction [%] *</b><br><input type='text' name='humCorr' id='humCorr'></p>
  84. <p style='font-weight:normal;font-size:0.8em;'>* added to the measured values. <br>Can be negative and/or fractions. <br>Use if measurements deviate from a calibrated sensor.</p><br>
  85. <p><b>Set Temp. Decrease Value **</b><br><input type='text' name='tempDec' id='tempDec'></p>
  86. <p style='font-weight:normal;font-size:0.8em;'>** the actual set temperatur is decreased by that value.<br>Can be a fraction. Can be used to prevent over-heating <br>when the thermostat is badly placed.<br></p>
  87. </fieldset>
  88. <div></div><br>
  89. <fieldset>
  90. <legend>Names and Labels</legend>
  91. <p style='font-weight:normal;font-size:0.8em;'>Used in some MQTT status/commands, <br>and also for the LCD and Web interface.<br></p><br>
  92. <p><b>Off-Message</b><br><input type='text' name='offMsg' id='offMsg'></p>
  93. <p style='font-weight:normal;font-size:0.8em;'>Shown on LCD in OFF mode. <br><b>max. 13 chars!</b></p>
  94. <br>
  95. <p>Labels</p>
  96. <p style='font-weight:normal;font-size:0.8em;'>Used on LCD to identify the data displayed. <br><b>MUST be 1 char</b> or empty for default</p>
  97. <p><b>Inside</b><br><input type='text' name='itemplab' id='itemplab'/></p>
  98. <p><b>Outside</b><br><input type='text' name='otemplab' id='otemplab'/></p>
  99. <br>
  100. <p>Mode</p>
  101. <p style='font-weight:normal;font-size:0.8em;'>Used in web interface and for Home Assistant <br>MQTT Climate component support. <br>Should be 'heat' and 'off' normally. <br><b>Case sensitive! Lower case recommended.</b><br>Web interface shows all in capitals.</p>
  102. <p><b>On</b><br><input type='text' name='modename1' id='modename1'></p>
  103. <p><b>Off</b><br><input type='text' name='modename0' id='modename0'></p>
  104. <br>
  105. <p>Preset Names</p>
  106. <p style='font-weight:normal;font-size:0.8em;'>Used in web interface and for Home Assistant <br>MQTT Climate component support.<br>
  107. Also shown on LCD at preset change, <br>therefore may not exceed <b>13 chars!</b><br><b>Case sensitive!</b> Type exactly as in HA!</p>
  108. <p><b>Normal *</b><br><input type='text' name='psetname0' id='psetname0'></p>
  109. <p style='font-weight:normal;font-size:0.8em;'>* always sends/receives "<i>none</i>" as this is hardcoded in <br>Home Assistant MQTT Climate component</p>
  110. <p><b>Reduction 1 **</b><br><input type='text' name='psetname1' id='psetname1'></p>
  111. <p><b>Reduction 2 **</b><br><input type='text' name='psetname2' id='psetname2'></p>
  112. <p style='font-weight:normal;font-size:0.8em;'>** sent/received as defined</p>
  113. </fieldset>
  114. <br>
  115. </form>
  116. <div></div>
  117. <table style='width:100%'>
  118. <td style='width:50%'><button onclick='location="conf";' class='bgrey'>Cancel</button></td>
  119. <td style='width:50%'><button onclick='return saveConf()' class='bred'>Save</button></td>
  120. </tr></table>
  121. </div>
  122. )====="; // html_confadv_body