Add entity translations to Honeywell Lyric (#98775)

This commit is contained in:
Joost Lekkerkerker 2023-08-21 22:28:20 +02:00 committed by GitHub
parent f97f33fff7
commit 5a835e703f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 6 deletions

View File

@ -118,6 +118,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
class LyricEntity(CoordinatorEntity[DataUpdateCoordinator[Lyric]]): class LyricEntity(CoordinatorEntity[DataUpdateCoordinator[Lyric]]):
"""Defines a base Honeywell Lyric entity.""" """Defines a base Honeywell Lyric entity."""
_attr_has_entity_name = True
def __init__( def __init__(
self, self,
coordinator: DataUpdateCoordinator[Lyric], coordinator: DataUpdateCoordinator[Lyric],

View File

@ -138,6 +138,8 @@ class LyricClimate(LyricDeviceEntity, ClimateEntity):
coordinator: DataUpdateCoordinator[Lyric] coordinator: DataUpdateCoordinator[Lyric]
entity_description: ClimateEntityDescription entity_description: ClimateEntityDescription
_attr_name = None
def __init__( def __init__(
self, self,
coordinator: DataUpdateCoordinator[Lyric], coordinator: DataUpdateCoordinator[Lyric],

View File

@ -86,7 +86,7 @@ async def async_setup_entry(
coordinator, coordinator,
LyricSensorEntityDescription( LyricSensorEntityDescription(
key=f"{device.macID}_indoor_temperature", key=f"{device.macID}_indoor_temperature",
name="Indoor Temperature", translation_key="indoor_temperature",
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=native_temperature_unit, native_unit_of_measurement=native_temperature_unit,
@ -102,7 +102,7 @@ async def async_setup_entry(
coordinator, coordinator,
LyricSensorEntityDescription( LyricSensorEntityDescription(
key=f"{device.macID}_indoor_humidity", key=f"{device.macID}_indoor_humidity",
name="Indoor Humidity", translation_key="indoor_humidity",
device_class=SensorDeviceClass.HUMIDITY, device_class=SensorDeviceClass.HUMIDITY,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
@ -123,7 +123,7 @@ async def async_setup_entry(
coordinator, coordinator,
LyricSensorEntityDescription( LyricSensorEntityDescription(
key=f"{device.macID}_outdoor_temperature", key=f"{device.macID}_outdoor_temperature",
name="Outdoor Temperature", translation_key="outdoor_temperature",
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=native_temperature_unit, native_unit_of_measurement=native_temperature_unit,
@ -139,7 +139,7 @@ async def async_setup_entry(
coordinator, coordinator,
LyricSensorEntityDescription( LyricSensorEntityDescription(
key=f"{device.macID}_outdoor_humidity", key=f"{device.macID}_outdoor_humidity",
name="Outdoor Humidity", translation_key="outdoor_humidity",
device_class=SensorDeviceClass.HUMIDITY, device_class=SensorDeviceClass.HUMIDITY,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
@ -156,7 +156,7 @@ async def async_setup_entry(
coordinator, coordinator,
LyricSensorEntityDescription( LyricSensorEntityDescription(
key=f"{device.macID}_next_period_time", key=f"{device.macID}_next_period_time",
name="Next Period Time", translation_key="next_period_time",
device_class=SensorDeviceClass.TIMESTAMP, device_class=SensorDeviceClass.TIMESTAMP,
value=lambda device: get_datetime_from_future_time( value=lambda device: get_datetime_from_future_time(
device.changeableValues.nextPeriodTime device.changeableValues.nextPeriodTime
@ -172,7 +172,7 @@ async def async_setup_entry(
coordinator, coordinator,
LyricSensorEntityDescription( LyricSensorEntityDescription(
key=f"{device.macID}_setpoint_status", key=f"{device.macID}_setpoint_status",
name="Setpoint Status", translation_key="setpoint_status",
icon="mdi:thermostat", icon="mdi:thermostat",
value=lambda device: get_setpoint_status( value=lambda device: get_setpoint_status(
device.changeableValues.thermostatSetpointStatus, device.changeableValues.thermostatSetpointStatus,

View File

@ -18,6 +18,28 @@
"default": "[%key:common::config_flow::create_entry::authenticated%]" "default": "[%key:common::config_flow::create_entry::authenticated%]"
} }
}, },
"entity": {
"sensor": {
"indoor_temperature": {
"name": "Indoor temperature"
},
"indoor_humidity": {
"name": "Indoor humidity"
},
"outdoor_temperature": {
"name": "Outdoor temperature"
},
"outdoor_humidity": {
"name": "Outdoor humidity"
},
"next_period_time": {
"name": "Next period time"
},
"setpoint_status": {
"name": "Setpoint status"
}
}
},
"services": { "services": {
"set_hold_time": { "set_hold_time": {
"name": "Set Hold Time", "name": "Set Hold Time",