1
mirror of https://github.com/home-assistant/core synced 2024-08-28 03:36:46 +02:00

Make bond BPUP callback a HassJob (#99470)

This commit is contained in:
J. Nick Koston 2023-09-03 12:39:49 -05:00 committed by GitHub
parent ca44242095
commit 7931d74938
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,7 @@ from homeassistant.const import (
ATTR_SW_VERSION,
ATTR_VIA_DEVICE,
)
from homeassistant.core import CALLBACK_TYPE, callback
from homeassistant.core import CALLBACK_TYPE, HassJob, callback
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.event import async_call_later
@ -68,6 +68,9 @@ class BondEntity(Entity):
self._attr_assumed_state = self._hub.is_bridge and not self._device.trust_state
self._apply_state()
self._bpup_polling_fallback: CALLBACK_TYPE | None = None
self._async_update_if_bpup_not_alive_job = HassJob(
self._async_update_if_bpup_not_alive
)
@property
def device_info(self) -> DeviceInfo:
@ -185,7 +188,7 @@ class BondEntity(Entity):
self._bpup_polling_fallback = async_call_later(
self.hass,
_BPUP_ALIVE_SCAN_INTERVAL if alive else _FALLBACK_SCAN_INTERVAL,
self._async_update_if_bpup_not_alive,
self._async_update_if_bpup_not_alive_job,
)
async def async_will_remove_from_hass(self) -> None: