Skip to content

Commit 0931d5b

Browse files
committed
events and UI fixes
1 parent 392e35c commit 0931d5b

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

metrics.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ exports.motes = {
450450
var thejson = { 'tmode':2, 't_cool' : ++targetNow };
451451
exports.tstatRequest(thejson, node._id);
452452
},
453-
condition:''+function(node) { return node.metrics['MODE'].value == 'COOL'; }
453+
condition:''+function(node) { return node.metrics['MODE'] && node.metrics['MODE'].value == 'COOL'; }
454454
},
455455
{ label:'Cool', action:'', icon:'fa-ge',
456456
serverExecute:function(node){
@@ -461,7 +461,7 @@ exports.motes = {
461461
var thejson = { 'tmode':2, 't_cool' : ++targetNow };
462462
exports.tstatRequest(thejson, node._id);
463463
},
464-
condition:''+function(node) { return node.metrics['MODE'].value != 'COOL'; }
464+
condition:''+function(node) { return node.metrics['MODE'] && node.metrics['MODE'].value != 'COOL'; }
465465
}]
466466
},
467467
//switch to HEAT mode
@@ -474,7 +474,7 @@ exports.motes = {
474474
var thejson = { 'tmode':1, 't_heat' : --targetNow };
475475
exports.tstatRequest(thejson, node._id);
476476
},
477-
condition:''+function(node) { return node.metrics['MODE'].value == 'HEAT'; }
477+
condition:''+function(node) { return node.metrics['MODE'] && node.metrics['MODE'].value == 'HEAT'; }
478478
},
479479
{ label:'Heat', action:'', icon:'fa-fire',
480480
serverExecute:function(node){
@@ -485,7 +485,7 @@ exports.motes = {
485485
var thejson = { 'tmode':1, 't_heat' : --targetNow };
486486
exports.tstatRequest(thejson, node._id);
487487
},
488-
condition:''+function(node) { return node.metrics['MODE'].value != 'HEAT'; }
488+
condition:''+function(node) { return node.metrics['MODE'] && node.metrics['MODE'].value != 'HEAT'; }
489489
}]
490490
},
491491
//switch to AUTO mode
@@ -496,7 +496,7 @@ exports.motes = {
496496
if (modeNow=='AUTO') return;
497497
exports.tstatRequest({ 'tmode':3 }, node._id);
498498
},
499-
condition:''+function(node) { return node.metrics['MODE'].value == 'AUTO'; }
499+
condition:''+function(node) { return node.metrics['MODE'] && node.metrics['MODE'].value == 'AUTO'; }
500500
},
501501
{ label:'Auto', action:'', icon:'fa-balance-scale',
502502
serverExecute:function(node){
@@ -505,7 +505,7 @@ exports.motes = {
505505
if (modeNow=='AUTO') return;
506506
exports.tstatRequest({ 'tmode':3 }, node._id);
507507
},
508-
condition:''+function(node) { return node.metrics['MODE'].value != 'AUTO'; }
508+
condition:''+function(node) { return node.metrics['MODE'] && node.metrics['MODE'].value != 'AUTO'; }
509509
}]
510510
},
511511
//switch thermostat OFF
@@ -516,7 +516,7 @@ exports.motes = {
516516
if (modeNow=='OFF') return;
517517
exports.tstatRequest({ 'tmode':0 }, node._id);
518518
},
519-
condition:''+function(node) { return node.metrics['MODE'].value == 'OFF'; }
519+
condition:''+function(node) { return node.metrics['MODE'] && node.metrics['MODE'].value == 'OFF'; }
520520
},
521521
{ label:'Off', action:'', icon:'fa-power-off',
522522
serverExecute:function(node){
@@ -525,7 +525,7 @@ exports.motes = {
525525
if (modeNow=='OFF') return;
526526
exports.tstatRequest({ 'tmode':0 }, node._id);
527527
},
528-
condition:''+function(node) { return node.metrics['MODE'].value != 'OFF'; }
528+
condition:''+function(node) { return node.metrics['MODE'] && node.metrics['MODE'].value != 'OFF'; }
529529
}],
530530
breakAfter:true,
531531
},
@@ -538,7 +538,7 @@ exports.motes = {
538538
var thejson = (fanNow == 'AUTO' ? { 'fmode':2 } : { 'fmode':0 }); //toggle between ON and AUTO
539539
exports.tstatRequest(thejson, node._id);
540540
},
541-
condition:''+function(node) { return node.metrics['FSTATE'].value == 'AUTO'; }
541+
condition:''+function(node) { return node.metrics['FSTATE'] && node.metrics['FSTATE'].value == 'AUTO'; }
542542
},
543543
{ label:'Turn fan AUTO', action:'', icon:'fa-lock', css:'background-color:#9BFFBE',
544544
serverExecute:function(node){
@@ -548,7 +548,7 @@ exports.motes = {
548548
var thejson = (fanNow == 'AUTO' ? { 'fmode':2 } : { 'fmode':0 }); //toggle between ON and AUTO
549549
exports.tstatRequest(thejson, node._id);
550550
},
551-
condition:''+function(node) { return node.metrics['FSTATE'].value == 'ON'; }
551+
condition:''+function(node) { return node.metrics['FSTATE'] && node.metrics['FSTATE'].value == 'ON'; }
552552
}],
553553
},
554554
//toggle HOLD on/off
@@ -560,7 +560,7 @@ exports.motes = {
560560
var thejson = (holdNow == 'OFF' ? { 'hold':1 } : { 'hold':0 });
561561
exports.tstatRequest(thejson, node._id);
562562
},
563-
condition:''+function(node) { return node.metrics['HOLD'].value == 'OFF'; }
563+
condition:''+function(node) { return node.metrics['HOLD'] && node.metrics['HOLD'].value == 'OFF'; }
564564
},
565565
{ label:'HOLD', action:'', icon:'fa-lock', css:'background-color:#9BFFBE',
566566
serverExecute:function(node){
@@ -570,7 +570,7 @@ exports.motes = {
570570
var thejson = (holdNow == 'OFF' ? { 'hold':1 } : { 'hold':0 });
571571
exports.tstatRequest(thejson, node._id);
572572
},
573-
condition:''+function(node) { return node.metrics['HOLD'].value == 'ON'; }
573+
condition:''+function(node) { return node.metrics['HOLD'] && node.metrics['HOLD'].value == 'ON'; }
574574
}],
575575
},
576576
},
@@ -674,7 +674,7 @@ exports.tstatRequest = function(thejson, nodeId) {
674674
// SUNRISE-SUNSET HELPER FUNCTIONALITY
675675
// ******************************************************************************************************************************************
676676
// find your lat/long at: http://www.latlong.net/
677-
// sunrise-sunset api at: http://api.sunrise-sunset.org/ --> more events available in this API (daylength, twilight, noon)
677+
// sunrise-sunset api at: http://api.sunrise-sunset.org/ --> more events available in this API (solarNoon, nadir, sunrise, sunset, sunriseEnd, sunsetStart, dawn, dusk, nauticalDawn, nauticalDusk, nightEnd, night, goldenHourEnd, goldenHour)
678678
// ******************************************************************************************************************************************
679679
exports.nextSunriseOrSunset = function(getSunrise) { //0=sunset, 1=sunrise
680680
var latitude = settings.location != undefined ? settings.location.latitude.value : 51.51; //fallback to London if setting not defined

www/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ <h3>Select date range for the CSV export</h3>
998998
var nodeValue = metricsValues(node.metrics);
999999
var lowVoltageSetting = node.settings && node.settings['lowVoltageValue'] ? node.settings['lowVoltageValue'] : (motesDef[node.type] && motesDef[node.type].settings && motesDef[node.type].settings.lowVoltageValue ? motesDef[node.type].settings.lowVoltageValue : boundSettings.general.lowVoltageValue.value);
10001000
var lowBat = node.metrics.V != null && node.metrics.V.value < lowVoltageSetting;
1001-
var newLI = $('<li id="' + node._id + '"><a node-id="' + node._id + '" href="#nodedetails" class="nodedetails"><img class="productimg" src="images/'+getNodeIcon(node)+'"><h2>' + (nodeResolveString(node.label, node.metrics) || node._id) + ' ' + resolveRSSIImage(node) + ' ' + (lowBat ? '<img src="images/lowbattery.png" class="lowbattimg"/> ' : '') + ago(node.updated, 0).tag + (node.hidden ? ' <img class="listIcon20px" src="images/icon_hidden.png" />' : '') + '</h2><p>' + (nodeResolveString(node.descr, node.metrics) || '&nbsp;') + '</p>' + (nodeValue ? '<span class="ui-li-count ui-li-count16">' + nodeValue + '</span>' : '') + '</a></li>');
1001+
var newLI = $('<li id="' + node._id + '"><a node-id="' + node._id + '" href="#nodedetails" class="nodedetails"><img class="productimg" src="images/'+getNodeIcon(node)+'"><h2>' + (nodeResolveString(node.label, node.metrics) || node._id) + ' ' + resolveRSSIImage(node) + ' ' + (lowBat ? '<img src="images/lowbattery.png" class="lowbattimg"/> ' : '') + ago(node.updated, 0).tag + (node.hidden ? ' <img class="listIcon20px" src="images/icon_hidden.png" />' : '') + '</h2><p>' + (nodeResolveString(node.descr || "", node.metrics) || '&nbsp;') + '</p>' + (nodeValue ? '<span class="ui-li-count ui-li-count16">' + nodeValue + '</span>' : '') + '</a></li>');
10021002
var existingNode = $('#nodeList li#' + node._id);
10031003
if (node.hidden)
10041004
if (showHiddenNodes)

0 commit comments

Comments
 (0)