diff -r 9eaaba49450f -r b34a1b2421fb www-thermferm/liveview.php
--- a/www-thermferm/liveview.php Thu Aug 07 22:06:18 2014 +0200
+++ b/www-thermferm/liveview.php Fri Aug 08 23:07:44 2014 +0200
@@ -54,6 +54,8 @@
$set_temperature = "NA";
$air_temperature = "NA";
$beer_temperature = "NA";
+ $profile = "";
+ $prof_state = "OFF";
$power_led = $cooler_led = $heater_led = $fan_led = "off";
$heater = $cooler = $fan = "no";
$heater_state = $cooler_state = $fan_state = 0;
@@ -95,6 +97,12 @@
if (strcmp($vals[0], "FAN_STATE") == 0) {
$fan_state = $vals[1];
}
+ if (strcmp($vals[0], "PROFILE") == 0) {
+ $profile = $vals[1];
+ }
+ if (strcmp($vals[0], "PROF_STATE") == 0) {
+ $prof_state = $vals[1];
+ }
if (($vals[0] == "BEER_SET") && ($mode == "BEER")) {
$set_temperature = $vals[1];
}
@@ -203,9 +211,97 @@
$outstr .= ' '.PHP_EOL;
$outstr .= ' '.PHP_EOL;
$outstr .= ' '.PHP_EOL;
+
$outstr .= '
'.PHP_EOL;
$outstr .= '
Pwr'.PHP_EOL;
$outstr .= '
'.PHP_EOL;
+
+ $outstr .= ' '.PHP_EOL;
+ if ($mode == "FRIDGE") {
+ $outstr .= '
'.PHP_EOL;
+ }
+ if ($mode == "BEER") {
+ $outstr .= '
'.PHP_EOL;
+ }
+ if ($mode == "PROFILE") {
+ /*
+ * First, load a list with available profiles.
+ */
+ $sock = open_socket();
+ if ($sock == true) {
+ socket_write($sock, "PROFILE LIST", 4096);
+ $answer = "";
+ while (1) {
+ $line = socket_read($sock, 4096);
+ if ($line === '')
+ break;
+ $answer .= $line;
+ }
+ socket_close($sock);
+ $reply = explode("\r\n", $answer);
+ }
+
+ /*
+ * Show loaded profile.
+ */
+ if ($profile == "(null)") {
+ $prof_name = "None";
+ }else {
+ if (startsWith($reply[0], "212")) {
+ $i = 1;
+ while (1) {
+ if (strcmp($reply[$i], ".") == 0)
+ break;
+ $f = explode(",", $reply[$i]);
+ if ($f[0] == $profile) {
+ $prof_name = $f[1];
+ break;
+ }
+ $i++;
+ }
+ }
+ }
+ $outstr .= '
Profile: '.$prof_name.'
'.PHP_EOL;
+
+ $outstr .= '
'.PHP_EOL;
+ }
+ $outstr .= '
'.PHP_EOL;
$outstr .= ' '.PHP_EOL;
$outstr .= ' '.PHP_EOL;