mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Fix OpenWeatherMap migration (#118428)
This commit is contained in:
parent
a670169325
commit
ab9581c617
@ -72,14 +72,15 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
"""Migrate old entry."""
|
"""Migrate old entry."""
|
||||||
config_entries = hass.config_entries
|
config_entries = hass.config_entries
|
||||||
data = entry.data
|
data = entry.data
|
||||||
|
options = entry.options
|
||||||
version = entry.version
|
version = entry.version
|
||||||
|
|
||||||
_LOGGER.debug("Migrating OpenWeatherMap entry from version %s", version)
|
_LOGGER.debug("Migrating OpenWeatherMap entry from version %s", version)
|
||||||
|
|
||||||
if version < 3:
|
if version < 4:
|
||||||
new_data = {**data, CONF_MODE: OWM_MODE_V25}
|
new_data = {**data, **options, CONF_MODE: OWM_MODE_V25}
|
||||||
config_entries.async_update_entry(
|
config_entries.async_update_entry(
|
||||||
entry, data=new_data, version=CONFIG_FLOW_VERSION
|
entry, data=new_data, options={}, version=CONFIG_FLOW_VERSION
|
||||||
)
|
)
|
||||||
|
|
||||||
_LOGGER.info("Migration to version %s successful", CONFIG_FLOW_VERSION)
|
_LOGGER.info("Migration to version %s successful", CONFIG_FLOW_VERSION)
|
||||||
|
@ -25,7 +25,7 @@ DEFAULT_NAME = "OpenWeatherMap"
|
|||||||
DEFAULT_LANGUAGE = "en"
|
DEFAULT_LANGUAGE = "en"
|
||||||
ATTRIBUTION = "Data provided by OpenWeatherMap"
|
ATTRIBUTION = "Data provided by OpenWeatherMap"
|
||||||
MANUFACTURER = "OpenWeather"
|
MANUFACTURER = "OpenWeather"
|
||||||
CONFIG_FLOW_VERSION = 3
|
CONFIG_FLOW_VERSION = 4
|
||||||
ATTR_API_PRECIPITATION = "precipitation"
|
ATTR_API_PRECIPITATION = "precipitation"
|
||||||
ATTR_API_PRECIPITATION_KIND = "precipitation_kind"
|
ATTR_API_PRECIPITATION_KIND = "precipitation_kind"
|
||||||
ATTR_API_DATETIME = "datetime"
|
ATTR_API_DATETIME = "datetime"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user