1 <?php |
|
2 /***************************************************************************** |
|
3 * Copyright (C) 2014-2019 |
|
4 * |
|
5 * Michiel Broek <mbroek at mbse dot eu> |
|
6 * |
|
7 * This file is part of ThermFerm |
|
8 * |
|
9 * This is free software; you can redistribute it and/or modify it |
|
10 * under the terms of the GNU General Public License as published by the |
|
11 * Free Software Foundation; either version 2, or (at your option) any |
|
12 * later version. |
|
13 * |
|
14 * ThermFerm is distributed in the hope that it will be useful, but |
|
15 * WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
17 * General Public License for more details. |
|
18 * |
|
19 * You should have received a copy of the GNU General Public License |
|
20 * along with ThermFerm; see the file COPYING. If not, write to the Free |
|
21 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
|
22 *****************************************************************************/ |
|
23 |
|
24 |
|
25 require_once('utilities.php'); |
|
26 |
|
27 |
|
28 |
|
29 function showunit($unit, $unr, $alias) |
|
30 { |
|
31 global $my_style; |
|
32 |
|
33 $outstr = ' <!-- showunit(' . $unit . ', ' . $unr . ', ' . $alias . ') -->' . PHP_EOL; |
|
34 $air_state = $beer_state = $chiller_state = 1; |
|
35 $answer = send_cmd("UNIT GET ".$unit); |
|
36 $arr = explode("\r\n", $answer); |
|
37 |
|
38 if (startsWith($arr[0], "213")) { |
|
39 |
|
40 $set_temperature_lo = "NA"; |
|
41 $set_temperature_hi = "NA"; |
|
42 $air_temperature = "NA"; |
|
43 $beer_temperature = "NA"; |
|
44 $chiller_temperature = "NA"; |
|
45 $profile_uuid = $profile_name = ""; |
|
46 $producr_code = ""; |
|
47 $product_name = ""; |
|
48 $prof_state = "OFF"; |
|
49 $power_led = $alarm_led = $cooler_led = $heater_led = $fan_led = "off"; |
|
50 $heater = $cooler = $fan = "no"; |
|
51 $heater_state = $cooler_state = $fan_state = 0; |
|
52 |
|
53 foreach($arr as $l) { |
|
54 // syslog(LOG_NOTICE, $l); |
|
55 $vals = explode(",", $l); |
|
56 if (strcmp($vals[0], "MODE") == 0) { |
|
57 $mode = $vals[1]; |
|
58 if (strcmp($mode, "OFF")) |
|
59 $power_led = "on"; |
|
60 } |
|
61 if (strcmp($vals[0], "PRODUCT_CODE") == 0) { |
|
62 $product_code = $vals[1]; |
|
63 } |
|
64 if (strcmp($vals[0], "PRODUCT_NAME") == 0) { |
|
65 $product_name = $vals[1]; |
|
66 } |
|
67 if (strcmp($vals[0], "AIR_STATE") == 0) { |
|
68 $air_state = $vals[1]; |
|
69 } |
|
70 if ((strcmp($vals[0], "AIR_TEMPERATURE") == 0) && (strcmp($air_state, "YES") == 0)) { |
|
71 $air_temperature = $vals[1]; |
|
72 } |
|
73 if (strcmp($vals[0], "BEER_STATE") == 0) { |
|
74 $beer_state = $vals[1]; |
|
75 } |
|
76 if ((strcmp($vals[0], "BEER_TEMPERATURE") == 0) && ($beer_state == 0)) { |
|
77 $beer_temperature = $vals[1]; |
|
78 } |
|
79 if (strcmp($vals[0], "CHILLER_STATE") == 0) { |
|
80 $chiller_state = $vals[1]; |
|
81 } |
|
82 if ((strcmp($vals[0], "CHILLER_TEMPERATURE") == 0) && ($chiller_state == 0)) { |
|
83 $chiller_temperature = $vals[1]; |
|
84 } |
|
85 if ((strcmp($vals[0], "HEATER_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) { |
|
86 $heater = "yes"; |
|
87 } |
|
88 if (strcmp($vals[0], "HEATER_STATE") == 0) { |
|
89 $heater_state = $vals[1]; |
|
90 } |
|
91 if ((strcmp($vals[0], "COOLER_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) { |
|
92 $cooler = "yes"; |
|
93 } |
|
94 if (strcmp($vals[0], "COOLER_STATE") == 0) { |
|
95 $cooler_state = $vals[1]; |
|
96 } |
|
97 if ((strcmp($vals[0], "FAN_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) { |
|
98 $fan = "yes"; |
|
99 } |
|
100 if (strcmp($vals[0], "FAN_STATE") == 0) { |
|
101 $fan_state = $vals[1]; |
|
102 } |
|
103 if (strcmp($vals[0], "PROFILE_UUID") == 0) { |
|
104 $profile_uuid = $vals[1]; |
|
105 } |
|
106 if (strcmp($vals[0], "PROFILE_NAME") == 0) { |
|
107 $profile_name = $vals[1]; |
|
108 } |
|
109 if (strcmp($vals[0], "PROF_STATE") == 0) { |
|
110 $prof_state = $vals[1]; |
|
111 } |
|
112 if (($vals[0] == "BEER_SET_LO") && ($mode == "BEER")) { |
|
113 $set_temperature_lo = $vals[1]; |
|
114 } |
|
115 if (($vals[0] == "BEER_SET_HI") && ($mode == "BEER")) { |
|
116 $set_temperature_hi = $vals[1]; |
|
117 } |
|
118 if (($vals[0] == "FRIDGE_SET_LO") && ($mode == "FRIDGE")) { |
|
119 $set_temperature_lo = $vals[1]; |
|
120 } |
|
121 if (($vals[0] == "FRIDGE_SET_HI") && ($mode == "FRIDGE")) { |
|
122 $set_temperature_hi = $vals[1]; |
|
123 } |
|
124 if (($vals[0] == "PROF_TARGET_LO") && ($mode == "PROFILE")) { |
|
125 $set_temperature_lo = $vals[1]; |
|
126 } |
|
127 if (($vals[0] == "PROF_TARGET_HI") && ($mode == "PROFILE")) { |
|
128 $set_temperature_hi = $vals[1]; |
|
129 } |
|
130 } |
|
131 |
|
132 $logname = $product_code . " " . $product_name; |
|
133 $outstr .= ' <script type="text/javascript">'.PHP_EOL; |
|
134 $outstr .= ' $(document).ready(function () {'.PHP_EOL; |
|
135 |
|
136 if ("$air_state" == "YES") { |
|
137 $outstr .= ' $("#gaugeContainer_air'.$unr.'").jqxGauge({'.PHP_EOL; |
|
138 $outstr .= ' min: -5, max: 45, width: 275, height: 275,'.PHP_EOL; |
|
139 $outstr .= ' ranges: [{ startValue: -5, endValue: 0, style: { fill: \'#3399FF\', stroke: \'#3399FF\' }, endWidth: 10, startWidth: 10 },'.PHP_EOL; |
|
140 $outstr .= ' { startValue: 0, endValue: 16, style: { fill: \'#00CC33\', stroke: \'#00CC33\' }, endWidth: 10, startWidth: 10 },'.PHP_EOL; |
|
141 $outstr .= ' { startValue: 16, endValue: 24, style: { fill: \'#FCA76A\', stroke: \'#FCA76A\' }, endWidth: 10, startWidth: 10 },'.PHP_EOL; |
|
142 $outstr .= ' { startValue: 24, endValue: 45, style: { fill: \'#FC6A6A\', stroke: \'#FC6A6A\' }, endWidth: 10, startWidth: 10 }],'.PHP_EOL; |
|
143 $outstr .= ' ticksMinor: { interval: 1, size: \'5%\' },'.PHP_EOL; |
|
144 $outstr .= ' ticksMajor: { interval: 5, size: \'9%\' },'.PHP_EOL; |
|
145 $outstr .= ' labels: { interval: 5 },'.PHP_EOL; |
|
146 $outstr .= ' value: '.$air_temperature.','.PHP_EOL; |
|
147 $outstr .= ' colorScheme: \'scheme05\','.PHP_EOL; |
|
148 $outstr .= ' animationDuration: 5000,'.PHP_EOL; |
|
149 $outstr .= ' caption: { value: \'Air\', position: \'bottom\', offset: [0, 10] }'.PHP_EOL; |
|
150 $outstr .= ' });'.PHP_EOL; |
|
151 } |
|
152 |
|
153 if ("$beer_state" == "YES") { |
|
154 $outstr .= ' $(\'#gaugeContainer_beer'.$unr.'\').jqxGauge({'.PHP_EOL; |
|
155 $outstr .= ' min: -5, max: 45, width: 275, height: 275,'.PHP_EOL; |
|
156 $outstr .= ' ranges: [{ startValue: -5, endValue: 0, style: { fill: \'#3399FF\', stroke: \'#3399FF\' }, endWidth: 10, startWidth: 10 },'.PHP_EOL; |
|
157 $outstr .= ' { startValue: 0, endValue: 16, style: { fill: \'#00CC33\', stroke: \'#00CC33\' }, endWidth: 10, startWidth: 10 },'.PHP_EOL; |
|
158 $outstr .= ' { startValue: 16, endValue: 24, style: { fill: \'#FCA76A\', stroke: \'#FCA76A\' }, endWidth: 10, startWidth: 10 },'.PHP_EOL; |
|
159 $outstr .= ' { startValue: 24, endValue: 45, style: { fill: \'#FC6A6A\', stroke: \'#FC6A6A\' }, endWidth: 10, startWidth: 10 }],'.PHP_EOL; |
|
160 $outstr .= ' ticksMinor: { interval: 1, size: \'5%\' },'.PHP_EOL; |
|
161 $outstr .= ' ticksMajor: { interval: 5, size: \'9%\' },'.PHP_EOL; |
|
162 $outstr .= ' labels: { interval: 5 },'.PHP_EOL; |
|
163 $outstr .= ' value: '.$beer_temperature.','.PHP_EOL; |
|
164 $outstr .= ' colorScheme: \'scheme05\','.PHP_EOL; |
|
165 $outstr .= ' animationDuration: 5000,'.PHP_EOL; |
|
166 $outstr .= ' caption: { value: \'Beer\', position: \'bottom\', offset: [0, 10] }'.PHP_EOL; |
|
167 $outstr .= ' });'.PHP_EOL; |
|
168 } |
|
169 |
|
170 if ("$chiller_state" == "YES") { |
|
171 $outstr .= ' $(\'#gaugeContainer_chiller'.$unr.'\').jqxGauge({'.PHP_EOL; |
|
172 $outstr .= ' min: -20, max: 25, width: 150, height: 150,'.PHP_EOL; |
|
173 $outstr .= ' ranges: [{ startValue: -20, endValue: 0, startWidth: 5, endWidth: 5, style: { fill: \'#3399FF\', stroke: \'#3399FF\' }},'.PHP_EOL; |
|
174 $outstr .= ' { startValue: 0, endValue: 25, startWidth: 5, endWidth: 5, style: { fill: \'#FC6A6A\', stroke: \'#FC6A6A\' }}],'.PHP_EOL; |
|
175 $outstr .= ' ticksMinor: { interval: 1, size: \'5%\' },'.PHP_EOL; |
|
176 $outstr .= ' ticksMajor: { interval: 5, size: \'9%\' },'.PHP_EOL; |
|
177 $outstr .= ' labels: { interval: 5 },'.PHP_EOL; |
|
178 $outstr .= ' value: '.$chiller_temperature.','.PHP_EOL; |
|
179 $outstr .= ' colorScheme: \'scheme05\','.PHP_EOL; |
|
180 $outstr .= ' animationDuration: 5000,'.PHP_EOL; |
|
181 $outstr .= ' caption: { value: \'Chiller\', position: \'bottom\', offset: [0, 10] }'.PHP_EOL; |
|
182 $outstr .= ' });'.PHP_EOL; |
|
183 } |
|
184 |
|
185 $outstr .= ' setInterval(function(){'.PHP_EOL; |
|
186 $outstr .= ' $.getJSON("getstate.php?uuid='.$unit.'", function(data) {'.PHP_EOL; |
|
187 if ("$air_state" == "YES") { |
|
188 $outstr .= ' $("#load_air_'.$unr.'").html(data.air_temperature);'.PHP_EOL; |
|
189 $outstr .= ' $("#gaugeContainer_air'.$unr.'").jqxGauge(\'value\', data.air_temperature);'.PHP_EOL; |
|
190 } |
|
191 if ("$beer_state" == "YES") { |
|
192 $outstr .= ' $("#load_beer_'.$unr.'").html(data.beer_temperature);'.PHP_EOL; |
|
193 $outstr .= ' $("#gaugeContainer_beer'.$unr.'").jqxGauge(\'value\', data.beer_temperature);'.PHP_EOL; |
|
194 } |
|
195 if ("$chiller_state" == "YES") { |
|
196 $outstr .= ' $("#gaugeContainer_chiller'.$unr.'").jqxGauge(\'value\', data.chiller_temperature);'.PHP_EOL; |
|
197 } |
|
198 $outstr .= ' $("#load_target_lo_'.$unr.'").html(data.target_temperature_lo);'.PHP_EOL; |
|
199 $outstr .= ' $("#load_target_hi_'.$unr.'").html(data.target_temperature_hi);'.PHP_EOL; |
|
200 $outstr .= ' $("#load_select_'.$unr.'").html(data.mode);'.PHP_EOL; |
|
201 $outstr .= ' $("#load_led1_'.$unr.'").html(data.led1);'.PHP_EOL; |
|
202 $outstr .= ' $("#load_led2_'.$unr.'").html(data.led2);'.PHP_EOL; |
|
203 $outstr .= ' $("#load_led3_'.$unr.'").html(data.led3);'.PHP_EOL; |
|
204 $outstr .= ' $("#load_sw1_'.$unr.'").html(data.sw1);'.PHP_EOL; |
|
205 $outstr .= ' $("#load_sw2_'.$unr.'").html(data.sw2);'.PHP_EOL; |
|
206 $outstr .= ' $("#load_sw3_'.$unr.'").html(data.sw3);'.PHP_EOL; |
|
207 if ($mode == "PROFILE") |
|
208 $outstr .= ' $("#prof_state_'.$unr.'").html(data.profile_state);'.PHP_EOL; |
|
209 $outstr .= ' $("#load_alarm_'.$unr.'").html(data.alarm);'.PHP_EOL; |
|
210 $outstr .= ' });'.PHP_EOL; |
|
211 $outstr .= ' }, 10000);'.PHP_EOL; |
|
212 |
|
213 /* |
|
214 * Tooltips |
|
215 */ |
|
216 $outstr .= ' $("#load_air_'.$unr.'").jqxTooltip({ content: "The measured air temperature.", theme: "'.$my_style.'" });'.PHP_EOL; |
|
217 $outstr .= ' $("#load_beer_'.$unr.'").jqxTooltip({ content: "The measured beer temperature.", theme: "'.$my_style.'" });'.PHP_EOL; |
|
218 $outstr .= ' $("#load_target_lo_'.$unr.'").jqxTooltip({ content: "The target low temperature.", theme: "'.$my_style.'" });'.PHP_EOL; |
|
219 $outstr .= ' $("#load_target_hi_'.$unr.'").jqxTooltip({ content: "The target high temperature.", theme: "'.$my_style.'" });'.PHP_EOL; |
|
220 $outstr .= ' $("#load_select_'.$unr.'").jqxTooltip({ content: "Select unit mode.", theme: "'.$my_style.'" });'.PHP_EOL; |
|
221 if (($mode == "NONE") && ($cooler == "yes")) |
|
222 $outstr .= ' $("#load_sw1_'.$unr.'").jqxTooltip({ content: "Manual control cooler.", theme: "'.$my_style.'" });'.PHP_EOL; |
|
223 if (($mode == "NONE") && ($heater == "yes")) |
|
224 $outstr .= ' $("#load_sw2_'.$unr.'").jqxTooltip({ content: "Manual control heater.", theme: "'.$my_style.'" });'.PHP_EOL; |
|
225 if (($mode == "NONE") && ($fan== "yes")) |
|
226 $outstr .= ' $("#load_sw3_'.$unr.'").jqxTooltip({ content: "Manual control fan.", theme: "'.$my_style.'" });'.PHP_EOL; |
|
227 |
|
228 $outstr .= ' });'.PHP_EOL; |
|
229 $outstr .= ' </script>'.PHP_EOL; |
|
230 |
|
231 $outstr .= ' <div id="fermentor">'.PHP_EOL; |
|
232 $outstr .= ' <div id="fermentor_thermometers">'.PHP_EOL; |
|
233 if (("$air_state" == "YES") && ("$beer_state" == "YES") && ("$chiller_state" == "YES")) { |
|
234 $outstr .= ' <div id="gaugeContainer_air'.$unr.'" style="float: left; margin-top: 10px; margin-left: 10px;"></div>'.PHP_EOL; |
|
235 $outstr .= ' <div id="gaugeContainer_beer'.$unr.'" style="float: right; margin-top: 10px; margin-right: 10px;"></div>'.PHP_EOL; |
|
236 $outstr .= ' <div id="gaugeContainer_chiller'.$unr.'" style="float: left; margin-top: 200px;"></div>'.PHP_EOL; |
|
237 } else if (("$air_state" == "YES") && ("$beer_state" == "YES")) { |
|
238 $outstr .= ' <div id="gaugeContainer_air'.$unr.'" style="float: left; margin-top: 48px; margin-left: 48px;"></div>'.PHP_EOL; |
|
239 $outstr .= ' <div id="gaugeContainer_beer'.$unr.'" style="float: right; margin-top: 48px; margin-right: 48px;"></div>'.PHP_EOL; |
|
240 } else if ("$air_state" == "YES") { |
|
241 $outstr .= ' <div id="gaugeContainer_air'.$unr.'" style="margin-top: 48px; margin-left: 222px;"></div>'.PHP_EOL; |
|
242 } |
|
243 $outstr .= ' </div>'.PHP_EOL; |
|
244 |
|
245 $outstr .= ' <div id="fermentor_panel_top">'.PHP_EOL; |
|
246 $outstr .= ' <div id="fermentor_selector">'.PHP_EOL; |
|
247 $outstr .= ' <form id="select_'.$unr.'" action="index.php" method="post">'.PHP_EOL; |
|
248 $outstr .= ' <div id="load_select_'.$unr.'">'.PHP_EOL; |
|
249 strcmp($mode, "OFF") ? $se = "" : $se = " checked"; |
|
250 $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="OFF"'.$se.'>Off<br>'.PHP_EOL; |
|
251 strcmp($mode, "NONE") ? $se = "" : $se = " checked"; |
|
252 $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="NONE"'.$se.'>None<br>'.PHP_EOL; |
|
253 (strcmp($heater, "no") || strcmp($cooler, "no")) ? $dis = "" : $dis = " disabled"; |
|
254 strcmp($mode, "FRIDGE") ? $se = "" : $se = " checked"; |
|
255 $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="FRIDGE"'.$se.$dis.'>Fridge<br>'.PHP_EOL; |
|
256 strcmp($mode, "BEER") ? $se = "" : $se = " checked"; |
|
257 $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="BEER"'.$se.$dis.'>Beer<br>'.PHP_EOL; |
|
258 strcmp($mode, "PROFILE") ? $se = "" : $se = " checked"; |
|
259 $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="PROFILE"'.$se.$dis.'>Profile'.PHP_EOL; |
|
260 $outstr .= ' </div>'.PHP_EOL; |
|
261 $outstr .= ' <input type="hidden" name="UUID" value="'.$unit.'">'.PHP_EOL; |
|
262 $outstr .= ' </form>'.PHP_EOL; |
|
263 $outstr .= ' </div>'.PHP_EOL; |
|
264 |
|
265 $outstr .= ' <div id="fermentor_alarmled">'.PHP_EOL; |
|
266 $outstr .= ' <div id="load_alarm_'.$unr.'"><div class="LEDred_'.$alarm_led.'"></div></div>Alm'.PHP_EOL; |
|
267 $outstr .= ' </div>'.PHP_EOL; |
|
268 $outstr .= ' <div id="fermentor_powerled">'.PHP_EOL; |
|
269 $outstr .= ' <div class="LEDblue_'.$power_led.'"></div>Pwr'.PHP_EOL; |
|
270 $outstr .= ' </div>'.PHP_EOL; |
|
271 |
|
272 $outstr .= ' <div id="fermentor_mode_control">'.PHP_EOL; |
|
273 if ($mode == "FRIDGE") { |
|
274 $outstr .= ' <form id="set_fridge_'.$unr.'" action="index.php" method="post">'.PHP_EOL; |
|
275 $outstr .= ' <input type="text" name="Fridge_lo" size="5" value="'.$set_temperature_lo.'"><br>'.PHP_EOL; |
|
276 $outstr .= ' <input type="text" name="Fridge_hi" size="5" value="'.$set_temperature_hi.'"><br>'.PHP_EOL; |
|
277 $outstr .= ' <input type="submit" value="Set" name="key">'.PHP_EOL; |
|
278 $outstr .= ' <input type="hidden" value="'.$unit.'" name="UUID">'.PHP_EOL; |
|
279 $outstr .= ' </form>'.PHP_EOL; |
|
280 } |
|
281 if ($mode == "BEER") { |
|
282 $outstr .= ' <form id="set_beer_'.$unr.'" action="index.php" method="post">'.PHP_EOL; |
|
283 $outstr .= ' <input type="text" name="Beer_lo" size="5" value="'.$set_temperature_lo.'">'.PHP_EOL; |
|
284 $outstr .= ' <input type="text" name="Beer_hi" size="5" value="'.$set_temperature_hi.'">'.PHP_EOL; |
|
285 $outstr .= ' <input type="submit" value="Set" name="key">'.PHP_EOL; |
|
286 $outstr .= ' <input type="hidden" value="'.$unit.'" name="UUID">'.PHP_EOL; |
|
287 $outstr .= ' </form>'.PHP_EOL; |
|
288 } |
|
289 if ($mode == "PROFILE") { |
|
290 $outstr .= ' <div style="color: blue; width: 148px; height: 23px; overflow: hidden;">Profile: '.$profile_name.'</div>'.PHP_EOL; |
|
291 $outstr .= ' <div id="prof_state_'.$unr.'" style="color: blue; width: 148px; height: 23px; overflow: hidden;">State: '.$prof_state.'</div>'.PHP_EOL; |
|
292 |
|
293 $outstr .= ' <form id="set_profile_'.$unr.'" action="index.php" method="post">'.PHP_EOL; |
|
294 if ($prof_state == "OFF") { |
|
295 if ($profile_name != "") |
|
296 $outstr .= ' <input type="submit" value="Start" name="key">'.PHP_EOL; |
|
297 |
|
298 } else if (startsWith($prof_state, "RUN")) { |
|
299 $outstr .= ' <input type="submit" value="Pause" name="key">'.PHP_EOL; |
|
300 $outstr .= ' <input type="submit" value="Abort" name="key">'.PHP_EOL; |
|
301 } else if ($prof_state == "PAUSE") { |
|
302 $outstr .= ' <input type="submit" value="Resume" name="key">'.PHP_EOL; |
|
303 $outstr .= ' <input type="submit" value="Abort" name="key">'.PHP_EOL; |
|
304 } else if ($prof_state == "DONE") { |
|
305 $outstr .= ' <input type="submit" value="Off" name="key">'.PHP_EOL; |
|
306 } |
|
307 $outstr .= ' <input type="hidden" value="'.$profile_uuid.'" name="SetProfile">'.PHP_EOL; // Only to select the right form. |
|
308 $outstr .= ' <input type="hidden" value="'.$unit.'" name="UUID">'.PHP_EOL; |
|
309 $outstr .= ' </form>'.PHP_EOL; |
|
310 } |
|
311 $outstr .= ' </div>'.PHP_EOL; |
|
312 $outstr .= ' </div> <!-- fermentor_panel_top -->'.PHP_EOL; |
|
313 |
|
314 $outstr .= ' <div id="fermentor_panel_display">'.PHP_EOL; |
|
315 $outstr .= ' <div id="fermentor_display1">'.PHP_EOL; |
|
316 $outstr .= ' <div id="load_target_hi_'.$unr.'" class="htemp">'.$set_temperature_hi.'</div>'.PHP_EOL; |
|
317 $outstr .= ' <div id="load_target_lo_'.$unr.'" class="ltemp">'.$set_temperature_lo.'</div>'.PHP_EOL; |
|
318 $outstr .= ' </div>'.PHP_EOL; |
|
319 $outstr .= ' <div id="fermentor_display2">'.PHP_EOL; |
|
320 $outstr .= ' <div id="load_air_'.$unr.'" class="dtemp">'.$air_temperature.'</div>Air'.PHP_EOL; |
|
321 $outstr .= ' </div>'.PHP_EOL; |
|
322 $outstr .= ' <div id="fermentor_display3">'.PHP_EOL; |
|
323 $outstr .= ' <div id="load_beer_'.$unr.'" class="dtemp">'.$beer_temperature.'</div>Beer'.PHP_EOL; |
|
324 $outstr .= ' </div>'.PHP_EOL; |
|
325 $outstr .= ' </div> <!-- fermentor_panel_display -->'.PHP_EOL; |
|
326 |
|
327 $outstr .= ' <div id="fermentor_panel_control">'.PHP_EOL; |
|
328 if ($cooler_state) |
|
329 $cooler_led = "on"; |
|
330 $outstr .= ' <div id="fermentor_led1">'.PHP_EOL; |
|
331 $outstr .= ' <div id="load_led1_'.$unr.'"><div class="LEDgreen_'.$cooler_led.'"></div></div>Cool'.PHP_EOL; |
|
332 $outstr .= ' </div>'.PHP_EOL; |
|
333 if ($heater_state) |
|
334 $heater_led = "on"; |
|
335 $outstr .= ' <div id="fermentor_led2">'.PHP_EOL; |
|
336 $outstr .= ' <div id="load_led2_'.$unr.'"><div class="LEDgreen_'.$heater_led.'"></div></div>Heat'.PHP_EOL; |
|
337 $outstr .= ' </div>'.PHP_EOL; |
|
338 if ($fan_state) |
|
339 $fan_led = "on"; |
|
340 $outstr .= ' <div id="fermentor_led3">'.PHP_EOL; |
|
341 $outstr .= ' <div id="load_led3_'.$unr.'"><div class="LEDgreen_'.$fan_led.'"></div></div>Fan'.PHP_EOL; |
|
342 $outstr .= ' </div>'.PHP_EOL; |
|
343 |
|
344 $outstr .= ' <div id="fermentor_toggle1">'.PHP_EOL; |
|
345 $outstr .= ' <form action="index.php" method="post">'.PHP_EOL; |
|
346 (($mode == "NONE") && ($cooler == "yes")) ? $dis = "" : $dis = " disabled"; |
|
347 ($cooler_state == "0") ? $ch = " checked" : $ch = ""; |
|
348 $outstr .= ' <div id="load_sw1_'.$unr.'">'.PHP_EOL; |
|
349 $outstr .= ' <input type="radio" name="CoolerState" onchange="this.form.submit()" value="0"'.$dis.$ch.'>Off<br>'.PHP_EOL; |
|
350 ($cooler_state == "100") ? $ch = " checked" : $ch = ""; |
|
351 $outstr .= ' <input type="radio" name="CoolerState" onchange="this.form.submit()" value="100"'.$dis.$ch.'>On'.PHP_EOL; |
|
352 $outstr .= ' </div>'.PHP_EOL; |
|
353 $outstr .= ' <input type="hidden" name="UUID" value="'.$unit.'">'.PHP_EOL; |
|
354 $outstr .= ' </form>'.PHP_EOL; |
|
355 $outstr .= ' </div>'.PHP_EOL; |
|
356 |
|
357 $outstr .= ' <div id="fermentor_toggle2">'.PHP_EOL; |
|
358 $outstr .= ' <form action="index.php" method="post">'.PHP_EOL; |
|
359 (($mode == "NONE") && ($heater == "yes")) ? $dis = "" : $dis = " disabled"; |
|
360 ($heater_state == "0") ? $ch = " checked" : $ch = ""; |
|
361 $outstr .= ' <div id="load_sw2_'.$unr.'">'.PHP_EOL; |
|
362 $outstr .= ' <input type="radio" name="HeaterState" onchange="this.form.submit()" value="0"'.$dis.$ch.'>Off<br>'.PHP_EOL; |
|
363 ($heater_state == "100") ? $ch = " checked" : $ch = ""; |
|
364 $outstr .= ' <input type="radio" name="HeaterState" onchange="this.form.submit()" value="100"'.$dis.$ch.'>On'.PHP_EOL; |
|
365 $outstr .= ' </div>'.PHP_EOL; |
|
366 $outstr .= ' <input type="hidden" name="UUID" value="'.$unit.'">'.PHP_EOL; |
|
367 $outstr .= ' </form>'.PHP_EOL; |
|
368 $outstr .= ' </div>'.PHP_EOL; |
|
369 |
|
370 $outstr .= ' <div id="fermentor_toggle3">'.PHP_EOL; |
|
371 $outstr .= ' <form action="index.php" method="post">'.PHP_EOL; |
|
372 (($mode == "NONE") && ($fan== "yes")) ? $dis = "" : $dis = " disabled"; |
|
373 ($fan_state == "0") ? $ch = " checked" : $ch = ""; |
|
374 $outstr .= ' <div id="load_sw3_'.$unr.'">'.PHP_EOL; |
|
375 $outstr .= ' <input type="radio" name="FanState" onchange="this.form.submit()" value="0"'.$dis.$ch.'>Off<br>'.PHP_EOL; |
|
376 ($fan_state == "100") ? $ch = " checked" : $ch = ""; |
|
377 $outstr .= ' <input type="radio" name="FanState" onchange="this.form.submit()" value="100"'.$dis.$ch.'>On'.PHP_EOL; |
|
378 $outstr .= ' </div>'.PHP_EOL; |
|
379 $outstr .= ' <input type="hidden" name="UUID" value="'.$unit.'">'.PHP_EOL; |
|
380 $outstr .= ' </form>'.PHP_EOL; |
|
381 $outstr .= ' </div>'.PHP_EOL; |
|
382 $outstr .= ' </div> <!-- fermentor_panel_control -->'.PHP_EOL; |
|
383 |
|
384 $outstr .= ' </div> <!-- fermentor -->'.PHP_EOL; |
|
385 } |
|
386 |
|
387 return $outstr; |
|
388 } |
|
389 |
|
390 |
|
391 |
|
392 function liveview() |
|
393 { |
|
394 $outstr = PHP_EOL; |
|
395 |
|
396 $answer = send_cmd("LIST"); |
|
397 if (strlen($answer)) { |
|
398 $arr = explode("\r\n", $answer); |
|
399 |
|
400 $outstr .= ' <div id="jqxTabs">'.PHP_EOL; |
|
401 $outstr .= ' <ul>'.PHP_EOL; |
|
402 if (startsWith($arr[0], "212")) { |
|
403 $i = 1; |
|
404 while (1) { |
|
405 if (strcmp($arr[$i], ".") == 0) |
|
406 break; |
|
407 $parts = explode(",", $arr[$i]); |
|
408 $outstr .= ' <li style="margin-left: 20px;">'.$parts[1].'</li>'.PHP_EOL; |
|
409 $i++; |
|
410 } |
|
411 } |
|
412 $outstr .= ' </ul>'.PHP_EOL; |
|
413 |
|
414 if (startsWith($arr[0], "212")) { |
|
415 $i = 1; |
|
416 while (1) { |
|
417 if (strcmp($arr[$i], ".") == 0) |
|
418 break; |
|
419 $parts = explode(",", $arr[$i]); |
|
420 $outstr .= showunit($parts[0], $i, $parts[1]); |
|
421 $i++; |
|
422 } |
|
423 } |
|
424 $outstr .= ' </div> <!-- jqxTabs -->'.PHP_EOL; |
|
425 } |
|
426 |
|
427 return $outstr; |
|
428 } |
|
429 |
|
430 |
|
431 ?> |
|