Set has_entity_name in mill (#94605)

This commit is contained in:
Erik Montnemery 2023-06-14 21:45:14 +02:00 committed by GitHub
parent cc53e4e6c1
commit e539344d22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,8 +91,10 @@ class MillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntity):
"""Representation of a Mill Thermostat device.""" """Representation of a Mill Thermostat device."""
_attr_fan_modes = [FAN_ON, FAN_OFF] _attr_fan_modes = [FAN_ON, FAN_OFF]
_attr_has_entity_name = True
_attr_max_temp = MAX_TEMP _attr_max_temp = MAX_TEMP
_attr_min_temp = MIN_TEMP _attr_min_temp = MIN_TEMP
_attr_name = None
_attr_temperature_unit = UnitOfTemperature.CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
def __init__( def __init__(
@ -106,12 +108,11 @@ class MillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntity):
self._id = heater.device_id self._id = heater.device_id
self._attr_unique_id = heater.device_id self._attr_unique_id = heater.device_id
self._attr_name = heater.name
self._attr_device_info = DeviceInfo( self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, heater.device_id)}, identifiers={(DOMAIN, heater.device_id)},
manufacturer=MANUFACTURER, manufacturer=MANUFACTURER,
model=f"Generation {heater.generation}", model=f"Generation {heater.generation}",
name=self.name, name=heater.name,
) )
if heater.is_gen1: if heater.is_gen1:
self._attr_hvac_modes = [HVACMode.HEAT] self._attr_hvac_modes = [HVACMode.HEAT]
@ -202,10 +203,12 @@ class MillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntity):
class LocalMillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntity): class LocalMillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntity):
"""Representation of a Mill Thermostat device.""" """Representation of a Mill Thermostat device."""
_attr_has_entity_name = True
_attr_hvac_mode = HVACMode.HEAT _attr_hvac_mode = HVACMode.HEAT
_attr_hvac_modes = [HVACMode.HEAT] _attr_hvac_modes = [HVACMode.HEAT]
_attr_max_temp = MAX_TEMP _attr_max_temp = MAX_TEMP
_attr_min_temp = MIN_TEMP _attr_min_temp = MIN_TEMP
_attr_name = None
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
_attr_target_temperature_step = PRECISION_HALVES _attr_target_temperature_step = PRECISION_HALVES
_attr_temperature_unit = UnitOfTemperature.CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
@ -213,7 +216,6 @@ class LocalMillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntit
def __init__(self, coordinator: MillDataUpdateCoordinator) -> None: def __init__(self, coordinator: MillDataUpdateCoordinator) -> None:
"""Initialize the thermostat.""" """Initialize the thermostat."""
super().__init__(coordinator) super().__init__(coordinator)
self._attr_name = coordinator.mill_data_connection.name
if mac := coordinator.mill_data_connection.mac_address: if mac := coordinator.mill_data_connection.mac_address:
self._attr_unique_id = mac self._attr_unique_id = mac
self._attr_device_info = DeviceInfo( self._attr_device_info = DeviceInfo(