- failed temp and humidity reading wont prevent data sending

- printing of water level
This commit is contained in:
2016-06-12 12:03:19 +02:00
parent 8fc028aaab
commit 78f052a664
3 changed files with 14 additions and 2 deletions

View File

@@ -5,7 +5,7 @@
<img src="{{ bucket_image }}" class="img-responsive center-block" id="bucket_image" />
<div class="text-center">
{{controller_id}}:
{{#with last_sensor_reading}} <strong> {{ temperatureValue }} °C, {{ humidityValue }} % </strong> {{/with}}
{{#with last_sensor_reading}} <strong> temp: {{ temperatureValue }} °C, vlaga: {{ humidityValue }} % <br/>nivo vode: {{water_level}} </strong> {{/with}}
</div>
<div class="text-center">
Automatsko zalijevanje:<br /> <strong>{{ pretty_days config.automaticDaysOfWeek }} {{ pretty_time config.automaticDaysOfWeek config.automaticTimeOfDay }}</strong> <button id="run_settings" class="btn btn-default"> <i class="fa fa-wrench"></i> </button>

View File

@@ -69,6 +69,18 @@ Template.state.helpers({
last_sensor_reading: last_sensor_reading,
water_level: function() {
var sensor = last_sensor_reading();
if (sensor) {
if (parseInt(sensor.tankFull) === 1) return '100 %';
else if (parseInt(sensor.tankLevel4) === 1) return '80 %';
else if (parseInt(sensor.tankLevel3) === 1) return '60 %';
else if (parseInt(sensor.tankLevel2) === 1) return '40 %';
else if (parseInt(sensor.tankLevel1) === 1) return '20 %';
else '0 %'
}
},
water_now_button_class: function() {
var stateObject = controller_state();
if (stateObject.state && (stateObject.state.out_valve === 'open' || stateObject.state.out_valve === 'opening')) {