Add entity translations to Bosch SHC (#98750)
This commit is contained in:
parent
2e0038b981
commit
a0a06f16a7
6 changed files with 46 additions and 14 deletions
|
@ -62,6 +62,8 @@ async def async_setup_entry(
|
|||
class ShutterContactSensor(SHCEntity, BinarySensorEntity):
|
||||
"""Representation of an SHC shutter contact sensor."""
|
||||
|
||||
_attr_name = None
|
||||
|
||||
def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
|
||||
"""Initialize an SHC shutter contact sensor.."""
|
||||
super().__init__(device, parent_id, entry_id)
|
||||
|
@ -89,7 +91,6 @@ class BatterySensor(SHCEntity, BinarySensorEntity):
|
|||
def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
|
||||
"""Initialize an SHC battery reporting sensor."""
|
||||
super().__init__(device, parent_id, entry_id)
|
||||
self._attr_name = f"{device.name} Battery"
|
||||
self._attr_unique_id = f"{device.serial}_battery"
|
||||
|
||||
@property
|
||||
|
|
|
@ -42,6 +42,7 @@ async def async_setup_entry(
|
|||
class ShutterControlCover(SHCEntity, CoverEntity):
|
||||
"""Representation of a SHC shutter control device."""
|
||||
|
||||
_attr_name = None
|
||||
_attr_device_class = CoverDeviceClass.SHUTTER
|
||||
_attr_supported_features = (
|
||||
CoverEntityFeature.OPEN
|
||||
|
|
|
@ -24,6 +24,7 @@ class SHCBaseEntity(Entity):
|
|||
"""Base representation of a SHC entity."""
|
||||
|
||||
_attr_should_poll = False
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self, device: SHCDevice | SHCIntrusionSystem, parent_id: str, entry_id: str
|
||||
|
@ -31,7 +32,6 @@ class SHCBaseEntity(Entity):
|
|||
"""Initialize the generic SHC device."""
|
||||
self._device = device
|
||||
self._entry_id = entry_id
|
||||
self._attr_name = device.name
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Subscribe to SHC events."""
|
||||
|
|
|
@ -170,7 +170,6 @@ class TemperatureSensor(SHCEntity, SensorEntity):
|
|||
def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
|
||||
"""Initialize an SHC temperature reporting sensor."""
|
||||
super().__init__(device, parent_id, entry_id)
|
||||
self._attr_name = f"{device.name} Temperature"
|
||||
self._attr_unique_id = f"{device.serial}_temperature"
|
||||
|
||||
@property
|
||||
|
@ -188,7 +187,6 @@ class HumiditySensor(SHCEntity, SensorEntity):
|
|||
def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
|
||||
"""Initialize an SHC humidity reporting sensor."""
|
||||
super().__init__(device, parent_id, entry_id)
|
||||
self._attr_name = f"{device.name} Humidity"
|
||||
self._attr_unique_id = f"{device.serial}_humidity"
|
||||
|
||||
@property
|
||||
|
@ -200,13 +198,13 @@ class HumiditySensor(SHCEntity, SensorEntity):
|
|||
class PuritySensor(SHCEntity, SensorEntity):
|
||||
"""Representation of an SHC purity reporting sensor."""
|
||||
|
||||
_attr_translation_key = "purity"
|
||||
_attr_icon = "mdi:molecule-co2"
|
||||
_attr_native_unit_of_measurement = CONCENTRATION_PARTS_PER_MILLION
|
||||
|
||||
def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
|
||||
"""Initialize an SHC purity reporting sensor."""
|
||||
super().__init__(device, parent_id, entry_id)
|
||||
self._attr_name = f"{device.name} Purity"
|
||||
self._attr_unique_id = f"{device.serial}_purity"
|
||||
|
||||
@property
|
||||
|
@ -218,10 +216,11 @@ class PuritySensor(SHCEntity, SensorEntity):
|
|||
class AirQualitySensor(SHCEntity, SensorEntity):
|
||||
"""Representation of an SHC airquality reporting sensor."""
|
||||
|
||||
_attr_translation_key = "air_quality"
|
||||
|
||||
def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
|
||||
"""Initialize an SHC airquality reporting sensor."""
|
||||
super().__init__(device, parent_id, entry_id)
|
||||
self._attr_name = f"{device.name} Air Quality"
|
||||
self._attr_unique_id = f"{device.serial}_airquality"
|
||||
|
||||
@property
|
||||
|
@ -240,10 +239,11 @@ class AirQualitySensor(SHCEntity, SensorEntity):
|
|||
class TemperatureRatingSensor(SHCEntity, SensorEntity):
|
||||
"""Representation of an SHC temperature rating sensor."""
|
||||
|
||||
_attr_translation_key = "temperature_rating"
|
||||
|
||||
def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
|
||||
"""Initialize an SHC temperature rating sensor."""
|
||||
super().__init__(device, parent_id, entry_id)
|
||||
self._attr_name = f"{device.name} Temperature Rating"
|
||||
self._attr_unique_id = f"{device.serial}_temperature_rating"
|
||||
|
||||
@property
|
||||
|
@ -255,12 +255,12 @@ class TemperatureRatingSensor(SHCEntity, SensorEntity):
|
|||
class CommunicationQualitySensor(SHCEntity, SensorEntity):
|
||||
"""Representation of an SHC communication quality reporting sensor."""
|
||||
|
||||
_attr_translation_key = "communication_quality"
|
||||
_attr_icon = "mdi:wifi"
|
||||
|
||||
def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
|
||||
"""Initialize an SHC communication quality reporting sensor."""
|
||||
super().__init__(device, parent_id, entry_id)
|
||||
self._attr_name = f"{device.name} Communication Quality"
|
||||
self._attr_unique_id = f"{device.serial}_communication_quality"
|
||||
|
||||
@property
|
||||
|
@ -272,10 +272,11 @@ class CommunicationQualitySensor(SHCEntity, SensorEntity):
|
|||
class HumidityRatingSensor(SHCEntity, SensorEntity):
|
||||
"""Representation of an SHC humidity rating sensor."""
|
||||
|
||||
_attr_translation_key = "humidity_rating"
|
||||
|
||||
def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
|
||||
"""Initialize an SHC humidity rating sensor."""
|
||||
super().__init__(device, parent_id, entry_id)
|
||||
self._attr_name = f"{device.name} Humidity Rating"
|
||||
self._attr_unique_id = f"{device.serial}_humidity_rating"
|
||||
|
||||
@property
|
||||
|
@ -287,10 +288,11 @@ class HumidityRatingSensor(SHCEntity, SensorEntity):
|
|||
class PurityRatingSensor(SHCEntity, SensorEntity):
|
||||
"""Representation of an SHC purity rating sensor."""
|
||||
|
||||
_attr_translation_key = "purity_rating"
|
||||
|
||||
def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
|
||||
"""Initialize an SHC purity rating sensor."""
|
||||
super().__init__(device, parent_id, entry_id)
|
||||
self._attr_name = f"{device.name} Purity Rating"
|
||||
self._attr_unique_id = f"{device.serial}_purity_rating"
|
||||
|
||||
@property
|
||||
|
@ -308,7 +310,6 @@ class PowerSensor(SHCEntity, SensorEntity):
|
|||
def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
|
||||
"""Initialize an SHC power reporting sensor."""
|
||||
super().__init__(device, parent_id, entry_id)
|
||||
self._attr_name = f"{device.name} Power"
|
||||
self._attr_unique_id = f"{device.serial}_power"
|
||||
|
||||
@property
|
||||
|
@ -327,7 +328,6 @@ class EnergySensor(SHCEntity, SensorEntity):
|
|||
def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
|
||||
"""Initialize an SHC energy reporting sensor."""
|
||||
super().__init__(device, parent_id, entry_id)
|
||||
self._attr_name = f"{self._device.name} Energy"
|
||||
self._attr_unique_id = f"{self._device.serial}_energy"
|
||||
|
||||
@property
|
||||
|
@ -340,13 +340,13 @@ class ValveTappetSensor(SHCEntity, SensorEntity):
|
|||
"""Representation of an SHC valve tappet reporting sensor."""
|
||||
|
||||
_attr_icon = "mdi:gauge"
|
||||
_attr_translation_key = "valvetappet"
|
||||
_attr_state_class = SensorStateClass.MEASUREMENT
|
||||
_attr_native_unit_of_measurement = PERCENTAGE
|
||||
|
||||
def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
|
||||
"""Initialize an SHC valve tappet reporting sensor."""
|
||||
super().__init__(device, parent_id, entry_id)
|
||||
self._attr_name = f"{device.name} Valvetappet"
|
||||
self._attr_unique_id = f"{device.serial}_valvetappet"
|
||||
|
||||
@property
|
||||
|
|
|
@ -36,5 +36,35 @@
|
|||
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
|
||||
},
|
||||
"flow_title": "Bosch SHC: {name}"
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"purity_rating": {
|
||||
"name": "Purity rating"
|
||||
},
|
||||
"purity": {
|
||||
"name": "Purity"
|
||||
},
|
||||
"valvetappet": {
|
||||
"name": "Valvetappet"
|
||||
},
|
||||
"air_quality": {
|
||||
"name": "Air quality"
|
||||
},
|
||||
"temperature_rating": {
|
||||
"name": "Temperature rating"
|
||||
},
|
||||
"humidity_rating": {
|
||||
"name": "Humidity rating"
|
||||
},
|
||||
"communication_quality": {
|
||||
"name": "Communication quality"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"routing": {
|
||||
"name": "Routing"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,12 +200,12 @@ class SHCRoutingSwitch(SHCEntity, SwitchEntity):
|
|||
"""Representation of a SHC routing switch."""
|
||||
|
||||
_attr_icon = "mdi:wifi"
|
||||
_attr_translation_key = "routing"
|
||||
_attr_entity_category = EntityCategory.CONFIG
|
||||
|
||||
def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
|
||||
"""Initialize an SHC communication quality reporting sensor."""
|
||||
super().__init__(device, parent_id, entry_id)
|
||||
self._attr_name = f"{device.name} Routing"
|
||||
self._attr_unique_id = f"{device.serial}_routing"
|
||||
|
||||
@property
|
||||
|
|
Loading…
Add table
Reference in a new issue