Mercurial > code > home > repos > homeauto
changeset 950:44fc68ca5c92
add a display for the dht sensor data
Ignore-this: ef36a1efc0a81c5f783d55bc1f7771f3
darcs-hash:20140713002445-312f9-460a08d0fa2afca58b4001a4709058e5363ce853
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sat, 12 Jul 2014 17:24:45 -0700 |
parents | fa8710124ff0 |
children | f16dea2380ff |
files | service/pilight/static/index.html |
diffstat | 1 files changed, 30 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/service/pilight/static/index.html Sat Jul 12 16:35:39 2014 -0700 +++ b/service/pilight/static/index.html Sat Jul 12 17:24:45 2014 -0700 @@ -77,5 +77,35 @@ <pilight-page></pilight-page> + <div> + DHT: <span id="dht"></span> + <div id="temperature" style="background: #cff"></div> + <div id="humidity" style="background: #fef"></div> + </div> + <script> + $(function() { + function update() { + $.getJSON("dht", function(result) { + result['tempF'] = 1.8 * result['temperature'] + 32; + result['time'] = new Date().toLocaleString(); + $("#dht").text(JSON.stringify(result)); + $("#temperature") + .text(result['tempF'] + " deg F") + .css('width', result['temperature'] * 10); + $("#humidity") + .text(result['humidity'] + " humidity") + .css('width', result['humidity'] * 10); + }); + } + + function loop() { + update(); + setTimeout(function() { + requestAnimationFrame(loop); + }, 2000); + } + loop(); + }); + </script> </body> </html>