Graphing Functions
The following scripts generate the graphs. It is necessary to install 'sunwait' which gives sunrise and sunset times given the hives position on the earth. These graphs are uploaded to my website hourly iaw crontab.
Temperature graph generation:
pi@raspberrypi:~/hive_data $ cat graph.sh
#!/bin/bash
############################
#
# Parameters to adjust
#
############################
RRDPATH="/home/pi/hive_data"
IMGPATH="/home/pi/hive_data/temp_graphs"
RRDFILE="hive_data.rrd"
LAT="53N"
LON="2W"
# Graph Colors
A_COLOUR="#FF9933"
B_COLOUR="#0000FF"
TRENDCOLOUR="#FFFF00"
# Calculating Civil Twilight based on location from LAT LON
DUSKHR=`/home/pi/sunwait/sunwait sun up $LAT $LON -p | sed -n '/Sun rises/{:a;n;/Nautical twilight/b;p;ba}' | cut -c 45-46`
DUSKMIN=`/home/pi/sunwait/sunwait sun up $LAT $LON -p | sed -n '/Sun rises/{:a;n;/Nautical twilight/b;p;ba}' | cut -c 47-48`
DAWNHR=`/home/pi/sunwait/sunwait sun up $LAT $LON -p | sed -n '/Sun rises/{:a;n;/Nautical twilight/b;p;ba}' | cut -c 30-31`
DAWNMIN=`/home/pi/sunwait/sunwait sun up $LAT $LON -p | sed -n '/Sun rises/{:a;n;/Nautical twilight/b;p;ba}' | cut -c 32-33`
# Calculating sunset/sunrise based on location from LAT LON
SUNRISEHR=`/home/pi/sunwait/sunwait sun up $LAT $LON -p | sed -n '/Sun transits/{:a;n;/Civil twilight/b;p;ba}' | cut -c 30-31`
SUNRISEMIN=`/home/pi/sunwait/sunwait sun up $LAT $LON -p | sed -n '/Sun transits/{:a;n;/Civil twilight/b;p;ba}' | cut -c 32-33`
SUNSETHR=`/home/pi/sunwait/sunwait sun up $LAT $LON -p | sed -n '/Sun transits/{:a;n;/Civil twilight/b;p;ba}' | cut -c 45-46`
SUNSETMIN=`/home/pi/sunwait/sunwait sun up $LAT $LON -p | sed -n '/Sun transits/{:a;n;/Civil twilight/b;p;ba}' | cut -c 47-48`
SUNRISEHR=${SUNRISEHR#0}
SUNRISEMIN=${SUNRISEMIN#0}
SUNSETHR=${SUNSETHR#0}
SUNSETMIN=${SUNSETMIN#0}
# Converting to seconds
SUNR=$(($SUNRISEHR * 3600 + 10#$SUNRISEMIN * 60))
SUNS=$(($SUNSETHR * 3600 + $SUNSETMIN * 60))
DUSK=$(($DUSKHR * 3600 + $DUSKMIN * 60))
DAWN=$(($DAWNHR * 3600 + $DAWNMIN * 60))
############################
#
# Creating graphs
#
############################
#hour
rrdtool graph $IMGPATH/hour.png --start -6h --end now \
--title "WBC Hive Temperature - Last 6 Hours" \
-v "Temperature (°C)" \
--full-size-mode \
--width=700 --height=400 \
--slope-mode \
--color=SHADEB#9999CC \
--watermark="© Rem Fowler - 2016" \
DEF:temp1=$RRDPATH/$RRDFILE:brood_temp:AVERAGE \
DEF:temp2=$RRDPATH/$RRDFILE:outside_temp:AVERAGE \
CDEF:nightplus=LTIME,86400,%,$SUNR,LT,INF,LTIME,86400,%,$SUNS,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:nightminus=LTIME,86400,%,$SUNR,LT,NEGINF,LTIME,86400,%,$SUNS,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:nightplus#E0E0E0 \
AREA:nightminus#E0E0E0 \
CDEF:dusktilldawn=LTIME,86400,%,$DAWN,LT,INF,LTIME,86400,%,$DUSK,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:dawntilldusk=LTIME,86400,%,$DAWN,LT,NEGINF,LTIME,86400,%,$DUSK,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:dusktilldawn#CCCCCC \
AREA:dawntilldusk#CCCCCC \
COMMENT:" Location Last Avg\l" \
LINE2:temp1$A_COLOUR:"Brood Box " \
GPRINT:temp1:LAST:"%5.1lf °C" \
GPRINT:temp1:AVERAGE:"%5.1lf °C\l" \
COMMENT:"Dawn\: $DAWNHR\:$DAWNMIN\r" \
LINE2:temp2$B_COLOUR:"Outside " \
GPRINT:temp2:LAST:"%5.1lf °C" \
GPRINT:temp2:AVERAGE:"%5.1lf °C\l" \
COMMENT:"\u" \
COMMENT:"Sunrise\: $SUNRISEHR\:$SUNRISEMIN\r" \
COMMENT:"Sunset\: $SUNSETHR\:$SUNSETMIN\r" \
COMMENT:"Dusk\: $DUSKHR\:$DUSKMIN\r" \
HRULE:0#66CCFF:"freezing\l"
#day
rrdtool graph $IMGPATH/day.png --start -1d --end now \
--title "WBC Hive Temperature - Last Day" \
-v "Temperature (°C)" \
--full-size-mode \
--width=700 --height=400 \
--slope-mode \
--color=SHADEB#9999CC \
--watermark="© Rem Fowler - 2016" \
DEF:temp1=$RRDPATH/$RRDFILE:brood_temp:AVERAGE \
DEF:temp2=$RRDPATH/$RRDFILE:outside_temp:AVERAGE \
CDEF:nightplus=LTIME,86400,%,$SUNR,LT,INF,LTIME,86400,%,$SUNS,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:nightminus=LTIME,86400,%,$SUNR,LT,NEGINF,LTIME,86400,%,$SUNS,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:nightplus#E0E0E0 \
AREA:nightminus#E0E0E0 \
CDEF:dusktilldawn=LTIME,86400,%,$DAWN,LT,INF,LTIME,86400,%,$DUSK,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:dawntilldusk=LTIME,86400,%,$DAWN,LT,NEGINF,LTIME,86400,%,$DUSK,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:dusktilldawn#CCCCCC \
AREA:dawntilldusk#CCCCCC \
COMMENT:" Location Last Avg\l" \
LINE2:temp1$A_COLOUR:"Brood Box " \
GPRINT:temp1:LAST:"%5.1lf °C" \
GPRINT:temp1:AVERAGE:"%5.1lf °C\l" \
COMMENT:"Dawn\: $DAWNHR\:$DAWNMIN\r" \
LINE2:temp2$B_COLOUR:"Outside " \
GPRINT:temp2:LAST:"%5.1lf °C" \
GPRINT:temp2:AVERAGE:"%5.1lf °C\l" \
COMMENT:"\u" \
COMMENT:"Sunrise\: $SUNRISEHR\:$SUNRISEMIN\r" \
COMMENT:"Sunset\: $SUNSETHR\:$SUNSETMIN\r" \
COMMENT:"Dusk\: $DUSKHR\:$DUSKMIN\r" \
HRULE:0#66CCFF:"freezing\l"
#week
rrdtool graph $IMGPATH/week.png --start -1w \
--full-size-mode \
--title "WBC Hive Temperature - Last Week" \
-v "Temperature (°C)" \
--width=700 --height=400 \
--slope-mode \
--color=SHADEB#9999CC \
--watermark="© Rem Fowler - 2016" \
DEF:temp1=$RRDPATH/$RRDFILE:brood_temp:AVERAGE \
DEF:temp2=$RRDPATH/$RRDFILE:outside_temp:AVERAGE \
CDEF:nightplus=LTIME,86400,%,$SUNR,LT,INF,LTIME,86400,%,$SUNS,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:nightminus=LTIME,86400,%,$SUNR,LT,NEGINF,LTIME,86400,%,$SUNS,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:nightplus#E0E0E0 \
AREA:nightminus#E0E0E0 \
CDEF:dusktilldawn=LTIME,86400,%,$DAWN,LT,INF,LTIME,86400,%,$DUSK,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:dawntilldusk=LTIME,86400,%,$DAWN,LT,NEGINF,LTIME,86400,%,$DUSK,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:dusktilldawn#CCCCCC \
AREA:dawntilldusk#CCCCCC \
COMMENT:" Location Last Avg\l" \
LINE2:temp1$A_COLOUR:"Brood Box " \
GPRINT:temp1:LAST:"%5.1lf °C" \
GPRINT:temp1:AVERAGE:"%5.1lf °C\l" \
COMMENT:"Dawn\: $DAWNHR\:$DAWNMIN\r" \
LINE2:temp2$B_COLOUR:"Outside " \
GPRINT:temp2:LAST:"%5.1lf °C" \
GPRINT:temp2:AVERAGE:"%5.1lf °C\l" \
COMMENT:"\u" \
COMMENT:"Sunrise\: $SUNRISEHR\:$SUNRISEMIN\r" \
COMMENT:"Sunset\: $SUNSETHR\:$SUNSETMIN\r" \
COMMENT:"Dusk\: $DUSKHR\:$DUSKMIN\r" \
HRULE:0#66CCFF:"freezing\l"
#month
rrdtool graph $IMGPATH/month.png --start -1m \
--title "WBC Hive Temperature - Last Month" \
-v "Temperature (°C)" \
--full-size-mode \
--width=700 --height=400 \
--slope-mode \
--color=SHADEA#9999CC \
--watermark="© Rem Fowler - 2016" \
DEF:temp1=$RRDPATH/$RRDFILE:brood_temp:AVERAGE \
DEF:temp2=$RRDPATH/$RRDFILE:outside_temp:AVERAGE \
CDEF:nightplus=LTIME,86400,%,$SUNR,LT,INF,LTIME,86400,%,$SUNS,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:nightminus=LTIME,86400,%,$SUNR,LT,NEGINF,LTIME,86400,%,$SUNS,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:nightplus#E0E0E0 \
AREA:nightminus#E0E0E0 \
CDEF:dusktilldawn=LTIME,86400,%,$DAWN,LT,INF,LTIME,86400,%,$DUSK,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:dawntilldusk=LTIME,86400,%,$DAWN,LT,NEGINF,LTIME,86400,%,$DUSK,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:dusktilldawn#CCCCCC \
AREA:dawntilldusk#CCCCCC \
COMMENT:" Location Last Avg\l" \
LINE2:temp1$A_COLOUR:"Brood Box " \
GPRINT:temp1:LAST:"%5.1lf °C" \
GPRINT:temp1:AVERAGE:"%5.1lf °C\l" \
COMMENT:"Dawn\: $DAWNHR\:$DAWNMIN\r" \
LINE2:temp2$B_COLOUR:"Outside " \
GPRINT:temp2:LAST:"%5.1lf °C" \
GPRINT:temp2:AVERAGE:"%5.1lf °C\l" \
COMMENT:"\u" \
COMMENT:"Sunrise\: $SUNRISEHR\:$SUNRISEMIN\r" \
COMMENT:"Sunset\: $SUNSETHR\:$SUNSETMIN\r" \
COMMENT:"Dusk\: $DUSKHR\:$DUSKMIN\r" \
HRULE:0#66CCFF:"freezing\l"
#year
rrdtool graph $IMGPATH/year.png --start -1y \
--full-size-mode \
--title "WBC Hive Temperature - Last Year" \
-v "Temperature (°C)" \
--width=700 --height=400 \
--color=SHADEB#9999CC \
--slope-mode \
--watermark="© Rem Fowler - 2016" \
DEF:temp1=$RRDPATH/$RRDFILE:brood_temp:AVERAGE \
DEF:temp2=$RRDPATH/$RRDFILE:outside_temp:AVERAGE \
CDEF:nightplus=LTIME,86400,%,$SUNR,LT,INF,LTIME,86400,%,$SUNS,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:nightminus=LTIME,86400,%,$SUNR,LT,NEGINF,LTIME,86400,%,$SUNS,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:nightplus#E0E0E0 \
AREA:nightminus#E0E0E0 \
CDEF:dusktilldawn=LTIME,86400,%,$DAWN,LT,INF,LTIME,86400,%,$DUSK,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:dawntilldusk=LTIME,86400,%,$DAWN,LT,NEGINF,LTIME,86400,%,$DUSK,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:dusktilldawn#CCCCCC \
AREA:dawntilldusk#CCCCCC \
COMMENT:" Location Last Avg\l" \
LINE2:temp1$A_COLOUR:"Brood Box " \
GPRINT:temp1:LAST:"%5.1lf °C" \
GPRINT:temp1:AVERAGE:"%5.1lf °C\l" \
COMMENT:"Dawn\: $DAWNHR\:$DAWNMIN\r" \
LINE2:temp2$B_COLOUR:"Outside " \
GPRINT:temp2:LAST:"%5.1lf °C" \
GPRINT:temp2:AVERAGE:"%5.1lf °C\l" \
COMMENT:"\u" \
COMMENT:"Sunrise\: $SUNRISEHR\:$SUNRISEMIN\r" \
COMMENT:"Sunset\: $SUNSETHR\:$SUNSETMIN\r" \
COMMENT:"Dusk\: $DUSKHR\:$DUSKMIN\r" \
HRULE:0#66CCFF:"freezing\l"
Weight graph generation:
pi@raspberrypi:~/hive_data $ cat wtgraph.sh
#!/bin/bash
############################
#
# Parameters to adjust
#
############################
RRDPATH="/home/pi/hive_data"
IMGPATH="/home/pi/hive_data/weight_graphs"
RRDFILE="weight.rrd"
LAT="53N"
LON="2W"
# Graph Colors
A_COLOUR="#006400"
B_COLOUR="#0000FF"
TRENDCOLOUR="#FFFF00"
# Calculating Civil Twilight based on location from LAT LON
DUSKHR=`/home/pi/sunwait/sunwait sun up $LAT $LON -p | sed -n '/Sun rises/{:a;n;/Nautical twilight/b;p;ba}' | cut -c 45-46`
DUSKMIN=`/home/pi/sunwait/sunwait sun up $LAT $LON -p | sed -n '/Sun rises/{:a;n;/Nautical twilight/b;p;ba}' | cut -c 47-48`
DAWNHR=`/home/pi/sunwait/sunwait sun up $LAT $LON -p | sed -n '/Sun rises/{:a;n;/Nautical twilight/b;p;ba}' | cut -c 30-31`
DAWNMIN=`/home/pi/sunwait/sunwait sun up $LAT $LON -p | sed -n '/Sun rises/{:a;n;/Nautical twilight/b;p;ba}' | cut -c 32-33`
# Calculating sunset/sunrise based on location from LAT LON
SUNRISEHR=`/home/pi/sunwait/sunwait sun up $LAT $LON -p | sed -n '/Sun transits/{:a;n;/Civil twilight/b;p;ba}' | cut -c 30-31`
SUNRISEMIN=`/home/pi/sunwait/sunwait sun up $LAT $LON -p | sed -n '/Sun transits/{:a;n;/Civil twilight/b;p;ba}' | cut -c 32-33`
SUNSETHR=`/home/pi/sunwait/sunwait sun up $LAT $LON -p | sed -n '/Sun transits/{:a;n;/Civil twilight/b;p;ba}' | cut -c 45-46`
SUNSETMIN=`/home/pi/sunwait/sunwait sun up $LAT $LON -p | sed -n '/Sun transits/{:a;n;/Civil twilight/b;p;ba}' | cut -c 47-48`
SUNRISEHR=${SUNRISEHR#0}
SUNRISEMIN=${SUNRISEMIN#0}
SUNSETHR=${SUNSETHR#0}
SUNSETMIN=${SUNSETMIN#0}
# Converting to seconds
SUNR=$(($SUNRISEHR * 3600 + $SUNRISEMIN * 60))
SUNS=$(($SUNSETHR * 3600 + $SUNSETMIN * 60))
DUSK=$(($DUSKHR * 3600 + $DUSKMIN * 60))
DAWN=$(($DAWNHR * 3600 + $DAWNMIN * 60))
############################
#
# Creating graphs
#
############################
#hour
rrdtool graph $IMGPATH/wthour.png --start -6h --end now \
--title "WBC Hive Mass - Last 6 Hours" \
-v "Mass (Kg)" \
--full-size-mode \
--width=700 --height=400 \
--slope-mode \
--color=SHADEB#9999CC \
--watermark="© Rem Fowler - 2016" \
DEF:temp1=$RRDPATH/$RRDFILE:weight:AVERAGE \
CDEF:nightplus=LTIME,86400,%,$SUNR,LT,INF,LTIME,86400,%,$SUNS,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:nightminus=LTIME,86400,%,$SUNR,LT,NEGINF,LTIME,86400,%,$SUNS,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:nightplus#E0E0E0 \
AREA:nightminus#E0E0E0 \
CDEF:dusktilldawn=LTIME,86400,%,$DAWN,LT,INF,LTIME,86400,%,$DUSK,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:dawntilldusk=LTIME,86400,%,$DAWN,LT,NEGINF,LTIME,86400,%,$DUSK,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:dusktilldawn#CCCCCC \
AREA:dawntilldusk#CCCCCC \
COMMENT:" Last Avg\l" \
COMMENT:"\u" \
COMMENT:"Dawn\: $DAWNHR\:$DAWNMIN\r" \
LINE2:temp1$A_COLOUR:"Hive Weight " \
GPRINT:temp1:LAST:"%5.1lf Kg" \
GPRINT:temp1:AVERAGE:"%5.1lf Kg\l" \
COMMENT:"\u" \
COMMENT:"Sunrise\: $SUNRISEHR\:$SUNRISEMIN\r" \
COMMENT:"Sunset\: $SUNSETHR\:$SUNSETMIN\r" \
COMMENT:"Dusk\: $DUSKHR\:$DUSKMIN\r" \
#day
rrdtool graph $IMGPATH/wtday.png --start -1d --end now \
--title "WBC Hive Mass - Last Day" \
-v "Mass (Kg)" \
--full-size-mode \
--width=700 --height=400 \
--slope-mode \
--color=SHADEB#9999CC \
--watermark="© Rem Fowler - 2016" \
DEF:temp1=$RRDPATH/$RRDFILE:weight:AVERAGE \
CDEF:nightplus=LTIME,86400,%,$SUNR,LT,INF,LTIME,86400,%,$SUNS,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:nightminus=LTIME,86400,%,$SUNR,LT,NEGINF,LTIME,86400,%,$SUNS,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:nightplus#E0E0E0 \
AREA:nightminus#E0E0E0 \
CDEF:dusktilldawn=LTIME,86400,%,$DAWN,LT,INF,LTIME,86400,%,$DUSK,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:dawntilldusk=LTIME,86400,%,$DAWN,LT,NEGINF,LTIME,86400,%,$DUSK,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:dusktilldawn#CCCCCC \
AREA:dawntilldusk#CCCCCC \
COMMENT:" Last Avg\l" \
COMMENT:"\u" \
COMMENT:"Dawn\: $DAWNHR\:$DAWNMIN\r" \
LINE2:temp1$A_COLOUR:"Hive Weight " \
GPRINT:temp1:LAST:"%5.1lf Kg" \
GPRINT:temp1:AVERAGE:"%5.1lf Kg\l" \
COMMENT:"\u" \
COMMENT:"Sunrise\: $SUNRISEHR\:$SUNRISEMIN\r" \
COMMENT:"Sunset\: $SUNSETHR\:$SUNSETMIN\r" \
COMMENT:"Dusk\: $DUSKHR\:$DUSKMIN\r" \
#week
rrdtool graph $IMGPATH/wtweek.png --start -1w --end now \
--title "WBC Hive Mass - Last Week" \
-v "Mass (Kg)" \
--full-size-mode \
--width=700 --height=400 \
--slope-mode \
--color=SHADEB#9999CC \
--watermark="© Rem Fowler - 2016" \
DEF:temp1=$RRDPATH/$RRDFILE:weight:AVERAGE \
CDEF:nightplus=LTIME,86400,%,$SUNR,LT,INF,LTIME,86400,%,$SUNS,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:nightminus=LTIME,86400,%,$SUNR,LT,NEGINF,LTIME,86400,%,$SUNS,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:nightplus#E0E0E0 \
AREA:nightminus#E0E0E0 \
CDEF:dusktilldawn=LTIME,86400,%,$DAWN,LT,INF,LTIME,86400,%,$DUSK,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:dawntilldusk=LTIME,86400,%,$DAWN,LT,NEGINF,LTIME,86400,%,$DUSK,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:dusktilldawn#CCCCCC \
AREA:dawntilldusk#CCCCCC \
COMMENT:" Last Avg\l" \
COMMENT:"\u" \
COMMENT:"Dawn\: $DAWNHR\:$DAWNMIN\r" \
LINE2:temp1$A_COLOUR:"Hive Weight " \
GPRINT:temp1:LAST:"%5.1lf Kg" \
GPRINT:temp1:AVERAGE:"%5.1lf Kg\l" \
COMMENT:"\u" \
COMMENT:"Sunrise\: $SUNRISEHR\:$SUNRISEMIN\r" \
COMMENT:"Sunset\: $SUNSETHR\:$SUNSETMIN\r" \
COMMENT:"Dusk\: $DUSKHR\:$DUSKMIN\r" \
#month
rrdtool graph $IMGPATH/wtmonth.png --start -1m --end now \
--title "WBC Hive Mass - Last Month" \
-v "Mass (Kg)" \
--full-size-mode \
--width=700 --height=400 \
--slope-mode \
--color=SHADEB#9999CC \
--watermark="© Rem Fowler - 2016" \
DEF:temp1=$RRDPATH/$RRDFILE:weight:AVERAGE \
CDEF:nightplus=LTIME,86400,%,$SUNR,LT,INF,LTIME,86400,%,$SUNS,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:nightminus=LTIME,86400,%,$SUNR,LT,NEGINF,LTIME,86400,%,$SUNS,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:nightplus#E0E0E0 \
AREA:nightminus#E0E0E0 \
CDEF:dusktilldawn=LTIME,86400,%,$DAWN,LT,INF,LTIME,86400,%,$DUSK,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:dawntilldusk=LTIME,86400,%,$DAWN,LT,NEGINF,LTIME,86400,%,$DUSK,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:dusktilldawn#CCCCCC \
AREA:dawntilldusk#CCCCCC \
COMMENT:" Last Avg\l" \
COMMENT:"\u" \
COMMENT:"Dawn\: $DAWNHR\:$DAWNMIN\r" \
LINE2:temp1$A_COLOUR:"Hive Weight " \
GPRINT:temp1:LAST:"%5.1lf Kg" \
GPRINT:temp1:AVERAGE:"%5.1lf Kg\l" \
COMMENT:"\u" \
COMMENT:"Sunrise\: $SUNRISEHR\:$SUNRISEMIN\r" \
COMMENT:"Sunset\: $SUNSETHR\:$SUNSETMIN\r" \
COMMENT:"Dusk\: $DUSKHR\:$DUSKMIN\r" \
VDEF:slope=temp1,LSLSLOPE \
VDEF:cons=temp1,LSLINT \
CDEF:trend=temp1,POP,slope,COUNT,*,cons,+ \
LINE2:trend#ff0000:"trend":dashes=8 \
#year
rrdtool graph $IMGPATH/wtyear.png --start -1y --end now \
--title "WBC Hive Mass - Last Year" \
-v "Mass (Kg)" \
--full-size-mode \
--width=700 --height=400 \
--slope-mode \
--color=SHADEB#9999CC \
--watermark="© Rem Fowler - 2016" \
DEF:temp1=$RRDPATH/$RRDFILE:weight:AVERAGE \
CDEF:nightplus=LTIME,86400,%,$SUNR,LT,INF,LTIME,86400,%,$SUNS,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:nightminus=LTIME,86400,%,$SUNR,LT,NEGINF,LTIME,86400,%,$SUNS,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:nightplus#E0E0E0 \
AREA:nightminus#E0E0E0 \
CDEF:dusktilldawn=LTIME,86400,%,$DAWN,LT,INF,LTIME,86400,%,$DUSK,GT,INF,UNKN,temp1,*,IF,IF \
CDEF:dawntilldusk=LTIME,86400,%,$DAWN,LT,NEGINF,LTIME,86400,%,$DUSK,GT,NEGINF,UNKN,temp1,*,IF,IF \
AREA:dusktilldawn#CCCCCC \
AREA:dawntilldusk#CCCCCC \
COMMENT:" Last Avg\l" \
COMMENT:"\u" \
COMMENT:"Dawn\: $DAWNHR\:$DAWNMIN\r" \
LINE2:temp1$A_COLOUR:"Hive Weight " \
GPRINT:temp1:LAST:"%5.1lf Kg" \
GPRINT:temp1:AVERAGE:"%5.1lf Kg\l" \
COMMENT:"\u" \
COMMENT:"Sunrise\: $SUNRISEHR\:$SUNRISEMIN\r" \
COMMENT:"Sunset\: $SUNSETHR\:$SUNSETMIN\r" \
COMMENT:"Dusk\: $DUSKHR\:$DUSKMIN\r" \