From 7867988775a7b6ec1604a863b665e46ac91e70ac Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Mon, 17 Jun 2013 23:22:40 +0000 Subject: [PATCH] update kiosk sensor code for spaceapi 0.13 --- raspberry-kiosk/kiosk.js | 49 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/raspberry-kiosk/kiosk.js b/raspberry-kiosk/kiosk.js index edbef05..0c90e4e 100644 --- a/raspberry-kiosk/kiosk.js +++ b/raspberry-kiosk/kiosk.js @@ -168,20 +168,47 @@ function writeAnwesenheitStatus(data) if (data.sensors) { - for (var s=0; s
'+swhere+': '+svalue+''; - }); + $.each( data.sensors.temperature, function(s, sensorobj) { + sensorstd+='Temperatur
'+sensorobj.location+': '+sensorobj.value.toFixed(2)+sensorobj.unit+''; }); } - } - if (sensorstd != "") - { - sensorshtml=''+sensorstd+'
'; - document.getElementById('sensor_status').innerHTML=sensorshtml; - } + if (data.sensors.ext_illumination) + { + $.each( data.sensors.ext_illumination, function(s, sensorobj) { + sensorstd+='Licht
'+sensorobj.location+': '+sensorobj.value+''; + }); + } + if (data.sensors.door_locked) + { + $.each( data.sensors.door_locked, function(s, sensorobj) { + var lockstatus="Unlocked"; + if (sensorobj.value) { lockstatus = "Locked"; } + sensorstd+='Türschloß
'+sensorobj.location+': '+lockstatus+''; + }); + } + if (data.sensors.ext_door_ajar) + { + $.each( data.sensors.ext_door_ajar, function(s, sensorobj) { + var lockstatus="Shut"; + if (sensorobj.value) { lockstatus = "Ajar"; } + sensorstd+='Türkontakt
'+sensorobj.location+': '+lockstatus+''; + }); + } + if (data.sensors.ext_dust) + { + $.each( data.sensors.ext_dust, function(s, sensorobj) { + sensorstd+='Staub
'+sensorobj.location+': '+sensorobj.value+sensorobj.unit+''; + }); + + } + if (sensorstd != "") + { + sensorshtml=''+sensorstd+'
'; + document.getElementById('sensor_status').innerHTML=sensorshtml; + } + } } function updateAnwesenheitStatus() -- 1.7.10.4