diff --git a/src/accessories/koboldVacuumRobot.ts b/src/accessories/koboldVacuumRobot.ts index 758245b..0e07e78 100644 --- a/src/accessories/koboldVacuumRobot.ts +++ b/src/accessories/koboldVacuumRobot.ts @@ -177,17 +177,17 @@ export class KoboldVacuumRobotAccessory private registerService(serviceName: RobotService, serviceType: WithUUID) : Service | undefined { - const displayName = this.prefix ? this.robot.name + serviceName : localize(serviceName, this.locale); - + const displayName = (this.prefix ? (this.robot.name + " ") : "") + localize(serviceName, this.locale); + // query existing service by type and subtype const existingService = this.accessory.getServiceById(serviceType, serviceName) if (this.availableServices.has(serviceName)) { - if (existingService) { - existingService.displayName = displayName // reset display name in case of locale change - return this.accessory.getServiceById(serviceType, serviceName) + if (existingService && existingService.displayName === displayName) { + return existingService } else { + if (existingService) {this.accessory.removeService(existingService);} // delete to reset display name in case of locale or prefix change return this.accessory.addService(serviceType, displayName, serviceName); } } diff --git a/src/homebridgeKoboldPlatform.ts b/src/homebridgeKoboldPlatform.ts index 2be8910..b42658b 100644 --- a/src/homebridgeKoboldPlatform.ts +++ b/src/homebridgeKoboldPlatform.ts @@ -40,7 +40,7 @@ export class HomebridgeKoboldPlatform implements DynamicPlatformPlugin discoverRobots() { const client = new KoboldApi.Client(); - this.log.debug("blubb"); + this.log.debug("blub"); try {