Add Whirlpool device_info and has_entity_name (#84946)
This commit is contained in:
parent
6ecf2e8c71
commit
f999258a42
1 changed files with 10 additions and 3 deletions
|
@ -24,7 +24,7 @@ from homeassistant.components.climate import (
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import generate_entity_id
|
||||
from homeassistant.helpers.entity import DeviceInfo, generate_entity_id
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from . import WhirlpoolData
|
||||
|
@ -92,9 +92,11 @@ class AirConEntity(ClimateEntity):
|
|||
"""Representation of an air conditioner."""
|
||||
|
||||
_attr_fan_modes = SUPPORTED_FAN_MODES
|
||||
_attr_has_entity_name = True
|
||||
_attr_hvac_modes = SUPPORTED_HVAC_MODES
|
||||
_attr_max_temp = SUPPORTED_MAX_TEMP
|
||||
_attr_min_temp = SUPPORTED_MIN_TEMP
|
||||
_attr_should_poll = False
|
||||
_attr_supported_features = (
|
||||
ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
| ClimateEntityFeature.FAN_MODE
|
||||
|
@ -103,15 +105,20 @@ class AirConEntity(ClimateEntity):
|
|||
_attr_swing_modes = SUPPORTED_SWING_MODES
|
||||
_attr_target_temperature_step = SUPPORTED_TARGET_TEMPERATURE_STEP
|
||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
_attr_should_poll = False
|
||||
|
||||
def __init__(self, hass, said, name, backend_selector: BackendSelector, auth: Auth):
|
||||
"""Initialize the entity."""
|
||||
self._aircon = Aircon(backend_selector, auth, said)
|
||||
self.entity_id = generate_entity_id(ENTITY_ID_FORMAT, said, hass=hass)
|
||||
self._attr_name = name if name is not None else said
|
||||
self._attr_unique_id = said
|
||||
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, said)},
|
||||
name=name if name is not None else said,
|
||||
manufacturer="Whirlpool",
|
||||
model="Sixth Sense",
|
||||
)
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Connect aircon to the cloud."""
|
||||
self._aircon.register_attr_callback(self.async_write_ha_state)
|
||||
|
|
Loading…
Add table
Reference in a new issue