Cleanup old config entry migration from Météo-France (#58809)

This commit is contained in:
Quentame 2021-10-31 16:17:35 +01:00 committed by GitHub
parent 4f83a251fa
commit 3c5799e394
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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]