confdevwifi 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. xhttp = new XMLHttpRequest();
  32. xhttp.timeout = 1000;
  33. xhttp.overrideMimeType('application/json');
  34. xhttp.open('POST', 'confDataDevWiFi');
  35. xhttp.send(f ? (new FormData(f)) : '');
  36. xhttp.onreadystatechange = function () {
  37. if (xhttp.readyState === XMLHttpRequest.DONE && xhttp.status === 200) {
  38. var data = JSON.parse(xhttp.responseText);
  39. g('devName').value = data.devName;
  40. g('hostName').value = data.hostName;
  41. g('SSID1').value = data.SSID1;
  42. g('WPW1').value = data.WPW1;
  43. g('SSID2').value = data.SSID2;
  44. g('WPW2').value = data.WPW2;
  45. g('SSIDAP').innerHTML = data.SSIDAP;
  46. g('WPWAP').value = data.WPWAP;
  47. g('WAPtout').value = data.WAPtout;
  48. g('WConnCheck').value = data.WConnCheck;
  49. g('Wretry').value = data.Wretry;
  50. g('Wreboot').value = data.Wreboot;
  51. xhttp = null;
  52. reqFin = true;
  53. }
  54. else {
  55. if(!reqFin && reqTime > 10) {
  56. xhttp = null;
  57. reqFin = true;
  58. }
  59. }
  60. }
  61. }
  62. return false;
  63. }
  64. //transmit();
  65. function saveConf() {
  66. g('frmConf').submit();
  67. }
  68. function init() {
  69. transmit();
  70. setCbx(g('WPW1Set'), 0);
  71. setCbx(g('WPW2Set'), 0);
  72. setCbx(g('WPWAPSet'), 0);
  73. }
  74. setInterval(function () { ++reqTime; }, 1000);
  75. </script>
  76. </head>
  77. <body onload='init()'>
  78. <div id='main'>
  79. <div id='head'>WiFiThermostat - WTherm-T5WZ
  80. </div><hr>
  81. <div></div>
  82. <b>Configuration - Device & WiFi</b>
  83. <div class='config'><br>
  84. <form id='frmConf' action='setConfDevWiFi' method='POST'>
  85. <fieldset>
  86. <legend>Device</legend>
  87. <p><b>Device Name *</b><br><input type='text' name='devName' id='devName'></p>
  88. <p><b>Hostname</b><br><input type='text' name='hostName' id='hostName'></p>
  89. <p class='n'>if blank, random hostname will be generated</p>
  90. </fieldset>
  91. <br>
  92. <p class='n'>After boot, firmware will first try to connect to Main Wifi-AP, <br>
  93. then if unsuccessful Fallback-AP. <br>
  94. If both fails it switches to Configuration AP-Mode. <br>
  95. AP-Mode is disabled again after configured timeout and a reconnect to the set <br>
  96. APs is tried every some minutes as configured below. <br>
  97. If no connection can be established the module will reboot after another <br>
  98. timeout if configured. <br>
  99. Reconnect always tries Main-AP first, then Fallback-AP.</p>
  100. <div></div>
  101. <fieldset>
  102. <legend>WiFi - Default-AP</legend>
  103. <p><b>Set</b>&nbsp;<input type='checkbox' id='WPW1Set' name='WPW1Set'></p>
  104. <p><b>SSID</b><br><input type='text' length=32 name='SSID1' id='SSID1'></p>
  105. <p><b>Password</b>&nbsp;<input type='checkbox' onclick='sp("WPW1")'>&nbsp;show<br><input type='password' length=64 name='WPW1' id='WPW1'></p>
  106. </fieldset>
  107. <br>
  108. <fieldset>
  109. <legend>WiFi - Fallback-AP</legend>
  110. <p><b>Set</b>&nbsp;<input type='checkbox' id='WPW2Set' name='WPW2Set'></p>
  111. <p><b>SSID</b><br><input type='text' length=32 name='SSID2' id='SSID2'></p>
  112. <p><b>Password</b>&nbsp;&nbsp;<input type='checkbox' onclick='sp("WPW2")'>&nbsp;show<br><input type='password' length=64 name='WPW2' id='WPW2'></p>
  113. </fieldset>
  114. <div></div><br>
  115. <fieldset>
  116. <legend>Configuration AP-Mode</legend>
  117. <p><b>SSID</b>: <i><span id='SSIDAP'></span></i>
  118. <p><b>Password *</b><input type='checkbox' id='WPWAPSet' name='WPWAPSet' onclick='sp("WPWAP")'><br><input type='password' name='WPWAP' id='WPWAP'></p>
  119. <p class='n'>* min. 8 chars, empty password for open WiFi</p>
  120. </fieldset>
  121. <div></div><br>
  122. <fieldset>
  123. <legend>Connection Handling</legend>
  124. <p><b>Switch off AP-Mode after [min] *</b><br><input type='number' name='WAPtout' id='WAPtout'></p>
  125. <p><b>WiFi connection check interval [s]</b><input type='number' name='WConnCheck' id='WConnCheck'></p>
  126. <p class='n'>min. 10s, max. 3600s</p><br>
  127. <p><b>Retry connecting WiFi-1 every [min] *</b><input type='number' name='Wretry' id='Wretry'></p>
  128. <p class='n'>Try WiFi-1 again when WiFi-2 is connected. <br>
  129. (prefer WiFi-1 over WiFi-2)</p><br>
  130. <p><b>Reboot if can´t connect for [min] *</b><input type='number' name='Wreboot' id='Wreboot'></p>
  131. <p class='n'>* set to 0 to disable</p>
  132. </fieldset>
  133. </form>
  134. <div></div>
  135. <table style='width:100%'>
  136. <td style='width:50%'><button onclick='location="conf";' class='bgrey'>Cancel</button></td>
  137. <td style='width:50%'><button onclick='return saveConf()' class='bred'>Save &amp; Restart</button></td>
  138. </tr></table>
  139. </div>
  140. <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>
  141. </div></body></html>