Plotting Pi

Temperature data from the Pi visualised

My house temperature taken from the pi, squirted into firebase every 3 seconds, then summarised by minute, hour and day using angular.

The time is shown as local time depending on where the user is.

Next I’m going to allow the user to select the day, then show the hours for that day, then allow the user to select the hour and so on for the minutes.

Same view on mobile…

var ref = new Firebase(“https://fusion.firebaseio.com/9023804092834/1hour");
ref.on(“value”, function (snapshot) {

$scope.minList = [];
$scope.maxList = [];
$scope.keyList = [];

snapshot.forEach(function (childSnapshot) {
 
 var childData = childSnapshot.val();
 var keyz = childSnapshot.key();
 var keya = keyz * 1;
 var d = (new Date(keya));
 var hours = d.getHours();
 
 if(hours => 12){var ampm = ‘PM’};
 if(hours < 12){var ampm = ‘AM’};
 var h = d.getHours() % 12 || 12;

var weekday = new Array(7);
 weekday[0] = “Sunday”;
 weekday[1] = “Monday”;
 weekday[2] = “Tuesday”;
 weekday[3] = “Wednesday”;
 weekday[4] = “Thursday”;
 weekday[5] = “Friday”;
 weekday[6] = “Saturday”;

var n = weekday[d.getDay()];

var formatedDate = n+’ ‘+h+’ ‘+ampm;

$scope.keyList.push(formatedDate);
 $scope.minList.push(childData.min);
 $scope.maxList.push(childData.max);
 });

$scope.$apply(function () {
 $scope.labels = $scope.keyList;
 $scope.series = [‘Low’, ‘High’];
 $scope.data = [$scope.minList, $scope.maxList];
 });

});