sensors in 768x1366
[svn42.git] / raspberry-kiosk / kiosk.js
index 253b2d1..827861f 100644 (file)
@@ -30,7 +30,7 @@ function writeGooglePlusEvents(data, elem)
             noteimgs.push(attach[a].thumbnails[t].image.url);
           }
         }
-        else if ( attach[a].objectType == "photo")
+        else if ( attach[a].objectType == "photo" || attach[a].objectType == "video")
         {
           noteimgs.push(attach[a].image.url);
         }
@@ -165,6 +165,18 @@ function loadCalendarMainPage()
 }
 
 
+function drawGauge(targetelem, label, temp, options) {
+    var data = google.visualization.arrayToDataTable([["Label", "Value"],[label,temp]]);
+    // Create and draw the visualization.
+    if (targetelem)
+    {
+        options["width"] = targetelem.getAttribute("width");
+        options["height"] = targetelem.getAttribute("height");
+        var chart = new google.visualization.Gauge(targetelem);
+        chart.draw(data, options);
+    }
+}
+
 function writeAnwesenheitStatus(data)
 {
   var html="";
@@ -195,23 +207,25 @@ function writeAnwesenheitStatus(data)
   {
     if (data.sensors.temperature)
     {
-      sensorstd+='<td style="background-color:white; height:42px; text-align:center; vertical-align:middle; display:table-cell;"><b>Temperatur</b>';
+      sensorstd+='<td class="sensorstatus"><b>Temperatur</b>';
       $.each( data.sensors.temperature, function(s, sensorobj) {
         sensorstd+='<br/>'+sensorobj.location+': '+sensorobj.value.toFixed(2)+sensorobj.unit;
+               drawGauge(document.getElementById('tempgauge'), "Temp "+sensorobj.location, sensorobj.value, {redFrom: 33, redTo: 40, yellowFrom:29, yellowTo: 33,  minorTicks: 4, min:0, max:40});
       });
       sensorstd+='</td>';
     }
     if (data.sensors.ext_illumination)
     {
-      sensorstd+='<td style="background-color:white; height:42px; text-align:center; vertical-align:middle; display:table-cell;"><b>Licht</b>';
+      sensorstd+='<td class="sensorstatus"><b>Licht</b>';
       $.each( data.sensors.ext_illumination, function(s, sensorobj) {
         sensorstd+='<br/>'+sensorobj.location+': '+sensorobj.value;
+        drawGauge(document.getElementById('lightgauge'), "Licht "+sensorobj.location, sensorobj.value, {redFrom: 950, redTo: 1024,yellowFrom:0, yellowTo: 200,minorTicks: 4, min:0, max:1024});
       });
       sensorstd+='</td>';
     }
     if (data.sensors.door_locked)
     {
-      sensorstd+='<td style="background-color:white; height:42px; text-align:center; vertical-align:middle; display:table-cell;"><b>Eingangstür</b>';
+      sensorstd+='<td class="sensorstatus"><b>Eingangstür</b>';
       $.each( data.sensors.door_locked, function(s, sensorobj)  {
         var lockstatus="Auf";
         if (sensorobj.value) { lockstatus = "Zu"; }
@@ -221,7 +235,7 @@ function writeAnwesenheitStatus(data)
     }
     if (data.sensors.ext_door_ajar)
     {
-      sensorstd+='<td style="background-color:white; height:42px; text-align:center; vertical-align:middle; display:table-cell;"><b>Türkontakt</b>';
+      sensorstd+='<td class="sensorstatus"><b>Türkontakt</b>';
       $.each( data.sensors.ext_door_ajar, function(s, sensorobj)  {
         var lockstatus="Auf";
         if (sensorobj.value) { lockstatus = "Zu"; }
@@ -231,7 +245,7 @@ function writeAnwesenheitStatus(data)
     }
     if (data.sensors.ext_dust)
     {
-      sensorstd+='<td style="background-color:white; height:42px; text-align:center; vertical-align:middle; display:table-cell;"><b>Staub</b>';
+      sensorstd+='<td class="sensorstatus"><b>Staub</b>';
       $.each( data.sensors.ext_dust, function(s, sensorobj) {
         sensorstd+='<br/>'+sensorobj.location+': '+sensorobj.value+sensorobj.unit+'</td>';
       });