mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 17:57:55 +00:00
Fix abode DeprecationWarnings (#97620)
This commit is contained in:
parent
7cf2199e8b
commit
3c2cebea72
@ -287,14 +287,14 @@ class AbodeDevice(AbodeEntity):
|
|||||||
"""Initialize Abode device."""
|
"""Initialize Abode device."""
|
||||||
super().__init__(data)
|
super().__init__(data)
|
||||||
self._device = device
|
self._device = device
|
||||||
self._attr_unique_id = device.device_uuid
|
self._attr_unique_id = device.uuid
|
||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
"""Subscribe to device events."""
|
"""Subscribe to device events."""
|
||||||
await super().async_added_to_hass()
|
await super().async_added_to_hass()
|
||||||
await self.hass.async_add_executor_job(
|
await self.hass.async_add_executor_job(
|
||||||
self._data.abode.events.add_device_callback,
|
self._data.abode.events.add_device_callback,
|
||||||
self._device.device_id,
|
self._device.id,
|
||||||
self._update_callback,
|
self._update_callback,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ class AbodeDevice(AbodeEntity):
|
|||||||
"""Unsubscribe from device events."""
|
"""Unsubscribe from device events."""
|
||||||
await super().async_will_remove_from_hass()
|
await super().async_will_remove_from_hass()
|
||||||
await self.hass.async_add_executor_job(
|
await self.hass.async_add_executor_job(
|
||||||
self._data.abode.events.remove_all_device_callbacks, self._device.device_id
|
self._data.abode.events.remove_all_device_callbacks, self._device.id
|
||||||
)
|
)
|
||||||
|
|
||||||
def update(self) -> None:
|
def update(self) -> None:
|
||||||
@ -313,7 +313,7 @@ class AbodeDevice(AbodeEntity):
|
|||||||
def extra_state_attributes(self) -> dict[str, str]:
|
def extra_state_attributes(self) -> dict[str, str]:
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return {
|
return {
|
||||||
"device_id": self._device.device_id,
|
"device_id": self._device.id,
|
||||||
"battery_low": self._device.battery_low,
|
"battery_low": self._device.battery_low,
|
||||||
"no_response": self._device.no_response,
|
"no_response": self._device.no_response,
|
||||||
"device_type": self._device.type,
|
"device_type": self._device.type,
|
||||||
@ -323,7 +323,7 @@ class AbodeDevice(AbodeEntity):
|
|||||||
def device_info(self) -> entity.DeviceInfo:
|
def device_info(self) -> entity.DeviceInfo:
|
||||||
"""Return device registry information for this entity."""
|
"""Return device registry information for this entity."""
|
||||||
return entity.DeviceInfo(
|
return entity.DeviceInfo(
|
||||||
identifiers={(DOMAIN, self._device.device_id)},
|
identifiers={(DOMAIN, self._device.id)},
|
||||||
manufacturer="Abode",
|
manufacturer="Abode",
|
||||||
model=self._device.type,
|
model=self._device.type,
|
||||||
name=self._device.name,
|
name=self._device.name,
|
||||||
|
@ -69,7 +69,7 @@ class AbodeAlarm(AbodeDevice, alarm.AlarmControlPanelEntity):
|
|||||||
def extra_state_attributes(self) -> dict[str, str]:
|
def extra_state_attributes(self) -> dict[str, str]:
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return {
|
return {
|
||||||
"device_id": self._device.device_id,
|
"device_id": self._device.id,
|
||||||
"battery_backup": self._device.battery,
|
"battery_backup": self._device.battery,
|
||||||
"cellular_backup": self._device.is_cellular,
|
"cellular_backup": self._device.is_cellular,
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ class AbodeSensor(AbodeDevice, SensorEntity):
|
|||||||
"""Initialize a sensor for an Abode device."""
|
"""Initialize a sensor for an Abode device."""
|
||||||
super().__init__(data, device)
|
super().__init__(data, device)
|
||||||
self.entity_description = description
|
self.entity_description = description
|
||||||
self._attr_unique_id = f"{device.device_uuid}-{description.key}"
|
self._attr_unique_id = f"{device.uuid}-{description.key}"
|
||||||
if description.key == CONST.TEMP_STATUS_KEY:
|
if description.key == CONST.TEMP_STATUS_KEY:
|
||||||
self._attr_native_unit_of_measurement = device.temp_unit
|
self._attr_native_unit_of_measurement = device.temp_unit
|
||||||
elif description.key == CONST.HUMI_STATUS_KEY:
|
elif description.key == CONST.HUMI_STATUS_KEY:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user