Individual distance value

This commit is contained in:
Gerrit Linnemann 2016-06-15 23:36:15 +02:00
parent 1b813fd749
commit 52344b9413
2 changed files with 18 additions and 12 deletions

View File

@ -40,7 +40,8 @@ Helper.each(Conf.items, function(item) {
function (distance) {
//Log.log('Distance Value: ' + distance);
if(distance < 200 && readyForNextNotification) {
if(readyForNextNotification) {
if((item.mode === '<' && distance < item.value) || (item.mode === '>' && distance > item.value)) {
counter++;
readyForNextNotification = false;
@ -52,6 +53,7 @@ Helper.each(Conf.items, function(item) {
setTimeout(function() { readyForNextNotification = true; }, item.on.action.timeout);
}
}
}
);
process.on( 'SIGINT', function() {

View File

@ -4,9 +4,11 @@
"host": "192.168.2.124",
"port": 4223,
"uid": "q2J",
"mode": "<",
"value": 200,
"on": {
"action": {
"timeout": 4500,
"timeout": 4000,
"on": {
"host": "hobu",
"port": "2999",
@ -24,9 +26,11 @@
"host": "192.168.2.125",
"port": 4223,
"uid": "z9q",
"mode": ">",
"value": 2000,
"on": {
"action": {
"timeout": 4500,
"timeout": 3500,
"on": {
"host": "hobu",
"port": "2999",