From e384fce13872512352d9c98ed7e6b482ae26012c Mon Sep 17 00:00:00 2001 From: Cameron Little Date: Tue, 14 Nov 2023 20:23:18 -0700 Subject: [PATCH] lint --- src/platform.ts | 26 +++++++++++++------------- src/platformAccessory.ts | 26 +++++++++++++------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/platform.ts b/src/platform.ts index a4ea56a..0088080 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -31,7 +31,7 @@ export class EeroPresenceHomebridgePlatform implements DynamicPlatformPlugin { constructor( public readonly log: Logger, public readonly config: PlatformConfig, - public readonly api: API + public readonly api: API, ) { this.log.debug("Finished initializing platform:", this.config); @@ -100,14 +100,14 @@ export class EeroPresenceHomebridgePlatform implements DynamicPlatformPlugin { // see if an accessory with the same uuid has already been registered and restored from // the cached devices we stored in the `configureAccessory` method above const existingAccessory = this.accessories.find( - (accessory) => accessory.UUID === uuid + (accessory) => accessory.UUID === uuid, ); if (existingAccessory) { // the accessory already exists this.log.info( "Restoring existing accessory from cache:", existingAccessory.displayName, - eero.serial + eero.serial, ); new EeroPresensePlatformAccessory(this, existingAccessory); @@ -117,7 +117,7 @@ export class EeroPresenceHomebridgePlatform implements DynamicPlatformPlugin { // create a new accessory const accessory = new this.api.platformAccessory( eero.location, - uuid + uuid, ) as PlatformAccessory; accessory.context.eero = eero; accessory.context.config = config; @@ -162,22 +162,22 @@ export class EeroPresenceHomebridgePlatform implements DynamicPlatformPlugin { (device) => (device.device_type === "watch" || device.device_type === "phone") && device.connection_type === "wireless" && - device.connected + device.connected, ) .filter(({ connectivity: { score } }) => score > 0.7); const connectedEeros = new Set( connectedDevices.map(({ source: { serial_number } }) => - this.api.hap.uuid.generate(serial_number) - ) + this.api.hap.uuid.generate(serial_number), + ), ); this.log.info( "connected devices:", connectedDevices .map( ({ display_name, source: { location } }) => - `${location}: ${display_name}` + `${location}: ${display_name}`, ) - .join(", ") + .join(", "), ); this.accessories.forEach((accessory) => { accessory @@ -186,7 +186,7 @@ export class EeroPresenceHomebridgePlatform implements DynamicPlatformPlugin { this.Characteristic.OccupancyDetected, connectedEeros.has(accessory.UUID) ? this.Characteristic.OccupancyDetected.OCCUPANCY_DETECTED - : this.Characteristic.OccupancyDetected.OCCUPANCY_NOT_DETECTED + : this.Characteristic.OccupancyDetected.OCCUPANCY_NOT_DETECTED, ); }); } @@ -203,19 +203,19 @@ export class EeroPresenceHomebridgePlatform implements DynamicPlatformPlugin { if (!response.ok) { throw new this.api.hap.HapStatusError( - this.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE + this.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE, ); } if (response.status === 401) { throw new this.api.hap.HapStatusError( - this.api.hap.HAPStatus.INSUFFICIENT_AUTHORIZATION + this.api.hap.HAPStatus.INSUFFICIENT_AUTHORIZATION, ); } if (response.status !== 200) { throw new this.api.hap.HapStatusError( - this.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE + this.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE, ); } diff --git a/src/platformAccessory.ts b/src/platformAccessory.ts index e5c5440..0497754 100644 --- a/src/platformAccessory.ts +++ b/src/platformAccessory.ts @@ -22,7 +22,7 @@ export class EeroPresensePlatformAccessory { constructor( private readonly platform: EeroPresenceHomebridgePlatform, - private readonly accessory: PlatformAccessory + private readonly accessory: PlatformAccessory, ) { // set accessory information const accessoryCharacteristics = this.accessory @@ -30,11 +30,11 @@ export class EeroPresensePlatformAccessory { .setCharacteristic(this.platform.Characteristic.Manufacturer, "Eero") .setCharacteristic( this.platform.Characteristic.Model, - this.accessory.context.eero.model + this.accessory.context.eero.model, ); accessoryCharacteristics.setCharacteristic( this.platform.Characteristic.SerialNumber, - this.accessory.context.eero.serial + this.accessory.context.eero.serial, ); this.sensorService = @@ -57,7 +57,7 @@ export class EeroPresensePlatformAccessory { data: { led_on }, } = await ( await this.fetch( - `https://api-user.e2ro.com/${this.accessory.context.eero.url}` + `https://api-user.e2ro.com/${this.accessory.context.eero.url}`, ) ).json(); @@ -67,7 +67,7 @@ export class EeroPresensePlatformAccessory { this.platform.log.debug( "setting on", value, - this.accessory.displayName + this.accessory.displayName, ); await this.fetch( `https://api-user.e2ro.com${this.accessory.context.eero.resources.led_action}`, @@ -76,7 +76,7 @@ export class EeroPresensePlatformAccessory { body: JSON.stringify({ led_on: value, }), - } + }, ); }); @@ -85,13 +85,13 @@ export class EeroPresensePlatformAccessory { .onGet(async () => { this.platform.log.debug( "getting brightness", - this.accessory.displayName + this.accessory.displayName, ); const { data: { led_brightness }, } = await ( await this.fetch( - `https://api-user.e2ro.com/${this.accessory.context.eero.url}` + `https://api-user.e2ro.com/${this.accessory.context.eero.url}`, ) ).json(); @@ -101,7 +101,7 @@ export class EeroPresensePlatformAccessory { this.platform.log.debug( "setting brightness", value, - this.accessory.displayName + this.accessory.displayName, ); await this.fetch( `https://api-user.e2ro.com${this.accessory.context.eero.resources.led_action}`, @@ -111,7 +111,7 @@ export class EeroPresensePlatformAccessory { led_on: !!value, led_brightness: value, }), - } + }, ); }); } @@ -128,19 +128,19 @@ export class EeroPresensePlatformAccessory { if (!response.ok) { throw new this.platform.api.hap.HapStatusError( - this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE + this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE, ); } if (response.status === 401) { throw new this.platform.api.hap.HapStatusError( - this.platform.api.hap.HAPStatus.INSUFFICIENT_AUTHORIZATION + this.platform.api.hap.HAPStatus.INSUFFICIENT_AUTHORIZATION, ); } if (response.status !== 200) { throw new this.platform.api.hap.HapStatusError( - this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE + this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE, ); }