mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Cleanup old config entry migration from Météo-France (#58809)
This commit is contained in:
parent
4f83a251fa
commit
3c5799e394
@ -60,23 +60,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up an Meteo-France account from a config entry."""
|
||||
hass.data.setdefault(DOMAIN, {})
|
||||
|
||||
latitude = entry.data.get(CONF_LATITUDE)
|
||||
|
||||
client = MeteoFranceClient()
|
||||
# Migrate from previous config
|
||||
if not latitude:
|
||||
places = await hass.async_add_executor_job(
|
||||
client.search_places, entry.data[CONF_CITY]
|
||||
)
|
||||
hass.config_entries.async_update_entry(
|
||||
entry,
|
||||
title=f"{places[0]}",
|
||||
data={
|
||||
CONF_LATITUDE: places[0].latitude,
|
||||
CONF_LONGITUDE: places[0].longitude,
|
||||
},
|
||||
)
|
||||
|
||||
latitude = entry.data[CONF_LATITUDE]
|
||||
longitude = entry.data[CONF_LONGITUDE]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user