mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
parent
2370dda1f0
commit
0d3bbfc9a7
@ -10,7 +10,7 @@ import async_timeout
|
|||||||
from voluptuous import Required, Schema
|
from voluptuous import Required, Schema
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.components import zeroconf
|
from homeassistant.components import persistent_notification, zeroconf
|
||||||
from homeassistant.const import CONF_IP_ADDRESS
|
from homeassistant.const import CONF_IP_ADDRESS
|
||||||
from homeassistant.data_entry_flow import AbortFlow, FlowResult
|
from homeassistant.data_entry_flow import AbortFlow, FlowResult
|
||||||
|
|
||||||
@ -32,13 +32,14 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
"""Handle a flow initiated by older `homewizard_energy` component."""
|
"""Handle a flow initiated by older `homewizard_energy` component."""
|
||||||
_LOGGER.debug("config_flow async_step_import")
|
_LOGGER.debug("config_flow async_step_import")
|
||||||
|
|
||||||
self.hass.components.persistent_notification.async_create(
|
persistent_notification.async_create(
|
||||||
(
|
self.hass,
|
||||||
|
title="HomeWizard Energy",
|
||||||
|
message=(
|
||||||
"The custom integration of HomeWizard Energy has been migrated to core. "
|
"The custom integration of HomeWizard Energy has been migrated to core. "
|
||||||
"You can safely remove the custom integration from the custom_integrations folder."
|
"You can safely remove the custom integration from the custom_integrations folder."
|
||||||
),
|
),
|
||||||
"HomeWizard Energy",
|
notification_id=f"homewizard_energy_to_{DOMAIN}",
|
||||||
f"homewizard_energy_to_{DOMAIN}",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return await self.async_step_user({CONF_IP_ADDRESS: import_config["host"]})
|
return await self.async_step_user({CONF_IP_ADDRESS: import_config["host"]})
|
||||||
|
@ -77,7 +77,7 @@ async def test_init_accepts_and_migrates_old_entry(aioclient_mock, hass):
|
|||||||
|
|
||||||
# Add original entry
|
# Add original entry
|
||||||
original_entry = MockConfigEntry(
|
original_entry = MockConfigEntry(
|
||||||
domain=DOMAIN,
|
domain="homewizard_energy",
|
||||||
data={CONF_IP_ADDRESS: "1.2.3.4"},
|
data={CONF_IP_ADDRESS: "1.2.3.4"},
|
||||||
entry_id="old_id",
|
entry_id="old_id",
|
||||||
)
|
)
|
||||||
@ -122,6 +122,9 @@ async def test_init_accepts_and_migrates_old_entry(aioclient_mock, hass):
|
|||||||
)
|
)
|
||||||
imported_entry.add_to_hass(hass)
|
imported_entry.add_to_hass(hass)
|
||||||
|
|
||||||
|
assert imported_entry.domain == DOMAIN
|
||||||
|
assert imported_entry.domain != original_entry.domain
|
||||||
|
|
||||||
# Add the entry_id to trigger migration
|
# Add the entry_id to trigger migration
|
||||||
with patch(
|
with patch(
|
||||||
"aiohwenergy.HomeWizardEnergy",
|
"aiohwenergy.HomeWizardEnergy",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user