Skip to content

Commit

Permalink
chore(logs): improve platform logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mgcrea committed Aug 22, 2023
1 parent 0d246b4 commit 0153ec3
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ export default class TydomPlatform implements DynamicPlatformPlugin {
const {platformAccessory: PlatformAccessory} = this.api;
const {group} = context;
const accessoryName = category === Categories.WINDOW && group ? group.name || name : name;
this.log.info(`Creating accessory named="${accessoryName}" with id="${id}", deviceId="${context.deviceId}"`);
this.log.info(
`Creating accessory named="${chalkString(accessoryName)}", deviceId="${chalkNumber(
context.deviceId
)} (id=${chalkKeyword(id)})"`
);
const accessory = new PlatformAccessory<TydomAccessoryContext>(accessoryName, id, category);
Object.assign(accessory.context, context);
await this.updateAccessory(accessory, context);
Expand All @@ -139,8 +143,12 @@ export default class TydomPlatform implements DynamicPlatformPlugin {
accessory: PlatformAccessory<TydomAccessoryContext>,
context: TydomAccessoryContext
): Promise<void> {
const {displayName: name, UUID: id} = accessory;
this.log.info(`Updating accessory named="${name}" with id="${id}", deviceId="${context.deviceId}"`);
const {displayName: accessoryName, UUID: id} = accessory;
this.log.info(
`Updating accessory named="${chalkString(accessoryName)}", deviceId="${chalkNumber(
context.deviceId
)} (id=${chalkKeyword(id)})"`
);
Object.assign(accessory.context, context);
const tydomAccessorySetup = getTydomAccessorySetup(accessory, context);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
Expand Down

0 comments on commit 0153ec3

Please sign in to comment.