mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Add manufacturer and model to bluetooth adapter device (#82769)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
parent
873b903cf0
commit
d6e287f47a
@ -10,10 +10,12 @@ from awesomeversion import AwesomeVersion
|
||||
from bluetooth_adapters import (
|
||||
ADAPTER_ADDRESS,
|
||||
ADAPTER_HW_VERSION,
|
||||
ADAPTER_MANUFACTURER,
|
||||
ADAPTER_SW_VERSION,
|
||||
DEFAULT_ADDRESS,
|
||||
AdapterDetails,
|
||||
adapter_human_name,
|
||||
adapter_model,
|
||||
adapter_unique_name,
|
||||
get_adapters,
|
||||
)
|
||||
@ -276,6 +278,8 @@ async def async_update_device(
|
||||
config_entry_id=entry.entry_id,
|
||||
name=adapter_human_name(adapter, details[ADAPTER_ADDRESS]),
|
||||
connections={(dr.CONNECTION_BLUETOOTH, details[ADAPTER_ADDRESS])},
|
||||
manufacturer=details[ADAPTER_MANUFACTURER],
|
||||
model=adapter_model(details),
|
||||
sw_version=details.get(ADAPTER_SW_VERSION),
|
||||
hw_version=details.get(ADAPTER_HW_VERSION),
|
||||
)
|
||||
|
@ -8,7 +8,7 @@
|
||||
"requirements": [
|
||||
"bleak==0.19.2",
|
||||
"bleak-retry-connector==2.8.5",
|
||||
"bluetooth-adapters==0.8.0",
|
||||
"bluetooth-adapters==0.11.0",
|
||||
"bluetooth-auto-recovery==0.5.2",
|
||||
"bluetooth-data-tools==0.3.0",
|
||||
"dbus-fast==1.75.0"
|
||||
|
@ -6,7 +6,7 @@
|
||||
"requirements": [
|
||||
"netmap==0.7.0.2",
|
||||
"getmac==0.8.2",
|
||||
"mac-vendor-lookup==0.1.11"
|
||||
"mac-vendor-lookup==0.1.12"
|
||||
],
|
||||
"codeowners": [],
|
||||
"iot_class": "local_polling",
|
||||
|
@ -12,7 +12,7 @@ awesomeversion==22.9.0
|
||||
bcrypt==3.1.7
|
||||
bleak-retry-connector==2.8.5
|
||||
bleak==0.19.2
|
||||
bluetooth-adapters==0.8.0
|
||||
bluetooth-adapters==0.11.0
|
||||
bluetooth-auto-recovery==0.5.2
|
||||
bluetooth-data-tools==0.3.0
|
||||
certifi>=2021.5.30
|
||||
|
@ -447,7 +447,7 @@ bluemaestro-ble==0.2.0
|
||||
# bluepy==1.3.0
|
||||
|
||||
# homeassistant.components.bluetooth
|
||||
bluetooth-adapters==0.8.0
|
||||
bluetooth-adapters==0.11.0
|
||||
|
||||
# homeassistant.components.bluetooth
|
||||
bluetooth-auto-recovery==0.5.2
|
||||
@ -1055,7 +1055,7 @@ lw12==0.9.2
|
||||
lxml==4.9.1
|
||||
|
||||
# homeassistant.components.nmap_tracker
|
||||
mac-vendor-lookup==0.1.11
|
||||
mac-vendor-lookup==0.1.12
|
||||
|
||||
# homeassistant.components.magicseaweed
|
||||
magicseaweed==1.0.3
|
||||
|
@ -361,7 +361,7 @@ blinkpy==0.19.2
|
||||
bluemaestro-ble==0.2.0
|
||||
|
||||
# homeassistant.components.bluetooth
|
||||
bluetooth-adapters==0.8.0
|
||||
bluetooth-adapters==0.11.0
|
||||
|
||||
# homeassistant.components.bluetooth
|
||||
bluetooth-auto-recovery==0.5.2
|
||||
@ -769,7 +769,7 @@ luftdaten==0.7.4
|
||||
lxml==4.9.1
|
||||
|
||||
# homeassistant.components.nmap_tracker
|
||||
mac-vendor-lookup==0.1.11
|
||||
mac-vendor-lookup==0.1.12
|
||||
|
||||
# homeassistant.components.maxcube
|
||||
maxcube-api==0.4.3
|
||||
|
@ -106,6 +106,10 @@ def one_adapter_fixture():
|
||||
"hw_version": "usb:v1D6Bp0246d053F",
|
||||
"passive_scan": True,
|
||||
"sw_version": "homeassistant",
|
||||
"manufacturer": "ACME",
|
||||
"product": "Bluetooth Adapter 5.0",
|
||||
"product_id": "aa01",
|
||||
"vendor_id": "cc01",
|
||||
},
|
||||
},
|
||||
):
|
||||
@ -132,12 +136,20 @@ def two_adapters_fixture():
|
||||
"hw_version": "usb:v1D6Bp0246d053F",
|
||||
"passive_scan": False,
|
||||
"sw_version": "homeassistant",
|
||||
"manufacturer": "ACME",
|
||||
"product": "Bluetooth Adapter 5.0",
|
||||
"product_id": "aa01",
|
||||
"vendor_id": "cc01",
|
||||
},
|
||||
"hci1": {
|
||||
"address": "00:00:00:00:00:02",
|
||||
"hw_version": "usb:v1D6Bp0246d053F",
|
||||
"passive_scan": True,
|
||||
"sw_version": "homeassistant",
|
||||
"manufacturer": "ACME",
|
||||
"product": "Bluetooth Adapter 5.0",
|
||||
"product_id": "aa01",
|
||||
"vendor_id": "cc01",
|
||||
},
|
||||
},
|
||||
):
|
||||
@ -164,6 +176,10 @@ def one_adapter_old_bluez():
|
||||
"hw_version": "usb:v1D6Bp0246d053F",
|
||||
"passive_scan": False,
|
||||
"sw_version": "homeassistant",
|
||||
"manufacturer": "ACME",
|
||||
"product": "Bluetooth Adapter 5.0",
|
||||
"product_id": "aa01",
|
||||
"vendor_id": "cc01",
|
||||
},
|
||||
},
|
||||
):
|
||||
|
@ -130,7 +130,10 @@ async def test_async_step_integration_discovery(hass):
|
||||
"""Test setting up from integration discovery."""
|
||||
|
||||
details = AdapterDetails(
|
||||
address="00:00:00:00:00:01", sw_version="1.23.5", hw_version="1.2.3"
|
||||
address="00:00:00:00:00:01",
|
||||
sw_version="1.23.5",
|
||||
hw_version="1.2.3",
|
||||
manufacturer="ACME",
|
||||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
@ -159,7 +162,10 @@ async def test_async_step_integration_discovery_during_onboarding_one_adapter(
|
||||
):
|
||||
"""Test setting up from integration discovery during onboarding."""
|
||||
details = AdapterDetails(
|
||||
address="00:00:00:00:00:01", sw_version="1.23.5", hw_version="1.2.3"
|
||||
address="00:00:00:00:00:01",
|
||||
sw_version="1.23.5",
|
||||
hw_version="1.2.3",
|
||||
manufacturer="ACME",
|
||||
)
|
||||
|
||||
with patch(
|
||||
@ -187,10 +193,16 @@ async def test_async_step_integration_discovery_during_onboarding_two_adapters(
|
||||
):
|
||||
"""Test setting up from integration discovery during onboarding."""
|
||||
details1 = AdapterDetails(
|
||||
address="00:00:00:00:00:01", sw_version="1.23.5", hw_version="1.2.3"
|
||||
address="00:00:00:00:00:01",
|
||||
sw_version="1.23.5",
|
||||
hw_version="1.2.3",
|
||||
manufacturer="ACME",
|
||||
)
|
||||
details2 = AdapterDetails(
|
||||
address="00:00:00:00:00:02", sw_version="1.23.5", hw_version="1.2.3"
|
||||
address="00:00:00:00:00:02",
|
||||
sw_version="1.23.5",
|
||||
hw_version="1.2.3",
|
||||
manufacturer="ACME",
|
||||
)
|
||||
|
||||
with patch(
|
||||
@ -226,7 +238,10 @@ async def test_async_step_integration_discovery_during_onboarding_two_adapters(
|
||||
async def test_async_step_integration_discovery_during_onboarding(hass, macos_adapter):
|
||||
"""Test setting up from integration discovery during onboarding."""
|
||||
details = AdapterDetails(
|
||||
address=DEFAULT_ADDRESS, sw_version="1.23.5", hw_version="1.2.3"
|
||||
address=DEFAULT_ADDRESS,
|
||||
sw_version="1.23.5",
|
||||
hw_version="1.2.3",
|
||||
manufacturer="ACME",
|
||||
)
|
||||
|
||||
with patch(
|
||||
@ -252,7 +267,10 @@ async def test_async_step_integration_discovery_during_onboarding(hass, macos_ad
|
||||
async def test_async_step_integration_discovery_already_exists(hass):
|
||||
"""Test setting up from integration discovery when an entry already exists."""
|
||||
details = AdapterDetails(
|
||||
address="00:00:00:00:00:01", sw_version="1.23.5", hw_version="1.2.3"
|
||||
address="00:00:00:00:00:01",
|
||||
sw_version="1.23.5",
|
||||
hw_version="1.2.3",
|
||||
manufacturer="ACME",
|
||||
)
|
||||
|
||||
entry = MockConfigEntry(domain=DOMAIN, unique_id="00:00:00:00:00:01")
|
||||
|
@ -76,12 +76,20 @@ async def test_diagnostics(
|
||||
"hw_version": "usb:v1D6Bp0246d053F",
|
||||
"passive_scan": False,
|
||||
"sw_version": "homeassistant",
|
||||
"manufacturer": "ACME",
|
||||
"product": "Bluetooth Adapter 5.0",
|
||||
"product_id": "aa01",
|
||||
"vendor_id": "cc01",
|
||||
},
|
||||
"hci1": {
|
||||
"address": "00:00:00:00:00:02",
|
||||
"hw_version": "usb:v1D6Bp0246d053F",
|
||||
"passive_scan": True,
|
||||
"sw_version": "homeassistant",
|
||||
"manufacturer": "ACME",
|
||||
"product": "Bluetooth Adapter 5.0",
|
||||
"product_id": "aa01",
|
||||
"vendor_id": "cc01",
|
||||
},
|
||||
},
|
||||
"dbus": {
|
||||
@ -107,12 +115,20 @@ async def test_diagnostics(
|
||||
"hw_version": "usb:v1D6Bp0246d053F",
|
||||
"passive_scan": False,
|
||||
"sw_version": "homeassistant",
|
||||
"manufacturer": "ACME",
|
||||
"product": "Bluetooth Adapter 5.0",
|
||||
"product_id": "aa01",
|
||||
"vendor_id": "cc01",
|
||||
},
|
||||
"hci1": {
|
||||
"address": "00:00:00:00:00:02",
|
||||
"hw_version": "usb:v1D6Bp0246d053F",
|
||||
"passive_scan": True,
|
||||
"sw_version": "homeassistant",
|
||||
"manufacturer": "ACME",
|
||||
"product": "Bluetooth Adapter 5.0",
|
||||
"product_id": "aa01",
|
||||
"vendor_id": "cc01",
|
||||
},
|
||||
},
|
||||
"advertisement_tracker": {
|
||||
@ -249,6 +265,10 @@ async def test_diagnostics_macos(
|
||||
"address": "00:00:00:00:00:00",
|
||||
"passive_scan": False,
|
||||
"sw_version": ANY,
|
||||
"manufacturer": "Apple",
|
||||
"product": "Unknown MacOS Model",
|
||||
"product_id": "Unknown",
|
||||
"vendor_id": "Unknown",
|
||||
}
|
||||
},
|
||||
"manager": {
|
||||
@ -257,6 +277,10 @@ async def test_diagnostics_macos(
|
||||
"address": "00:00:00:00:00:00",
|
||||
"passive_scan": False,
|
||||
"sw_version": ANY,
|
||||
"manufacturer": "Apple",
|
||||
"product": "Unknown MacOS Model",
|
||||
"product_id": "Unknown",
|
||||
"vendor_id": "Unknown",
|
||||
}
|
||||
},
|
||||
"advertisement_tracker": {
|
||||
|
@ -1050,6 +1050,10 @@ def mock_bluetooth_adapters():
|
||||
"hw_version": "usb:v1D6Bp0246d053F",
|
||||
"passive_scan": False,
|
||||
"sw_version": "homeassistant",
|
||||
"manufacturer": "ACME",
|
||||
"product": "Bluetooth Adapter 5.0",
|
||||
"product_id": "aa01",
|
||||
"vendor_id": "cc01",
|
||||
},
|
||||
},
|
||||
):
|
||||
|
Loading…
x
Reference in New Issue
Block a user