comparison web/log.py @ 210:3f403e22c2e3

improved layering of sensor lines
author Matt Johnston <matt@ucc.asn.au>
date Thu, 26 Jun 2014 22:58:25 +0800
parents 9c2de3f977e4
children 59379b2bd056
comparison
equal deleted inserted replaced
207:9c2de3f977e4 210:3f403e22c2e3
123 if legend == 'Wort': 123 if legend == 'Wort':
124 wort_sensor = vname 124 wort_sensor = vname
125 elif legend == 'Fridge': 125 elif legend == 'Fridge':
126 fridge_sensor = vname 126 fridge_sensor = vname
127 127
128 sensor_lines.sort(key = lambda (legend, line): "Wort" in legend)
129
130 graph_args += (line for (legend, line) in sensor_lines)
131
132 print>>sys.stderr, '\n'.join(graph_args)
133
134 # calculated bits 128 # calculated bits
135 colour = '000000' 129 colour = '000000'
136 print_legend = 'Heat' 130 print_legend = 'Heat'
137 graph_args.append('CDEF:wortdel=%(wort_sensor)s,PREV(%(wort_sensor)s),-' % locals()) 131 graph_args.append('CDEF:wortdel=%(wort_sensor)s,PREV(%(wort_sensor)s),-' % locals())
138 graph_args.append('CDEF:tempdel=%(wort_sensor)s,%(fridge_sensor)s,-' % locals()) 132 graph_args.append('CDEF:tempdel=%(wort_sensor)s,%(fridge_sensor)s,-' % locals())
139 graph_args.append('CDEF:fermheat=wortdel,80,*,tempdel,0.9,*,+' % locals()) 133 graph_args.append('CDEF:fermheat=wortdel,80,*,tempdel,0.9,*,+' % locals())
140 graph_args.append('CDEF:trendfermheat=fermheat,10800,TRENDNAN' % locals()) 134 graph_args.append('CDEF:trendfermheat=fermheat,7200,TRENDNAN' % locals())
141 graph_args.append('CDEF:limitfermheat=trendfermheat,5,+,11,MIN,2,MAX' % locals()) 135 graph_args.append('CDEF:limitfermheat=trendfermheat,5,+,11,MIN,2,MAX' % locals())
142 graph_args.append('LINE0.5:limitfermheat#%(colour)s:%(print_legend)s' % locals()) 136 graph_args.append('LINE0.5:limitfermheat#%(colour)s:%(print_legend)s' % locals())
137
138 # lines are done afterwards so they can be layered
139 sensor_lines.sort(key = lambda (legend, line): "Wort" in legend)
140 graph_args += (line for (legend, line) in sensor_lines)
141
142 print>>sys.stderr, '\n'.join(graph_args)
143
143 144
144 end = int(start+length) 145 end = int(start+length)
145 start = int(start) 146 start = int(start)
146 147
147 tempf = tempfile.NamedTemporaryFile() 148 tempf = tempfile.NamedTemporaryFile()