Use device class translations for Coolmaster (#95182)
This commit is contained in:
parent
dffe468ceb
commit
f84887d5f8
6 changed files with 24 additions and 11 deletions
|
@ -32,12 +32,11 @@ async def async_setup_entry(
|
||||||
class CoolmasterCleanFilter(CoolmasterEntity, BinarySensorEntity):
|
class CoolmasterCleanFilter(CoolmasterEntity, BinarySensorEntity):
|
||||||
"""Representation of a unit's filter state (true means need to be cleaned)."""
|
"""Representation of a unit's filter state (true means need to be cleaned)."""
|
||||||
|
|
||||||
_attr_has_entity_name = True
|
|
||||||
entity_description = BinarySensorEntityDescription(
|
entity_description = BinarySensorEntityDescription(
|
||||||
key="clean_filter",
|
key="clean_filter",
|
||||||
|
translation_key="clean_filter",
|
||||||
device_class=BinarySensorDeviceClass.PROBLEM,
|
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
name="Clean filter",
|
|
||||||
icon="mdi:air-filter",
|
icon="mdi:air-filter",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -28,11 +28,10 @@ async def async_setup_entry(
|
||||||
class CoolmasterResetFilter(CoolmasterEntity, ButtonEntity):
|
class CoolmasterResetFilter(CoolmasterEntity, ButtonEntity):
|
||||||
"""Reset the clean filter timer (once filter was cleaned)."""
|
"""Reset the clean filter timer (once filter was cleaned)."""
|
||||||
|
|
||||||
_attr_has_entity_name = True
|
|
||||||
entity_description = ButtonEntityDescription(
|
entity_description = ButtonEntityDescription(
|
||||||
key="reset_filter",
|
key="reset_filter",
|
||||||
|
translation_key="reset_filter",
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
name="Reset filter",
|
|
||||||
icon="mdi:air-filter",
|
icon="mdi:air-filter",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,8 @@ async def async_setup_entry(
|
||||||
class CoolmasterClimate(CoolmasterEntity, ClimateEntity):
|
class CoolmasterClimate(CoolmasterEntity, ClimateEntity):
|
||||||
"""Representation of a coolmaster climate device."""
|
"""Representation of a coolmaster climate device."""
|
||||||
|
|
||||||
|
_attr_name = None
|
||||||
|
|
||||||
def __init__(self, coordinator, unit_id, info, supported_modes):
|
def __init__(self, coordinator, unit_id, info, supported_modes):
|
||||||
"""Initialize the climate device."""
|
"""Initialize the climate device."""
|
||||||
super().__init__(coordinator, unit_id, info)
|
super().__init__(coordinator, unit_id, info)
|
||||||
|
@ -63,11 +65,6 @@ class CoolmasterClimate(CoolmasterEntity, ClimateEntity):
|
||||||
"""Return unique ID for this device."""
|
"""Return unique ID for this device."""
|
||||||
return self._unit_id
|
return self._unit_id
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Return the name of the climate device."""
|
|
||||||
return self.unique_id
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_features(self) -> ClimateEntityFeature:
|
def supported_features(self) -> ClimateEntityFeature:
|
||||||
"""Return the list of supported features."""
|
"""Return the list of supported features."""
|
||||||
|
|
|
@ -12,6 +12,8 @@ from .const import DOMAIN
|
||||||
class CoolmasterEntity(CoordinatorEntity[CoolmasterDataUpdateCoordinator]):
|
class CoolmasterEntity(CoordinatorEntity[CoolmasterDataUpdateCoordinator]):
|
||||||
"""Representation of a Coolmaster entity."""
|
"""Representation of a Coolmaster entity."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
coordinator: CoolmasterDataUpdateCoordinator,
|
coordinator: CoolmasterDataUpdateCoordinator,
|
||||||
|
|
|
@ -28,11 +28,10 @@ async def async_setup_entry(
|
||||||
class CoolmasterCleanFilter(CoolmasterEntity, SensorEntity):
|
class CoolmasterCleanFilter(CoolmasterEntity, SensorEntity):
|
||||||
"""Representation of a unit's error code."""
|
"""Representation of a unit's error code."""
|
||||||
|
|
||||||
_attr_has_entity_name = True
|
|
||||||
entity_description = SensorEntityDescription(
|
entity_description = SensorEntityDescription(
|
||||||
key="error_code",
|
key="error_code",
|
||||||
|
translation_key="error_code",
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
name="Error code",
|
|
||||||
icon="mdi:alert",
|
icon="mdi:alert",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -19,5 +19,22 @@
|
||||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||||
"no_units": "Could not find any HVAC units in CoolMasterNet host."
|
"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"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue