LaundrySorcery

Log | Files | Refs

commit 299073600d97efe8107da1ad1375084bf5586141
parent d0728381ad96a2f858ab093d378a7758dc732983
Author: Dominik Schmidt <das1993@hotmail.com>
Date:   Wed,  6 Jun 2018 16:21:23 +0000

Improve plotting

Diffstat:
Makefile | 2+-
www/generate_image.sh | 5+++--
www/index.sh | 11++++++++---
www/light_1d.sh | 5+++++
www/light_1h.sh | 5+++++
www/light_5min.sh | 2+-
6 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile @@ -18,5 +18,5 @@ plot.png: install: src/laundrysorcery $(WWWDIR)/database.rrd install -s -m 755 src/laundrysorcery $(DESTDIR)/bin/laundrysorcery - install -m 600 dist/systemd/LaundrySorcery.service /usr/lib/systemd/system/LaundrySorcery.service + install -m 600 dist/systemd/LaundrySorcery.service /var/lib/systemd/system/LaundrySorcery.service install -m 755 $(wildcard www/index.sh www/plot_*.sh) -t $(WWWDIR) diff --git a/www/generate_image.sh b/www/generate_image.sh @@ -1,5 +1,6 @@ #!/bin/bash -echo "Content-Type: image/png" +echo "Content-Type: image/svg+xml" +echo -rrdtool rrdtool graph -s "${START}" /dev/stdout DEF:mylight=database.rrd:light:AVERAGE:step=${RESOLUTION} LINE2:mylight#ff0000 +/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 @@ -1,6 +1,8 @@ #!/bin/bash - +OTIME=`<on_time` +TIME=`date +%s` +DTIME=$(( TIME-OTIME )) cat <<-EOF Content-Type: text/html @@ -11,14 +13,17 @@ Content-Type: text/html <title>LaundrySorcery</title> <meta charset="UTF-8"/> <style type="text/CSS"> - + delta_t=${DTIME}; + setInterval(function(){ delta_t++; }, 1000); </style> </head> <body> <H1>Laundry Status</H1> <H1>Light Sensor Data</H1> - <img src="light_5min.sh" /> + <div><img src="light_5min.sh" /></div> + <div><img src="light_1h.sh" /></div> + <div><img src="light_1d.sh" /></div> <script type="text/JavaScript"> <!-- --> diff --git a/www/light_1d.sh b/www/light_1d.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +START="-$((24*60*60))" +RESOLUTION="900" +source generate_image.sh diff --git a/www/light_1h.sh b/www/light_1h.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +START="-$((60*60))" +RESOLUTION="60" +source generate_image.sh diff --git a/www/light_5min.sh b/www/light_5min.sh @@ -2,4 +2,4 @@ START="-300" RESOLUTION="1" -source generate_plot.sh +source generate_image.sh