mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Migrate iZone to has entity name (#98234)
This commit is contained in:
parent
fe794e2be3
commit
27876b929b
@ -133,6 +133,8 @@ class ControllerDevice(ClimateEntity):
|
|||||||
_attr_precision = PRECISION_TENTHS
|
_attr_precision = PRECISION_TENTHS
|
||||||
_attr_should_poll = False
|
_attr_should_poll = False
|
||||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
_attr_name = None
|
||||||
|
|
||||||
def __init__(self, controller: Controller) -> None:
|
def __init__(self, controller: Controller) -> None:
|
||||||
"""Initialise ControllerDevice."""
|
"""Initialise ControllerDevice."""
|
||||||
@ -169,7 +171,7 @@ class ControllerDevice(ClimateEntity):
|
|||||||
identifiers={(IZONE, self.unique_id)},
|
identifiers={(IZONE, self.unique_id)},
|
||||||
manufacturer="IZone",
|
manufacturer="IZone",
|
||||||
model=self._controller.sys_type,
|
model=self._controller.sys_type,
|
||||||
name=self.name,
|
name=f"iZone Controller {self._controller.device_uid}",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create the zones
|
# Create the zones
|
||||||
@ -256,11 +258,6 @@ class ControllerDevice(ClimateEntity):
|
|||||||
"""Return the ID of the controller device."""
|
"""Return the ID of the controller device."""
|
||||||
return self._controller.device_uid
|
return self._controller.device_uid
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self) -> str:
|
|
||||||
"""Return the name of the entity."""
|
|
||||||
return f"iZone Controller {self._controller.device_uid}"
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def extra_state_attributes(self) -> Mapping[str, Any]:
|
def extra_state_attributes(self) -> Mapping[str, Any]:
|
||||||
"""Return the optional state attributes."""
|
"""Return the optional state attributes."""
|
||||||
@ -444,13 +441,14 @@ class ZoneDevice(ClimateEntity):
|
|||||||
|
|
||||||
_attr_precision = PRECISION_TENTHS
|
_attr_precision = PRECISION_TENTHS
|
||||||
_attr_should_poll = False
|
_attr_should_poll = False
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
_attr_name = None
|
||||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||||
|
|
||||||
def __init__(self, controller: ControllerDevice, zone: Zone) -> None:
|
def __init__(self, controller: ControllerDevice, zone: Zone) -> None:
|
||||||
"""Initialise ZoneDevice."""
|
"""Initialise ZoneDevice."""
|
||||||
self._controller = controller
|
self._controller = controller
|
||||||
self._zone = zone
|
self._zone = zone
|
||||||
self._name = zone.name.title()
|
|
||||||
|
|
||||||
if zone.type != Zone.Type.AUTO:
|
if zone.type != Zone.Type.AUTO:
|
||||||
self._state_to_pizone = {
|
self._state_to_pizone = {
|
||||||
@ -471,7 +469,7 @@ class ZoneDevice(ClimateEntity):
|
|||||||
},
|
},
|
||||||
manufacturer="IZone",
|
manufacturer="IZone",
|
||||||
model=zone.type.name.title(),
|
model=zone.type.name.title(),
|
||||||
name=self.name,
|
name=zone.name.title(),
|
||||||
via_device=(IZONE, controller.unique_id),
|
via_device=(IZONE, controller.unique_id),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -500,7 +498,6 @@ class ZoneDevice(ClimateEntity):
|
|||||||
return
|
return
|
||||||
if not self.available:
|
if not self.available:
|
||||||
return
|
return
|
||||||
self._name = zone.name.title()
|
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
self.async_on_remove(
|
self.async_on_remove(
|
||||||
@ -517,11 +514,6 @@ class ZoneDevice(ClimateEntity):
|
|||||||
"""Return the ID of the controller device."""
|
"""Return the ID of the controller device."""
|
||||||
return f"{self._controller.unique_id}_z{self._zone.index + 1}"
|
return f"{self._controller.unique_id}_z{self._zone.index + 1}"
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self) -> str:
|
|
||||||
"""Return the name of the entity."""
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@_return_on_connection_error(0)
|
@_return_on_connection_error(0)
|
||||||
def supported_features(self) -> ClimateEntityFeature:
|
def supported_features(self) -> ClimateEntityFeature:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user