1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Switch to a different local Bluetooth adapter when one runs out of connection slots (#84331)

This commit is contained in:
J. Nick Koston
2022-12-23 08:58:33 -10:00
committed by GitHub
parent f39f3b612a
commit 070aa714a0
13 changed files with 395 additions and 29 deletions

View File

@@ -86,6 +86,7 @@ async def test_diagnostics(
"product": "Bluetooth Adapter 5.0",
"product_id": "aa01",
"vendor_id": "cc01",
"connection_slots": 1,
},
"hci1": {
"address": "00:00:00:00:00:02",
@@ -96,6 +97,7 @@ async def test_diagnostics(
"product": "Bluetooth Adapter 5.0",
"product_id": "aa01",
"vendor_id": "cc01",
"connection_slots": 2,
},
},
"dbus": {
@@ -115,6 +117,11 @@ async def test_diagnostics(
}
},
"manager": {
"slot_manager": {
"adapter_slots": {"hci0": 5, "hci1": 2},
"allocations_by_adapter": {"hci0": [], "hci1": []},
"manager": False,
},
"adapters": {
"hci0": {
"address": "00:00:00:00:00:01",
@@ -125,6 +132,7 @@ async def test_diagnostics(
"product": "Bluetooth Adapter 5.0",
"product_id": "aa01",
"vendor_id": "cc01",
"connection_slots": 1,
},
"hci1": {
"address": "00:00:00:00:00:02",
@@ -135,6 +143,7 @@ async def test_diagnostics(
"product": "Bluetooth Adapter 5.0",
"product_id": "aa01",
"vendor_id": "cc01",
"connection_slots": 2,
},
},
"advertisement_tracker": {
@@ -274,6 +283,7 @@ async def test_diagnostics_macos(
inject_advertisement(hass, switchbot_device, switchbot_adv)
diag = await get_diagnostics_for_config_entry(hass, hass_client, entry1)
assert diag == {
"adapters": {
"Core Bluetooth": {
@@ -287,6 +297,11 @@ async def test_diagnostics_macos(
}
},
"manager": {
"slot_manager": {
"adapter_slots": {"Core Bluetooth": 5},
"allocations_by_adapter": {"Core Bluetooth": []},
"manager": False,
},
"adapters": {
"Core Bluetooth": {
"address": "00:00:00:00:00:00",
@@ -457,6 +472,7 @@ async def test_diagnostics_remote_adapter(
inject_advertisement(hass, switchbot_device, switchbot_adv)
diag = await get_diagnostics_for_config_entry(hass, hass_client, entry1)
assert diag == {
"adapters": {
"hci0": {
@@ -472,6 +488,11 @@ async def test_diagnostics_remote_adapter(
},
"dbus": {},
"manager": {
"slot_manager": {
"adapter_slots": {"hci0": 5},
"allocations_by_adapter": {"hci0": []},
"manager": False,
},
"adapters": {
"hci0": {
"address": "00:00:00:00:00:01",