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
status : {states: [{label:'Disabled',action:'BELL:1',css:'background-color:#FF9B9B;',icon:'fa-bell-slash',condition:''+function(node){returnnode.metrics['Status']!=null&&node.metrics['Status'].value=='OFF';}},
//NOTE the \b word boundary is used to avoid matching "OPENING" (ie OPEN must be followed by word boundary/end of word)
5
+
open : {name:'Status',regexp:/(?:STS\:)?(OPN|OPEN)\b/i,value:'OPEN',pin:1,graph:1,logValue:2,graphOptions:{legendLbl:'Garage door events',yaxis: {ticks:0},colors:['#4a0'],/*lines: { lineWidth:1 }*/}},
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.replace(/\{.+\}/ig,'')+'] @ '+newDate().toLocaleTimeString());};}},
14
+
garagePoll: {label:'Garage : POLL Status',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);}});}},
15
+
16
+
garageSnapshotEmail : {label:'Garage : Snapshot',icon:'camera',descr:'Send IPCam snapshot when garage is OPENING',
motionAlert : {label:'Motion : Alert',icon:'audio',descr:'Alert sound when MOTION is detected',serverExecute:function(node){if(node.metrics['M']&&node.metrics['M'].value=='MOTION'&&(Date.now()-newDate(node.metrics['M'].updated).getTime()<2000)){io.sockets.emit('PLAYSOUND','sounds/alert.wav');};}},
10
+
mailboxAlert : {label:'Mailbox Open Alert!',icon:'audio',descr:'Message sound when mailbox is opened',serverExecute:function(node){if(node.metrics['M']&&node.metrics['M'].value=='MOTION'&&(Date.now()-newDate(node.metrics['M'].updated).getTime()<2000)){io.sockets.emit('PLAYSOUND','sounds/incomingmessage.wav');};}},
11
+
motionEmail : {label:'Motion : Email',icon:'mail',descr:'Send email when MOTION is detected',serverExecute:function(node){if(node.metrics['M']&&node.metrics['M'].value=='MOTION'&&(Date.now()-newDate(node.metrics['M'].updated).getTime()<2000)){sendEmail('MOTION DETECTED','MOTION WAS DETECTED ON NODE: ['+node._id+':'+node.label.replace(/\{.+\}/ig,'')+'] @ '+newDate().toLocaleTimeString());};}},
12
+
motionSMS : {label:'Motion : SMS',icon:'comment',descr:'Send SMS when MOTION is detected',serverExecute:function(node){if(node.metrics['M']&&node.metrics['M'].value=='MOTION'&&(Date.now()-newDate(node.metrics['M'].updated).getTime()<2000)){sendSMS('MOTION DETECTED','MOTION WAS DETECTED ON NODE: ['+node._id+':'+node.label.replace(/\{.+\}/ig,'')+'] @ '+newDate().toLocaleTimeString());};}},
13
+
14
+
motionSMSLimiter : {label:'Motion : SMS Limited',icon:'comment',descr:'Send SMS when MOTION is detected, once per time limit (setting)',
15
+
serverExecute:function(node){
16
+
if(node.metrics['M']&&node.metrics['M'].value=='MOTION'&&(Date.now()-node.metrics['M'].updated<2000))/*check if M metric exists and value is MOTION, received less than 2s ago*/
17
+
{
18
+
varapproveSMS=false;
19
+
20
+
if(node.metrics['M'].lastSMS)/*check if lastSMS value is not NULL ... */
sendEmail('MOTION DETECTED','MOTION DETECTED ON NODE: ['+dbNode._id+':'+dbNode.label.replace(/\{.+\}/ig,'')+'] @ '+newDate().toLocaleTimeString(),[{path: snapshotURL,filename: 'snapshot.jpg'}]);
51
+
});
52
+
}
53
+
}
54
+
},
55
+
56
+
mailboxSMS : {label:'Mailbox open : SMS',icon:'comment',descr:'Send SMS when mailbox is opened',serverExecute:function(node){if(node.metrics['M']&&node.metrics['M'].value=='MOTION'&&(Date.now()-newDate(node.metrics['M'].updated).getTime()<2000)){sendSMS('MAILBOX OPENED','Mailbox opened ['+node._id+':'+node.label.replace(/\{.+\}/ig,'')+'] @ '+newDate().toLocaleTimeString());};}},
57
+
motionLightON23 : {label:'Motion: SM23 ON!',icon:'action',descr:'Turn SwitchMote:23 ON when MOTION is detected',serverExecute:function(node){if(node.metrics['M']&&node.metrics['M'].value=='MOTION'&&(Date.now()-newDate(node.metrics['M'].updated).getTime()<2000)){sendMessageToNode({nodeId:23,action:'MOT:1'});};}},
58
+
59
+
}
60
+
61
+
exports.motes={
62
+
MotionMote: {
63
+
label : 'Motion Sensor',
64
+
icon : 'icon_motion.png',
65
+
settings: {lowVoltageValue: '',ipcam_snapURL: ''},//blank will make it inherit from global settings.json lowVoltageValue, a specific value overrides the general setting, user can always choose his own setting in the UI
66
+
},
67
+
Mailbox: {
68
+
label : 'Mailbox',
69
+
icon : 'icon_mailbox.png',
70
+
settings: {lowVoltageValue: '',ipcam_snapURL: ''},//blank will make it inherit from global settings.json lowVoltageValue, a specific value overrides the general setting, user can always choose his own setting in the UI
sumpSMS : {label:'SumpPump : SMS (below 20cm)',icon:'comment',descr:'Send SMS if water < 20cm below surface',serverExecute:function(node){if(node.metrics['CM']&&node.metrics['CM'].value<20&&(Date.now()-newDate(node.metrics['CM'].updated).getTime()<2000)){sendSMS('SUMP PUMP ALERT','Water is only 20cm below surface and rising - ['+node._id+'] '+node.label.replace(/\{.+\}/ig,'')+' @ '+newDate().toLocaleTimeString());};}},
9
+
}
10
+
11
+
exports.motes={
12
+
SonarMote: {
13
+
label : 'Sonar Mote (Distance Sensor)',
14
+
icon : 'icon_sonar.png',
15
+
settings: {lowVoltageValue: ''},//blank will make it inherit from global settings.json lowVoltageValue, a specific value overrides the general setting, user can always choose his own setting in the UI
0 commit comments