diff --git a/package-lock.json b/package-lock.json index 61fcb00..da36602 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1011,7 +1011,8 @@ "version": "0.3.2", "resolved": "https://registry.npmjs.org/ansicolors/-/ansicolors-0.3.2.tgz", "integrity": "sha1-ZlWX3oap/+Oqm/vmyuXG6kJrSXk=", - "dev": true + "dev": true, + "peer": true }, "node_modules/anymatch": { "version": "3.1.2", @@ -1415,6 +1416,7 @@ "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.0.tgz", "integrity": "sha512-gnB85c3MGC7Nm9I/FkiasNBOKjOiO1RNuXXarQms37q4QMpWdlbBgD/VnOStA2faG1dpXMv31RFApjX1/QdgWQ==", "dev": true, + "peer": true, "dependencies": { "object-assign": "^4.1.0", "string-width": "^4.2.0" @@ -1471,6 +1473,7 @@ "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", "dev": true, "optional": true, + "peer": true, "engines": { "node": ">=0.1.90" } @@ -7198,6 +7201,7 @@ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true, + "peer": true, "engines": { "node": ">=0.10.0" } @@ -10061,7 +10065,8 @@ "version": "0.3.2", "resolved": "https://registry.npmjs.org/ansicolors/-/ansicolors-0.3.2.tgz", "integrity": "sha1-ZlWX3oap/+Oqm/vmyuXG6kJrSXk=", - "dev": true + "dev": true, + "peer": true }, "anymatch": { "version": "3.1.2", @@ -10377,6 +10382,7 @@ "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.0.tgz", "integrity": "sha512-gnB85c3MGC7Nm9I/FkiasNBOKjOiO1RNuXXarQms37q4QMpWdlbBgD/VnOStA2faG1dpXMv31RFApjX1/QdgWQ==", "dev": true, + "peer": true, "requires": { "colors": "^1.1.2", "object-assign": "^4.1.0", @@ -10424,7 +10430,8 @@ "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", "dev": true, - "optional": true + "optional": true, + "peer": true }, "commander": { "version": "5.1.0", @@ -14657,7 +14664,8 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true + "dev": true, + "peer": true }, "object-inspect": { "version": "1.11.0", diff --git a/src/platform.ts b/src/platform.ts index b4be32e..d0e6124 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -16,7 +16,6 @@ import { Vent, Room, Structure, - FlairMode, StructureHeatCoolMode, Client, Model, @@ -161,15 +160,10 @@ export class FlairPlatform implements DynamicPlatformPlugin { } public async setStructureMode( - mode: FlairMode, heatingCoolingMode: StructureHeatCoolMode, ): Promise { - let structure = await this.client!.setStructureMode( + const structure = await this.client!.setStructureHeatingCoolMode( await this.getStructure(), - mode, - ); - structure = await this.client!.setStructureHeatingCoolMode( - structure, heatingCoolingMode, ); diff --git a/src/roomPlatformAccessory.ts b/src/roomPlatformAccessory.ts index 544594c..0e9eda0 100644 --- a/src/roomPlatformAccessory.ts +++ b/src/roomPlatformAccessory.ts @@ -7,7 +7,7 @@ import { } from 'homebridge'; import {FlairPlatform} from './platform'; -import {FlairMode, Room, Structure, StructureHeatCoolMode, Client} from 'flair-api-ts'; +import {Room, Structure, StructureHeatCoolMode, Client} from 'flair-api-ts'; import {getRandomIntInclusive} from './utils'; /** @@ -80,19 +80,19 @@ export class FlairRoomPlatformAccessory { }); } else if (value === this.platform.Characteristic.TargetHeatingCoolingState.COOL) { this.setRoomActive(); - this.platform.setStructureMode(FlairMode.AUTO, StructureHeatCoolMode.COOL).then((structure: Structure) => { + this.platform.setStructureMode(StructureHeatCoolMode.COOL).then((structure: Structure) => { callback(null); this.updateFromStructure(structure); }); } else if (value === this.platform.Characteristic.TargetHeatingCoolingState.HEAT) { this.setRoomActive(); - this.platform.setStructureMode(FlairMode.AUTO, StructureHeatCoolMode.HEAT).then((structure: Structure) => { + this.platform.setStructureMode(StructureHeatCoolMode.HEAT).then((structure: Structure) => { callback(null); this.updateFromStructure(structure); }); } else if (value === this.platform.Characteristic.TargetHeatingCoolingState.AUTO) { this.setRoomActive(); - this.platform.setStructureMode(FlairMode.AUTO, StructureHeatCoolMode.AUTO).then((structure: Structure) => { + this.platform.setStructureMode(StructureHeatCoolMode.AUTO).then((structure: Structure) => { callback(null); this.updateFromStructure(structure); }); @@ -103,7 +103,7 @@ export class FlairRoomPlatformAccessory { if (this.room.active) { return; } - this.client.setRoomAway(this.room, false).then((room: Room) => { + this.client.setRoomAway(this.room, false).then(() => { this.platform.log.debug('Set Room to active'); }); } diff --git a/src/structurePlatformAccessory.ts b/src/structurePlatformAccessory.ts index 6ca027f..c7aefc4 100644 --- a/src/structurePlatformAccessory.ts +++ b/src/structurePlatformAccessory.ts @@ -7,7 +7,7 @@ import { } from 'homebridge'; import {FlairPlatform} from './platform'; -import {FlairMode, Structure, StructureHeatCoolMode, Client} from 'flair-api-ts'; +import {Structure, StructureHeatCoolMode, Client} from 'flair-api-ts'; /** * Platform Accessory @@ -62,22 +62,22 @@ export class FlairStructurePlatformAccessory { setTargetHeatingCoolingState(value: CharacteristicValue, callback: CharacteristicSetCallback): void { if (value === this.platform.Characteristic.TargetHeatingCoolingState.OFF) { - this.platform.setStructureMode(FlairMode.AUTO, StructureHeatCoolMode.OFF).then((structure: Structure) => { + this.platform.setStructureMode(StructureHeatCoolMode.OFF).then((structure: Structure) => { callback(null); this.updateFromStructure(structure); }); } else if (value === this.platform.Characteristic.TargetHeatingCoolingState.COOL) { - this.platform.setStructureMode(FlairMode.AUTO, StructureHeatCoolMode.COOL).then((structure: Structure) => { + this.platform.setStructureMode(StructureHeatCoolMode.COOL).then((structure: Structure) => { callback(null); this.updateFromStructure(structure); }); } else if (value === this.platform.Characteristic.TargetHeatingCoolingState.HEAT) { - this.platform.setStructureMode(FlairMode.AUTO, StructureHeatCoolMode.HEAT).then((structure: Structure) => { + this.platform.setStructureMode(StructureHeatCoolMode.HEAT).then((structure: Structure) => { callback(null); this.updateFromStructure(structure); }); } else if (value === this.platform.Characteristic.TargetHeatingCoolingState.AUTO) { - this.platform.setStructureMode(FlairMode.AUTO, StructureHeatCoolMode.AUTO).then((structure: Structure) => { + this.platform.setStructureMode(StructureHeatCoolMode.AUTO).then((structure: Structure) => { callback(null); this.updateFromStructure(structure); });