temperature sensors enabled / disabled ui
This commit is contained in:
@@ -24,12 +24,37 @@ Meteor.zoblak.client = {
|
||||
if (!controller.features) return false;
|
||||
|
||||
return controller.features[feature] === true;
|
||||
},
|
||||
|
||||
sensor_data_collection: function() {
|
||||
var controllerId = Session.get('controller_id');
|
||||
return SensorData.find({
|
||||
controllerId: controllerId
|
||||
}, {
|
||||
sort: {
|
||||
created_at: -1
|
||||
},
|
||||
limit: 3
|
||||
});
|
||||
},
|
||||
|
||||
last_sensor_reading: function() {
|
||||
var controller = Session.get('controller_id');
|
||||
var result = null;
|
||||
if (controller) {
|
||||
result = Meteor.zoblak.client.sensor_data_collection();
|
||||
}
|
||||
if (result && result.count() > 0) {
|
||||
return result.fetch()[0];
|
||||
} else {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Meteor.zoblak.shared = {
|
||||
valid_temperature: function(value) {
|
||||
return (parseFloat(value) > -40 && parseFloat(value) < 50);
|
||||
return (parseFloat(value) > -40 && parseFloat(value) < 50);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +86,7 @@ Meteor.zoblak.server = {
|
||||
var controller_id = ids[index];
|
||||
try {
|
||||
whatToDo(controller_id);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
console.log('Cannot call ', whatToDo, controller_id, err);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user