Skip to content

Commit

Permalink
remove sicaapp_lu for sica_lu (also add migration)
Browse files Browse the repository at this point in the history
  • Loading branch information
5ila5 committed Sep 30, 2024
1 parent 6e17813 commit bdbb66c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 131 deletions.
2 changes: 1 addition & 1 deletion custom_components/waste_collection_schedule/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
UPDATE_SENSORS_SIGNAL: Final = "wcs_update_sensors_signal"

CONFIG_VERSION: Final = 2
CONFIG_MINOR_VERSION: Final = 2
CONFIG_MINOR_VERSION: Final = 3

# Config var names
CONF_SOURCES: Final = "sources"
Expand Down
16 changes: 15 additions & 1 deletion custom_components/waste_collection_schedule/init_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
return False

# Version number has gone up
if config_entry.version < const.CONFIG_VERSION:
if config_entry.version < const.CONFIG_VERSION or (
config_entry.version == const.CONFIG_VERSION
and config_entry.minor_version < const.CONFIG_MINOR_VERSION
):
_LOGGER.debug("Migrating from version %s", config_entry.version)
new_data = {**config_entry.data}

Expand All @@ -128,6 +131,17 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
_LOGGER.debug("Migrating from chiltern_gov_uk to iapp_itouchvision_com")
new_data["name"] = "iapp_itouchvision_com"
new_data["args"]["municipality"] = "BUCKINGHAMSHIRE"
if config_entry.version < 2 or (
config_entry.version == 2 and config_entry.minor_version < 3
):
# Migrate from sicaapp_lu to sica_lu
if new_data.get("name", "") == "sicaapp_lu":
if not new_data["args"].get("commune"):
return False
_LOGGER.debug("Migrating from sicaapp_lu to sica_lu")
new_data["name"] = "sica_lu"
new_data["args"]["municipality"] = new_data["args"].get("commune")
del new_data["args"]["commune"]

hass.config_entries.async_update_entry(
config_entry,
Expand Down

This file was deleted.

45 changes: 0 additions & 45 deletions doc/source/sicaapp_lu.md

This file was deleted.

0 comments on commit bdbb66c

Please sign in to comment.