X-Git-Url: https://git.realraum.at/?a=blobdiff_plain;f=raspberry-kiosk%2Fkiosk.js;h=278d3d65ea90fb4a47fcbd596cc4a994f0ffc5b6;hb=4903316ed93c55ff34c1af1d32c0cc1f60c95c66;hp=bb69932e37424dddf35afc4d6cd8f83cb93671c8;hpb=4c36e4d9f491d1f75295e7c8a3c31e5aaa59acc8;p=svn42.git diff --git a/raspberry-kiosk/kiosk.js b/raspberry-kiosk/kiosk.js index bb69932..278d3d6 100644 --- a/raspberry-kiosk/kiosk.js +++ b/raspberry-kiosk/kiosk.js @@ -44,7 +44,7 @@ function writeGooglePlusEvents(data, elem) ghtml += '

'+item.updated.substring(0,16).replace("T"," ")+'

'; ghtml += '

'+notetxt+'

'; if (noteimgs.length>0) - { + { var bigimglimit; ghtml += ''; if (noteimgs.length > 3) @@ -145,7 +145,7 @@ function loadCalendarKiosk() $.getJSON('/shmcache/grical_realraum.json', function(data){ var calhtml = ""; $.each(calendarItemEnhancer(data), function(index, itm) { - calhtml += '
  • '+itm.when+' - '+itm.title+'
  • '+"\n"; + calhtml += '
  • '+itm.when+' - '+itm.title+'
  • '+"\n"; }); calcontainer.innerHTML=''; }); @@ -164,6 +164,61 @@ function loadCalendarMainPage() }); } +var gauges = {} +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"); + if (!gauges.hasOwnProperty(targetelem.id)) { + gauges[targetelem.id] = new google.visualization.Gauge(targetelem); + } + gauges[targetelem.id].draw(data, options); + } +} + +var linecharts = {} +function drawLineGraph(targetelem, dataarray, options, x_is_epochdate) { + if (dataarray) { + var data; + if (x_is_epochdate) { + data=new google.visualization.DataTable(); + data.addColumn('datetime',dataarray[0][0]); + for (var c=1; c
    '+data.status+'
    '; } - + if (data.sensors) { if (data.sensors.temperature) @@ -198,6 +253,7 @@ function writeAnwesenheitStatus(data) sensorstd+='Temperatur'; $.each( data.sensors.temperature, function(s, sensorobj) { sensorstd+='
    '+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+=''; } @@ -206,6 +262,7 @@ function writeAnwesenheitStatus(data) sensorstd+='Licht'; $.each( data.sensors.ext_illumination, function(s, sensorobj) { sensorstd+='
    '+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+=''; } @@ -237,7 +294,7 @@ function writeAnwesenheitStatus(data) }); sensorstd+=''; - } + } if (sensorstd != "") { sensorshtml=''+sensorstd+'
    '; @@ -275,7 +332,7 @@ function highlightEntry(idx, color, value) if(value == 0) { if(idx%2 == 0) $('#upnext' + idx).css('background-color', 'white'); - else + else $('#upnext' + idx).css('background-color', '#E0E0E0'); } else { $('#upnext' + idx).css('background-color', color); @@ -350,7 +407,7 @@ function reloadImg(element) $(document).ready(function() { updateAnwesenheitStatus(); - setInterval("updateAnwesenheitStatus()", 10*1000); + setInterval("updateAnwesenheitStatus()", 10*1000); if (document.getElementById("dateclock")) { updateDateClock(new Date()); @@ -366,9 +423,14 @@ $(document).ready(function() loadCalendarMainPage(); setInterval("loadCalendarMainPage()", 123*1000); } - if (document.getElementById("sensorgraphs")) +// if (document.getElementById("sensorgraphs")) +// { +// setInterval("updateSensors()",145*1000); +// } + if (document.getElementById("tempgooglegraph") || document.getElementById("lightgooglegraph") || document.getElementById("movementgooglegraph")) { - setInterval("updateSensors()",145*1000); + loadAndDrawSensorData(); + setInterval("loadAndDrawSensorData()",145*1000); } if (document.getElementById("gplusevents")) {