saving and temperature works
This commit is contained in:
@@ -1,11 +1,3 @@
|
||||
function controller_state() {
|
||||
var controllerId = Session.get('controller_id');
|
||||
result = ControllerState.findOne({});
|
||||
if (!result) {
|
||||
result = {}
|
||||
};
|
||||
return result;
|
||||
};
|
||||
|
||||
function sensor_data_collection() {
|
||||
var controllerId = Session.get('controller_id');
|
||||
@@ -44,7 +36,7 @@ Template.state.helpers({
|
||||
|
||||
bucket_image: function() {
|
||||
var sensor = last_sensor_reading();
|
||||
var stateObject = controller_state();
|
||||
var stateObject = Meteor.zoblak.client.controller_state();
|
||||
if (sensor) {
|
||||
if (parseInt(sensor.tankFull) === 0 && stateObject.state.in_valve === 'open' && stateObject.state.out_valve === 'closed') return "/images/barrellFillingUp.png";
|
||||
else if (parseInt(sensor.tankFull) === 1 && (stateObject.state.out_valve === 'closed')) return "/images/barrellFull.png";
|
||||
@@ -74,7 +66,7 @@ Template.state.helpers({
|
||||
},
|
||||
|
||||
water_now_button_class: function() {
|
||||
var stateObject = controller_state();
|
||||
var stateObject = Meteor.zoblak.client.controller_state();
|
||||
if (stateObject.state && (stateObject.state.out_valve === 'open' || stateObject.state.out_valve === 'opening')) {
|
||||
return 'hidden btn btn-success';
|
||||
} else {
|
||||
@@ -82,7 +74,7 @@ Template.state.helpers({
|
||||
}
|
||||
},
|
||||
stop_button_class: function() {
|
||||
var stateObject = controller_state();
|
||||
var stateObject = Meteor.zoblak.client.controller_state();
|
||||
if (stateObject.state && (stateObject.state.out_valve === 'closed' || stateObject.state.out_valve === 'closing')) {
|
||||
return 'hidden btn btn-success';
|
||||
} else {
|
||||
@@ -91,7 +83,7 @@ Template.state.helpers({
|
||||
},
|
||||
|
||||
start_inflow_button_class: function() {
|
||||
var stateObject = controller_state();
|
||||
var stateObject = Meteor.zoblak.client.controller_state();
|
||||
if(stateObject.config && stateObject.config.manualInflow && stateObject.state.out_valve === 'closed' && ( stateObject.state.in_valve === 'closed' || stateObject.state.in_valve === 'closing')) {
|
||||
return 'btn btn-danger'
|
||||
} else {
|
||||
@@ -100,7 +92,7 @@ Template.state.helpers({
|
||||
},
|
||||
|
||||
stop_inflow_button_class: function() {
|
||||
var stateObject = controller_state();
|
||||
var stateObject = Meteor.zoblak.client.controller_state();
|
||||
if(stateObject.config && stateObject.config.manualInflow && stateObject.state.out_valve === 'closed' && ( stateObject.state.in_valve === 'open' || stateObject.state.in_valve === 'opening')) {
|
||||
return 'btn btn-danger'
|
||||
} else {
|
||||
@@ -159,7 +151,7 @@ Template.state.events({
|
||||
},
|
||||
|
||||
'click #bucket_image': function() {
|
||||
Modal.show('state_details', controller_state());
|
||||
Modal.show('state_details', Meteor.zoblak.client.controller_state());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user