Skip to content

Commit

Permalink
Fix up migration error...
Browse files Browse the repository at this point in the history
  • Loading branch information
hcoohb committed Sep 28, 2020
1 parent e78a7eb commit 9681e82
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions custom_components/yeelight_bt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
return True


async def async_migrate_entry(hass, entry):
"""Migrate old entry."""
data = entry.data
version = entry.version

_LOGGER.debug(f"Migrating Yeelight_bt from Version {version}. it has data: {data}")
# Migrate Version 1 -> Version 2: Stuff up... nothing changed.
if version == 1:
version = entry.version = 2
hass.config_entries.async_update_entry(entry, data=data)
return True


async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Unload a config entry."""
_LOGGER.debug("async unload entry")
Expand Down

0 comments on commit 9681e82

Please sign in to comment.