def segmentUpdate(self,value): self.s=segmentDisplay(self.displayId) if value[0] != "0": self.s.writeDisplay(1,value[0],0) else: self.s.clearDisplay(1) self.s.writeDisplay(2,value[1],0) self.s.writeDisplay(3,value[2],1) self.s.writeDisplay(4,value[4],0)
import rrdtool from time import sleep from segmentDisplay import segmentDisplay from ds18b20 import ds18b20 project_dir="/home/pi/virtualenvs/BrewPi" log=False temp=-999 s=segmentDisplay('0x38') t=ds18b20('28-000004e4e579') l='Office' s.setupDisplay() for i in range (1,5): s.clearDisplay(i) while True: curtemp=t.getTemp() temp = '%05.1f' % round(curtemp,1) ret = rrdtool.update(project_dir + "/rrd/temps.rrd","N:" + str(temp)); if ret: print rrdtool.error() if log==True: # Logging switch l = Log(temperature=curtemp,location=l,timestamp=timezone.now()) l.save() if temp_HLT[0] != "0": s.writeDisplay(1,temp[0],0) else: s.clearDisplay(1) s.writeDisplay(2,temp[1],0)
def segmentInitialise(self): self.s=segmentDisplay(self.displayId) time.sleep(0.2) self.s.setupDisplay() for i in range(1,5): self.s.clearDisplay(i)
import rrdtool from time import sleep from segmentDisplay import segmentDisplay from ds18b20 import ds18b20 project_dir = "/home/pi/virtualenvs/BrewPi" log = False temp = -999 s = segmentDisplay('0x38') t = ds18b20('28-000004e4e579') l = 'Office' s.setupDisplay() for i in range(1, 5): s.clearDisplay(i) while True: curtemp = t.getTemp() temp = '%05.1f' % round(curtemp, 1) ret = rrdtool.update(project_dir + "/rrd/temps.rrd", "N:" + str(temp)) if ret: print rrdtool.error() if log == True: # Logging switch l = Log(temperature=curtemp, location=l, timestamp=timezone.now()) l.save() if temp_HLT[0] != "0": s.writeDisplay(1, temp[0], 0) else: s.clearDisplay(1) s.writeDisplay(2, temp[1], 0) s.writeDisplay(3, temp[2], 1)