LaundrySorcery

Log | Files | Refs

commit 924d0eded1f90ae652c2017c06af8ccc2aa9ce56
parent 23484fb78e90b1ec74d4b98f04f694cc0376f9fe
Author: Dominik Schmidt <das1993@hotmail.com>
Date:   Wed,  6 Jun 2018 21:05:37 +0000

Reload sensor panels every 10 seconds

Diffstat:
www/generate_image.sh | 1+
www/index.sh | 17+++++++++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/www/generate_image.sh b/www/generate_image.sh @@ -1,6 +1,7 @@ #!/bin/bash echo "Content-Type: image/svg+xml" +echo "Cache-Control: no-cache" echo /usr/bin/rrdtool graph -a SVG -s "${START}" /dev/stderr DEF:mylight=database.rrd:light:AVERAGE:step=${RESOLUTION} DEF:myon=database.rrd:on_mean:AVERAGE:step=${RESOLUTION} DEF:myoff=database.rrd:off_mean:AVERAGE:step=${RESOLUTION} LINE2:mylight#ff0000 LINE2:myon#00aa00 LINE2:myoff#0000aa 1>/dev/null diff --git a/www/index.sh b/www/index.sh @@ -69,9 +69,26 @@ Content-Type: text/html --> </script> <H1>Light Sensor Data</H1> + <div id="SensorPanel"> <div><img src="light_5min.sh" /></div> <div><img src="light_1h.sh" /></div> <div><img src="light_1d.sh" /></div> + </div> + <script type="text/javascript"> + <!-- + panel=document.getElementById("SensorPanel"); + function updatePanels(){ + panels=panel.getElementsByTagName("img"); + for(i=0; i<panels.length; i++){ + if(!panels[i].orig_src){ + panels[i].orig_src=panels[i].src; + } + panels[i].src=panels[i].orig_src+"#"+new Date().getTime(); + } + } + setInterval(updatePanels,10*1000); + --> + </script> </body> </HTML> EOF