Mercurial > templog
comparison web/log.py @ 503:d96042bce9d3
- fermentation heat prediction kind of works?
- fix watch
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 21 Apr 2014 21:41:44 +0800 |
parents | 88204c0db5fa |
children | 3f403e22c2e3 |
comparison
equal
deleted
inserted
replaced
502:95fe8c725f90 | 503:d96042bce9d3 |
---|---|
81 volts_mult = 1.0/volts_div | 81 volts_mult = 1.0/volts_div |
82 | 82 |
83 # (title, sensorline) pairs. | 83 # (title, sensorline) pairs. |
84 sensor_lines = [] | 84 sensor_lines = [] |
85 | 85 |
86 wort_sensor = None | |
87 fridge_sensor = None | |
86 for n, (rrdfile, sensor) in enumerate(rrds): | 88 for n, (rrdfile, sensor) in enumerate(rrds): |
87 unit = None | 89 unit = None |
88 if 'avrtemp' in sensor: | 90 if 'avrtemp' in sensor: |
89 continue | 91 continue |
90 if 'voltage' in sensor: | 92 if 'voltage' in sensor: |
116 if format_last_value: | 118 if format_last_value: |
117 print_legend = '%s (%s)' % (legend, format_last_value) | 119 print_legend = '%s (%s)' % (legend, format_last_value) |
118 else: | 120 else: |
119 print_legend = legend | 121 print_legend = legend |
120 sensor_lines.append( (legend, 'LINE%(width)f:%(vname)s#%(colour)s:%(print_legend)s' % locals()) ) | 122 sensor_lines.append( (legend, 'LINE%(width)f:%(vname)s#%(colour)s:%(print_legend)s' % locals()) ) |
123 if legend == 'Wort': | |
124 wort_sensor = vname | |
125 elif legend == 'Fridge': | |
126 fridge_sensor = vname | |
121 | 127 |
122 sensor_lines.sort(key = lambda (legend, line): "Wort" in legend) | 128 sensor_lines.sort(key = lambda (legend, line): "Wort" in legend) |
123 | 129 |
124 graph_args += (line for (legend, line) in sensor_lines) | 130 graph_args += (line for (legend, line) in sensor_lines) |
131 | |
132 print>>sys.stderr, '\n'.join(graph_args) | |
133 | |
134 # calculated bits | |
135 colour = '000000' | |
136 print_legend = 'Heat' | |
137 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()) | |
139 graph_args.append('CDEF:fermheat=wortdel,80,*,tempdel,0.9,*,+' % locals()) | |
140 graph_args.append('CDEF:trendfermheat=fermheat,10800,TRENDNAN' % locals()) | |
141 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()) | |
125 | 143 |
126 end = int(start+length) | 144 end = int(start+length) |
127 start = int(start) | 145 start = int(start) |
128 | 146 |
129 tempf = tempfile.NamedTemporaryFile() | 147 tempf = tempfile.NamedTemporaryFile() |