Просмотр исходного кода

Run black to keep the format consistent

Jason Rumney 5 лет назад
Родитель
Сommit
128d1cd265

+ 1 - 0
custom_components/tuya_local/__init__.py

@@ -76,6 +76,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
 
 
     return True
     return True
 
 
+
 async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
 async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
     if entry.data.get(SOURCE_IMPORT):
     if entry.data.get(SOURCE_IMPORT):
         raise ValueError("Devices configured via yaml cannot be deleted from the UI.")
         raise ValueError("Devices configured via yaml cannot be deleted from the UI.")

+ 1 - 0
custom_components/tuya_local/climate.py

@@ -21,6 +21,7 @@ from .gpcv_heater.climate import GoldairGPCVHeater
 from .heater.climate import GoldairHeater
 from .heater.climate import GoldairHeater
 from .kogan_heater.climate import KoganHeater
 from .kogan_heater.climate import KoganHeater
 
 
+
 async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
 async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
     """Set up the Goldair climate device according to its type."""
     """Set up the Goldair climate device according to its type."""
     data = hass.data[DOMAIN][discovery_info[CONF_DEVICE_ID]]
     data = hass.data[DOMAIN][discovery_info[CONF_DEVICE_ID]]

+ 9 - 8
custom_components/tuya_local/dehumidifier/climate.py

@@ -185,9 +185,7 @@ class GoldairDehumidifier(ClimateDevice):
         if air_clean_on:
         if air_clean_on:
             return PRESET_AIR_CLEAN
             return PRESET_AIR_CLEAN
         elif dps_mode is not None:
         elif dps_mode is not None:
-            return TuyaLocalDevice.get_key_for_value(
-                PRESET_MODE_TO_DPS_MODE, dps_mode
-            )
+            return TuyaLocalDevice.get_key_for_value(PRESET_MODE_TO_DPS_MODE, dps_mode)
         else:
         else:
             return None
             return None
 
 
@@ -234,9 +232,7 @@ class GoldairDehumidifier(ClimateDevice):
         else:
         else:
             dps_mode = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_FAN_MODE])
             dps_mode = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_FAN_MODE])
             if dps_mode is not None:
             if dps_mode is not None:
-                return TuyaLocalDevice.get_key_for_value(
-                    FAN_MODE_TO_DPS_MODE, dps_mode
-                )
+                return TuyaLocalDevice.get_key_for_value(FAN_MODE_TO_DPS_MODE, dps_mode)
             else:
             else:
                 return None
                 return None
 
 
@@ -274,7 +270,8 @@ class GoldairDehumidifier(ClimateDevice):
         error = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_ERROR])
         error = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_ERROR])
         if error is not None:
         if error is not None:
             return (
             return (
-                TuyaLocalDevice.get_key_for_value(ERROR_CODE_TO_DPS_CODE, error) == ERROR_TANK
+                TuyaLocalDevice.get_key_for_value(ERROR_CODE_TO_DPS_CODE, error)
+                == ERROR_TANK
             )
             )
         else:
         else:
             return None
             return None
@@ -294,7 +291,11 @@ class GoldairDehumidifier(ClimateDevice):
         else:
         else:
             error = "Unavailable"
             error = "Unavailable"
 
 
-        return {ATTR_ERROR: error, ATTR_ERROR_CODE: error_code, ATTR_DEFROSTING: self.defrosting}
+        return {
+            ATTR_ERROR: error,
+            ATTR_ERROR_CODE: error_code,
+            ATTR_DEFROSTING: self.defrosting,
+        }
 
 
     async def async_update(self):
     async def async_update(self):
         await self._device.async_refresh()
         await self._device.async_refresh()

+ 1 - 0
custom_components/tuya_local/dehumidifier/lock.py

@@ -7,6 +7,7 @@ from homeassistant.const import STATE_UNAVAILABLE
 from ..device import TuyaLocalDevice
 from ..device import TuyaLocalDevice
 from .const import ATTR_CHILD_LOCK, PROPERTY_TO_DPS_ID
 from .const import ATTR_CHILD_LOCK, PROPERTY_TO_DPS_ID
 
 
+
 class GoldairDehumidifierChildLock(LockDevice):
 class GoldairDehumidifierChildLock(LockDevice):
     """Representation of a Goldair WiFi-connected dehumidifier child lock."""
     """Representation of a Goldair WiFi-connected dehumidifier child lock."""
 
 

+ 1 - 3
custom_components/tuya_local/fan/climate.py

@@ -99,9 +99,7 @@ class GoldairFan(ClimateDevice):
         """Return current preset mode, ie Comfort, Eco, Anti-freeze."""
         """Return current preset mode, ie Comfort, Eco, Anti-freeze."""
         dps_mode = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_PRESET_MODE])
         dps_mode = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_PRESET_MODE])
         if dps_mode is not None:
         if dps_mode is not None:
