1
mirror of https://github.com/home-assistant/core synced 2024-07-30 21:18:57 +02:00

Migrate airtouch 4 to use has entity name (#96356)

This commit is contained in:
Joost Lekkerkerker 2023-07-20 11:15:54 +02:00 committed by GitHub
parent fa0d68b1d7
commit 34e30570c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,6 +84,9 @@ async def async_setup_entry(
class AirtouchAC(CoordinatorEntity, ClimateEntity):
"""Representation of an AirTouch 4 ac."""
_attr_has_entity_name = True
_attr_name = None
_attr_supported_features = (
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE
)
@ -107,7 +110,7 @@ class AirtouchAC(CoordinatorEntity, ClimateEntity):
"""Return device info for this device."""
return DeviceInfo(
identifiers={(DOMAIN, self.unique_id)},
name=self.name,
name=f"AC {self._ac_number}",
manufacturer="Airtouch",
model="Airtouch 4",
)
@ -122,11 +125,6 @@ class AirtouchAC(CoordinatorEntity, ClimateEntity):
"""Return the current temperature."""
return self._unit.Temperature
@property
def name(self):
"""Return the name of the climate device."""
return f"AC {self._ac_number}"
@property
def fan_mode(self):
"""Return fan mode of the AC this group belongs to."""
@ -200,6 +198,8 @@ class AirtouchAC(CoordinatorEntity, ClimateEntity):
class AirtouchGroup(CoordinatorEntity, ClimateEntity):
"""Representation of an AirTouch 4 group."""
_attr_has_entity_name = True
_attr_name = None
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
_attr_temperature_unit = UnitOfTemperature.CELSIUS
_attr_hvac_modes = AT_GROUP_MODES
@ -224,7 +224,7 @@ class AirtouchGroup(CoordinatorEntity, ClimateEntity):
identifiers={(DOMAIN, self.unique_id)},
manufacturer="Airtouch",
model="Airtouch 4",
name=self.name,
name=self._unit.GroupName,
)
@property
@ -242,11 +242,6 @@ class AirtouchGroup(CoordinatorEntity, ClimateEntity):
"""Return Max Temperature for AC of this group."""
return self._airtouch.acs[self._unit.BelongsToAc].MaxSetpoint
@property
def name(self):
"""Return the name of the climate device."""
return self._unit.GroupName
@property
def current_temperature(self):
"""Return the current temperature."""