mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Add missing transmit power to ESPHome Bluetooth scanners (#98175)
We did not previously have a way to get the transmit power value when using ESPHome scanners. bluetooth-data-tools 1.8.0 includes it in the advertisment tuple to fully align with the bleak implementation. txpower is not yet used in the HA codebase but may be expected by upstream libaries that calculate estimated distance
This commit is contained in:
parent
296c27859e
commit
108bcabf75
@ -18,7 +18,7 @@
|
|||||||
"bleak-retry-connector==3.1.1",
|
"bleak-retry-connector==3.1.1",
|
||||||
"bluetooth-adapters==0.16.0",
|
"bluetooth-adapters==0.16.0",
|
||||||
"bluetooth-auto-recovery==1.2.1",
|
"bluetooth-auto-recovery==1.2.1",
|
||||||
"bluetooth-data-tools==1.7.0",
|
"bluetooth-data-tools==1.8.0",
|
||||||
"dbus-fast==1.91.2"
|
"dbus-fast==1.91.2"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,10 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from aioesphomeapi import BluetoothLEAdvertisement, BluetoothLERawAdvertisement
|
from aioesphomeapi import BluetoothLEAdvertisement, BluetoothLERawAdvertisement
|
||||||
from bluetooth_data_tools import int_to_bluetooth_address, parse_advertisement_data
|
from bluetooth_data_tools import (
|
||||||
|
int_to_bluetooth_address,
|
||||||
|
parse_advertisement_data_tuple,
|
||||||
|
)
|
||||||
|
|
||||||
from homeassistant.components.bluetooth import MONOTONIC_TIME, BaseHaRemoteScanner
|
from homeassistant.components.bluetooth import MONOTONIC_TIME, BaseHaRemoteScanner
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -11,6 +14,8 @@ from homeassistant.core import callback
|
|||||||
class ESPHomeScanner(BaseHaRemoteScanner):
|
class ESPHomeScanner(BaseHaRemoteScanner):
|
||||||
"""Scanner for esphome."""
|
"""Scanner for esphome."""
|
||||||
|
|
||||||
|
__slots__ = ()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_on_advertisement(self, adv: BluetoothLEAdvertisement) -> None:
|
def async_on_advertisement(self, adv: BluetoothLEAdvertisement) -> None:
|
||||||
"""Call the registered callback."""
|
"""Call the registered callback."""
|
||||||
@ -34,15 +39,10 @@ class ESPHomeScanner(BaseHaRemoteScanner):
|
|||||||
"""Call the registered callback."""
|
"""Call the registered callback."""
|
||||||
now = MONOTONIC_TIME()
|
now = MONOTONIC_TIME()
|
||||||
for adv in advertisements:
|
for adv in advertisements:
|
||||||
parsed = parse_advertisement_data((adv.data,))
|
|
||||||
self._async_on_advertisement(
|
self._async_on_advertisement(
|
||||||
int_to_bluetooth_address(adv.address),
|
int_to_bluetooth_address(adv.address),
|
||||||
adv.rssi,
|
adv.rssi,
|
||||||
parsed.local_name,
|
*parse_advertisement_data_tuple((adv.data,)),
|
||||||
parsed.service_uuids,
|
|
||||||
parsed.service_data,
|
|
||||||
parsed.manufacturer_data,
|
|
||||||
None,
|
|
||||||
{"address_type": adv.address_type},
|
{"address_type": adv.address_type},
|
||||||
now,
|
now,
|
||||||
)
|
)
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"requirements": [
|
"requirements": [
|
||||||
"async_interrupt==1.1.1",
|
"async_interrupt==1.1.1",
|
||||||
"aioesphomeapi==15.1.15",
|
"aioesphomeapi==15.1.15",
|
||||||
"bluetooth-data-tools==1.7.0",
|
"bluetooth-data-tools==1.8.0",
|
||||||
"esphome-dashboard-api==1.2.3"
|
"esphome-dashboard-api==1.2.3"
|
||||||
],
|
],
|
||||||
"zeroconf": ["_esphomelib._tcp.local."]
|
"zeroconf": ["_esphomelib._tcp.local."]
|
||||||
|
@ -20,5 +20,5 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/ld2410_ble",
|
"documentation": "https://www.home-assistant.io/integrations/ld2410_ble",
|
||||||
"integration_type": "device",
|
"integration_type": "device",
|
||||||
"iot_class": "local_push",
|
"iot_class": "local_push",
|
||||||
"requirements": ["bluetooth-data-tools==1.7.0", "ld2410-ble==0.1.1"]
|
"requirements": ["bluetooth-data-tools==1.8.0", "ld2410-ble==0.1.1"]
|
||||||
}
|
}
|
||||||
|
@ -32,5 +32,5 @@
|
|||||||
"dependencies": ["bluetooth_adapters"],
|
"dependencies": ["bluetooth_adapters"],
|
||||||
"documentation": "https://www.home-assistant.io/integrations/led_ble",
|
"documentation": "https://www.home-assistant.io/integrations/led_ble",
|
||||||
"iot_class": "local_polling",
|
"iot_class": "local_polling",
|
||||||
"requirements": ["bluetooth-data-tools==1.7.0", "led-ble==1.0.0"]
|
"requirements": ["bluetooth-data-tools==1.8.0", "led-ble==1.0.0"]
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ bleak-retry-connector==3.1.1
|
|||||||
bleak==0.20.2
|
bleak==0.20.2
|
||||||
bluetooth-adapters==0.16.0
|
bluetooth-adapters==0.16.0
|
||||||
bluetooth-auto-recovery==1.2.1
|
bluetooth-auto-recovery==1.2.1
|
||||||
bluetooth-data-tools==1.7.0
|
bluetooth-data-tools==1.8.0
|
||||||
certifi>=2021.5.30
|
certifi>=2021.5.30
|
||||||
ciso8601==2.3.0
|
ciso8601==2.3.0
|
||||||
cryptography==41.0.3
|
cryptography==41.0.3
|
||||||
|
@ -543,7 +543,7 @@ bluetooth-auto-recovery==1.2.1
|
|||||||
# homeassistant.components.esphome
|
# homeassistant.components.esphome
|
||||||
# homeassistant.components.ld2410_ble
|
# homeassistant.components.ld2410_ble
|
||||||
# homeassistant.components.led_ble
|
# homeassistant.components.led_ble
|
||||||
bluetooth-data-tools==1.7.0
|
bluetooth-data-tools==1.8.0
|
||||||
|
|
||||||
# homeassistant.components.bond
|
# homeassistant.components.bond
|
||||||
bond-async==0.2.1
|
bond-async==0.2.1
|
||||||
|
@ -454,7 +454,7 @@ bluetooth-auto-recovery==1.2.1
|
|||||||
# homeassistant.components.esphome
|
# homeassistant.components.esphome
|
||||||
# homeassistant.components.ld2410_ble
|
# homeassistant.components.ld2410_ble
|
||||||
# homeassistant.components.led_ble
|
# homeassistant.components.led_ble
|
||||||
bluetooth-data-tools==1.7.0
|
bluetooth-data-tools==1.8.0
|
||||||
|
|
||||||
# homeassistant.components.bond
|
# homeassistant.components.bond
|
||||||
bond-async==0.2.1
|
bond-async==0.2.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user