From ca0cd19dc917db915d3a3cd4d4dc18622a6745e1 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 30 Sep 2022 02:29:36 -1000 Subject: [PATCH] Switch to using new esphome bluetooth_proxy_version field (#79331) --- homeassistant/components/esphome/__init__.py | 2 +- .../components/esphome/bluetooth/__init__.py | 14 ++++++++------ homeassistant/components/esphome/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/esphome/__init__.py b/homeassistant/components/esphome/__init__.py index 90f1bac8de2..8846007374e 100644 --- a/homeassistant/components/esphome/__init__.py +++ b/homeassistant/components/esphome/__init__.py @@ -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) ) diff --git a/homeassistant/components/esphome/bluetooth/__init__.py b/homeassistant/components/esphome/bluetooth/__init__.py index 4061333b4f3..4f3235676a4 100644 --- a/homeassistant/components/esphome/bluetooth/__init__.py +++ b/homeassistant/components/esphome/bluetooth/__init__.py @@ -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, diff --git a/homeassistant/components/esphome/manifest.json b/homeassistant/components/esphome/manifest.json index d094b8518ef..c6a475b6eea 100644 --- a/homeassistant/components/esphome/manifest.json +++ b/homeassistant/components/esphome/manifest.json @@ -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"], diff --git a/requirements_all.txt b/requirements_all.txt index 788463b3f54..8e0d5571a26 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -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 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index b0c3f7c4a4a..a7bb29b9dea 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -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