saving and temperature works

This commit is contained in:
Senad Uka
2016-10-23 15:10:20 +02:00
parent 31b355f381
commit 6108d75074
16 changed files with 270 additions and 130 deletions

View File

@@ -13,6 +13,7 @@ Api.addRoute('sensorData', {
var sensorObject = {
temperatureValue: parseFloat(this.bodyParams.temperatureValue),
humidityValue: parseFloat(this.bodyParams.humidityValue),
temperatures: this.bodyParams.temperatures,
tankLevel0: this.bodyParams.tankLevel0,
tankLevel1: this.bodyParams.tankLevel1,
tankLevel2: this.bodyParams.tankLevel2,
@@ -96,6 +97,20 @@ reactToSensorData = function(nextSensorReading) {
}
}
Api.addRoute('alarm/:id/stop', {
authRequired: false
}, {
post: function() {
var state = Meteor.zoblak.server.controller_state(controller_id);
ControllerState.update(state._id, {
'$set': {
'state.alarmTriggered': false,
'state.alarmStopped': new Date()
}
});
}
});
Api.addRoute('state/:id', {
authRequired: false
}, {