Log marking device missing if a onewire devices goes away. Fixes in fermenters display. Added Present and Inuse columns in devices list.

Sun, 28 Apr 2024 14:25:26 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 28 Apr 2024 14:25:26 +0200
changeset 712
93a87fe230cc
parent 711
844588d0df65
child 713
ea24b4ce02b1

Log marking device missing if a onewire devices goes away. Fixes in fermenters display. Added Present and Inuse columns in devices list.

thermferm/one-wire.c file | annotate | diff | comparison | revisions
www/js/fermenter.js file | annotate | diff | comparison | revisions
www/js/set_devices.js file | annotate | diff | comparison | revisions
--- a/thermferm/one-wire.c	Thu Apr 25 16:44:54 2024 +0200
+++ b/thermferm/one-wire.c	Sun Apr 28 14:25:26 2024 +0200
@@ -252,6 +252,7 @@
 		if (strcmp(dev_w1->address, device->address) == 0) {
 //		    pthread_mutex_lock(&mutexes[LOCK_DEVICES]);
 		    device->present = DEVPRESENT_NO;
+		     syslog(LOG_NOTICE, "One-wire device %s marked device %s not present", dev_w1->address, device->address);
 //		    pthread_mutex_unlock(&mutexes[LOCK_DEVICES]);
 		}
 	    }
--- a/www/js/fermenter.js	Thu Apr 25 16:44:54 2024 +0200
+++ b/www/js/fermenter.js	Sun Apr 28 14:25:26 2024 +0200
@@ -464,17 +464,23 @@
    record.beername = obj.metric.product.name;
    record.yeast_lo = obj.metric.product.yeast_lo;
    record.yeast_hi = obj.metric.product.yeast_hi;
-   record.air_state = obj.metric.air.state;
-   record.air_temperature = obj.metric.air.temperature;
-   record.beer_state = obj.metric.beer.state;
-   record.beer_temperature = obj.metric.beer.temperature;
-   record.chiller_state = obj.metric.chiller.state;
-   record.chiller_temperature = obj.metric.chiller.temperature;
-   if (obj.metric.heater.state !== undefined)
+   if (obj.metric.air) {
+     record.air_state = obj.metric.air.state;
+     record.air_temperature = obj.metric.air.temperature;
+   }
+   if (obj.metric.beer) {
+     record.beer_state = obj.metric.beer.state;
+     record.beer_temperature = obj.metric.beer.temperature;
+   }
+   if (obj.metric.chiller) {
+     record.chiller_state = obj.metric.chiller.state;
+     record.chiller_temperature = obj.metric.chiller.temperature;
+   }
+   if (obj.metric.heater)
      record.heater_state = obj.metric.heater.state;
-   if (obj.metric.cooler.state !== undefined)
+   if (obj.metric.cooler)
      record.cooler_state = obj.metric.cooler.state;
-   if (obj.metric.fan.state !== undefined)
+   if (obj.metric.fan)
     record.fan_state = obj.metric.fan.state;
    if (obj.metric.door)
      record.door_state = obj.metric.door.state;
--- a/www/js/set_devices.js	Thu Apr 25 16:44:54 2024 +0200
+++ b/www/js/set_devices.js	Sun Apr 28 14:25:26 2024 +0200
@@ -195,13 +195,15 @@
    });
   },
   columns: [
-   { text: 'Address', datafield: 'address', width: 200 },
-   { text: 'Sub', datafield: 'subdevice', width: 60 },
+   { text: 'Address', datafield: 'address', width: 180 },
+   { text: 'Sub', datafield: 'subdevice', width: 50 },
+   { text: 'Present', datafield: 'present', width: 80 },
    { text: 'Type', datafield: 'type', width: 100 },
-   { text: 'Direction', datafield: 'direction', width: 120 },
+   { text: 'Direction', datafield: 'direction', width: 110 },
    { text: 'Value', datafield: 'value', width: 80 },
+   { text: 'Used', datafield: 'inuse', width: 60 },
    { text: 'Description', datafield: 'description' },
-   { text: 'Last change', datafield: 'timestamp', width: 200,
+   { text: 'Last change', datafield: 'timestamp', width: 190,
      cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
       var date = new Date((value * 1000) - tzoffset).toISOString().slice(0, 19).replace("T", " ");
       return '<span style="margin: 3px; margin-top: 6px; float: left;">' +  date + '</span>';

mercurial