I am trying to fill a rrd database based on duration and intervals the user commits through a gui. i built a timer which calls the update-function every ... minutes. After the measurement I try to look at the collected data by using the fetch-method but I get only "none"-values listed.
def update(self):
t=getTemperature()
h=getHumidity()
if self.status==11:
rrdtool.update(self.path,"N:"+t+":"+h)
elif self.status==10:
rrdtool.update(self.path,"N:"+t)
elif self.status==01:
rrdtool.update(self.path,"N:"+h)
The sensor values are correct, I checked it via a print-out. The rrdtool.create-method works also totally fine, a database is created, but as i said not actually updated correctly.
Here the usage of rrdtool.create():
def __init__(self,term,temEnabled,humEnabled,mins,hrs,fre):
self.path="/home/pi/Wetterstation/Speicherort/"+term+".rrd"
if os.path.exists(self.path)==False:
totalEntries=int((mins+hrs*60)/fre)
totalEntries=str(totalEntries)
if temEnabled==True and humEnabled==True:
rrdtool.create(self.path,
"DS:temperature:GAUGE:900:0:50",
"DS:humidity:GAUGE:"+str(fre)+":0:100",
"RRA:AVERAGE:0.5:1:"+totalEntries, "RRA:MIN:0.5:12:2400",
"RRA:MAX:0.5:"+totalEntries+":1",
"RRA:MIN:0.5:"+totalEntries+":1")
self.status=11
elif temEnabled==True:
rrdtool.create(self.path,
"DS:temperature:GAUGE:"+str(fre)+":0:50",
"RRA:AVERAGE:0.5:1:"+totalEntries,
"RRA:MIN:0.5:"+totalEntries+":1",
"RRA:MAX:0.5:"+totalEntries+":1")
self.status=10
elif humEnabled==True:
rrdtool.create(self.path,
"DS:hum:GAUGE:"+str(fre)+":0:100",
"RRA:AVERAGE:0.5:1:"+totalEntries,
"RRA:MIN:0.5:"+totalEntries+":1",
"RRA:MAX:0.5:"+totalEntries+":1")
self.status=01
self.success=True
else:
self.success=False