Mercurial > code > home > repos > homeauto
changeset 145:7233fdb6b30a
add a display for the dht sensor data
Ignore-this: ef36a1efc0a81c5f783d55bc1f7771f3
author | drewp@bigasterisk.com |
---|---|
date | Sat, 12 Jul 2014 17:24:45 -0700 |
parents | 2e4a9204f23b |
children | 289cea70e582 |
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>