From 03c7a0bf02c9fd0e2b6e96913cf55fbcc66a6eea Mon Sep 17 00:00:00 2001 From: Stuart Olivera Date: Mon, 19 Apr 2021 21:06:20 -0700 Subject: [PATCH] fix: resolve Homebridge warnings in log --- src/characteristic/abstractCharacteristic.ts | 13 ++----------- src/platformAccessory.ts | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/characteristic/abstractCharacteristic.ts b/src/characteristic/abstractCharacteristic.ts index 840b7ca..5e8f805 100644 --- a/src/characteristic/abstractCharacteristic.ts +++ b/src/characteristic/abstractCharacteristic.ts @@ -46,10 +46,6 @@ export default abstract class AbstractCharacteristic< this.apiCommand = apiCommand this.apiDataKey = apiDataKey - this.service - .getCharacteristic(this.characteristic) - .on(CharacteristicEventTypes.GET, this.handleGet.bind(this)) - if (this.handleSet) { // read-only characteristics won't have a handleSet this.service @@ -96,7 +92,7 @@ export default abstract class AbstractCharacteristic< // The air conditioner will make a sound every time this API is called. // To avoid unnecessary chimes, we'll optimistically skip sending the API call. this.logDebug('State equals cached state. Skipping.', targetState) - callback(null, targetState) + callback(null) return } @@ -106,7 +102,7 @@ export default abstract class AbstractCharacteristic< .sendCommand(this.deviceId, this.apiCommand, this.apiDataKey, apiValue) .then(() => { this.cachedState = targetState - callback(null, targetState) + callback(null) }) .catch((error) => { this.logError('Failed to set state', targetState, error.toString()) @@ -114,11 +110,6 @@ export default abstract class AbstractCharacteristic< }) } - /** Handle a "get" command from Homebridge */ - handleGet(callback: CharacteristicGetCallback) { - callback(null, this.cachedState) - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any logError(message: string, ...parameters: any[]) { this.platform.log.error( diff --git a/src/platformAccessory.ts b/src/platformAccessory.ts index e975b8c..901e9ab 100644 --- a/src/platformAccessory.ts +++ b/src/platformAccessory.ts @@ -66,7 +66,7 @@ export class LgAirConditionerPlatformAccessory { this.platform.log, ) - // // create handlers for required characteristics + // create handlers for required characteristics this.updateCharacteristics() const refreshInterval = this.platform.getRefreshIntervalMinutes() this.platform.log.info(