Skip to content

Commit

Permalink
fix(mode): removing manual/auto mode
Browse files Browse the repository at this point in the history
  • Loading branch information
bassrock committed Sep 20, 2021
1 parent 87c83ac commit a7cac44
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
16 changes: 12 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
Vent,
Room,
Structure,
FlairMode,
StructureHeatCoolMode,
Client,
Model,
Expand Down Expand Up @@ -161,15 +160,10 @@ export class FlairPlatform implements DynamicPlatformPlugin {
}

public async setStructureMode(
mode: FlairMode,
heatingCoolingMode: StructureHeatCoolMode,
): Promise<Structure> {
let structure = await this.client!.setStructureMode(
const structure = await this.client!.setStructureHeatingCoolMode(
await this.getStructure(),
mode,
);
structure = await this.client!.setStructureHeatingCoolMode(
structure,
heatingCoolingMode,
);

Expand Down
10 changes: 5 additions & 5 deletions src/roomPlatformAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/**
Expand Down Expand Up @@ -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);
});
Expand All @@ -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');
});
}
Expand Down
10 changes: 5 additions & 5 deletions src/structurePlatformAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
});
Expand Down

0 comments on commit a7cac44

Please sign in to comment.