www-thermferm/getstate.php

changeset 284
9e6fb5aed618
parent 257
abdba3f9d9e2
child 287
61be1e1711d3
equal deleted inserted replaced
283:affe4d2adc94 284:9e6fb5aed618
24 require_once('utilities.php'); 24 require_once('utilities.php');
25 25
26 if (isset($_GET["uuid"])) 26 if (isset($_GET["uuid"]))
27 $uuid = $_GET["uuid"]; 27 $uuid = $_GET["uuid"];
28 else 28 else
29 $uuid = "0e261929-486d-4117-897a-2b23509157c6"; 29 $uuid = "48c9ae27-3f58-41c9-ae4b-1d57b249c45a";
30 30
31 $answer = send_cmd('UNIT GET '.$uuid); 31 $answer = send_cmd('UNIT GET '.$uuid);
32 $arr = explode("\r\n", $answer); 32 $arr = explode("\r\n", $answer);
33 33
34 $air_temperature = "NA"; 34 $air_temperature = "NA";
38 $target_temperature = "NA"; 38 $target_temperature = "NA";
39 $led1 = $led2 = $led3 = $sw1 = $sw2 = $sw3 = ""; 39 $led1 = $led2 = $led3 = $sw1 = $sw2 = $sw3 = "";
40 $fridge_set = "NA"; 40 $fridge_set = "NA";
41 $beer_set = "NA"; 41 $beer_set = "NA";
42 $heater = $cooler = $fan = "no"; 42 $heater = $cooler = $fan = "no";
43 $prof_state = "OFF";
43 44
44 45
45 if (startsWith($arr[0], "213")) { 46 if (startsWith($arr[0], "213")) {
46 $j = 1; 47 $j = 1;
47 while (1) { 48 while (1) {
81 $target_temperature = $f[1]; 82 $target_temperature = $f[1];
82 if (($f[0] == "FRIDGE_SET") && ($mode == "FRIDGE")) 83 if (($f[0] == "FRIDGE_SET") && ($mode == "FRIDGE"))
83 $target_temperature = $f[1]; 84 $target_temperature = $f[1];
84 if (($f[0] == "PROF_TARGET") && ($mode == "PROFILE")) 85 if (($f[0] == "PROF_TARGET") && ($mode == "PROFILE"))
85 $target_temperature = $f[1]; 86 $target_temperature = $f[1];
87 if (($f[0] == "PROF_STATE") && ($mode == "PROFILE"))
88 $prof_state = $f[1];
86 $j++; 89 $j++;
87 } 90 }
88 } 91 }
89 92
90 93
135 'led1' => $led1, 138 'led1' => $led1,
136 'led2' => $led2, 139 'led2' => $led2,
137 'led3' => $led3, 140 'led3' => $led3,
138 'sw1' => $sw1, 141 'sw1' => $sw1,
139 'sw2' => $sw2, 142 'sw2' => $sw2,
140 'sw3' => $sw3 143 'sw3' => $sw3,
144 'profile_state' => $prof_state
141 ); 145 );
142 146
143 147
144 echo json_encode($reply); 148 echo json_encode($reply);
145 ?> 149 ?>

mercurial