From bde546e1532d9f0248cbdea828b95117695007e6 Mon Sep 17 00:00:00 2001 From: Brett Date: Fri, 14 Jun 2024 19:13:32 +1000 Subject: [PATCH] Publish --- .eslintrc | 14 ++++++++------ src/services/base.ts | 1 + src/services/door.ts | 1 - src/services/firmware.ts | 6 +++--- src/services/thermostat.ts | 20 ++++++++++---------- src/services/windows.ts | 1 - src/utils/event.ts | 1 + tsconfig.json | 14 ++++---------- 8 files changed, 27 insertions(+), 31 deletions(-) diff --git a/.eslintrc b/.eslintrc index ba9b8ef..7285dca 100644 --- a/.eslintrc +++ b/.eslintrc @@ -9,14 +9,12 @@ "ecmaVersion": 2018, "sourceType": "module" }, - "ignorePatterns": [ - "dist" - ], + "ignorePatterns": ["dist"], "rules": { - "quotes": ["warn", "single"], + //"quotes": ["warn", "single"], "indent": ["warn", 2, { "SwitchCase": 1 }], "semi": ["off"], - "comma-dangle": ["warn", "always-multiline"], + //"comma-dangle": ["warn", "always-multiline"], "dot-notation": "off", "eqeqeq": "warn", "curly": ["warn", "all"], @@ -28,7 +26,11 @@ "comma-spacing": ["error"], "no-multi-spaces": ["warn", { "ignoreEOLComments": true }], "no-trailing-spaces": ["warn"], - "lines-between-class-members": ["warn", "always", {"exceptAfterSingleLine": true}], + "lines-between-class-members": [ + "warn", + "always", + { "exceptAfterSingleLine": true } + ], "@typescript-eslint/explicit-function-return-type": "off", "@typescript-eslint/no-non-null-assertion": "off", "@typescript-eslint/explicit-module-boundary-types": "off", diff --git a/src/services/base.ts b/src/services/base.ts index 6b440e1..26d1d1e 100644 --- a/src/services/base.ts +++ b/src/services/base.ts @@ -6,6 +6,7 @@ export abstract class BaseService { constructor( protected parent: VehicleAccessory, + // eslint-disable-next-line @typescript-eslint/no-explicit-any definition: any, name: string | undefined = undefined ) { diff --git a/src/services/door.ts b/src/services/door.ts index 96e437c..3851de5 100644 --- a/src/services/door.ts +++ b/src/services/door.ts @@ -40,7 +40,6 @@ export class DoorService extends BaseService { } async setPosition(value: CharacteristicValue) { - console.log(value); const position = this.getPosition(); if ( (position === 0 && value === 100) || diff --git a/src/services/firmware.ts b/src/services/firmware.ts index 37c6463..379661b 100644 --- a/src/services/firmware.ts +++ b/src/services/firmware.ts @@ -1,6 +1,5 @@ // https://developers.homebridge.io/#/service/FirmwareUpdate -import { CharacteristicValue } from "homebridge"; import { VehicleAccessory } from "../vehicle.js"; import { BaseService } from "./base.js"; @@ -27,8 +26,9 @@ export class WindowService extends BaseService { .onGet(this.getStaged.bind(this)); this.parent.emitter.on("vehicle_data", () => { - //currentPosition.updateValue(this.getPosition()); - //targetPosition.updateValue(this.getPosition()); + readiness.updateValue(this.getReadiness()); + status.updateValue(this.getStatus()); + staged.updateValue(this.getStaged()); }); } diff --git a/src/services/thermostat.ts b/src/services/thermostat.ts index 023cb2a..66d7fb9 100644 --- a/src/services/thermostat.ts +++ b/src/services/thermostat.ts @@ -64,17 +64,17 @@ export class ClimateService extends BaseService { async setTargetState(value: CharacteristicValue) { return value ? this.parent.vehicle - .auto_conditioning_start() - .then( - () => - this.parent.platform.Characteristic.TargetHeatingCoolingState.AUTO - ) + .auto_conditioning_start() + .then( + () => + this.parent.platform.Characteristic.TargetHeatingCoolingState.AUTO + ) : this.parent.vehicle - .auto_conditioning_stop() - .then( - () => - this.parent.platform.Characteristic.TargetHeatingCoolingState.OFF - ); + .auto_conditioning_stop() + .then( + () => + this.parent.platform.Characteristic.TargetHeatingCoolingState.OFF + ); } getCurrentTemp(): number { diff --git a/src/services/windows.ts b/src/services/windows.ts index 40c963f..b64c725 100644 --- a/src/services/windows.ts +++ b/src/services/windows.ts @@ -37,7 +37,6 @@ export class WindowService extends BaseService { } async setPosition(value: CharacteristicValue) { - console.log(value); const { latitude, longitude } = this.parent.accessory.context?.drive_state ?? {}; diff --git a/src/utils/event.ts b/src/utils/event.ts index f9244be..0631dbe 100644 --- a/src/utils/event.ts +++ b/src/utils/event.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any type Listener = (...args: any[]) => void; type ListenerArgs = T extends Listener ? Parameters : never; diff --git a/tsconfig.json b/tsconfig.json index bfc2128..a141f9a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,19 +6,13 @@ "forceConsistentCasingInFileNames": true, "outDir": "dist", "rootDir": "src", - "lib": [ - "DOM", - "ES2022" - ], + "noImplicitAny": false, + "lib": ["DOM", "ES2022"], "module": "ES2022", - "moduleResolution":"node", + "moduleResolution": "node", "sourceMap": true, "strict": true, "target": "ES2022" }, - "include": [ - "eslint.config.mjs", - "homebridge-ui", - "src" - ] + "include": ["eslint.config.mjs", "homebridge-ui", "src"] }