Skip to content

Commit

Permalink
Set operation_mode as target heating cooling state for FHKs
Browse files Browse the repository at this point in the history
  • Loading branch information
awaescher committed Jan 9, 2024
1 parent 1db490a commit 8179286
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/EltakoThermostatAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ export class EltakoThermostatAccessory implements IUpdatableAccessory {
}

async setCurrentHeatingCoolingState(value: CharacteristicValue) {
const command = value === this.platform.Characteristic.CurrentHeatingCoolingState.OFF ? 'off' : 'on';
await this.platform.miniSafe.sendGenericCommand(this.accessory.context.device.info.sid, command);
const operationMode = value === this.platform.Characteristic.CurrentHeatingCoolingState.OFF ? 'off' : 'on';
await this.platform.miniSafe.sendGenericCommandWithValue(this.accessory.context.device.info.sid, 'operation_mode', operationMode);
}

getTargetTemperature(): CharacteristicValue {
Expand Down
17 changes: 17 additions & 0 deletions src/MiniSafe2Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,23 @@ export class MiniSafe2Api {
await axios.post(url, payload);
}

async sendGenericCommandWithValue(sid: string, command: string, value: string) {

const payload =
{
XC_FNC: 'SendGenericCmd',
id: sid,
data:
{
cmd: `${command}`,
value: `${value}`,
},
};

const url = this.buildUrl('/cmd');
await axios.post(url, payload);
}

buildUrl(route: string) {

const separator = route.includes('?') ? '&' : '?';
Expand Down

0 comments on commit 8179286

Please sign in to comment.