mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Bump bleak to 0.21.0 (#99520)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
70b460f52b
commit
453c5f90f8
@ -14,7 +14,7 @@
|
|||||||
],
|
],
|
||||||
"quality_scale": "internal",
|
"quality_scale": "internal",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"bleak==0.20.2",
|
"bleak==0.21.0",
|
||||||
"bleak-retry-connector==3.1.1",
|
"bleak-retry-connector==3.1.1",
|
||||||
"bluetooth-adapters==0.16.0",
|
"bluetooth-adapters==0.16.0",
|
||||||
"bluetooth-auto-recovery==1.2.1",
|
"bluetooth-auto-recovery==1.2.1",
|
||||||
|
@ -120,15 +120,17 @@ class HaBleakScannerWrapper(BaseBleakScanner):
|
|||||||
|
|
||||||
def register_detection_callback(
|
def register_detection_callback(
|
||||||
self, callback: AdvertisementDataCallback | None
|
self, callback: AdvertisementDataCallback | None
|
||||||
) -> None:
|
) -> Callable[[], None]:
|
||||||
"""Register a detection callback.
|
"""Register a detection callback.
|
||||||
|
|
||||||
The callback is called when a device is discovered or has a property changed.
|
The callback is called when a device is discovered or has a property changed.
|
||||||
|
|
||||||
This method takes the callback and registers it with the long running sscanner.
|
This method takes the callback and registers it with the long running scanner.
|
||||||
"""
|
"""
|
||||||
self._advertisement_data_callback = callback
|
self._advertisement_data_callback = callback
|
||||||
self._setup_detection_callback()
|
self._setup_detection_callback()
|
||||||
|
assert self._detection_cancel is not None
|
||||||
|
return self._detection_cancel
|
||||||
|
|
||||||
def _setup_detection_callback(self) -> None:
|
def _setup_detection_callback(self) -> None:
|
||||||
"""Set up the detection callback."""
|
"""Set up the detection callback."""
|
||||||
|
@ -7,9 +7,15 @@ import contextlib
|
|||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from functools import partial
|
from functools import partial
|
||||||
import logging
|
import logging
|
||||||
|
import sys
|
||||||
from typing import Any, TypeVar, cast
|
from typing import Any, TypeVar, cast
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
if sys.version_info < (3, 12):
|
||||||
|
from typing_extensions import Buffer
|
||||||
|
else:
|
||||||
|
from collections.abc import Buffer
|
||||||
|
|
||||||
from aioesphomeapi import (
|
from aioesphomeapi import (
|
||||||
ESP_CONNECTION_ERROR_DESCRIPTION,
|
ESP_CONNECTION_ERROR_DESCRIPTION,
|
||||||
ESPHOME_GATT_ERRORS,
|
ESPHOME_GATT_ERRORS,
|
||||||
@ -620,14 +626,14 @@ class ESPHomeClient(BaseBleakClient):
|
|||||||
@api_error_as_bleak_error
|
@api_error_as_bleak_error
|
||||||
async def write_gatt_char(
|
async def write_gatt_char(
|
||||||
self,
|
self,
|
||||||
char_specifier: BleakGATTCharacteristic | int | str | uuid.UUID,
|
characteristic: BleakGATTCharacteristic | int | str | uuid.UUID,
|
||||||
data: bytes | bytearray | memoryview,
|
data: Buffer,
|
||||||
response: bool = False,
|
response: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Perform a write operation of the specified GATT characteristic.
|
"""Perform a write operation of the specified GATT characteristic.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
char_specifier (BleakGATTCharacteristic, int, str or UUID):
|
characteristic (BleakGATTCharacteristic, int, str or UUID):
|
||||||
The characteristic to write to, specified by either integer
|
The characteristic to write to, specified by either integer
|
||||||
handle, UUID or directly by the BleakGATTCharacteristic object
|
handle, UUID or directly by the BleakGATTCharacteristic object
|
||||||
representing it.
|
representing it.
|
||||||
@ -635,16 +641,14 @@ class ESPHomeClient(BaseBleakClient):
|
|||||||
response (bool): If write-with-response operation should be done.
|
response (bool): If write-with-response operation should be done.
|
||||||
Defaults to `False`.
|
Defaults to `False`.
|
||||||
"""
|
"""
|
||||||
characteristic = self._resolve_characteristic(char_specifier)
|
characteristic = self._resolve_characteristic(characteristic)
|
||||||
await self._client.bluetooth_gatt_write(
|
await self._client.bluetooth_gatt_write(
|
||||||
self._address_as_int, characteristic.handle, bytes(data), response
|
self._address_as_int, characteristic.handle, bytes(data), response
|
||||||
)
|
)
|
||||||
|
|
||||||
@verify_connected
|
@verify_connected
|
||||||
@api_error_as_bleak_error
|
@api_error_as_bleak_error
|
||||||
async def write_gatt_descriptor(
|
async def write_gatt_descriptor(self, handle: int, data: Buffer) -> None:
|
||||||
self, handle: int, data: bytes | bytearray | memoryview
|
|
||||||
) -> None:
|
|
||||||
"""Perform a write operation on the specified GATT descriptor.
|
"""Perform a write operation on the specified GATT descriptor.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -9,7 +9,7 @@ attrs==23.1.0
|
|||||||
awesomeversion==22.9.0
|
awesomeversion==22.9.0
|
||||||
bcrypt==4.0.1
|
bcrypt==4.0.1
|
||||||
bleak-retry-connector==3.1.1
|
bleak-retry-connector==3.1.1
|
||||||
bleak==0.20.2
|
bleak==0.21.0
|
||||||
bluetooth-adapters==0.16.0
|
bluetooth-adapters==0.16.0
|
||||||
bluetooth-auto-recovery==1.2.1
|
bluetooth-auto-recovery==1.2.1
|
||||||
bluetooth-data-tools==1.9.1
|
bluetooth-data-tools==1.9.1
|
||||||
|
@ -521,7 +521,7 @@ bizkaibus==0.1.1
|
|||||||
bleak-retry-connector==3.1.1
|
bleak-retry-connector==3.1.1
|
||||||
|
|
||||||
# homeassistant.components.bluetooth
|
# homeassistant.components.bluetooth
|
||||||
bleak==0.20.2
|
bleak==0.21.0
|
||||||
|
|
||||||
# homeassistant.components.blebox
|
# homeassistant.components.blebox
|
||||||
blebox-uniapi==2.1.4
|
blebox-uniapi==2.1.4
|
||||||
|
@ -439,7 +439,7 @@ bimmer-connected==0.14.0
|
|||||||
bleak-retry-connector==3.1.1
|
bleak-retry-connector==3.1.1
|
||||||
|
|
||||||
# homeassistant.components.bluetooth
|
# homeassistant.components.bluetooth
|
||||||
bleak==0.20.2
|
bleak==0.21.0
|
||||||
|
|
||||||
# homeassistant.components.blebox
|
# homeassistant.components.blebox
|
||||||
blebox-uniapi==2.1.4
|
blebox-uniapi==2.1.4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user