Small web page changes

Wed, 31 May 2017 16:29:52 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 31 May 2017 16:29:52 +0200
changeset 512
fd1354e2a045
parent 511
2d1d43c3a2c2
child 513
a2732027afb3

Small web page changes

www-thermferm/getalog.php file | annotate | diff | comparison | revisions
www-thermferm/getlog.php file | annotate | diff | comparison | revisions
www-thermferm/getroom.php file | annotate | diff | comparison | revisions
www-thermferm/index.php file | annotate | diff | comparison | revisions
--- a/www-thermferm/getalog.php	Sun May 28 14:19:57 2017 +0200
+++ b/www-thermferm/getalog.php	Wed May 31 16:29:52 2017 +0200
@@ -1,6 +1,6 @@
 <?php
 /*****************************************************************************
- * Copyright (C) 2015
+ * Copyright (C) 2015-2017
  *   
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -39,10 +39,20 @@
 	if ($j > 1)
 	    $row .= ',';
 	$f = explode(",", $arr[$j]);
-	$heater   = $f[5] / 100;
-	$cooler   = $f[6] / 100;
-	$row .= '{"Date":"'.$f[0].'","Mode":"'.$f[1].'","Air":"'.$f[2].'","Beer":"'.$f[3].'","Target_lo":"'.$f[4].'",';
-        $row .= '"Heater":'.$heater.',"Cooler":'.$cooler.',"HeatUse":'.$f[7].',"CoolUse":"'.$f[8].'","Room":"'.$f[9].'","Target_hi":"'.$f[10].'"}';
+	$reply = array (
+	    'Date'      => $f[0],
+	    'Mode'      => $f[1],
+	    'Air'       => $f[2],
+	    'Beer'      => $f[3],
+	    'Target_lo' => $f[4],
+	    'Heater'    => $f[5] / 100,
+	    'Cooler'    => $f[6] / 100,
+	    'HeatUse'   => $f[7],
+	    'CoolUse'   => $f[8],
+	    'Room'      => $f[9],
+	    'Target_hi' => $f[10]
+        );
+	$row .= json_encode($reply, JSON_NUMERIC_CHECK);
 	$j++;
     }
 }
--- a/www-thermferm/getlog.php	Sun May 28 14:19:57 2017 +0200
+++ b/www-thermferm/getlog.php	Wed May 31 16:29:52 2017 +0200
@@ -1,6 +1,6 @@
 <?php
 /*****************************************************************************
- * Copyright (C) 2014-2015
+ * Copyright (C) 2014-2017
  *   
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -39,10 +39,20 @@
 	if ($j > 1)
 	    $row .= ',';
 	$f = explode(",", $arr[$j]);
-	$heater   = $f[5] / 100;
-	$cooler   = $f[6] / 100;
-	$row .= '{"Date":"'.$f[0].'","Mode":"'.$f[1].'","Air":"'.$f[2].'","Beer":"'.$f[3].'","Target_lo":"'.$f[4].'",';
-        $row .= '"Heater":'.$heater.',"Cooler":'.$cooler.',"HeatUse":'.$f[7].',"CoolUse":"'.$f[8].'","Room":"'.$f[9].'","Target_hi":"'.$f[10].'"}';
+	$reply = array (
+	    'Date'      => $f[0],
+	    'Mode'      => $f[1],
+	    'Air'       => $f[2],
+	    'Beer'      => $f[3],
+	    'Target_lo' => $f[4],
+	    'Heater'    => $f[5] / 100,
+	    'Cooler'    => $f[6] / 100,
+	    'HeatUse'   => $f[7],
+	    'CoolUse'   => $f[8],
+	    'Room'      => $f[9],
+	    'Target_hi' => $f[10]
+	);
+	$row .= json_encode($reply, JSON_NUMERIC_CHECK);
 	$j++;
     }
 }
--- a/www-thermferm/getroom.php	Sun May 28 14:19:57 2017 +0200
+++ b/www-thermferm/getroom.php	Wed May 31 16:29:52 2017 +0200
@@ -1,6 +1,6 @@
 <?php
 /*****************************************************************************
- * Copyright (C) 2014
+ * Copyright (C) 2014-2017
  *   
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -42,11 +42,11 @@
 	if ($f[0] == "TEMP_STATE")
 		$temp_state = $f[1];
 	if (($f[0] == "TEMP_VALUE") && ($temp_state == "OK"))
-		$temp_value = $f[1].' &deg;C';
+		$temp_value = $f[1];
 	if ($f[0] == "HUM_STATE")
 		$hum_state = $f[1];
 	if (($f[0] == "HUM_VALUE") && ($hum_state == "OK"))
-		$hum_value = $f[1].' %';
+		$hum_value = $f[1];
 	$j++;
     }
 }
--- a/www-thermferm/index.php	Sun May 28 14:19:57 2017 +0200
+++ b/www-thermferm/index.php	Wed May 31 16:29:52 2017 +0200
@@ -1,6 +1,6 @@
 <?php
 /*****************************************************************************
- * Copyright (C) 2014
+ * Copyright (C) 2014-2017
  *   
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -129,11 +129,11 @@
 	if ($f[0] == "TEMP_STATE")
 	    $temp_state = $f[1];
 	if (($f[0] == "TEMP_VALUE") && ($temp_state == "OK"))
-	    $temp_value = $f[1].' &deg;C';
+	    $temp_value = $f[1];
 	if ($f[0] == "HUM_STATE")
 	    $hum_state = $f[1];
 	if (($f[0] == "HUM_VALUE") && ($hum_state == "OK"))
-	    $hum_value = $f[1].' %';
+	    $hum_value = $f[1];
 	$j++;
     }
 }
@@ -167,8 +167,8 @@
 $outstr .= '     ThermFerm '.$version.PHP_EOL;
 $outstr .= '    </div>'.PHP_EOL;
 $outstr .= '    <div id="room">'.PHP_EOL;
-$outstr .= '     <div id="room_temp" class="rtemp">'.$temp_value.'</div>'.PHP_EOL;
-$outstr .= '     <div id="room_hum" class="rtemp">'.$hum_value.'</div>'.PHP_EOL;
+$outstr .= '     <div id="room_temp" class="rtemp">'.$temp_value.' &deg;C</div>'.PHP_EOL;
+$outstr .= '     <div id="room_hum" class="rtemp">'.$hum_value.' %</div>'.PHP_EOL;
 $outstr .= '    </div>'.PHP_EOL;
 $outstr .= '    <form action="maintenance.php" style="margin:30px; float:right">'.PHP_EOL;
 $outstr .= '     <input type="submit" id="maintenance" value="Maintenance panel" />'.PHP_EOL;

mercurial