mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Cleanup BLE-only controls when migrating HomeKit BLE device to Thread (#110334)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
@@ -70,44 +70,6 @@
|
||||
'state': 'unknown',
|
||||
}),
|
||||
}),
|
||||
dict({
|
||||
'entry': dict({
|
||||
'aliases': list([
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': 'TestData',
|
||||
'device_class': None,
|
||||
'disabled_by': None,
|
||||
'domain': 'button',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'button.airversa_ap2_1808_provision_preferred_thread_credentials',
|
||||
'has_entity_name': False,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'labels': list([
|
||||
]),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Airversa AP2 1808 Provision Preferred Thread Credentials',
|
||||
'platform': 'homekit_controller',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '00:00:00:00:00:00_1_112_119',
|
||||
'unit_of_measurement': None,
|
||||
}),
|
||||
'state': dict({
|
||||
'attributes': dict({
|
||||
'friendly_name': 'Airversa AP2 1808 Provision Preferred Thread Credentials',
|
||||
}),
|
||||
'entity_id': 'button.airversa_ap2_1808_provision_preferred_thread_credentials',
|
||||
'state': 'unknown',
|
||||
}),
|
||||
}),
|
||||
dict({
|
||||
'entry': dict({
|
||||
'aliases': list([
|
||||
@@ -14200,44 +14162,6 @@
|
||||
'state': 'unknown',
|
||||
}),
|
||||
}),
|
||||
dict({
|
||||
'entry': dict({
|
||||
'aliases': list([
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': 'TestData',
|
||||
'device_class': None,
|
||||
'disabled_by': None,
|
||||
'domain': 'button',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'button.nanoleaf_strip_3b32_provision_preferred_thread_credentials',
|
||||
'has_entity_name': False,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'labels': list([
|
||||
]),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Nanoleaf Strip 3B32 Provision Preferred Thread Credentials',
|
||||
'platform': 'homekit_controller',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '00:00:00:00:00:00_1_31_119',
|
||||
'unit_of_measurement': None,
|
||||
}),
|
||||
'state': dict({
|
||||
'attributes': dict({
|
||||
'friendly_name': 'Nanoleaf Strip 3B32 Provision Preferred Thread Credentials',
|
||||
}),
|
||||
'entity_id': 'button.nanoleaf_strip_3b32_provision_preferred_thread_credentials',
|
||||
'state': 'unknown',
|
||||
}),
|
||||
}),
|
||||
dict({
|
||||
'entry': dict({
|
||||
'aliases': list([
|
||||
|
||||
@@ -14,7 +14,7 @@ from homeassistant.components.homekit_controller.const import (
|
||||
from homeassistant.components.thread import async_add_dataset, dataset_store
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
||||
from .common import setup_accessories_from_file, setup_platform, setup_test_accessories
|
||||
|
||||
@@ -216,7 +216,9 @@ async def test_thread_provision_no_creds(hass: HomeAssistant) -> None:
|
||||
)
|
||||
|
||||
|
||||
async def test_thread_provision(hass: HomeAssistant) -> None:
|
||||
async def test_thread_provision(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
) -> None:
|
||||
"""Test that a when a thread provision works the config entry is updated."""
|
||||
await async_add_dataset(
|
||||
hass,
|
||||
@@ -256,6 +258,13 @@ async def test_thread_provision(hass: HomeAssistant) -> None:
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.states.get(
|
||||
"button.nanoleaf_strip_3b32_provision_preferred_thread_credentials"
|
||||
)
|
||||
assert entity_registry.async_get(
|
||||
"button.nanoleaf_strip_3b32_provision_preferred_thread_credentials"
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
"button",
|
||||
"press",
|
||||
@@ -267,6 +276,13 @@ async def test_thread_provision(hass: HomeAssistant) -> None:
|
||||
|
||||
assert config_entry.data["Connection"] == "CoAP"
|
||||
|
||||
assert not hass.states.get(
|
||||
"button.nanoleaf_strip_3b32_provision_preferred_thread_credentials"
|
||||
)
|
||||
assert not entity_registry.async_get(
|
||||
"button.nanoleaf_strip_3b32_provision_preferred_thread_credentials"
|
||||
)
|
||||
|
||||
|
||||
async def test_thread_provision_migration_failed(hass: HomeAssistant) -> None:
|
||||
"""Test that when a device 'migrates' but doesn't show up in CoAP, we remain in BLE mode."""
|
||||
|
||||
Reference in New Issue
Block a user