mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Switch to using new esphome bluetooth_proxy_version field (#79331)
This commit is contained in:
parent
ed044acca7
commit
ca0cd19dc9
@ -236,7 +236,7 @@ async def async_setup_entry( # noqa: C901
|
|||||||
await cli.subscribe_states(entry_data.async_update_state)
|
await cli.subscribe_states(entry_data.async_update_state)
|
||||||
await cli.subscribe_service_calls(async_on_service_call)
|
await cli.subscribe_service_calls(async_on_service_call)
|
||||||
await cli.subscribe_home_assistant_states(async_on_state_subscription)
|
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(
|
entry_data.disconnect_callbacks.append(
|
||||||
await async_connect_scanner(hass, entry, cli, entry_data)
|
await async_connect_scanner(hass, entry, cli, entry_data)
|
||||||
)
|
)
|
||||||
|
@ -4,7 +4,6 @@ from __future__ import annotations
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from aioesphomeapi import APIClient
|
from aioesphomeapi import APIClient
|
||||||
from awesomeversion import AwesomeVersion
|
|
||||||
|
|
||||||
from homeassistant.components.bluetooth import (
|
from homeassistant.components.bluetooth import (
|
||||||
HaBluetoothConnector,
|
HaBluetoothConnector,
|
||||||
@ -24,7 +23,6 @@ from ..entry_data import RuntimeEntryData
|
|||||||
from .client import ESPHomeClient
|
from .client import ESPHomeClient
|
||||||
from .scanner import ESPHomeScanner
|
from .scanner import ESPHomeScanner
|
||||||
|
|
||||||
CONNECTABLE_MIN_VERSION = AwesomeVersion("2022.10.0-dev")
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -53,10 +51,14 @@ async def async_connect_scanner(
|
|||||||
assert entry.unique_id is not None
|
assert entry.unique_id is not None
|
||||||
source = str(entry.unique_id)
|
source = str(entry.unique_id)
|
||||||
new_info_callback = async_get_advertisement_callback(hass)
|
new_info_callback = async_get_advertisement_callback(hass)
|
||||||
connectable = bool(
|
assert entry_data.device_info is not None
|
||||||
entry_data.device_info
|
version = entry_data.device_info.bluetooth_proxy_version
|
||||||
and AwesomeVersion(entry_data.device_info.esphome_version)
|
connectable = version >= 2
|
||||||
>= CONNECTABLE_MIN_VERSION
|
_LOGGER.debug(
|
||||||
|
"Connecting scanner for %s, version=%s, connectable=%s",
|
||||||
|
source,
|
||||||
|
version,
|
||||||
|
connectable,
|
||||||
)
|
)
|
||||||
connector = HaBluetoothConnector(
|
connector = HaBluetoothConnector(
|
||||||
client=ESPHomeClient,
|
client=ESPHomeClient,
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "ESPHome",
|
"name": "ESPHome",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/esphome",
|
"documentation": "https://www.home-assistant.io/integrations/esphome",
|
||||||
"requirements": ["aioesphomeapi==10.14.0"],
|
"requirements": ["aioesphomeapi==11.0.0"],
|
||||||
"zeroconf": ["_esphomelib._tcp.local."],
|
"zeroconf": ["_esphomelib._tcp.local."],
|
||||||
"dhcp": [{ "registered_devices": true }],
|
"dhcp": [{ "registered_devices": true }],
|
||||||
"codeowners": ["@OttoWinter", "@jesserockz"],
|
"codeowners": ["@OttoWinter", "@jesserockz"],
|
||||||
|
@ -156,7 +156,7 @@ aioecowitt==2022.09.3
|
|||||||
aioemonitor==1.0.5
|
aioemonitor==1.0.5
|
||||||
|
|
||||||
# homeassistant.components.esphome
|
# homeassistant.components.esphome
|
||||||
aioesphomeapi==10.14.0
|
aioesphomeapi==11.0.0
|
||||||
|
|
||||||
# homeassistant.components.flo
|
# homeassistant.components.flo
|
||||||
aioflo==2021.11.0
|
aioflo==2021.11.0
|
||||||
|
@ -143,7 +143,7 @@ aioecowitt==2022.09.3
|
|||||||
aioemonitor==1.0.5
|
aioemonitor==1.0.5
|
||||||
|
|
||||||
# homeassistant.components.esphome
|
# homeassistant.components.esphome
|
||||||
aioesphomeapi==10.14.0
|
aioesphomeapi==11.0.0
|
||||||
|
|
||||||
# homeassistant.components.flo
|
# homeassistant.components.flo
|
||||||
aioflo==2021.11.0
|
aioflo==2021.11.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user