Use device class translations for Coolmaster (#95182)

This commit is contained in:
Joost Lekkerkerker 2023-06-25 13:10:37 +02:00 committed by GitHub
parent dffe468ceb
commit f84887d5f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 11 deletions

View file

@ -32,12 +32,11 @@ async def async_setup_entry(
class CoolmasterCleanFilter(CoolmasterEntity, BinarySensorEntity):
"""Representation of a unit's filter state (true means need to be cleaned)."""
_attr_has_entity_name = True
entity_description = BinarySensorEntityDescription(
key="clean_filter",
translation_key="clean_filter",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
name="Clean filter",
icon="mdi:air-filter",
)

View file

@ -28,11 +28,10 @@ async def async_setup_entry(
class CoolmasterResetFilter(CoolmasterEntity, ButtonEntity):
"""Reset the clean filter timer (once filter was cleaned)."""
_attr_has_entity_name = True
entity_description = ButtonEntityDescription(
key="reset_filter",
translation_key="reset_filter",
entity_category=EntityCategory.CONFIG,
name="Reset filter",
icon="mdi:air-filter",
)

View file

@ -53,6 +53,8 @@ async def async_setup_entry(
class CoolmasterClimate(CoolmasterEntity, ClimateEntity):
"""Representation of a coolmaster climate device."""
_attr_name = None
def __init__(self, coordinator, unit_id, info, supported_modes):
"""Initialize the climate device."""
super().__init__(coordinator, unit_id, info)
@ -63,11 +65,6 @@ class CoolmasterClimate(CoolmasterEntity, ClimateEntity):
"""Return unique ID for this device."""
return self._unit_id
@property
def name(self):
"""Return the name of the climate device."""
return self.unique_id
@property
def supported_features(self) -> ClimateEntityFeature:
"""Return the list of supported features."""

View file

@ -12,6 +12,8 @@ from .const import DOMAIN
class CoolmasterEntity(CoordinatorEntity[CoolmasterDataUpdateCoordinator]):
"""Representation of a Coolmaster entity."""
_attr_has_entity_name = True
def __init__(
self,
coordinator: CoolmasterDataUpdateCoordinator,

View file

@ -28,11 +28,10 @@ async def async_setup_entry(
class CoolmasterCleanFilter(CoolmasterEntity, SensorEntity):
"""Representation of a unit's error code."""
_attr_has_entity_name = True
entity_description = SensorEntityDescription(
key="error_code",
translation_key="error_code",
entity_category=EntityCategory.DIAGNOSTIC,
name="Error code",
icon="mdi:alert",
)

View file

@ -19,5 +19,22 @@
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"no_units": "Could not find any HVAC units in CoolMasterNet host."
}
},
"entity": {
"binary_sensor": {
"clean_filter": {
"name": "Clean filter"
}
},
"button": {
"reset_filter": {
"name": "Reset filter"
}
},
"sensor": {
"error_code": {
"name": "Error code"
}
}
}
}