hap-controller
Advanced tools
Comparing version
@@ -6,3 +6,3 @@ const readline = require('readline').createInterface({ | ||
const { HttpClient, IPDiscovery } = require('../../lib'); | ||
const { HttpClient, IPDiscovery } = require('hap-controller'); | ||
@@ -16,3 +16,3 @@ const discovery = new IPDiscovery(); | ||
try { | ||
const pairMethod = await discovery.getPairingMethod(service); | ||
const pairMethod = await discovery.getPairMethod(service); | ||
@@ -19,0 +19,0 @@ const client = new HttpClient(service.id, service.address, service.port); |
@@ -39,7 +39,13 @@ const { HttpClient, IPDiscovery } = require('hap-controller'); | ||
client.on('event-disconnect', (formerSubscribes) => { | ||
client.on('event-disconnect', async (formerSubscribes) => { | ||
console.log(`Disconnected: ${JSON.stringify(formerSubscribes, null, 2)}`); | ||
// resubscribe if wanted: | ||
// await client.subscribeCharacteristics(formerSubscribes); | ||
try { | ||
// a disconnect can happen if the device was disconnected from the network | ||
// so you have to catch any network errors here | ||
await client.subscribeCharacteristics(formerSubscribes); | ||
} catch (e) { | ||
console.error('error while resubscribing', e); | ||
// if the discovery will detect the device again it will fire a new serviceUp event | ||
} | ||
}); | ||
@@ -46,0 +52,0 @@ |
@@ -21,2 +21,3 @@ export interface CharacteristicObject { | ||
pid?: number; | ||
status?: number; | ||
} | ||
@@ -23,0 +24,0 @@ /** |
@@ -15,6 +15,10 @@ /** | ||
/** | ||
* address: the IP address of the accessory | ||
* address: the first discovered IP address of the accessory | ||
*/ | ||
address: string; | ||
/** | ||
* allAddresses: all discovered IP addresses of the accessory | ||
*/ | ||
allAddresses: string[]; | ||
/** | ||
* port: the used port | ||
@@ -21,0 +25,0 @@ */ |
@@ -60,2 +60,3 @@ "use strict"; | ||
address: service.addresses[0], | ||
allAddresses: service.addresses, | ||
port: service.port, | ||
@@ -62,0 +63,0 @@ 'c#': parseInt(service.txt['c#']), |
{ | ||
"name": "hap-controller", | ||
"version": "0.9.3", | ||
"version": "0.10.0", | ||
"description": "Library to implement a HAP (HomeKit) controller", | ||
@@ -31,4 +31,4 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@abandonware/noble": "1.9.2-20", | ||
"bignumber.js": "^9.1.1", | ||
"@abandonware/noble": "1.9.2-23", | ||
"bignumber.js": "^9.1.2", | ||
"debug": "^4.3.4", | ||
@@ -39,22 +39,22 @@ "dnssd": "^0.4.1", | ||
"json-bigint": "^1.0.0", | ||
"libsodium-wrappers": "^0.7.11", | ||
"libsodium-wrappers": "^0.7.13", | ||
"node-hkdf-sync": "^1.0.0", | ||
"uuid": "^9.0.0" | ||
"uuid": "^9.0.1" | ||
}, | ||
"devDependencies": { | ||
"@alcalzone/release-script": "^3.5.9", | ||
"@types/debug": "^4.1.7", | ||
"@types/dnssd": "^0.4.2", | ||
"@types/json-bigint": "^1.0.1", | ||
"@types/libsodium-wrappers": "^0.7.10", | ||
"@types/node": "^18.14.2", | ||
"@types/uuid": "^9.0.1", | ||
"@typescript-eslint/eslint-plugin": "^5.53.0", | ||
"@typescript-eslint/parser": "^5.53.0", | ||
"eslint": "^8.35.0", | ||
"eslint-config-prettier": "^8.6.0", | ||
"@alcalzone/release-script": "^3.6.0", | ||
"@types/debug": "^4.1.9", | ||
"@types/dnssd": "^0.4.3", | ||
"@types/json-bigint": "^1.0.2", | ||
"@types/libsodium-wrappers": "^0.7.11", | ||
"@types/node": "^20.6.3", | ||
"@types/uuid": "^9.0.4", | ||
"@typescript-eslint/eslint-plugin": "^6.7.2", | ||
"@typescript-eslint/parser": "^6.7.2", | ||
"eslint": "^8.50.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"event-to-promise": "^0.8.0", | ||
"jest": "^29.4.3", | ||
"prettier": "^2.8.4", | ||
"typescript": "^4.9.5" | ||
"jest": "^29.7.0", | ||
"prettier": "^3.0.3", | ||
"typescript": "^5.2.2" | ||
}, | ||
@@ -61,0 +61,0 @@ "files": [ |
@@ -276,2 +276,6 @@ # hap-controller | ||
## Changelog | ||
### 0.10.0 (2023-09-23) | ||
* (Apollon77) Also return all found addresses and not just the first one | ||
* (Apollon77) Update dependencies | ||
### 0.9.3 (2023-02-27) | ||
@@ -278,0 +282,0 @@ * (Apollon77) Update Noble to fix CPU/Memory issue |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
519121
0.15%7399
0.18%350
1.16%+ Added
- Removed
Updated
Updated
Updated
Updated