For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /developers/blog/2022-09-16-bluetooth-unavailable-api-changes.md.

2022.10 的 Bluetooth async_track_unavailable API 变更

对于 Home Assistant Core 2022.10,我们修改了 async_track_unavailable bluetooth API,使其向回调发送最后一个 BluetoothServiceInfoBleak,而不是 address

以下是一个使用示例:

from homeassistant.components import bluetooth

def _unavailable_callback(info: bluetooth.BluetoothServiceInfoBleak) -> None:
    _LOGGER.debug("%s is no longer seen", info.address)

cancel = bluetooth.async_track_unavailable(hass, _unavailable_callback, "44:44:33:11:23:42", connectable=True)