From c0d80c5995d0894b5485fa119dfb27349ff2bc01 Mon Sep 17 00:00:00 2001 From: Nyirsh Date: Tue, 2 Jan 2024 16:37:33 -0600 Subject: [PATCH] fix: error while setting target temperature if thermostat is set to OFF from physical controls and cache hasn't been updated yet --- src/accessory/thermostat-accessory.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/accessory/thermostat-accessory.ts b/src/accessory/thermostat-accessory.ts index 6188e04..55e687b 100644 --- a/src/accessory/thermostat-accessory.ts +++ b/src/accessory/thermostat-accessory.ts @@ -312,6 +312,12 @@ export default class ThermostatAccessory extends BaseAccessory { } const units = maybeTemp.value.scale.toLowerCase() as TemperatureScale; const newTemp = tempMapper.mapHomeKitTempToAlexa(value, units); + try { + const userSelectedState = await this.handleTargetStateGet(); + await this.handleTargetStateSet(userSelectedState); + } catch (e) { + this.logWithContext('debug', 'Attempting to reset thermostat state failure, this might not be an issue'); + } return pipe( this.platform.alexaApi.setDeviceState( this.device.id,