Units can display the temperature

Sat, 12 Jul 2014 19:22:13 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 12 Jul 2014 19:22:13 +0200
changeset 102
e37b9c571a56
parent 101
1302abe92eb1
child 103
99c47a8a61cb

Units can display the temperature

www-thermferm/liveview.php file | annotate | diff | comparison | revisions
--- a/www-thermferm/liveview.php	Sat Jul 12 17:57:53 2014 +0200
+++ b/www-thermferm/liveview.php	Sat Jul 12 19:22:13 2014 +0200
@@ -29,6 +29,7 @@
 function showunit($unit)
 {
     $outstr = '';
+    $air_state = $beer_state = 1;
 
     $sock = open_socket();
     if ($sock == false) {
@@ -83,8 +84,25 @@
 	    if (strcmp($vals[0], "MODE") == 0) {
 		$outstr .= '      mode ' . $vals[1] . '<br>' .PHP_EOL;
 	    }
+	    if (strcmp($vals[0], "AIR_STATE") == 0) {
+		$air_state = $vals[1];
+	    }
+	    if (strcmp($vals[0], "AIR_TEMPERATURE") == 0) {
+		if ($air_state == 0)
+		    $outstr .= '      air temperature ' . $vals[1] . '<br>' .PHP_EOL;
+		else
+		    $outstr .= '      air temperature N/A<br>' .PHP_EOL;		
+	    }
+	    if (strcmp($vals[0], "BEER_STATE") == 0) {
+		$beer_state = $vals[1];
+	    }
+	    if (strcmp($vals[0], "BEER_TEMPERATURE") == 0) {
+		if ($beer_state == 0)
+		    $outstr .= '      beer temperature ' . $vals[1] . '<br>' .PHP_EOL;
+		else
+		    $outstr .= '      beer temperature N/A<br>' .PHP_EOL;    
+	    }
 	}
-	$outstr .= '      temp 12.3'.PHP_EOL;
 	$outstr .= '     </div>'.PHP_EOL;
     	$outstr .= '    </div>'.PHP_EOL;
     }

mercurial