Explorar o código

Wrong power state fixed

Vassilis Panos %!s(int64=7) %!d(string=hai) anos
pai
achega
49cbbb0906
Modificáronse 1 ficheiros con 6 adicións e 4 borrados
  1. 6 4
      smartir/climate.py

+ 6 - 4
smartir/climate.py

@@ -400,14 +400,16 @@ class SmartIRClimate(ClimateDevice, RestoreEntity):
         if new_state is None:
             return
 
-        if new_state.state == STATE_OFF and self._current_operation != STATE_OFF:
-            self._current_operation = STATE_OFF
-            await self.async_update_ha_state()
-
         if new_state.state == STATE_ON and self._current_operation == STATE_OFF:
             self._on_by_remote = True
             await self.async_update_ha_state()
 
+        if new_state.state == STATE_OFF:
+            self._on_by_remote = False
+            if self._current_operation != STATE_OFF:
+                self._current_operation = STATE_OFF
+            await self.async_update_ha_state()
+
     @callback
     def _async_update_temp(self, state):
         """Update thermostat with latest state from temperature sensor."""