alarm triggering / silencing works

This commit is contained in:
Senad Uka
2016-10-23 15:57:04 +02:00
parent 6108d75074
commit d92e208221
6 changed files with 60 additions and 23 deletions

View File

@@ -25,14 +25,17 @@ function last_sensor_reading() {
Template.alarm.helpers({
last_reading: last_sensor_reading,
state: function() {
return Meteor.zoblak.client.controller_state().state;
},
pretty_time: function(time) {
return moment(time).format("DD.MM.YYYY, HH:mm")
},
all_temperatures: function() {
var result="";
var result = "";
var temperatures = last_sensor_reading().temperatures;
for(var i in temperatures) {
for (var i in temperatures) {
result += '' + parseFloat(temperatures[i]).toFixed(1) + ' °C ';
}
return result;
@@ -42,6 +45,10 @@ Template.alarm.helpers({
Template.alarm.events({
'click #run_alarm_settings': function() {
Modal.show('alarm_settings');
},
'click #stop_alarm': function() {
let controller_id = Meteor.zoblak.client.controller_state().controller_id;
Meteor.call('stopTheAlarm', controller_id);
}
});