mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Use shorthand attributes for airtouch4 (#99086)
This commit is contained in:
parent
faed58c01b
commit
11cecc3f0a
@ -98,28 +98,20 @@ class AirtouchAC(CoordinatorEntity, ClimateEntity):
|
|||||||
self._ac_number = ac_number
|
self._ac_number = ac_number
|
||||||
self._airtouch = coordinator.airtouch
|
self._airtouch = coordinator.airtouch
|
||||||
self._info = info
|
self._info = info
|
||||||
self._unit = self._airtouch.GetAcs()[self._ac_number]
|
self._unit = self._airtouch.GetAcs()[ac_number]
|
||||||
|
self._attr_unique_id = f"ac_{ac_number}"
|
||||||
|
self._attr_device_info = DeviceInfo(
|
||||||
|
identifiers={(DOMAIN, f"ac_{ac_number}")},
|
||||||
|
name=f"AC {ac_number}",
|
||||||
|
manufacturer="Airtouch",
|
||||||
|
model="Airtouch 4",
|
||||||
|
)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _handle_coordinator_update(self):
|
def _handle_coordinator_update(self):
|
||||||
self._unit = self._airtouch.GetAcs()[self._ac_number]
|
self._unit = self._airtouch.GetAcs()[self._ac_number]
|
||||||
return super()._handle_coordinator_update()
|
return super()._handle_coordinator_update()
|
||||||
|
|
||||||
@property
|
|
||||||
def device_info(self) -> DeviceInfo:
|
|
||||||
"""Return device info for this device."""
|
|
||||||
return DeviceInfo(
|
|
||||||
identifiers={(DOMAIN, self.unique_id)},
|
|
||||||
name=f"AC {self._ac_number}",
|
|
||||||
manufacturer="Airtouch",
|
|
||||||
model="Airtouch 4",
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def unique_id(self):
|
|
||||||
"""Return unique ID for this device."""
|
|
||||||
return f"ac_{self._ac_number}"
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_temperature(self):
|
def current_temperature(self):
|
||||||
"""Return the current temperature."""
|
"""Return the current temperature."""
|
||||||
@ -208,29 +200,21 @@ class AirtouchGroup(CoordinatorEntity, ClimateEntity):
|
|||||||
"""Initialize the climate device."""
|
"""Initialize the climate device."""
|
||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
self._group_number = group_number
|
self._group_number = group_number
|
||||||
|
self._attr_unique_id = group_number
|
||||||
self._airtouch = coordinator.airtouch
|
self._airtouch = coordinator.airtouch
|
||||||
self._info = info
|
self._info = info
|
||||||
self._unit = self._airtouch.GetGroupByGroupNumber(self._group_number)
|
self._unit = self._airtouch.GetGroupByGroupNumber(group_number)
|
||||||
|
self._attr_device_info = DeviceInfo(
|
||||||
@callback
|
identifiers={(DOMAIN, group_number)},
|
||||||
def _handle_coordinator_update(self):
|
|
||||||
self._unit = self._airtouch.GetGroupByGroupNumber(self._group_number)
|
|
||||||
return super()._handle_coordinator_update()
|
|
||||||
|
|
||||||
@property
|
|
||||||
def device_info(self) -> DeviceInfo:
|
|
||||||
"""Return device info for this device."""
|
|
||||||
return DeviceInfo(
|
|
||||||
identifiers={(DOMAIN, self.unique_id)},
|
|
||||||
manufacturer="Airtouch",
|
manufacturer="Airtouch",
|
||||||
model="Airtouch 4",
|
model="Airtouch 4",
|
||||||
name=self._unit.GroupName,
|
name=self._unit.GroupName,
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@callback
|
||||||
def unique_id(self):
|
def _handle_coordinator_update(self):
|
||||||
"""Return unique ID for this device."""
|
self._unit = self._airtouch.GetGroupByGroupNumber(self._group_number)
|
||||||
return self._group_number
|
return super()._handle_coordinator_update()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def min_temp(self):
|
def min_temp(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user