Improve esphome bluetooth error reporting (#81326)
parent
0bca9a614c
commit
d87ca0b099
|
@ -7,7 +7,11 @@ import logging
|
|||
from typing import Any, TypeVar, cast
|
||||
import uuid
|
||||
|
||||
from aioesphomeapi import ESP_CONNECTION_ERROR_DESCRIPTION, BLEConnectionError
|
||||
from aioesphomeapi import (
|
||||
ESP_CONNECTION_ERROR_DESCRIPTION,
|
||||
ESPHOME_GATT_ERRORS,
|
||||
BLEConnectionError,
|
||||
)
|
||||
from aioesphomeapi.connection import APIConnectionError, TimeoutAPIError
|
||||
import async_timeout
|
||||
from bleak.backends.characteristic import BleakGATTCharacteristic
|
||||
|
@ -207,7 +211,9 @@ class ESPHomeClient(BaseBleakClient):
|
|||
human_error = ESP_CONNECTION_ERROR_DESCRIPTION[ble_connection_error]
|
||||
except (KeyError, ValueError):
|
||||
ble_connection_error_name = str(error)
|
||||
human_error = f"Unknown error code {error}"
|
||||
human_error = ESPHOME_GATT_ERRORS.get(
|
||||
error, f"Unknown error code {error}"
|
||||
)
|
||||
connected_future.set_exception(
|
||||
BleakError(
|
||||
f"Error {ble_connection_error_name} while connecting: {human_error}"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "ESPHome",
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/esphome",
|
||||
"requirements": ["aioesphomeapi==11.4.1"],
|
||||
"requirements": ["aioesphomeapi==11.4.2"],
|
||||
"zeroconf": ["_esphomelib._tcp.local."],
|
||||
"dhcp": [{ "registered_devices": true }],
|
||||
"codeowners": ["@OttoWinter", "@jesserockz"],
|
||||
|
|
|
@ -153,7 +153,7 @@ aioecowitt==2022.09.3
|
|||
aioemonitor==1.0.5
|
||||
|
||||
# homeassistant.components.esphome
|
||||
aioesphomeapi==11.4.1
|
||||
aioesphomeapi==11.4.2
|
||||
|
||||
# homeassistant.components.flo
|
||||
aioflo==2021.11.0
|
||||
|
|
|
@ -140,7 +140,7 @@ aioecowitt==2022.09.3
|
|||
aioemonitor==1.0.5
|
||||
|
||||
# homeassistant.components.esphome
|
||||
aioesphomeapi==11.4.1
|
||||
aioesphomeapi==11.4.2
|
||||
|
||||
# homeassistant.components.flo
|
||||
aioflo==2021.11.0
|
||||
|
|
Loading…
Reference in New Issue