Browse Source

Wrong power state fixed

Vassilis Panos 7 years ago
parent
commit
49cbbb0906
1 changed files with 6 additions and 4 deletions
  1. 6 4
      smartir/climate.py

+ 6 - 4
smartir/climate.py

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