Added last valve open time

This commit is contained in:
Senad Uka
2016-05-08 05:17:12 +02:00
parent 2772baafbc
commit ac76654e2a
4 changed files with 21 additions and 1 deletions

View File

@@ -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">

View File

@@ -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);