Tue, 11 Nov 2014 16:19:07 +0100
Fixed logfile header
171
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | <?php |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | /***************************************************************************** |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * Copyright (C) 2014 |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * Michiel Broek <mbroek at mbse dot eu> |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * This file is part of ThermFerm |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * This is free software; you can redistribute it and/or modify it |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * under the terms of the GNU General Public License as published by the |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * Free Software Foundation; either version 2, or (at your option) any |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * later version. |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * ThermFerm is distributed in the hope that it will be useful, but |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * General Public License for more details. |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | * |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | * along with ThermFerm; see the file COPYING. If not, write to the Free |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | *****************************************************************************/ |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | require_once('utilities.php'); |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | if (isset($_GET["uuid"])) |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | $uuid = $_GET["uuid"]; |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | else |
284
9e6fb5aed618
Profile progress is visible in the web interface
Michiel Broek <mbroek@mbse.eu>
parents:
257
diff
changeset
|
29 | $uuid = "48c9ae27-3f58-41c9-ae4b-1d57b249c45a"; |
171
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | |
196 | 31 | $answer = send_cmd('UNIT GET '.$uuid); |
171
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | $arr = explode("\r\n", $answer); |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | $air_temperature = "NA"; |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | $air_state = "NA"; |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | $beer_temperature = "NA"; |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | $beer_state = "NA"; |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | $target_temperature = "NA"; |
257
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
39 | $led1 = $led2 = $led3 = $sw1 = $sw2 = $sw3 = ""; |
171
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | $fridge_set = "NA"; |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
41 | $beer_set = "NA"; |
257
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
42 | $heater = $cooler = $fan = "no"; |
284
9e6fb5aed618
Profile progress is visible in the web interface
Michiel Broek <mbroek@mbse.eu>
parents:
257
diff
changeset
|
43 | $prof_state = "OFF"; |
257
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
44 | |
171
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
45 | |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
46 | if (startsWith($arr[0], "213")) { |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | $j = 1; |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
48 | while (1) { |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
49 | if (strcmp($arr[$j], ".") == 0) |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
50 | break; |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
51 | $f = explode(",", $arr[$j]); |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
52 | |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
53 | if ($f[0] == "AIR_STATE") |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
54 | $air_state = $f[1]; |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
55 | if (($f[0] == "AIR_TEMPERATURE") && ($air_state == "OK")) |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
56 | $air_temperature = $f[1]; |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
57 | if ($f[0] == "BEER_STATE") |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
58 | $beer_state = $f[1]; |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
59 | if (($f[0] == "BEER_TEMPERATURE") && ($beer_state == "OK")) |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
60 | $beer_temperature = $f[1]; |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
61 | if ($f[0] == "MODE") |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
62 | $mode = $f[1]; |
257
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
63 | if (($f[0] == "COOLER_ADDRESS") && (strcmp($f[1], "(null)"))) |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
64 | $cooler = "yes"; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
65 | if ($f[0] == "COOLER_STATE") { |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
66 | $cooler_state = $f[1]; |
225
b18b06c17a80
Changed CSS colors for the LED's. Removed the old LED's.
Michiel Broek <mbroek@mbse.eu>
parents:
196
diff
changeset
|
67 | $led1 = $f[1] ? '<div class="LEDgreen_on"></div>' : '<div class="LEDgreen_off"></div>'; |
257
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
68 | } |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
69 | if (($f[0] == "HEATER_ADDRESS") && (strcmp($f[1], "(null)"))) |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
70 | $heater = "yes"; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
71 | if ($f[0] == "HEATER_STATE") { |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
72 | $heater_state = $f[1]; |
225
b18b06c17a80
Changed CSS colors for the LED's. Removed the old LED's.
Michiel Broek <mbroek@mbse.eu>
parents:
196
diff
changeset
|
73 | $led2 = $f[1] ? '<div class="LEDgreen_on"></div>' : '<div class="LEDgreen_off"></div>'; |
257
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
74 | } |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
75 | if (($f[0] == "FAN_ADDRESS") && (strcmp($f[1], "(null)"))) |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
76 | $fan = "yes"; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
77 | if ($f[0] == "FAN_STATE") { |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
78 | $fan_state = $f[1]; |
225
b18b06c17a80
Changed CSS colors for the LED's. Removed the old LED's.
Michiel Broek <mbroek@mbse.eu>
parents:
196
diff
changeset
|
79 | $led3 = $f[1] ? '<div class="LEDgreen_on"></div>' : '<div class="LEDgreen_off"></div>'; |
257
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
80 | } |
171
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
81 | if (($f[0] == "BEER_SET") && ($mode == "BEER")) |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
82 | $target_temperature = $f[1]; |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | if (($f[0] == "FRIDGE_SET") && ($mode == "FRIDGE")) |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
84 | $target_temperature = $f[1]; |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
85 | if (($f[0] == "PROF_TARGET") && ($mode == "PROFILE")) |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
86 | $target_temperature = $f[1]; |
284
9e6fb5aed618
Profile progress is visible in the web interface
Michiel Broek <mbroek@mbse.eu>
parents:
257
diff
changeset
|
87 | if (($f[0] == "PROF_STATE") && ($mode == "PROFILE")) |
287
61be1e1711d3
Make ajax response for profile state the same as the startup state
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
88 | $prof_state = 'State: '.$f[1]; |
171
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
89 | $j++; |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
90 | } |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
91 | } |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
92 | |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
93 | |
257
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
94 | /* |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
95 | * Create the value for the mode select radio buttons |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
96 | */ |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
97 | strcmp($mode, "OFF") ? $se = "" : $se = " checked"; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
98 | $modestr = ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="OFF"'.$se.'>Off<br>'.PHP_EOL; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
99 | strcmp($mode, "NONE") ? $se = "" : $se = " checked"; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
100 | $modestr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="NONE"'.$se.'>None<br>'.PHP_EOL; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
101 | (strcmp($heater, "no") || strcmp($cooler, "no")) ? $dis = "" : $dis = " disabled"; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
102 | strcmp($mode, "FRIDGE") ? $se = "" : $se = " checked"; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
103 | $modestr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="FRIDGE"'.$se.$dis.'>Fridge<br>'.PHP_EOL; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
104 | strcmp($mode, "BEER") ? $se = "" : $se = " checked"; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
105 | $modestr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="BEER"'.$se.$dis.'>Beer<br>'.PHP_EOL; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
106 | strcmp($mode, "PROFILE") ? $se = "" : $se = " checked"; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
107 | $modestr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="PROFILE"'.$se.$dis.'>Profile'.PHP_EOL; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
108 | |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
109 | |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
110 | /* |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
111 | * Create the values for the on/off switches |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
112 | */ |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
113 | (($mode == "NONE") && ($cooler == "yes")) ? $dis = "" : $dis = " disabled"; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
114 | ($cooler_state == "0") ? $ch = " checked" : $ch = ""; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
115 | $sw1 = ' <input type="radio" name="CoolerState" onchange="this.form.submit()" value="0"'.$dis.$ch.'>Off<br>'.PHP_EOL; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
116 | ($cooler_state == "100") ? $ch = " checked" : $ch = ""; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
117 | $sw1 .= ' <input type="radio" name="CoolerState" onchange="this.form.submit()" value="100"'.$dis.$ch.'>On'.PHP_EOL; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
118 | |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
119 | (($mode == "NONE") && ($heater == "yes")) ? $dis = "" : $dis = " disabled"; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
120 | ($heater_state == "0") ? $ch = " checked" : $ch = ""; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
121 | $sw2 = ' <input type="radio" name="HeaterState" onchange="this.form.submit()" value="0"'.$dis.$ch.'>Off<br>'.PHP_EOL; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
122 | ($heater_state == "100") ? $ch = " checked" : $ch = ""; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
123 | $sw2 .= ' <input type="radio" name="HeaterState" onchange="this.form.submit()" value="100"'.$dis.$ch.'>On'.PHP_EOL; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
124 | |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
125 | (($mode == "NONE") && ($fan== "yes")) ? $dis = "" : $dis = " disabled"; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
126 | ($fan_state == "0") ? $ch = " checked" : $ch = ""; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
127 | $sw3 = ' <input type="radio" name="FanState" onchange="this.form.submit()" value="0"'.$dis.$ch.'>Off<br>'.PHP_EOL; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
128 | ($fan_state == "100") ? $ch = " checked" : $ch = ""; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
129 | $sw3 .= ' <input type="radio" name="FanState" onchange="this.form.submit()" value="100"'.$dis.$ch.'>On'.PHP_EOL; |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
130 | |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
131 | |
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
132 | |
171
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
133 | $reply = array ( |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
134 | 'air_temperature' => $air_temperature, |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
135 | 'beer_temperature' => $beer_temperature, |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
136 | 'target_temperature' => $target_temperature, |
257
abdba3f9d9e2
Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents:
225
diff
changeset
|
137 | 'mode' => $modestr, |
171
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
138 | 'led1' => $led1, |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
139 | 'led2' => $led2, |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
140 | 'led3' => $led3, |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
141 | 'sw1' => $sw1, |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
142 | 'sw2' => $sw2, |
284
9e6fb5aed618
Profile progress is visible in the web interface
Michiel Broek <mbroek@mbse.eu>
parents:
257
diff
changeset
|
143 | 'sw3' => $sw3, |
9e6fb5aed618
Profile progress is visible in the web interface
Michiel Broek <mbroek@mbse.eu>
parents:
257
diff
changeset
|
144 | 'profile_state' => $prof_state |
171
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
145 | ); |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
146 | |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
147 | |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
148 | echo json_encode($reply); |
15f92e5eecef
Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
149 | ?> |