mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Remove deprecated device migration from opentherm_gw (#139612)
This commit is contained in:
parent
4c8a58f7cc
commit
d006d33dc0
@ -87,23 +87,6 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
||||
gateway = OpenThermGatewayHub(hass, config_entry)
|
||||
hass.data[DATA_OPENTHERM_GW][DATA_GATEWAYS][config_entry.data[CONF_ID]] = gateway
|
||||
|
||||
# Migration can be removed in 2025.4.0
|
||||
dev_reg = dr.async_get(hass)
|
||||
if (
|
||||
migrate_device := dev_reg.async_get_device(
|
||||
{(DOMAIN, config_entry.data[CONF_ID])}
|
||||
)
|
||||
) is not None:
|
||||
dev_reg.async_update_device(
|
||||
migrate_device.id,
|
||||
new_identifiers={
|
||||
(
|
||||
DOMAIN,
|
||||
f"{config_entry.data[CONF_ID]}-{OpenThermDeviceIdentifier.GATEWAY}",
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
# Migration can be removed in 2025.4.0
|
||||
ent_reg = er.async_get(hass)
|
||||
if (
|
||||
|
@ -71,59 +71,6 @@ async def test_device_registry_update(
|
||||
assert gw_dev.sw_version == VERSION_NEW
|
||||
|
||||
|
||||
# Device migration test can be removed in 2025.4.0
|
||||
async def test_device_migration(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_pyotgw: MagicMock,
|
||||
) -> None:
|
||||
"""Test that the device registry is updated correctly."""
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
|
||||
device_registry.async_get_or_create(
|
||||
config_entry_id=mock_config_entry.entry_id,
|
||||
identifiers={
|
||||
(DOMAIN, MOCK_GATEWAY_ID),
|
||||
},
|
||||
name="Mock Gateway",
|
||||
manufacturer="Schelte Bron",
|
||||
model="OpenTherm Gateway",
|
||||
sw_version=VERSION_TEST,
|
||||
)
|
||||
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert (
|
||||
device_registry.async_get_device(identifiers={(DOMAIN, MOCK_GATEWAY_ID)})
|
||||
is None
|
||||
)
|
||||
|
||||
gw_dev = device_registry.async_get_device(
|
||||
identifiers={(DOMAIN, f"{MOCK_GATEWAY_ID}-{OpenThermDeviceIdentifier.GATEWAY}")}
|
||||
)
|
||||
assert gw_dev is not None
|
||||
|
||||
assert (
|
||||
device_registry.async_get_device(
|
||||
identifiers={
|
||||
(DOMAIN, f"{MOCK_GATEWAY_ID}-{OpenThermDeviceIdentifier.BOILER}")
|
||||
}
|
||||
)
|
||||
is not None
|
||||
)
|
||||
|
||||
assert (
|
||||
device_registry.async_get_device(
|
||||
identifiers={
|
||||
(DOMAIN, f"{MOCK_GATEWAY_ID}-{OpenThermDeviceIdentifier.THERMOSTAT}")
|
||||
}
|
||||
)
|
||||
is not None
|
||||
)
|
||||
|
||||
|
||||
# Entity migration test can be removed in 2025.4.0
|
||||
async def test_climate_entity_migration(
|
||||
hass: HomeAssistant,
|
||||
|
Loading…
x
Reference in New Issue
Block a user