homebridge-flair
Advanced tools
Comparing version 1.2.4 to 1.2.5
@@ -79,3 +79,2 @@ "use strict"; | ||
} | ||
this._hasValidCredentials = false; | ||
try { | ||
@@ -86,2 +85,3 @@ await this.client.getUsers(); | ||
catch (e) { | ||
this._hasValidCredentials = false; | ||
this.log.error('Error getting structure readings this is usually incorrect credentials, ensure you entered the right credentials.'); | ||
@@ -122,6 +122,7 @@ } | ||
catch (e) { | ||
throw ('There was an error getting your primary flair home from the api: ' + e.message); | ||
throw ('There was an error getting your primary flair home from the api: ' + | ||
e.message); | ||
} | ||
if (!this.structure) { | ||
throw ('The structure is not available, this should not happen.'); | ||
throw 'The structure is not available, this should not happen.'; | ||
} | ||
@@ -169,5 +170,3 @@ return this.structure; | ||
let currentUUIDs = []; | ||
const promisesToResolve = [ | ||
this.addDevices(await this.client.getVents()), | ||
]; | ||
const promisesToResolve = [this.addDevices(await this.client.getVents())]; | ||
if (!this.config.hidePuckRooms) { | ||
@@ -181,7 +180,9 @@ promisesToResolve.push(this.addDevices((await this.client.getRooms()).filter((value) => { | ||
} | ||
currentUUIDs = currentUUIDs.concat(...await Promise.all(promisesToResolve)); | ||
currentUUIDs = currentUUIDs.concat(...(await Promise.all(promisesToResolve))); | ||
//Loop over the current uuid's and if they don't exist then remove them. | ||
for (const accessory of this.accessories) { | ||
if (!currentUUIDs.find(uuid => uuid === accessory.UUID)) { | ||
this.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]); | ||
if (!currentUUIDs.find((uuid) => uuid === accessory.UUID)) { | ||
this.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [ | ||
accessory, | ||
]); | ||
delete this.accessories[this.accessories.indexOf(accessory, 0)]; | ||
@@ -203,3 +204,3 @@ this.log.debug('Removing not found device:', accessory.displayName); | ||
// cached devices we stored in the `configureAccessory` method above | ||
if (!this.accessories.find(accessory => accessory.UUID === uuid)) { | ||
if (!this.accessories.find((accessory) => accessory.UUID === uuid)) { | ||
// create a new accessory | ||
@@ -231,3 +232,5 @@ const accessory = new this.api.platformAccessory(device.name, uuid); | ||
// link the accessory to your platform | ||
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]); | ||
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [ | ||
accessory, | ||
]); | ||
// push into accessory cache | ||
@@ -234,0 +237,0 @@ this.accessories.push(accessory); |
{ | ||
"displayName": "Homebridge Flair", | ||
"name": "homebridge-flair", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"publishConfig": { | ||
@@ -6,0 +6,0 @@ "registry": "https://registry.npmjs.org/" |
# homebridge-flair | ||
[![verified-by-homebridge](https://badgen.net/badge/homebridge/verified/purple)](https://github.com/homebridge/homebridge/wiki/Verified-Plugins) | ||
@@ -3,0 +4,0 @@ [Flair Smart Vent](https://flair.co/products/vent) plug-in for [Homebridge](https://github.com/nfarina/homebridge) using the Flair API. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
83400
897
77