Bump bleak to 0.21.0 (#99520)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
J. Nick Koston 2023-09-03 08:22:03 -05:00 committed by GitHub
parent 5f487b5d85
commit 00893bbf14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 13 deletions

View file

@ -14,7 +14,7 @@
],
"quality_scale": "internal",
"requirements": [
"bleak==0.20.2",
"bleak==0.21.0",
"bleak-retry-connector==3.1.1",
"bluetooth-adapters==0.16.0",
"bluetooth-auto-recovery==1.2.1",

View file

@ -120,15 +120,17 @@ class HaBleakScannerWrapper(BaseBleakScanner):
def register_detection_callback(
self, callback: AdvertisementDataCallback | None
) -> None:
) -> Callable[[], None]:
"""Register a detection callback.
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._setup_detection_callback()
assert self._detection_cancel is not None
return self._detection_cancel
def _setup_detection_callback(self) -> None:
"""Set up the detection callback."""

View file

@ -7,9 +7,15 @@ import contextlib
from dataclasses import dataclass, field
from functools import partial
import logging
import sys
from typing import Any, TypeVar, cast
import uuid
if sys.version_info < (3, 12):
from typing_extensions import Buffer
else:
from collections.abc import Buffer
from aioesphomeapi import (
ESP_CONNECTION_ERROR_DESCRIPTION,
ESPHOME_GATT_ERRORS,
@ -620,14 +626,14 @@ class ESPHomeClient(BaseBleakClient):
@api_error_as_bleak_error
async def write_gatt_char(
self,
char_specifier: BleakGATTCharacteristic | int | str | uuid.UUID,
data: bytes | bytearray | memoryview,
characteristic: BleakGATTCharacteristic | int | str | uuid.UUID,
data: Buffer,
response: bool = False,
) -> None:
"""Perform a write operation of the specified GATT characteristic.
Args:
char_specifier (BleakGATTCharacteristic, int, str or UUID):
characteristic (BleakGATTCharacteristic, int, str or UUID):
The characteristic to write to, specified by either integer
handle, UUID or directly by the BleakGATTCharacteristic object
representing it.
@ -635,16 +641,14 @@ class ESPHomeClient(BaseBleakClient):
response (bool): If write-with-response operation should be done.
Defaults to `False`.
"""
characteristic = self._resolve_characteristic(char_specifier)
characteristic = self._resolve_characteristic(characteristic)
await self._client.bluetooth_gatt_write(
self._address_as_int, characteristic.handle, bytes(data), response
)
@verify_connected
@api_error_as_bleak_error
async def write_gatt_descriptor(
self, handle: int, data: bytes | bytearray | memoryview
) -> None:
async def write_gatt_descriptor(self, handle: int, data: Buffer) -> None:
"""Perform a write operation on the specified GATT descriptor.
Args:

View file

@ -9,7 +9,7 @@ attrs==23.1.0
awesomeversion==22.9.0
bcrypt==4.0.1
bleak-retry-connector==3.1.1
bleak==0.20.2
bleak==0.21.0
bluetooth-adapters==0.16.0
bluetooth-auto-recovery==1.2.1
bluetooth-data-tools==1.11.0

View file

@ -522,7 +522,7 @@ bizkaibus==0.1.1
bleak-retry-connector==3.1.1
# homeassistant.components.bluetooth
bleak==0.20.2
bleak==0.21.0
# homeassistant.components.blebox
blebox-uniapi==2.1.4

View file

@ -440,7 +440,7 @@ bimmer-connected==0.14.0
bleak-retry-connector==3.1.1
# homeassistant.components.bluetooth
bleak==0.20.2
bleak==0.21.0
# homeassistant.components.blebox
blebox-uniapi==2.1.4