Web pages for the CO2 meters added.

Thu, 10 Oct 2019 22:19:29 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 10 Oct 2019 22:19:29 +0200
changeset 503
b23ef14c6b09
parent 502
a8a6901b5a99
child 504
42a0ab588a4f

Web pages for the CO2 meters added.

www/css/style-min.css file | annotate | diff | comparison | revisions
www/css/style.css file | annotate | diff | comparison | revisions
www/getco2meter.php file | annotate | diff | comparison | revisions
www/includes/global.inc.php file | annotate | diff | comparison | revisions
www/js/mon_co2meter-min.js file | annotate | diff | comparison | revisions
www/js/mon_co2meter.js file | annotate | diff | comparison | revisions
www/mon_co2meter.php file | annotate | diff | comparison | revisions
--- a/www/css/style-min.css	Thu Oct 10 20:42:39 2019 +0200
+++ b/www/css/style-min.css	Thu Oct 10 22:19:29 2019 +0200
@@ -1,1 +1,1 @@
-body{background:#ccc;font-family:Verdana,Arial,sans-serif;margin:0}#MainPanel,#fermenter{width:1278px;height:628px;border:2px solid #4297d7;background:#252526;float:left;color:#eee}#water_totals{width:960px;background:#353536;margin-top:15px;border:1px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#propagator{width:800px;background:#353536;margin-top:15px;border:1px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#export_table,#about_table{width:960px;background:#353536;margin:150px;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#node_table{width:600px;background:#353536;margin:50px;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_table{width:960px;height:210px;background:#252526;margin:5px;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}.ebccolor{float:left;margin-left:10px;width:75px;height:23px;border:1px solid #59b4d4;border-radius:6px;moz-border-radius:6px;webkit-border-radius:6px;background:#212121}#fermenter_thermometers{width:960px;height:390px;float:left;background-color:#252526;margin:5px;margin-top:3px;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_panel_top{width:290px;height:100px;float:right;margin:5px;background-color:#252526;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_doorled,#fermenter_lightled,#fermenter_alarmled,#fermenter_powerled{width:50px;height:30px;float:left;text-align:center;margin-top:15px;margin-left:20px}#fermenter_panel_display{width:290px;height:98px;float:right;margin:5px;margin-top:3px;background-color:#252526;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_display{width:145px;height:98px;float:left;text-align:center}#fermenter_panel_control{width:290px;height:150px;float:right;margin:5px;margin-top:3px;background-color:#252526;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_led1,#fermenter_led2,#fermenter_led3{width:96px;height:30px;float:left;text-align:center;margin-top:13px}#fermenter_toggle1{float:left;margin-left:29px;margin-top:20px}#fermenter_toggle2,#fermenter_toggle3{float:left;margin-left:60px;margin-top:20px}#fermenter_panel_buttons{width:290px;height:227px;float:right;margin:5px;margin-top:3px;background-color:#252526;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}.LEDred_on{margin:5px auto;width:18px;height:18px;background-color:#F40;border-radius:50%;box-shadow:#000 0 0 4px 1px,inset #C33 0 -1px 5px,#f44 0 2px 12px}.LEDred_off{margin:5px auto;width:18px;height:18px;background-color:#820;border-radius:50%;box-shadow:#400 0 0 1px 1px}.LEDyellow_on{margin:5px auto;width:18px;height:18px;background-color:#FF0;border-radius:50%;box-shadow:#000 0 0 4px 1px,inset #860 0 -1px 5px,#DD0 0 2px 12px}.LEDyellow_off{margin:5px auto;width:18px;height:18px;background-color:#A90;border-radius:50%;box-shadow:#440 0 0 1px 1px}.LEDgreen_on{margin:5px auto;width:18px;height:18px;background-color:#5E0;border-radius:50%;box-shadow:#000 0 0 4px 1px,inset #270 0 -1px 5px,#5D0 0 2px 12px}.LEDgreen_off{margin:5px auto;width:18px;height:18px;background-color:#270;border-radius:50%;box-shadow:#250 0 0 1px 1px}.LEDblue_on{margin:5px auto;width:18px;height:18px;background-color:#4AF;border-radius:50%;box-shadow:#000 0 0 4px 1px,inset #247 0 -1px 5px,#48F 0 2px 12px}.LEDblue_off{margin:5px auto;width:18px;height:18px;background-color:#137;border-radius:50%;box-shadow:#024 0 0 1px 1px}#hintBase,#hintStyle,#hintEq{float:left;margin-top:30px;margin-right:20px;padding:5px;width:600px;color:yellow}#section{margin:5px}#baseButtonsWrapper{float:right;margin-top:30px;margin-right:10px;width:160px}#styleButtonsWrapper{float:right;margin-top:30px;margin-right:10px;width:320px}#eqButtonsWrapper{float:right;margin-top:30px;margin-right:10px;width:320px}#completedButtonsWrapper{float:right;margin-right:10px;width:320px;margin-top:160px}.nextButton{float:right;margin-left:0}.backButton{float:left;margin-left:10px}
\ No newline at end of file
+body{background:#ccc;font-family:Verdana,Arial,sans-serif;margin:0}#MainPanel,#fermenter,#co2meter{width:1278px;height:628px;border:2px solid #4297d7;background:#252526;float:left;color:#eee}#water_totals{width:960px;background:#353536;margin-top:15px;border:1px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#propagator{width:800px;background:#353536;margin-top:15px;border:1px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#export_table,#about_table{width:960px;background:#353536;margin:150px;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#node_table{width:600px;background:#353536;margin:50px;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_table,#co2meter_table{width:960px;height:210px;background:#252526;margin:5px;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}.ebccolor{float:left;margin-left:10px;width:75px;height:23px;border:1px solid #59b4d4;border-radius:6px;moz-border-radius:6px;webkit-border-radius:6px;background:#212121}#fermenter_thermometers,#co2meter_meters{width:960px;height:390px;float:left;background-color:#252526;margin:5px;margin-top:3px;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_panel_top,#co2meter_panel_top{width:290px;height:100px;float:right;margin:5px;background-color:#252526;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_doorled,#fermenter_lightled,#fermenter_alarmled,#fermenter_powerled{width:50px;height:30px;float:left;text-align:center;margin-top:15px;margin-left:20px}#fermenter_panel_display{width:290px;height:98px;float:right;margin:5px;margin-top:3px;background-color:#252526;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_display{width:145px;height:98px;float:left;text-align:center}#fermenter_panel_control{width:290px;height:150px;float:right;margin:5px;margin-top:3px;background-color:#252526;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}#fermenter_led1,#fermenter_led2,#fermenter_led3{width:96px;height:30px;float:left;text-align:center;margin-top:13px}#fermenter_toggle1{float:left;margin-left:29px;margin-top:20px}#fermenter_toggle2,#fermenter_toggle3{float:left;margin-left:60px;margin-top:20px}#fermenter_panel_buttons{width:290px;height:227px;float:right;margin:5px;margin-top:3px;background-color:#252526;border:2px solid;border-color:#59b4d4;border-radius:5px 5px 5px 5px}.LEDred_on{margin:5px auto;width:18px;height:18px;background-color:#F40;border-radius:50%;box-shadow:#000 0 0 4px 1px,inset #C33 0 -1px 5px,#f44 0 2px 12px}.LEDred_off{margin:5px auto;width:18px;height:18px;background-color:#820;border-radius:50%;box-shadow:#400 0 0 1px 1px}.LEDyellow_on{margin:5px auto;width:18px;height:18px;background-color:#FF0;border-radius:50%;box-shadow:#000 0 0 4px 1px,inset #860 0 -1px 5px,#DD0 0 2px 12px}.LEDyellow_off{margin:5px auto;width:18px;height:18px;background-color:#A90;border-radius:50%;box-shadow:#440 0 0 1px 1px}.LEDgreen_on{margin:5px auto;width:18px;height:18px;background-color:#5E0;border-radius:50%;box-shadow:#000 0 0 4px 1px,inset #270 0 -1px 5px,#5D0 0 2px 12px}.LEDgreen_off{margin:5px auto;width:18px;height:18px;background-color:#270;border-radius:50%;box-shadow:#250 0 0 1px 1px}.LEDblue_on{margin:5px auto;width:18px;height:18px;background-color:#4AF;border-radius:50%;box-shadow:#000 0 0 4px 1px,inset #247 0 -1px 5px,#48F 0 2px 12px}.LEDblue_off{margin:5px auto;width:18px;height:18px;background-color:#137;border-radius:50%;box-shadow:#024 0 0 1px 1px}#hintBase,#hintStyle,#hintEq{float:left;margin-top:30px;margin-right:20px;padding:5px;width:600px;color:yellow}#section{margin:5px}#baseButtonsWrapper{float:right;margin-top:30px;margin-right:10px;width:160px}#styleButtonsWrapper{float:right;margin-top:30px;margin-right:10px;width:320px}#eqButtonsWrapper{float:right;margin-top:30px;margin-right:10px;width:320px}#completedButtonsWrapper{float:right;margin-right:10px;width:320px;margin-top:160px}.nextButton{float:right;margin-left:0}.backButton{float:left;margin-left:10px}
\ No newline at end of file
--- a/www/css/style.css	Thu Oct 10 20:42:39 2019 +0200
+++ b/www/css/style.css	Thu Oct 10 22:19:29 2019 +0200
@@ -9,7 +9,8 @@
 
 
 #MainPanel,
-#fermenter {
+#fermenter,
+#co2meter {
     width: 1278px;
     height: 628px;
     border: 2px solid #4297d7;
@@ -63,7 +64,8 @@
 
 
 
-#fermenter_table {
+#fermenter_table,
+#co2meter_table {
     width: 960px;
     height: 210px;
     background: #252526;
@@ -88,13 +90,13 @@
 
 
 /*
- * +----------------------------------------------------_
+ * +----------------------------------------------------+
  * |+-------------------++--------++-------------------+|
  * ||                   ||        ||                   ||
  * ||			|| chiller||                   ||
  * ||                   ||        ||                   ||
- * ||                   |+--------+|                   ||
- * ||     Air temp      |          |     Beer temp     ||
+ * ||     Air temp      |+--------+|     Beer temp     ||
+ * ||    Temperature    |          |     Pressure      ||
  * ||                   |          |                   ||
  * ||                   |          |                   ||
  * ||                   |          |                   ||
@@ -102,7 +104,8 @@
  * +----------------------------------------------------+
  */
 
-#fermenter_thermometers {
+#fermenter_thermometers,
+#co2meter_meters {
     width: 960px;
     height: 390px;
     float: left;
@@ -136,7 +139,8 @@
  * |                               |
  * +-------------------------------+
  */
-#fermenter_panel_top {
+#fermenter_panel_top,
+#co2meter_panel_top {
   width: 290px;
   height: 100px;
   float: right;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/www/getco2meter.php	Thu Oct 10 22:19:29 2019 +0200
@@ -0,0 +1,16 @@
+<?php
+
+require_once('config.php');
+
+if (isset($_GET["uuid"]))
+	    $uuid = $_GET["uuid"];
+else
+	    $uuid = "'ef166f25-1bb4-4bef-b112-a867af77f766'";
+
+
+$mysqli = new mysqli(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME);
+$query = "SELECT * FROM mon_co2meters WHERE uuid=".$uuid."";
+$result = $mysqli->query($query);
+$resultArray = $result->fetch_array(MYSQLI_ASSOC);
+header("Content-type: application/json");
+echo json_encode($resultArray);
--- a/www/includes/global.inc.php	Thu Oct 10 20:42:39 2019 +0200
+++ b/www/includes/global.inc.php	Thu Oct 10 22:19:29 2019 +0200
@@ -200,7 +200,7 @@
      <li style='width: 80px;'>Monitoren
       <ul style='width: 200px;'>
        <li><img style='float: left; margin-right: 5px;' src='images/computer.png' />Systemen
-        <ul style='width: 150px;'>
+        <ul style='width: 200px;'>
 <?php
 $connect = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME);
 $result = mysqli_query($connect, "SELECT uuid,node,online,net_address FROM mon_nodes ORDER BY node");
@@ -230,6 +230,21 @@
 ?>
         </ul>
        </li>
+       <li><img style='float: left; margin-right: 5px;' src='images/fridge.png' />CO2 meters
+        <ul style='width: 250px;'>
+<?php
+$result = mysqli_query($connect, "SELECT uuid,node,alias,online,mode FROM mon_co2meters ORDER BY node,alias");
+while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
+    if ($row['online'] == 1)
+        $img = "network-idle.png";
+    else
+        $img = "network-error.png";
+    echo '         <li><img style="float: left; margin-right: 5px;" src="images/'.$img.'" /><a href="mon_co2meter.php?uuid='.$row['uuid'].'">'.$row['node'].'/'.$row['alias'].'</a></li>'.PHP_EOL;
+}
+mysqli_free_result($result);
+?>
+        </ul>
+       </li>
       </ul>
      </li>
      <li style='width: 80px;'>Productie
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/www/js/mon_co2meter-min.js	Thu Oct 10 22:19:29 2019 +0200
@@ -0,0 +1,1 @@
+$(document).ready(function(){var f={},e={},g=0,h={datatype:"json",cache:false,datafields:[{name:"code",type:"string"},{name:"name",type:"string"},{name:"uuid",type:"string"}],id:"code",url:"includes/db_product.php?select=ferment"},j=new $.jqx.dataAdapter(h,{beforeLoadComplete:function(k){var n,l,m=new Array();e.code="Free";e.name="Dummy";e.uuid="66ecccbf-e942-4a35-af49-8b02314561a5";m.push(e);for(l=0;l<k.length;l++){n=k[l];m.push(n)}return m},loadError:function(m,k,l){$("#err").text(k+" "+l)},}),c={min:0,max:40,width:375,height:375,ranges:[{startValue:0,endValue:20,style:{fill:"#3399FF",stroke:"#3399FF"},endWidth:10,startWidth:10},{startValue:20,endValue:26,style:{fill:"#00CC33",stroke:"#00CC33"},endWidth:10,startWidth:10},{startValue:26,endValue:40,style:{fill:"#FC6A6A",stroke:"#FC6A6A"},endWidth:10,startWidth:10}],ticksMinor:{interval:1,size:"5%"},ticksMajor:{interval:5,size:"9%"},labels:{interval:5},style:{fill:"#eeeeee",stroke:"#666666"},value:0,colorScheme:"scheme05"},d={min:0,max:6,width:375,height:375,ranges:[{startValue:0,endValue:3,style:{fill:"#00CC33",stroke:"#00CC33"},endWidth:10,startWidth:10},{startValue:3,endValue:6,style:{fill:"#FC6A6A",stroke:"#FC6A6A"},endWidth:10,startWidth:10}],ticksMinor:{interval:0.2,size:"5%"},ticksMajor:{interval:1,size:"9%"},labels:{interval:1},style:{fill:"#eeeeee",stroke:"#666666"},value:0,colorScheme:"scheme05"},b="getco2meter.php?uuid='"+my_uuid+"'",a={datatype:"json",datafields:[{name:"record",type:"int"},{name:"uuid",type:"string"},{name:"alias",type:"string"},{name:"node",type:"string"},{name:"online",type:"int"},{name:"beercode",type:"string"},{name:"beername",type:"string"},{name:"beeruuid",type:"string"},{name:"mode",type:"string"},{name:"temperature_state",type:"string"},{name:"temperature",type:"float"},{name:"pressure_state",type:"string"},{name:"pressure_bar",type:"float"}],id:"record",url:b},i=new $.jqx.dataAdapter(a,{loadComplete:function(k){f=i.records[0];var l=(f.online)?"On-line":"Off-line";$("#info_uuid").html(f.uuid);$("#info_system").html(f.node+"/"+f.alias);$("#info_online").html(l);$("#info_mode").jqxDropDownList("selectItem",f.mode);e.name=f.alias;e.code=f.alias.toUpperCase();e.uuid=f.uuid;if(f.online&&(f.mode!="OFF")){$("#co2meter_powerled").html('<div class="LEDblue_on"></div>Power')}else{$("#co2meter_powerled").html('<div class="LEDblue_off"></div>Power')}$("#gaugeContainer_temperature").jqxGauge({caption:{value:"Temp: "+f.temperature.toFixed(3)}});$("#gaugeContainer_temperature").jqxGauge({value:f.temperature});if(f.temperature_state=="OK"){$("#gaugeContainer_temperature").jqxGauge({disabled:false})}else{$("#gaugeContainer_temperature").jqxGauge({disabled:true})}$("#gaugeContainer_pressure").jqxGauge({caption:{value:"Bar: "+f.pressure_bar.toFixed(2)}});$("#gaugeContainer_pressure").jqxGauge({value:f.pressure_bar});if(f.pressure_state=="OK"){$("#gaugeContainer_pressure").jqxGauge({disabled:false})}else{$("#gaugeContainer_pressure").jqxGauge({disabled:true})}}});$("#select_beer").jqxDropDownList({placeHolder:"Kies bier:",theme:theme,source:j,displayMember:"code",width:150,height:24,dropDownWidth:500,autoDropDownHeight:true,renderer:function(l,k,n){var m=j.records[l];return m.code+" - "+m.name}});$("#gaugeContainer_temperature").jqxGauge(c);$("#gaugeContainer_temperature").jqxGauge({caption:{value:"Temp: 00.000"}});$("#gaugeContainer_pressure").jqxGauge(d);$("#gaugeContainer_pressure").jqxGauge({caption:{value:"Bar: 00.000"}});srcMode=["OFF","ON"];$("#info_mode").jqxDropDownList({theme:theme,source:srcMode,width:100,height:24,dropDownHeight:62});i.dataBind();setInterval(function(){var k=false;if(k){g=4}else{if(g>0){g--}}if(g<=0){i.dataBind();g=20}},500);$("#info_mode").on("change",function(l){var k=l.args;if(k){f.mode=k.item.value}});$("#FLog").jqxButton({template:"primary",width:"150px",theme:theme});$("#FLog").click(function(){window.open("log_fermentation.php?code="+f.beercode+"&name="+f.beername)})});
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/www/js/mon_co2meter.js	Thu Oct 10 22:19:29 2019 +0200
@@ -0,0 +1,224 @@
+/*****************************************************************************
+ * Copyright (C) 2019
+ *
+ * Michiel Broek <mbroek at mbse dot eu>
+ *
+ * This file is part of BMS
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * Brewery Management System istributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with ThermFerm; see the file COPYING.  If not, write to the Free
+ * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ *****************************************************************************/
+
+
+$(document).ready(function () {
+
+	var record = {},
+	blank = {},
+//	newBase = false,
+//	newProduct = false,
+	schedule = 0,
+
+	productSource = {
+		datatype: "json",
+		cache: false,
+		datafields: [
+			{ name: 'code', type: 'string' },
+			{ name: 'name', type: 'string' },
+			{ name: 'uuid', type: 'string' }
+		],
+		id: 'code',
+		url: "includes/db_product.php?select=ferment"
+	},
+	productlist = new $.jqx.dataAdapter(productSource, {
+		beforeLoadComplete: function (records) {
+			var row, i, data = new Array();
+			// Create a dummy beer on top to store in idle fermenters.
+			blank['code'] = "Free";	 // Will override this later.
+			blank['name'] = 'Dummy';
+			blank['uuid'] = '66ecccbf-e942-4a35-af49-8b02314561a5';
+			data.push(blank);
+			for (i = 0; i < records.length; i++) {
+				row = records[i];
+				data.push(row);
+			}
+			return data;
+		},
+        	loadError: function(jqXHR, status, error) {
+                	$('#err').text(status + ' ' + error);
+		},
+	}),
+        gaugeoptionst = {
+                min: 0, max: 40, width: 375, height: 375,
+                ranges: [{ startValue:  0, endValue: 20, style: { fill: '#3399FF', stroke: '#3399FF' }, endWidth: 10, startWidth: 10 },
+                         { startValue: 20, endValue: 26, style: { fill: '#00CC33', stroke: '#00CC33' }, endWidth: 10, startWidth: 10 },
+                         { startValue: 26, endValue: 40, style: { fill: '#FC6A6A', stroke: '#FC6A6A' }, endWidth: 10, startWidth: 10 }],
+                ticksMinor: { interval: 1, size: '5%' },
+                ticksMajor: { interval: 5, size: '9%' },
+                labels: { interval: 5 },
+                style: { fill: '#eeeeee', stroke: '#666666' },
+                value: 0,
+                colorScheme: 'scheme05'
+        },
+        gaugeoptionsp = {
+                min: 0, max: 6, width: 375, height: 375,
+                ranges: [{ startValue: 0, endValue: 3, style: { fill: '#00CC33', stroke: '#00CC33' }, endWidth: 10, startWidth: 10 },
+                         { startValue: 3, endValue: 6, style: { fill: '#FC6A6A', stroke: '#FC6A6A' }, endWidth: 10, startWidth: 10 }],
+                ticksMinor: { interval: 0.2, size: '5%' },
+                ticksMajor: { interval: 1, size: '9%' },
+                labels: { interval: 1 },
+                style: { fill: '#eeeeee', stroke: '#666666' },
+                value: 0,
+                colorScheme: 'scheme05'
+        },
+        url = "getco2meter.php?uuid='" + my_uuid + "'",
+        source = {
+                datatype: "json",
+                datafields: [
+                        { name: 'record', type: 'int' },
+                        { name: 'uuid', type: 'string' },
+                        { name: 'alias', type: 'string' },
+                        { name: 'node', type: 'string' },
+                        { name: 'online', type: 'int' },
+                        { name: 'beercode', type: 'string' },
+                        { name: 'beername', type: 'string' },
+			{ name: 'beeruuid', type: 'string' },
+			{ name: 'mode', type: 'string' },
+                        { name: 'temperature_state', type: 'string' },
+                        { name: 'temperature', type: 'float' },
+                        { name: 'pressure_state', type: 'string' },
+                        { name: 'pressure_bar', type: 'float' }
+                ],
+                id: 'record',
+                url: url
+        },
+        dataAdapter = new $.jqx.dataAdapter(source, {
+                loadComplete: function (records) {
+                        record = dataAdapter.records[0];
+                        var oline = (record.online) ? "On-line" : "Off-line";
+                        $("#info_uuid").html(record.uuid);
+                        $("#info_system").html(record.node +  "/" + record.alias);
+                        $("#info_online").html(oline);
+                        $("#info_mode").jqxDropDownList('selectItem', record.mode);
+                        blank['name'] = record.alias;
+                        blank['code'] = record.alias.toUpperCase();
+                        blank['uuid'] = record.uuid;
+
+                        if (record.online && (record.mode != "OFF")) {
+                                $("#co2meter_powerled").html('<div class="LEDblue_on"></div>Power');
+                        } else {
+                                $("#co2meter_powerled").html('<div class="LEDblue_off"></div>Power');
+                        }
+
+                        $("#gaugeContainer_temperature").jqxGauge({ caption: { value: 'Temp: '+record.temperature.toFixed(3) }});
+                        $('#gaugeContainer_temperature').jqxGauge({ value: record.temperature });
+                        if (record.temperature_state == "OK") {
+                                $("#gaugeContainer_temperature").jqxGauge({ disabled: false });
+                        } else {
+                                $("#gaugeContainer_temperature").jqxGauge({ disabled: true });
+                        }
+                        $("#gaugeContainer_pressure").jqxGauge({ caption: { value: 'Bar: '+record.pressure_bar.toFixed(2) }});
+                        $('#gaugeContainer_pressure').jqxGauge({ value: record.pressure_bar });
+                        if (record.pressure_state == "OK") {
+                                $("#gaugeContainer_pressure").jqxGauge({ disabled: false });
+                        } else {
+                                $("#gaugeContainer_pressure").jqxGauge({ disabled: true });
+                        }
+                }
+        });
+
+	$("#select_beer").jqxDropDownList({
+		placeHolder: "Kies bier:",
+		theme: theme,
+		source: productlist,
+		displayMember: "code",
+		width: 150,
+		height: 24,
+		dropDownWidth: 500,
+		autoDropDownHeight: true,
+		renderer: function (index, label, value) {
+			var datarecord = productlist.records[index];
+			return datarecord.code + " - " + datarecord.name;
+		}
+	});
+
+	$("#gaugeContainer_temperature").jqxGauge( gaugeoptionst );
+	$("#gaugeContainer_temperature").jqxGauge( { caption: { value: 'Temp: 00.000' }} );
+	$("#gaugeContainer_pressure").jqxGauge( gaugeoptionsp );
+	$("#gaugeContainer_pressure").jqxGauge( { caption: { value: 'Bar: 00.000' }} );
+
+	srcMode = [ "OFF", "ON" ];
+	$("#info_mode").jqxDropDownList({ theme: theme, source: srcMode, width: 100, height: 24, dropDownHeight: 62 });
+
+//	function sendProduct(code, name, uuid, yeast_lo, yeast_hi) {
+
+//		console.log("sendProduct("+code+", "+name+", "+uuid+", "+yeast_lo+", "+yeast_hi+")");
+//		var data  = 'node='+record.node+'&alias='+record.alias+'&payload=';
+//		    data += '{"product":{"code":"'+code+'","name":"'+name+'","uuid":"'+uuid+'","yeast_lo":'+yeast_lo+',"yeast_hi":'+yeast_hi+'}}';
+//		$.ajax({
+//			url: "cmd_fermenter.php",
+//			data: data,
+//			type: "POST",
+//			success: function(data) {},
+//			error: function(jqXHR, textStatus, errorThrown) { console.log("sendProduct() error"); }
+//		});
+//	}
+
+	// Get the data immediatly and then at regular intervals to refresh.
+	dataAdapter.dataBind();
+	setInterval(function() {
+		var skip = false;
+//		if (newProduct) {
+//			sendProduct(record.beercode, record.beername, record.beeruuid, record.yeast_lo, record.yeast_hi);
+//			newProduct = false;
+//			skip = true;
+//		}
+		if (skip) {
+			schedule = 4;	// 2 seconds wait to get the results
+		} else {
+			if (schedule > 0)
+				schedule--;
+		}
+
+		if (schedule <= 0) {
+			dataAdapter.dataBind();
+			schedule = 20;
+		}
+	}, 500);
+
+	$('#info_mode').on('change', function (event) {
+		var args = event.args;
+		if (args) {
+			record.mode = args.item.value;
+		}
+//		newBase = true;
+	});
+//	$("#select_beer").on('select', function (event) {
+//		if (event.args) {
+//			var index = event.args.index,
+//			datarecord = productlist.records[index];
+//			record.beercode = datarecord.code;
+//			record.beername = datarecord.name;
+//			record.beeruuid = datarecord.uuid;
+//			record.yeast_lo = datarecord.yeast_lo;
+//			record.yeast_hi = datarecord.yeast_hi;
+//			newProduct = true;
+//		}
+//	});
+
+	// The chart button.
+   	$("#FLog").jqxButton({ template: "primary", width: '150px', theme: theme });
+	$("#FLog").click(function () {
+		window.open('log_fermentation.php?code=' + record.beercode + '&name=' + record.beername);
+	});
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/www/mon_co2meter.php	Thu Oct 10 22:19:29 2019 +0200
@@ -0,0 +1,67 @@
+<?php
+require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
+page_header('Monitor CO2 meters', 'mon_co2meter');
+?>
+
+   <div id="co2meter">
+
+    <div style="float: left; width: 970px;">
+     <div id="co2meter_table">
+      <div id="co2meter_info">
+       <table style='width: 100%; padding: 10px;'>
+	<col width="20%">
+	<col width="40%">
+        <col width="40%">
+        <tr><th colspan=3>CO2 meter overzicht</th></tr>
+	<tr style="height: 25px;">
+         <td>Uuid</td>
+         <td colspan="2"><div id="info_uuid"></div></td>
+        </tr>
+	<tr style="height: 25px;">
+         <td>Systeem</td>
+	 <td><div id="info_system"></div></td>
+         <td><div id="info_online"></div></td>
+        </tr>
+	<tr style="height: 25px;">
+         <td>Code en bier</td>
+         <td><div id="info_beer"></div></td>
+         <td><div id="select_beer"></div></td>
+        </tr>
+	<tr style="height: 25px;">
+         <td>Werking</td>
+         <td><div id="info_mode"></div></td>
+         <td></td>
+        </tr>
+       </table>
+      </div>
+     </div>
+     <div id='co2meter_meters'>
+      <div id="gaugeContainer_temperature" style='float: left; margin-top: 10px; margin-left: 10px;'></div>
+      <div id="gaugeContainer_pressure" style="float: right; margin-top: 10px; margin-right: 10px;"></div>
+     </div>
+    </div> <!-- End left side -->
+
+    <div style="float: right; width: 295px;">
+     <div id="co2meter_panel_top">
+      <div id="co2meter_powerled"></div>
+     </div> <!-- co2meter_panel_top -->
+
+     <div id="co2meter_panel_display">
+      <div id="co2meter_display">
+      </div>
+      <div id="co2meter_display">
+      </div>
+     </div> <!-- co2meter_panel_display -->
+
+     <div id="co2meter_panel_control">
+     </div> <!-- co2meter_panel_control -->
+
+     <div id="co2meter_panel_buttons">
+      <input style="margin-top: 20px; margin-left: 70px;" type="button" id="FLog" value="CO2 log" />
+     </div> <!-- co2meter_panel_buttons -->
+    </div> <!-- End right side -->
+   </div>
+
+<?php
+page_footer();
+?>

mercurial