Added last valve open time #19
@@ -14,6 +14,10 @@
|
||||
<div><strong>Ulazni ventil/pumpa:</strong> {{pretty_valve state.in_valve }}</div>
|
||||
<div><strong>Zadnja komunikacija: {{ last_communication_time }}</strong>
|
||||
</div>
|
||||
<div><strong>Zadnje zaljevanje: {{ last_out_valve_open }}</strong>
|
||||
</div>
|
||||
<div><strong>Zadnje punjenje: {{ last_in_valve_open }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
@@ -7,6 +7,12 @@ Template.state_details.helpers({
|
||||
},
|
||||
last_communication_time: function() {
|
||||
return moment(this.time).fromNow();
|
||||
},
|
||||
last_out_valve_open: function() {
|
||||
return moment(this.significantEvents.lastOutValveOpen).fromNow();
|
||||
},
|
||||
last_in_valve_open: function() {
|
||||
return moment(this.significantEvents.lastInValveOpen).fromNow();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -90,7 +96,7 @@ function buildTemperatureGraph() {
|
||||
function buildHumidityGraph() {
|
||||
var unfilteredReadings = sensor_data_collection();
|
||||
// we want to show only 11 points from all data - filtering will add
|
||||
// the last one so 10 + 1 = 11
|
||||
// the last one so 10 + 1 = 11
|
||||
var breakingPoint = Math.floor(countValues(unfilteredReadings) / 10);
|
||||
|
||||
var sensorReadings = filterDataPoints(unfilteredReadings, breakingPoint);
|
||||
|
||||
@@ -37,6 +37,7 @@ function reactToSensorData(nextSensorReading) {
|
||||
}, {
|
||||
'$set': {
|
||||
'state.in_valve': 'opening',
|
||||
'significantEvents.lastInValveOpen': new Date(),
|
||||
'time': new Date(),
|
||||
'set_by': 'server'
|
||||
}
|
||||
|
||||
@@ -21,6 +21,15 @@ function setOutValveTo(controller_id, nextState) {
|
||||
'set_by': 'server'
|
||||
}
|
||||
});
|
||||
|
||||
if(nextState === "open") {
|
||||
ControllerState.update(state._id, {
|
||||
'$set': {
|
||||
'significantEvents.lastOutValveOpen': new Date(),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function openOutValve(controller_id) {
|
||||
|
||||
Reference in New Issue
Block a user