You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The "duplicateInterval" metric setting allows to only log a metric value
(when not changed) after this interval (seconds).
This saves log disk space when the metric values doesn't change for long
periods of time (ie battery voltage).
The \b word boundaries was added to several metrics to avoid undesired
partial matching on other similar metrics (ex "c:123" could previously
match "abc:123").
}catch(err){console.error(' POST ERROR: '+err.message);/*console.log(' POST ERROR STACK TRACE: ' + err.stack); */}//because this is a callback concurrent calls to the same log, milliseconds apart, can cause a file handle concurrency exception
541
541
}
542
542
elseconsole.log(' METRIC NOT NUMERIC, logging skipped... (extracted value:'+graphValue+')');
if(value!=lastValue||(timestamp-lastTime>3600))//only write new value if different than last value or 1 hour has passed (should be a setting?)
127
+
if(value!=lastValue||(duplicateInterval==null||timestamp-lastTime>duplicateInterval))//only write new value if different than last value or duplicateInterval seconds has passed (should be a setting?)
//uncomment FtoC if you want a F:1234 to be valuated as a Centigrade isntead of F (the first match is picked up and will evaluate, any following defs are ignored)
F : {name:'F',regexp:/F\:(-?\d+\.\d+)/i,value:'',unit:'°',pin:1,graph:1,graphValSuffix:'F',graphOptions:{legendLbl:'Temperature',lines: {lineWidth:1}}},
F : {name:'F',regexp:/\bF\:(-?\d+\.\d+)\b/i,value:'',duplicateInterval:3600,unit:'°',pin:1,graph:1,graphValSuffix:'F',graphOptions:{legendLbl:'Temperature',lines: {lineWidth:1}}},
80
80
//uncomment FHtoC if you want a F:1234 to be valuated as a Centigrade isntead of F (the first match is picked up and will evaluate, any following defs are ignored)
C : {name:'C',regexp:/\bC\:([-\d\.]+)\b/i,value:'',duplicateInterval:3600,unit:'°',pin:1,graph:1,graphValSuffix:'C',graphOptions:{legendLbl:'Temperature'}},
84
+
H : {name:'H',regexp:/\bH\:([\d\.]+)\b/i,value:'',duplicateInterval:3600,unit:'%',pin:1,graph:1,graphOptions:{legendLbl:'Humidity',lines: {lineWidth:1}}},
85
+
P : {name:'P',regexp:/\bP\:([\d\.]+)\b/i,value:'',duplicateInterval:3600,unit:'"',pin:1,},
86
86
87
87
//SprinklerMote
88
88
SPRKL_ZONE : {name:'ZONE',regexp:/ZONE\:([\d\.]+)/i,value:'',pin:1,graph:1,logValue:'',graphValPrefix:'Zone ',graphValSuffix:' running!',graphOptions:{legendLbl:'Zone',colors:['#4a0']}},//this captures zone messages and extracts the ID of the active zone
garageSMS : {label:'Garage : SMS',icon:'comment',descr:'Send SMS when garage is OPENING',serverExecute:function(node){if(node.metrics['Status']&&(node.metrics['Status'].value.indexOf('OPENING')>-1)&&(Date.now()-newDate(node.metrics['Status'].updated).getTime()<2000)){sendSMS('Garage event','Garage was opening on node : ['+node._id+':'+node.label+'] @ '+(newDate().toLocaleTimeString()+(newDate().getHours()>12 ? 'PM':'AM')));};}},
194
194
garagePoll: {label:'Garage : POLL',icon:'comment',descr:'Poll Garage Status',nextSchedule:function(nodeAtScheduleTime){return30000;},scheduledExecute:function(nodeAtScheduleTime){db.findOne({_id : nodeAtScheduleTime._id},function(err,nodeRightNow){if(nodeRightNow){/*just emit a log the status to client(s)*/io.sockets.emit('LOG','GARAGE POLL STATUS: '+nodeRightNow.metrics['Status'].value);}});}},
195
195
196
-
switchMoteON_PM : {label:'SwitchMote ON at 5:30PM!',icon:'clock',descr:'Turn this switch ON every evening',nextSchedule:function(node){returnexports.timeoutOffset(17,30);},scheduledExecute:function(node){sendMessageToNode({nodeId:node._id,action:'BTN1:1'});}},
197
-
switchMoteOFF_AM : {label:'SwitchMote OFF at 7:30AM!',icon:'clock',descr:'Turn this switch OFF every morning',nextSchedule:function(node){returnexports.timeoutOffset(7,30);},scheduledExecute:function(node){sendMessageToNode({nodeId:node._id,action:'BTN1:0'});}},
196
+
switchMoteON_PM : {label:'SwitchMote ON at 6:30PM!',icon:'clock',descr:'Turn this switch ON every evening',nextSchedule:function(node){returnexports.timeoutOffset(18,30);},scheduledExecute:function(node){sendMessageToNode({nodeId:node._id,action:'BTN1:1'});}},
197
+
switchMoteOFF_AM : {label:'SwitchMote OFF at 8:00AM!',icon:'clock',descr:'Turn this switch OFF every morning',nextSchedule:function(node){returnexports.timeoutOffset(8,00);},scheduledExecute:function(node){sendMessageToNode({nodeId:node._id,action:'BTN1:0'});}},
198
198
switchMoteONBUZZ : {label:'SwitchMote ON Buzzer beep!',icon:'clock',descr:'Buzz gateway when switchmote is ON',serverExecute:function(node){if(node.metrics['B1']&&node.metrics['B1'].value=='ON'&&(Date.now()-newDate(node.metrics['B1'].updated).getTime()<2000)){setTimeout(function(){sendMessageToGateway('BEEP');},5);}}},
199
-
199
+
200
200
//for the sprinkler events, rather than scheduling with offsets, its much easir we run them every day, and check the odd/even/weekend condition in the event itself
201
-
sprinklersOddDays : {label:'Odd days @ 6:30AM',icon:'clock',descr:'Run this sprinkler program on odd days at 6:30AM',nextSchedule:function(node){returnexports.timeoutOffset(6,30);},scheduledExecute:function(node){if((newDate().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))*/});}},
202
-
sprinklersEvenDays : {label:'Even days @ 6:30AM',icon:'clock',descr:'Run this sprinkler program on even days at 6:30AM',nextSchedule:function(node){returnexports.timeoutOffset(6,30);},scheduledExecute:function(node){if((newDate().getDate()%2)==0)sendMessageToNode({nodeId:node._id,action:'PRG 2:300 3:300 1:300 4:300 5:300'/*runs stations 1-5 (300sec each)*/});}},
203
-
sprinklersWeekends : {label:'Weekends @ 6:30AM)',icon:'clock',descr:'Run this sprinkler program on weekend days at 6:30AM',nextSchedule:function(node){returnexports.timeoutOffset(6,30);},scheduledExecute:function(node){if([0,6].indexOf(newDate().getDay())>-1/*Saturday=6,Sunday=0,*/)sendMessageToNode({nodeId:node._id,action:'PRG 2:180 3:180 1:180 4:180 5:180'/*runs stations 1-5 (180sec each)*/});}},
201
+
sprinklersOddDays : {label:'Odd days @ 2:30AM',icon:'clock',descr:'Run this sprinkler program on odd days at 2:30AM',nextSchedule:function(node){returnexports.timeoutOffset(2,30);},scheduledExecute:function(node){if((newDate().getDate()%2)==1)sendMessageToNode({nodeId:node._id,action:'PRG 1:300 2:300 3:300 4:300 5:300'/*runs stations 1-5 (300sec each))*/});}},
202
+
sprinklersEvenDays : {label:'Even days @ 2:30AM',icon:'clock',descr:'Run this sprinkler program on even days at 2:30AM',nextSchedule:function(node){returnexports.timeoutOffset(2,30);},scheduledExecute:function(node){if((newDate().getDate()%2)==0)sendMessageToNode({nodeId:node._id,action:'PRG 1:300 2:300 3:300 4:300 5:300'/*runs stations 1-5 (300sec each)*/});}},
203
+
sprinklersWeekends : {label:'Weekends @ 2:30AM)',icon:'clock',descr:'Run this sprinkler program on weekend days at 2:30AM',nextSchedule:function(node){returnexports.timeoutOffset(2,30);},scheduledExecute:function(node){if([0,6].indexOf(newDate().getDay())>-1/*Saturday=6,Sunday=0,*/)sendMessageToNode({nodeId:node._id,action:'PRG 1:180 2:180 3:180 4:180 5:180'/*runs stations 1-5 (180sec each)*/});}},
204
204
205
205
//thermostat poll event
206
206
thermostatPoll : {label:'Thermostat status poll',icon:'fa-heartbeat',descr:'Poll thermostat status (HTTP GET)',
207
207
nextSchedule:function(node){return30000;},
208
208
scheduledExecute:function(node){
209
209
exports.tstatPoll(node._id);
210
-
}},
210
+
}
211
+
},
211
212
//END thermostat poll event
212
213
213
214
thermostat_H68_AM : {label:'Thermostat heat 68° @ 8AM weekdays',icon:'clock',descr:'Request heat point of 68° weekdays at 8am',
0 commit comments