homebridge-syntex-webhooks
Advanced tools
Comparing version 1.0.5-b6 to 1.0.5-b7
64
index.js
@@ -85,3 +85,30 @@ var request = require('request'); | ||
if(obj) | ||
if(!obj && !err) | ||
{ | ||
log('\x1b[33m%s\x1b[0m', "[INFO]", "Storage.json wurde ohne Inhalt geladen!"); | ||
if(urlParams.type) | ||
{ | ||
var device = { | ||
id: "storage", | ||
devices: [{mac: urlParams.mac, value: urlParams.value, type: urlParams.type}] | ||
}; | ||
} | ||
else | ||
{ | ||
var device = { | ||
id: "storage", | ||
devices: [{mac: urlParams.mac, value: urlParams.value}] | ||
}; | ||
} | ||
this.storage.add(device, (err) => { | ||
if(err) | ||
{ | ||
log('\x1b[31m%s\x1b[0m', "[ERROR]", "Storage.json konnte nicht aktualisiert werden!"); | ||
} | ||
}); | ||
} | ||
else if(obj && !err) | ||
{ | ||
@@ -131,32 +158,6 @@ var found = false; | ||
}); | ||
log(obj.devices); | ||
} | ||
if(err) | ||
else if(obj && err) | ||
{ | ||
log('\x1b[31m%s\x1b[0m', "[ERROR]", "Storage.json konnte nicht geladen werden!"); | ||
if(urlParams.type) | ||
{ | ||
var device = { | ||
id: "storage", | ||
devices: [{mac: urlParams.mac, value: urlParams.value, type: urlParams.type}] | ||
}; | ||
} | ||
else | ||
{ | ||
var device = { | ||
id: "storage", | ||
devices: [{mac: urlParams.mac, value: urlParams.value}] | ||
}; | ||
} | ||
this.storage.add(device, (err) => { | ||
if(err) | ||
{ | ||
log('\x1b[31m%s\x1b[0m', "[ERROR]", "Storage.json konnte nicht aktualisiert werden!"); | ||
} | ||
}); | ||
log('\x1b[31m%s\x1b[0m', "[ERROR]", "Storage.json konnte nicht geladen werden!"); | ||
} | ||
@@ -198,6 +199,3 @@ | ||
if(!obj && !err) | ||
{ | ||
log('\x1b[33m%s\x1b[0m', "[INFO]", "Storage.json wurde ohne Inhalt geladen!"); | ||
} | ||
log(obj.devices); | ||
}); | ||
@@ -204,0 +202,0 @@ |
{ | ||
"name": "homebridge-syntex-webhooks", | ||
"version": "1.0.5-b6", | ||
"version": "1.0.5-b7", | ||
"description": "A webhook plugin for HTTP devices", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
30732