mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-12 11:56:29 +00:00
Change signature of async_track_unavailable callback to provide additional information (#1470)
This commit is contained in:
parent
dd9cb2a28f
commit
98d93ae563
19
blog/2022-09-16-bluetooth-unavailable-api-changes.md
Normal file
19
blog/2022-09-16-bluetooth-unavailable-api-changes.md
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
author: J. Nick Koston
|
||||
authorURL: https://github.com/bdraco
|
||||
title: "Bluetooth async_track_unavailable API changes for 2022.10"
|
||||
---
|
||||
|
||||
For Home Assistant Core 2022.10 we have changed the `async_track_unavailable` bluetooth API to send the last `BluetoothServiceInfoBleak` to the callback instead of the `address`.
|
||||
|
||||
Below is a new example of the usage:
|
||||
|
||||
```python
|
||||
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)
|
||||
```
|
||||
|
@ -118,8 +118,8 @@ If the `connectable` argument is set to `True`, if any `connectable` controller
|
||||
```python
|
||||
from homeassistant.components import bluetooth
|
||||
|
||||
def _unavailable_callback(address: str) -> None:
|
||||
_LOGGER.debug("%s is no longer seen", address)
|
||||
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)
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user