Преглед изворни кода

water_heater: use correct Python syntax for elif

Part of PR #769 preparation, which I forgot to tag in the previous commit
Jason Rumney пре 2 година
родитељ
комит
e0a855a6ae
1 измењених фајлова са 6 додато и 3 уклоњено
  1. 6 3
      custom_components/tuya_local/water_heater.py

+ 6 - 3
custom_components/tuya_local/water_heater.py

@@ -170,7 +170,9 @@ class TuyaLocalWaterHeater(TuyaLocalEntity, WaterHeaterEntity):
         """Turn away mode on"""
         """Turn away mode on"""
         if self._away_mode_dps:
         if self._away_mode_dps:
             await self._away_mode_dps.async_set_value(self._device, True)
             await self._away_mode_dps.async_set_value(self._device, True)
-        else if self._operation_mode_dps and "away" in self._operation_mode_dps.values(self._device):
+        elif self._operation_mode_dps and "away" in self._operation_mode_dps.values(
+            self._device
+        ):
             await self.async_set_operation_mode("away")
             await self.async_set_operation_mode("away")
         else:
         else:
             raise NotImplementedError()
             raise NotImplementedError()
@@ -179,11 +181,12 @@ class TuyaLocalWaterHeater(TuyaLocalEntity, WaterHeaterEntity):
         """Turn away mode off"""
         """Turn away mode off"""
         if self._away_mode_dps:
         if self._away_mode_dps:
             await self._away_mode_dps.async_set_value(self._device, False)
             await self._away_mode_dps.async_set_value(self._device, False)
-        else if self._operation_mode_dps and "away" in self._operation_mode_dps.values(self._device):
+        elif self._operation_mode_dps and "away" in self._operation_mode_dps.values(
+            self._device
+        ):
             # switch to the default mode
             # switch to the default mode
             await self.async_set_operation_mode(self._operation_mode_dps.default)
             await self.async_set_operation_mode(self._operation_mode_dps.default)
 
 
-
     @property
     @property
     def min_temp(self):
     def min_temp(self):
         """Return the minimum supported target temperature."""
         """Return the minimum supported target temperature."""