29 function showunit($unit, $unr, $name) |
29 function showunit($unit, $unr, $name) |
30 { |
30 { |
31 global $my_style; |
31 global $my_style; |
32 |
32 |
33 $outstr = ' <!-- showunit(' . $unit . ', ' . $unr . ', ' . $name . ') -->' . PHP_EOL; |
33 $outstr = ' <!-- showunit(' . $unit . ', ' . $unr . ', ' . $name . ') -->' . PHP_EOL; |
34 $air_state = $beer_state = 1; |
34 $air_state = $beer_state = $chiller_state = 1; |
35 $answer = send_cmd("UNIT GET ".$unit); |
35 $answer = send_cmd("UNIT GET ".$unit); |
36 $arr = explode("\r\n", $answer); |
36 $arr = explode("\r\n", $answer); |
37 |
37 |
38 if (startsWith($arr[0], "213")) { |
38 if (startsWith($arr[0], "213")) { |
39 |
39 |
40 $set_temperature_lo = "NA"; |
40 $set_temperature_lo = "NA"; |
41 $set_temperature_hi = "NA"; |
41 $set_temperature_hi = "NA"; |
42 $air_temperature = "NA"; |
42 $air_temperature = "NA"; |
43 $beer_temperature = "NA"; |
43 $beer_temperature = "NA"; |
|
44 $chiller_temperature = "NA"; |
44 $profile = ""; |
45 $profile = ""; |
45 $prof_state = "OFF"; |
46 $prof_state = "OFF"; |
46 $power_led = $cooler_led = $heater_led = $fan_led = "off"; |
47 $power_led = $cooler_led = $heater_led = $fan_led = "off"; |
47 $heater = $cooler = $chiller = $fan = "no"; |
48 $heater = $cooler = $fan = "no"; |
48 $heater_state = $cooler_state = $chiller_state = $fan_state = 0; |
49 $heater_state = $cooler_state = $fan_state = 0; |
49 |
50 |
50 foreach($arr as $l) { |
51 foreach($arr as $l) { |
51 $vals = explode(",", $l); |
52 $vals = explode(",", $l); |
52 if (strcmp($vals[0], "MODE") == 0) { |
53 if (strcmp($vals[0], "MODE") == 0) { |
53 $mode = $vals[1]; |
54 $mode = $vals[1]; |
64 $beer_state = $vals[1]; |
65 $beer_state = $vals[1]; |
65 } |
66 } |
66 if ((strcmp($vals[0], "BEER_TEMPERATURE") == 0) && ($beer_state == 0)) { |
67 if ((strcmp($vals[0], "BEER_TEMPERATURE") == 0) && ($beer_state == 0)) { |
67 $beer_temperature = $vals[1]; |
68 $beer_temperature = $vals[1]; |
68 } |
69 } |
|
70 if (strcmp($vals[0], "CHILLER_STATE") == 0) { |
|
71 $chiller_state = $vals[1]; |
|
72 } |
|
73 if ((strcmp($vals[0], "CHILLER_TEMPERATURE") == 0) && ($chiller_state == 0)) { |
|
74 $chiller_temperature = $vals[1]; |
|
75 } |
69 if ((strcmp($vals[0], "HEATER_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) { |
76 if ((strcmp($vals[0], "HEATER_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) { |
70 $heater = "yes"; |
77 $heater = "yes"; |
71 } |
78 } |
72 if (strcmp($vals[0], "HEATER_STATE") == 0) { |
79 if (strcmp($vals[0], "HEATER_STATE") == 0) { |
73 $heater_state = $vals[1]; |
80 $heater_state = $vals[1]; |
75 if ((strcmp($vals[0], "COOLER_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) { |
82 if ((strcmp($vals[0], "COOLER_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) { |
76 $cooler = "yes"; |
83 $cooler = "yes"; |
77 } |
84 } |
78 if (strcmp($vals[0], "COOLER_STATE") == 0) { |
85 if (strcmp($vals[0], "COOLER_STATE") == 0) { |
79 $cooler_state = $vals[1]; |
86 $cooler_state = $vals[1]; |
80 } |
|
81 if ((strcmp($vals[0], "CHILLER_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) { |
|
82 $chiller = "yes"; |
|
83 } |
|
84 if (strcmp($vals[0], "CHILLER_STATE") == 0) { |
|
85 $chiller_state = $vals[1]; |
|
86 } |
87 } |
87 if ((strcmp($vals[0], "FAN_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) { |
88 if ((strcmp($vals[0], "FAN_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) { |
88 $fan = "yes"; |
89 $fan = "yes"; |
89 } |
90 } |
90 if (strcmp($vals[0], "FAN_STATE") == 0) { |
91 if (strcmp($vals[0], "FAN_STATE") == 0) { |
153 $outstr .= ' ranges: [{ startValue: -20, endValue: 0, style: { fill: \'#3399FF\', stroke: \'#3399FF\' }},'.PHP_EOL; |
154 $outstr .= ' ranges: [{ startValue: -20, endValue: 0, style: { fill: \'#3399FF\', stroke: \'#3399FF\' }},'.PHP_EOL; |
154 $outstr .= ' { startValue: 1, endValue: 25, style: { fill: \'#FC6A6A\', stroke: \'#FC6A6A\' }}],'.PHP_EOL; |
155 $outstr .= ' { startValue: 1, endValue: 25, style: { fill: \'#FC6A6A\', stroke: \'#FC6A6A\' }}],'.PHP_EOL; |
155 $outstr .= ' ticksMinor: { interval: 1, size: \'5%\' },'.PHP_EOL; |
156 $outstr .= ' ticksMinor: { interval: 1, size: \'5%\' },'.PHP_EOL; |
156 $outstr .= ' ticksMajor: { interval: 5, size: \'9%\' },'.PHP_EOL; |
157 $outstr .= ' ticksMajor: { interval: 5, size: \'9%\' },'.PHP_EOL; |
157 $outstr .= ' labels: { interval: 5, position: \'far\' },'.PHP_EOL; |
158 $outstr .= ' labels: { interval: 5, position: \'far\' },'.PHP_EOL; |
158 $outstr .= ' value: 0,'.PHP_EOL; |
159 $outstr .= ' value: '.$chiller_temperature.','.PHP_EOL; |
159 $outstr .= ' ticksPosition: \'far\','.PHP_EOL; |
160 $outstr .= ' ticksPosition: \'far\','.PHP_EOL; |
160 $outstr .= ' colorScheme: \'scheme04\','.PHP_EOL; |
161 $outstr .= ' colorScheme: \'scheme04\','.PHP_EOL; |
161 $outstr .= ' animationDuration: 1200'.PHP_EOL; |
162 $outstr .= ' animationDuration: 1200'.PHP_EOL; |
162 $outstr .= ' });'.PHP_EOL; |
163 $outstr .= ' });'.PHP_EOL; |
163 } |
164 } |
171 if ("$beer_state" == "OK") { |
172 if ("$beer_state" == "OK") { |
172 $outstr .= ' $("#load_beer_'.$unr.'").html(data.beer_temperature);'.PHP_EOL; |
173 $outstr .= ' $("#load_beer_'.$unr.'").html(data.beer_temperature);'.PHP_EOL; |
173 $outstr .= ' $("#gaugeContainer_beer'.$unr.'").jqxGauge(\'value\', data.beer_temperature);'.PHP_EOL; |
174 $outstr .= ' $("#gaugeContainer_beer'.$unr.'").jqxGauge(\'value\', data.beer_temperature);'.PHP_EOL; |
174 } |
175 } |
175 if ("$chiller_state" == "OK") { |
176 if ("$chiller_state" == "OK") { |
176 $outstr .= ' $("#load_chiller_'.$unr.'").html(data.chiller_temperature);'.PHP_EOL; |
|
177 $outstr .= ' $("#gaugeContainer_chiller'.$unr.'").jqxGauge(\'value\', data.chiller_temperature);'.PHP_EOL; |
177 $outstr .= ' $("#gaugeContainer_chiller'.$unr.'").jqxGauge(\'value\', data.chiller_temperature);'.PHP_EOL; |
178 } |
178 } |
179 $outstr .= ' $("#load_target_lo_'.$unr.'").html(data.target_temperature_lo);'.PHP_EOL; |
179 $outstr .= ' $("#load_target_lo_'.$unr.'").html(data.target_temperature_lo);'.PHP_EOL; |
180 $outstr .= ' $("#load_target_hi_'.$unr.'").html(data.target_temperature_hi);'.PHP_EOL; |
180 $outstr .= ' $("#load_target_hi_'.$unr.'").html(data.target_temperature_hi);'.PHP_EOL; |
181 $outstr .= ' $("#load_select_'.$unr.'").html(data.mode);'.PHP_EOL; |
181 $outstr .= ' $("#load_select_'.$unr.'").html(data.mode);'.PHP_EOL; |