Skip to content

Commit 6a5ccab

Browse files
committed
Fix user metrics _example.js
1 parent 1a4774a commit 6a5ccab

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

userMetrics/_example.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
/*this sample metric will override that which is already defined in main metrics.js*/
2-
/*you can redefine defaults or write your own new custom metrics in 1 or more files in this folder, separate them as you'd like - they all get merged together when the app loads*/
1+
//This sample metric will override that which is already defined in main metrics.js
2+
//You can redefine defaults or write your own new custom metrics in 1 or more files in this folder, separate them as you'd like - they all get merged together when the app loads
3+
4+
//you will have to import any used functions from metrics.js this way:
5+
exports.timeoutOffset = require('../metrics.js').timeoutOffset;
6+
exports.futureDateOffset = require('../metrics.js').futureDateOffset;
7+
38
exports.metrics = {
49
V:
510
{
@@ -58,14 +63,15 @@ exports.metrics = {
5863
}
5964
};
6065

66+
//example of overriding an event
6167
exports.events = {
62-
sprinklersOddDays : { label:'Odd days @ 6:31AM', icon:'clock', descr:'Run this sprinkler program on odd days at 6:30AM', nextSchedule:function(node) { return exports.timeoutOffset(6,30); }, scheduledExecute:function(node) { if ((new Date().getDate()%2)==1) sendMessageToNode({nodeId:node._id, action:'PRG 2:300 3:300 1:300 4:300 5:300' /*runs stations 1-5 (300sec each))*/}); } },
68+
sprinklersOddDays : { label:'Odd days Z1-9 @3AM', icon:'clock', descr:'Run Zones 1-9, odd days @3AM', nextSchedule:function(node) { return exports.timeoutOffset(3,0); }, scheduledExecute:function(node) { if ((new Date().getDate()%2)==1) sendMessageToNode({nodeId:node._id, action:'PRG 1:400 2:400 3:400 4:300 5:400 6:400 7:400 8:300 9:150' /*runs stations 1-5 (300sec each))*/}); } },
6369
};
6470

65-
/*example of defining a property to use anywhere in the app/events or in other custom functions*/
71+
//example of defining a property to use anywhere in the app/events or in other custom functions
6672
exports.ONEDAYHOURS = 24;
6773

68-
/*example of defining a general purpose function to use in the app/events or in other custom functions*/
74+
//example of defining a general purpose function to use in the app/events or in other custom functions
6975
exports.secondsInOneDay = function() {
7076
var result = exports.ONEDAYHOURS * 3600;
7177
return result;

0 commit comments

Comments
 (0)