Liveview completed the chiller thermometer.

Sat, 22 Jul 2017 23:34:50 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 22 Jul 2017 23:34:50 +0200
changeset 522
4d9ed666431d
parent 521
28d1f5188c1d
child 523
eca3813c21ee

Liveview completed the chiller thermometer.

www-thermferm/getstate.php file | annotate | diff | comparison | revisions
www-thermferm/liveview.php file | annotate | diff | comparison | revisions
--- a/www-thermferm/getstate.php	Sat Jul 22 23:04:44 2017 +0200
+++ b/www-thermferm/getstate.php	Sat Jul 22 23:34:50 2017 +0200
@@ -1,6 +1,6 @@
 <?php
 /*****************************************************************************
- * Copyright (C) 2014
+ * Copyright (C) 2014-2017
  *   
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -35,12 +35,14 @@
 $air_state = "NA";
 $beer_temperature = "NA";
 $beer_state = "NA";
+$chiller_temperature = "NA";
+$chiller_state = "NA";
 $target_temperature_lo = "NA";
 $target_temperature_hi = "NA";
 $led1 = $led2 = $led3 = $sw1 = $sw2 = $sw3 = "";
 $fridge_set = "NA";
 $beer_set = "NA";
-$heater = $cooler = $fan = $psu = $door = "no";
+$heater = $cooler = $chiller = $fan = $psu = $door = "no";
 $prof_state = "OFF";
 $mode = "NA";
 $cooler_state = "NA";
@@ -63,6 +65,10 @@
 		$beer_state = $f[1];
 	if (($f[0] == "BEER_TEMPERATURE") && ($beer_state == "OK"))
 		$beer_temperature = $f[1];
+	if ($f[0] == "CHILLER_STATE")
+	    	$chiller_state = $f[1];
+	if (($f[0] == "CHILLER_TEMPERATURE") && ($chiller_state == "OK"))
+	    	$chiller_temperature = $f[1];
 	if ($f[0] == "MODE")
 		$mode = $f[1];
 	if (($f[0] == "COOLER_ADDRESS") && (strcmp($f[1], "(null)")))
@@ -144,6 +150,7 @@
 $reply = array (
     'air_temperature'       => $air_temperature,
     'beer_temperature'      => $beer_temperature,
+    'chiller_temperature'   => $chiller_temperature,
     'target_temperature_lo' => $target_temperature_lo,
     'target_temperature_hi' => $target_temperature_hi,
     'mode'                  => $modestr,
--- a/www-thermferm/liveview.php	Sat Jul 22 23:04:44 2017 +0200
+++ b/www-thermferm/liveview.php	Sat Jul 22 23:34:50 2017 +0200
@@ -31,7 +31,7 @@
     global $my_style;
 
     $outstr = '    <!--  showunit(' . $unit . ', ' . $unr . ', ' . $name . ')  -->' . PHP_EOL;
-    $air_state = $beer_state = 1;
+    $air_state = $beer_state = $chiller_state = 1;
     $answer = send_cmd("UNIT GET ".$unit);
     $arr = explode("\r\n", $answer);
 
@@ -41,11 +41,12 @@
 	$set_temperature_hi = "NA";
 	$air_temperature = "NA";
 	$beer_temperature = "NA";
+	$chiller_temperature = "NA";
 	$profile = "";
 	$prof_state = "OFF";
 	$power_led = $cooler_led = $heater_led = $fan_led = "off";
-	$heater = $cooler = $chiller = $fan = "no";
-	$heater_state = $cooler_state = $chiller_state = $fan_state = 0;
+	$heater = $cooler = $fan = "no";
+	$heater_state = $cooler_state = $fan_state = 0;
 
 	foreach($arr as $l) {
 	    $vals = explode(",", $l);
@@ -66,6 +67,12 @@
 	    if ((strcmp($vals[0], "BEER_TEMPERATURE") == 0) && ($beer_state == 0)) {
 		$beer_temperature = $vals[1];
 	    }
+	    if (strcmp($vals[0], "CHILLER_STATE") == 0) {
+		$chiller_state = $vals[1];
+	    }
+	    if ((strcmp($vals[0], "CHILLER_TEMPERATURE") == 0) && ($chiller_state == 0)) {
+		$chiller_temperature = $vals[1];
+	    }
 	    if ((strcmp($vals[0], "HEATER_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) {
 		$heater = "yes";
 	    }
@@ -78,12 +85,6 @@
 	    if (strcmp($vals[0], "COOLER_STATE") == 0) {
 		$cooler_state = $vals[1];
 	    }
-	    if ((strcmp($vals[0], "CHILLER_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) {
-		$chiller = "yes";
-	    }
-	    if (strcmp($vals[0], "CHILLER_STATE") == 0) {
-		$chiller_state = $vals[1];
-	    }
 	    if ((strcmp($vals[0], "FAN_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) {
 		$fan = "yes";
 	    }
@@ -155,7 +156,7 @@
 	    $outstr .= '         ticksMinor: { interval: 1, size: \'5%\' },'.PHP_EOL;
 	    $outstr .= '         ticksMajor: { interval: 5, size: \'9%\' },'.PHP_EOL;
 	    $outstr .= '         labels: { interval: 5, position: \'far\' },'.PHP_EOL;
-	    $outstr .= '         value: 0,'.PHP_EOL;
+	    $outstr .= '         value: '.$chiller_temperature.','.PHP_EOL;
 	    $outstr .= '         ticksPosition: \'far\','.PHP_EOL;
 	    $outstr .= '         colorScheme: \'scheme04\','.PHP_EOL;
 	    $outstr .= '         animationDuration: 1200'.PHP_EOL;
@@ -173,7 +174,6 @@
 	    $outstr .= '           $("#gaugeContainer_beer'.$unr.'").jqxGauge(\'value\', data.beer_temperature);'.PHP_EOL;
 	}
 	if ("$chiller_state" == "OK") {
-	    $outstr .= '           $("#load_chiller_'.$unr.'").html(data.chiller_temperature);'.PHP_EOL;
 	    $outstr .= '           $("#gaugeContainer_chiller'.$unr.'").jqxGauge(\'value\', data.chiller_temperature);'.PHP_EOL;
 	}
 	$outstr .= '           $("#load_target_lo_'.$unr.'").html(data.target_temperature_lo);'.PHP_EOL;

mercurial