homebridge-syntex-webhooks
Advanced tools
Comparing version 2.3.8-b9 to 2.3.8
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true, | ||
"node": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"parserOptions": { | ||
"ecmaVersion": 13, | ||
"sourceType": "module" | ||
}, | ||
"rules": {} | ||
"env": { | ||
"browser": true, | ||
"es2021": true, | ||
"node": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"parserOptions": { | ||
"ecmaVersion": 13, | ||
"sourceType": "module" | ||
}, | ||
"rules": {} | ||
} |
10
index.js
@@ -1,3 +0,1 @@ | ||
let DeviceManager = require('./src/device-manager'); | ||
const { DynamicPlatform } = require('homebridge-syntex-dynamic-platform'); | ||
@@ -7,2 +5,4 @@ | ||
const DeviceManager = require('./src/device-manager'); | ||
const pluginID = 'homebridge-syntex-webhooks'; | ||
@@ -24,3 +24,3 @@ const pluginName = 'SynTexWebHooks'; | ||
DeviceManager = new DeviceManager(this); | ||
this.DeviceManager = new DeviceManager(this); | ||
@@ -42,7 +42,7 @@ this.loadAccessories(); | ||
device.manufacturer = pluginName; | ||
device.manufacturer = this.pluginName; | ||
this.addAccessory(new SynTexUniversalAccessory(homebridgeAccessory, device, { platform : this, DeviceManager })); | ||
this.addAccessory(new SynTexUniversalAccessory(homebridgeAccessory, device, { platform : this, DeviceManager : this.DeviceManager })); | ||
} | ||
} | ||
} |
{ | ||
"name": "homebridge-syntex-webhooks", | ||
"version": "2.3.8-b9", | ||
"version": "2.3.8", | ||
"description": "A webhook plugin for HTTP devices", | ||
@@ -14,5 +14,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"axios": "^0.21.1", | ||
"color-convert": "^1.5.0", | ||
"homebridge-syntex-dynamic-platform": "1.0.8-b13", | ||
"homebridge-syntex-dynamic-platform": "1.0.8-b42", | ||
"json-fs-store": "^1.0.1" | ||
@@ -19,0 +18,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
const axios = require('axios'), convert = require('color-convert'); | ||
const convert = require('color-convert'); | ||
@@ -10,4 +10,6 @@ module.exports = class DeviceManager | ||
this.logger = platform.logger; | ||
this.typeManager = platform.TypeManager; | ||
this.RequestManager = platform.RequestManager; | ||
this.TypeManager = platform.TypeManager; | ||
this.accessories = platform.accessories; | ||
@@ -43,20 +45,23 @@ | ||
axios.get(url, { timeout : 25000 }).then(() => { | ||
this.RequestManager.fetch(url, { timeout : 25000 }).then((response) => { | ||
this.connections[url] = 0; | ||
if(accessory.setConnectionState != null) | ||
if(response.data != null) | ||
{ | ||
accessory.setConnectionState(true, null, true); | ||
} | ||
this.connections[url] = 0; | ||
}).catch(() => { | ||
if(this.connections[url] < 2) | ||
{ | ||
this.connections[url]++; | ||
if(accessory.setConnectionState != null) | ||
{ | ||
accessory.setConnectionState(true, null, true); | ||
} | ||
} | ||
else if(accessory.setConnectionState != null) | ||
else | ||
{ | ||
accessory.setConnectionState(false, null, true); | ||
if(this.connections[url] < 2) | ||
{ | ||
this.connections[url]++; | ||
} | ||
else if(accessory.setConnectionState != null) | ||
{ | ||
accessory.setConnectionState(false, null, true); | ||
} | ||
} | ||
@@ -131,14 +136,11 @@ }); | ||
{ | ||
axios.get(urlToCall, theRequest).then(function(response) { | ||
this.RequestManager.fetch(urlToCall, theRequest).then(function(response) { | ||
success++; | ||
if(response.data != null) | ||
{ | ||
success++; | ||
} | ||
this.logger.log(response.data != null ? 'success' : 'error', service.id, service.letters, '[' + service.name + '] %request_result[0]% [' + this.url + '] %request_result[1]% [' + (response.status || -1)+ '] %request_result[2]%: [' + (response.data || '') + ']', response.error || ''); | ||
this.logger.log('success', service.id, service.letters, '[' + service.name + '] %request_result[0]% [' + this.url + '] %request_result[1]% [' + response.status + '] %request_result[2]%: [' + (response.data || '') + ']'); | ||
}.bind({ url : urlToCall, logger : this.logger })).catch(function(err) { | ||
this.logger.log('error', service.id, service.letters, '[' + service.name + '] %request_result[0]% [' + this.url + '] %request_result[1]% [' + (err.response != null ? err.response.status : -1)+ '] %request_result[2]%: [' + (err.response != null ? err.response.data : '') + ']', err.stack); | ||
}.bind({ url : urlToCall, logger : this.logger })).then(function() { | ||
finished++; | ||
@@ -153,3 +155,3 @@ | ||
if(success == 0 && this.typeManager.letterToType(service.letters) == 'relais') | ||
if(success == 0 && this.TypeManager.letterToType(service.letters) == 'relais') | ||
{ | ||
@@ -163,4 +165,4 @@ resolve(false); | ||
} | ||
}.bind({ url : urlToCall, typeManager : this.typeManager })); | ||
}.bind({ url : urlToCall, logger : this.logger, TypeManager : this.TypeManager })); | ||
} | ||
@@ -176,12 +178,6 @@ else if(service.options.requests[i].trigger.toLowerCase() == 'color') | ||
axios.get(urlToCall + colors[0] + ',' + colors[1] + ',' + (state.value ? colors[2] : 0), theRequest).then(function(response) { | ||
this.RequestManager.fetch(urlToCall + colors[0] + ',' + colors[1] + ',' + (state.value ? colors[2] : 0), theRequest).then(function(response) { | ||
this.logger.log('success', service.id, service.letters, '[' + service.name + '] %request_result[0]% [' + this.url + '] %request_result[1]% [' + response.status + '] %request_result[2]%: [' + (response.data || '') + '] '); | ||
}.bind({ url : urlToCall + colors[0] + ',' + colors[1] + ',' + (state.value ? colors[2] : 0), logger : this.logger })).catch(function(err) { | ||
this.logger.log(response.data != null ? 'success' : 'error', service.id, service.letters, '[' + service.name + '] %request_result[0]% [' + this.url + '] %request_result[1]% [' + (response.status || -1) + '] %request_result[2]%: [' + (response.data || '') + ']', response.error || ''); | ||
this.logger.log('error', service.id, service.letters, '[' + service.name + '] %request_result[0]% [' + this.url + '] %request_result[1]% [' + (err.response != null ? err.response.status : -1) + '] %request_result[2]%: [' + (err.response != null ? err.response.data : '') + ']', err.stack); | ||
}.bind({ url : urlToCall + colors[0] + ',' + colors[1] + ',' + (state.value ? colors[2] : 0), logger : this.logger })).then(() => { | ||
finished++; | ||
@@ -198,16 +194,11 @@ | ||
} | ||
}); | ||
}.bind({ url : urlToCall + colors[0] + ',' + colors[1] + ',' + (state.value ? colors[2] : 0), logger : this.logger })); | ||
} | ||
else if(service.options.requests[i].trigger.toLowerCase() == 'dimmer') | ||
{ | ||
axios.get(urlToCall + state.brightness, theRequest).then(function(response) { | ||
this.RequestManager.fetch(urlToCall + state.brightness, theRequest).then(function(response) { | ||
this.logger.log('success', service.id, service.letters, '[' + service.name + '] %request_result[0]% [' + this.url + '] %request_result[1]% [' + response.status + '] %request_result[2]%: [' + (response.data || '') + '] '); | ||
}.bind({ url : urlToCall + state.brightness, logger : this.logger })).catch(function(err) { | ||
this.logger.log(response.data != null ? 'success' : 'error', service.id, service.letters, '[' + service.name + '] %request_result[0]% [' + this.url + '] %request_result[1]% [' + (response.status || -1) + '] %request_result[2]%: [' + (response.data || '') + ']', response.error || ''); | ||
this.logger.log('error', service.id, service.letters, '[' + service.name + '] %request_result[0]% [' + this.url + '] %request_result[1]% [' + (err.response != null ? err.response.status : -1) + '] %request_result[2]%: [' + (err.response != null ? err.response.data : '') + ']', err.stack); | ||
}.bind({ url : urlToCall + state.brightness, logger : this.logger })).then(() => { | ||
finished++; | ||
@@ -224,3 +215,4 @@ | ||
} | ||
}); | ||
}.bind({ url : urlToCall + state.brightness, logger : this.logger })); | ||
} | ||
@@ -227,0 +219,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
3
0
54669
+ Addedcharenc@0.0.2(transitive)
+ Addedcrypt@0.0.2(transitive)
+ Addedhomebridge-syntex-dynamic-platform@1.0.8-b42(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedmd5@2.3.0(transitive)
+ Addedsyntex-automation@1.2.1-b16(transitive)
+ Addedsyntex-basic@1.0.0-b18(transitive)
+ Addedsyntex-filesystem@1.0.3-b9(transitive)
+ Addedsyntex-logger@1.0.9-b2(transitive)
+ Addedsyntex-webserver@1.1.1-b14(transitive)
- Removedaxios@^0.21.1
- Removedaxios@0.21.4(transitive)
- Removedfollow-redirects@1.15.9(transitive)
- Removedhomebridge-syntex-dynamic-platform@1.0.8-b13(transitive)
- Removedsyntex-automation@1.2.1-b1(transitive)
- Removedsyntex-filesystem@1.0.3-b1(transitive)
- Removedsyntex-logger@1.0.9-b1(transitive)
- Removedsyntex-webserver@1.1.1-b2(transitive)