Skip to content

Commit

Permalink
chore: fixes after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
chemelli74 committed Jun 25, 2024
1 parent ed94374 commit 84ccca5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
31 changes: 27 additions & 4 deletions custom_components/midea_lan/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ async def update_listener(hass: HomeAssistant, config_entry: ConfigEntry) -> Non
await hass.config_entries.async_unload_platforms(config_entry, ALL_PLATFORM)
# forward the Config Entry to the platforms
hass.async_create_task(
hass.config_entries.async_forward_entry_setups(
config_entry, ALL_PLATFORM),
hass.config_entries.async_forward_entry_setups(config_entry, ALL_PLATFORM),
)
device_id = config_entry.data.get(CONF_DEVICE_ID)
customize = config_entry.options.get(CONF_CUSTOMIZE, "")
Expand Down Expand Up @@ -242,8 +241,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
# Listener `update_listener` is
# attached when the entry is loaded
# and detached when it's unloaded
config_entry.async_on_unload(
config_entry.add_update_listener(update_listener))
config_entry.async_on_unload(config_entry.add_update_listener(update_listener))
return True
return False

Expand Down Expand Up @@ -281,6 +279,31 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->

_LOGGER.debug("Migration to configuration version 2 successful")

# 2 -> 3: migrate domain
if config_entry.version == 2: # noqa: PLR2004
_LOGGER.debug("Migrating configuration from version 2")

# Migrate config entry
new_data = {**config_entry.data}
new_data["domain"] = DOMAIN
if (MAJOR_VERSION, MINOR_VERSION) >= (2024, 3):
hass.config_entries.async_update_entry(config_entry, version=2)
else:
config_entry.version = 2
hass.config_entries.async_update_entry(config_entry)

# Migrate device.
await _async_migrate_device_identifiers(hass, config_entry)

# Migrate entities.
await er.async_migrate_entries(
hass,
config_entry.entry_id,
_migrate_entities_domain,
)

_LOGGER.debug("Migration to configuration version 3 successful")

return True


Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_lan/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class MideaLanConfigFlow(ConfigFlow, domain=DOMAIN): # type: ignore[call-arg]
ConfigFlow will manage the creation of entries from user input, discovery
"""

VERSION = 2
VERSION = 3
MINOR_VERSION = 1

def __init__(self) -> None:
Expand Down

0 comments on commit 84ccca5

Please sign in to comment.