-            return TuyaLocalDevice.get_key_for_value(
-                PRESET_MODE_TO_DPS_MODE, dps_mode
-            )
+            return TuyaLocalDevice.get_key_for_value(PRESET_MODE_TO_DPS_MODE, dps_mode)
         else:
         else:
             return None
             return None
 
 

+ 1 - 3
custom_components/tuya_local/gpcv_heater/climate.py

@@ -150,9 +150,7 @@ class GoldairGPCVHeater(ClimateDevice):
         """Return current preset mode, ie Comfort, Eco, Anti-freeze."""
         """Return current preset mode, ie Comfort, Eco, Anti-freeze."""
         dps_mode = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_PRESET_MODE])
         dps_mode = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_PRESET_MODE])
         if dps_mode is not None:
         if dps_mode is not None:
-            return TuyaLocalDevice.get_key_for_value(
-                PRESET_MODE_TO_DPS_MODE, dps_mode
-            )
+            return TuyaLocalDevice.get_key_for_value(PRESET_MODE_TO_DPS_MODE, dps_mode)
         else:
         else:
             return None
             return None
 
 

+ 4 - 9
custom_components/tuya_local/kogan_heater/climate.py

@@ -45,10 +45,7 @@ class KoganHeater(ClimateDevice):
         self._support_flags = SUPPORT_FLAGS
         self._support_flags = SUPPORT_FLAGS
 
 
         self._TEMPERATURE_STEP = 1
         self._TEMPERATURE_STEP = 1
-        self._TEMPERATURE_LIMITS = {
-            'min': 15,
-            'max': 35
-        }
+        self._TEMPERATURE_LIMITS = {"min": 15, "max": 35}
 
 
     @property
     @property
     def supported_features(self):
     def supported_features(self):
@@ -102,12 +99,12 @@ class KoganHeater(ClimateDevice):
     @property
     @property
     def min_temp(self):
     def min_temp(self):
         """Return the minimum temperature."""
         """Return the minimum temperature."""
-        return self._TEMPERATURE_LIMITS['min']
+        return self._TEMPERATURE_LIMITS["min"]
 
 
     @property
     @property
     def max_temp(self):
     def max_temp(self):
         """Return the maximum temperature."""
         """Return the maximum temperature."""
-        return self._TEMPERATURE_LIMITS['max']
+        return self._TEMPERATURE_LIMITS["max"]
 
 
     async def async_set_temperature(self, **kwargs):
     async def async_set_temperature(self, **kwargs):
         """Set new target temperatures."""
         """Set new target temperatures."""
@@ -162,9 +159,7 @@ class KoganHeater(ClimateDevice):
         """Return current preset mode, ie Low or High."""
         """Return current preset mode, ie Low or High."""
         dps_mode = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_PRESET_MODE])
         dps_mode = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_PRESET_MODE])
         if dps_mode is not None:
         if dps_mode is not None:
-            return TuyaLocalDevice.get_key_for_value(
-                PRESET_MODE_TO_DPS_MODE, dps_mode
-            )
+            return TuyaLocalDevice.get_key_for_value(PRESET_MODE_TO_DPS_MODE, dps_mode)
         else:
         else:
             return None
             return None
 
 

+ 2 - 2
custom_components/tuya_local/kogan_heater/const.py

@@ -10,8 +10,8 @@ ATTR_TARGET_TEMPERATURE = "target_temperature"
 ATTR_CHILD_LOCK = "child_lock"
 ATTR_CHILD_LOCK = "child_lock"
 ATTR_TIMER = "timer"
 ATTR_TIMER = "timer"
 
 
-PRESET_LOW = 'LOW'
-PRESET_HIGH = 'HIGH'
+PRESET_LOW = "LOW"
+PRESET_HIGH = "HIGH"
 
 
 PROPERTY_TO_DPS_ID = {
 PROPERTY_TO_DPS_ID = {
     ATTR_TARGET_TEMPERATURE: "2",
     ATTR_TARGET_TEMPERATURE: "2",

+ 1 - 1
custom_components/tuya_local/light.py

@@ -41,7 +41,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
     elif discovery_info[CONF_TYPE] == CONF_TYPE_GECO_HEATER:
     elif discovery_info[CONF_TYPE] == CONF_TYPE_GECO_HEATER:
         raise ValueError("Goldair GECO Heaters do not support panel lighting control.")
         raise ValueError("Goldair GECO Heaters do not support panel lighting control.")
     elif discovery_info[CONF_TYPE] == CONF_TYPE_KOGAN_HEATER:
     elif discovery_info[CONF_TYPE] == CONF_TYPE_KOGAN_HEATER:
-        raise ValueError('Kogan heaters do not support panel lighting control')
+        raise ValueError("Kogan heaters do not support panel lighting control")
 
 
     if CONF_DISPLAY_LIGHT in data:
     if CONF_DISPLAY_LIGHT in data:
         async_add_entities([data[CONF_DISPLAY_LIGHT]])
         async_add_entities([data[CONF_DISPLAY_LIGHT]])