Switch to using new esphome bluetooth_proxy_version field (#79331)

pull/79376/head
J. Nick Koston 2022-09-30 02:29:36 -10:00 committed by GitHub
parent ed044acca7
commit ca0cd19dc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 10 deletions

View File

@ -236,7 +236,7 @@ async def async_setup_entry( # noqa: C901
await cli.subscribe_states(entry_data.async_update_state)
await cli.subscribe_service_calls(async_on_service_call)
await cli.subscribe_home_assistant_states(async_on_state_subscription)
if entry_data.device_info.has_bluetooth_proxy:
if entry_data.device_info.bluetooth_proxy_version:
entry_data.disconnect_callbacks.append(
await async_connect_scanner(hass, entry, cli, entry_data)
)

View File

@ -4,7 +4,6 @@ from __future__ import annotations
import logging
from aioesphomeapi import APIClient
from awesomeversion import AwesomeVersion
from homeassistant.components.bluetooth import (
HaBluetoothConnector,
@ -24,7 +23,6 @@ from ..entry_data import RuntimeEntryData
from .client import ESPHomeClient
from .scanner import ESPHomeScanner
CONNECTABLE_MIN_VERSION = AwesomeVersion("2022.10.0-dev")
_LOGGER = logging.getLogger(__name__)
@ -53,10 +51,14 @@ async def async_connect_scanner(
assert entry.unique_id is not None
source = str(entry.unique_id)
new_info_callback = async_get_advertisement_callback(hass)
connectable = bool(
entry_data.device_info
and AwesomeVersion(entry_data.device_info.esphome_version)
>= CONNECTABLE_MIN_VERSION
assert entry_data.device_info is not None
version = entry_data.device_info.bluetooth_proxy_version
connectable = version >= 2
_LOGGER.debug(
"Connecting scanner for %s, version=%s, connectable=%s",
source,
version,
connectable,
)
connector = HaBluetoothConnector(
client=ESPHomeClient,

View File

@ -3,7 +3,7 @@
"name": "ESPHome",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/esphome",
"requirements": ["aioesphomeapi==10.14.0"],
"requirements": ["aioesphomeapi==11.0.0"],
"zeroconf": ["_esphomelib._tcp.local."],
"dhcp": [{ "registered_devices": true }],
"codeowners": ["@OttoWinter", "@jesserockz"],

View File

@ -156,7 +156,7 @@ aioecowitt==2022.09.3
aioemonitor==1.0.5
# homeassistant.components.esphome
aioesphomeapi==10.14.0
aioesphomeapi==11.0.0
# homeassistant.components.flo
aioflo==2021.11.0

View File

@ -143,7 +143,7 @@ aioecowitt==2022.09.3
aioemonitor==1.0.5
# homeassistant.components.esphome
aioesphomeapi==10.14.0
aioesphomeapi==11.0.0
# homeassistant.components.flo
aioflo==2021.11.0