diff --git a/homeassistant/components/freedompro/binary_sensor.py b/homeassistant/components/freedompro/binary_sensor.py index 3de80c58de8..9f397d32899 100644 --- a/homeassistant/components/freedompro/binary_sensor.py +++ b/homeassistant/components/freedompro/binary_sensor.py @@ -44,7 +44,7 @@ async def async_setup_entry( class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], BinarySensorEntity): - """Representation of an Freedompro binary_sensor.""" + """Representation of a Freedompro binary_sensor.""" _attr_has_entity_name = True _attr_name = None diff --git a/homeassistant/components/freedompro/climate.py b/homeassistant/components/freedompro/climate.py index bbbb6ba47a2..8a0a706c0d9 100644 --- a/homeassistant/components/freedompro/climate.py +++ b/homeassistant/components/freedompro/climate.py @@ -58,11 +58,16 @@ async def async_setup_entry( class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], ClimateEntity): - """Representation of an Freedompro climate.""" + """Representation of a Freedompro climate.""" _attr_has_entity_name = True _attr_hvac_modes = SUPPORTED_HVAC_MODES _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_name = None + _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE + _attr_current_temperature = 0 + _attr_target_temperature = 0 + _attr_hvac_mode = HVACMode.OFF def __init__( self, @@ -75,7 +80,6 @@ class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], ClimateEntity): super().__init__(coordinator) self._session = session self._api_key = api_key - self._attr_name = None self._attr_unique_id = device["uid"] self._characteristics = device["characteristics"] self._attr_device_info = DeviceInfo( @@ -86,10 +90,6 @@ class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], ClimateEntity): model=device["type"], name=device["name"], ) - self._attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE - self._attr_current_temperature = 0 - self._attr_target_temperature = 0 - self._attr_hvac_mode = HVACMode.OFF @callback def _handle_coordinator_update(self) -> None: @@ -122,8 +122,7 @@ class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], ClimateEntity): if hvac_mode not in SUPPORTED_HVAC_MODES: raise ValueError(f"Got unsupported hvac_mode {hvac_mode}") - payload = {} - payload["heatingCoolingState"] = HVAC_INVERT_MAP[hvac_mode] + payload = {"heatingCoolingState": HVAC_INVERT_MAP[hvac_mode]} await put_state( self._session, self._api_key, diff --git a/homeassistant/components/freedompro/cover.py b/homeassistant/components/freedompro/cover.py index 8be0ccc3af2..59e58d75c43 100644 --- a/homeassistant/components/freedompro/cover.py +++ b/homeassistant/components/freedompro/cover.py @@ -46,10 +46,17 @@ async def async_setup_entry( class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], CoverEntity): - """Representation of an Freedompro cover.""" + """Representation of a Freedompro cover.""" _attr_has_entity_name = True _attr_name = None + _attr_current_cover_position = 0 + _attr_is_closed = True + _attr_supported_features = ( + CoverEntityFeature.CLOSE + | CoverEntityFeature.OPEN + | CoverEntityFeature.SET_POSITION + ) def __init__( self, @@ -71,13 +78,6 @@ class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], CoverEntity): model=device["type"], name=device["name"], ) - self._attr_current_cover_position = 0 - self._attr_is_closed = True - self._attr_supported_features = ( - CoverEntityFeature.CLOSE - | CoverEntityFeature.OPEN - | CoverEntityFeature.SET_POSITION - ) self._attr_device_class = DEVICE_CLASS_MAP[device["type"]] @callback diff --git a/homeassistant/components/freedompro/fan.py b/homeassistant/components/freedompro/fan.py index d9791852136..68149b65fd7 100644 --- a/homeassistant/components/freedompro/fan.py +++ b/homeassistant/components/freedompro/fan.py @@ -33,10 +33,12 @@ async def async_setup_entry( class FreedomproFan(CoordinatorEntity[FreedomproDataUpdateCoordinator], FanEntity): - """Representation of an Freedompro fan.""" + """Representation of a Freedompro fan.""" _attr_has_entity_name = True _attr_name = None + _attr_is_on = False + _attr_percentage = 0 def __init__( self, @@ -59,8 +61,6 @@ class FreedomproFan(CoordinatorEntity[FreedomproDataUpdateCoordinator], FanEntit model=device["type"], name=device["name"], ) - self._attr_is_on = False - self._attr_percentage = 0 if "rotationSpeed" in self._characteristics: self._attr_supported_features = FanEntityFeature.SET_SPEED diff --git a/homeassistant/components/freedompro/light.py b/homeassistant/components/freedompro/light.py index 793f24d39ef..2a101d5c82a 100644 --- a/homeassistant/components/freedompro/light.py +++ b/homeassistant/components/freedompro/light.py @@ -38,10 +38,12 @@ async def async_setup_entry( class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], LightEntity): - """Representation of an Freedompro light.""" + """Representation of a Freedompro light.""" _attr_has_entity_name = True _attr_name = None + _attr_is_on = False + _attr_brightness = 0 def __init__( self, @@ -61,8 +63,6 @@ class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], LightEntity): model=device["type"], name=device["name"], ) - self._attr_is_on = False - self._attr_brightness = 0 color_mode = ColorMode.ONOFF if "hue" in device["characteristics"]: color_mode = ColorMode.HS diff --git a/homeassistant/components/freedompro/lock.py b/homeassistant/components/freedompro/lock.py index 2cf464ecdd3..e1e8ee44b2d 100644 --- a/homeassistant/components/freedompro/lock.py +++ b/homeassistant/components/freedompro/lock.py @@ -31,7 +31,7 @@ async def async_setup_entry( class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], LockEntity): - """Representation of an Freedompro lock.""" + """Representation of a Freedompro lock.""" _attr_has_entity_name = True _attr_name = None diff --git a/homeassistant/components/freedompro/sensor.py b/homeassistant/components/freedompro/sensor.py index e784b1d7581..85d70c30956 100644 --- a/homeassistant/components/freedompro/sensor.py +++ b/homeassistant/components/freedompro/sensor.py @@ -52,7 +52,7 @@ async def async_setup_entry( class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], SensorEntity): - """Representation of an Freedompro sensor.""" + """Representation of a Freedompro sensor.""" _attr_has_entity_name = True _attr_name = None diff --git a/homeassistant/components/freedompro/switch.py b/homeassistant/components/freedompro/switch.py index 52eadf68f7b..97f0a968cff 100644 --- a/homeassistant/components/freedompro/switch.py +++ b/homeassistant/components/freedompro/switch.py @@ -31,7 +31,7 @@ async def async_setup_entry( class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], SwitchEntity): - """Representation of an Freedompro switch.""" + """Representation of a Freedompro switch.""" _attr_has_entity_name = True _attr_name = None