123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <html><body>
- <h1>WiFi Thermostat</h1>
-
- <!--<form id='tempbtns'>
- <input type='text' id='tempbtn' name='tempbtn' value='xx'>
- </form>-->
- <span id='setTemp'>22.5</span> ℃
- <input type='button' onclick='return sendBtn("min")' value='-'/>
- <input type='button' onclick='return sendBtn("pls")' value='+'/>
-
- <br><br>
- Betriebsmodus: <span id='mode'></span><br>
- <br>
- Aktuell: <span id='temp'></span> ℃ <span id='hum'></span> %<br>
- <br>
- WiFi verbunden mit: <span id='ssid'></span><br>
- <h6>Letztes Update vor
- <span id='ut'></span> Sekunden.
- <span id='status'></span>
- </h6>
- <br><a href='/wifi.htm'>WiFi-Einstellungen</a><br>
- <a href='/update'>Firmware Update</a>
- <script>
- function g(i) { return document.getElementById(i) };
- var xhttp, updateTime;
-
- function sendBtn(btn) {
- //var form = document.getElementById('tempbtns');
- //var act=document.getElementById('tempbtn')
- //act.value = btn;
- var fd = new FormData();
- fd.append('tempbtn', btn);
- return transmit(fd);
- }
-
- function transmit(f) {
- if (!xhttp) {
- g('status').innerHTML = 'lade...';
- xhttp = new XMLHttpRequest();
- xhttp.open('POST', 'api.php');
- xhttp.send(f ? (new FormData(f)) : '');
- xhttp.onreadystatechange = function () {
- if (xhttp.readyState === XMLHttpRequest.DONE && xhttp.status === 200) {
- var data = JSON.parse(xhttp.responseText);
- g('temp').innerHTML = data.temp;
- g('hum').innerHTML = data.hum;
- g('setTemp').innerHTML = data.setTemp;
- g('ssid').innerHTML = data.ssid;
-
- if(data.mode == '0') {
- g('mode').innerHTML = 'AUS';
- }
- else if(data.mode == '1') {
- g('mode').innerHTML = 'Normalbetrieb';
- }
- else if(data.mode == '2') {
- g('mode').innerHTML = 'Nachtabsenkung';
- }
- xhttp = null;
- g('status').innerHTML = '';
- updateTime = 0;
- }
- }
- }
- return false;
- }
- transmit();
- setInterval(function () { g('ut').innerHTML = ++updateTime; }, 1000);
- setInterval(transmit, 5000);
- </script>
- </body></html>
|