diff --git a/src/EltakoThermostatAccessory.ts b/src/EltakoThermostatAccessory.ts index d1a0fee..0697feb 100644 --- a/src/EltakoThermostatAccessory.ts +++ b/src/EltakoThermostatAccessory.ts @@ -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 { diff --git a/src/MiniSafe2Api.ts b/src/MiniSafe2Api.ts index 0663e9f..40d5426 100644 --- a/src/MiniSafe2Api.ts +++ b/src/MiniSafe2Api.ts @@ -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('?') ? '&' : '?';