1

I have a water flowmeter connected to a RPi which is writing data to a simple RRD

RRDs::create ($rrdfile, "--start", 1572829200,
                        "--step", 60,
                        "DS:FLOW1:GAUGE:90:U:U",
                        "RRA:MAX:0.5:1:10512000",);

From this I generate a graph for the last 24 hours and some statistics for the last few days. A simplified version follows

RRDs::graph "temps.png",
  "--start=now-1d",
  "--end=now",
  "--width=1000",
  "--base=1000",
  "--height=240",
  "--title=Flow Data - ",
  "--slope-mode",
  "--vertical-label=Volume of Water",
  "DEF:flow-now=flow.rrd:FLOW1:AVERAGE", #Used to generate the graph
  "DEF:flow-1d=flow.rrd:FLOW1:AVERAGE:end=midnight:start=end-1d", #Data for yesterday
  "CDEF:flow-1d-1=flow-1d,25440,/", #Convert raw data to litres
  "VDEF:flow-1dtotal=flow-1d-1,TOTAL", #Get total litres
  "GPRINT:flow-1dtotal:Total Volume last 1 day = %.2lf L", #Print total for yesterday

I would like to add an arbitrary value to flow-1dtotal but can't work out how. Something along the lines of the psuedo code below is what I need

flow-1dtotal = flow-1dtotal + 1000

Thanks for reading and for any suggestions

0 Answers0