From 6d0120d8b385d23eb13dcffab75c827cd2ff2d1b Mon Sep 17 00:00:00 2001 From: Jordan Ryan Moore Date: Sun, 9 Feb 2020 20:29:46 -0800 Subject: [PATCH] Fix registration of new devices. --- src/scoutPlatform.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/scoutPlatform.ts b/src/scoutPlatform.ts index 92fc2d1..7031414 100644 --- a/src/scoutPlatform.ts +++ b/src/scoutPlatform.ts @@ -76,17 +76,19 @@ export class ScoutPlatform implements Platform { this.cachedAccessories.delete(accessory.UUID); } else { this.homebridge.logger.info(`Creating new accessory [${accessory.UUID}].`); + + newAccessories.push(accessory); } accessoryFactory.configureAccessory(accessory); } } - this.homebridge.logger.info(`Registering new accessories [${[...this.cachedAccessories.values()].join(", ")}].`); + this.homebridge.logger.info(`Registering new accessories [${[...newAccessories.map(accessory => accessory.UUID)].join(", ")}].`); this.homebridge.api.registerPlatformAccessories(ScoutPlatform.PLUGIN_NAME, ScoutPlatform.PLATFORM_NAME, newAccessories); - this.homebridge.logger.info(`Removing old cached accessories [${[...this.cachedAccessories.values()].join(", ")}].`); + this.homebridge.logger.info(`Removing old cached accessories [${[...this.cachedAccessories.keys()].join(", ")}].`); this.homebridge.api.unregisterPlatformAccessories(ScoutPlatform.PLUGIN_NAME, ScoutPlatform.PLATFORM_NAME, [...this.cachedAccessories.values()]);