Skip to content

Commit bfc814c

Browse files
authored
Use entry.async_on_unload in meteo_france (home-assistant#148015)
1 parent 5008151 commit bfc814c

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

homeassistant/components/meteo_france/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
COORDINATOR_RAIN,
2424
DOMAIN,
2525
PLATFORMS,
26-
UNDO_UPDATE_LISTENER,
2726
)
2827

2928
_LOGGER = logging.getLogger(__name__)
@@ -130,10 +129,9 @@ async def _async_update_data_alert() -> CurrentPhenomenons:
130129
entry.title,
131130
)
132131

133-
undo_listener = entry.add_update_listener(_async_update_listener)
132+
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
134133

135134
hass.data[DOMAIN][entry.entry_id] = {
136-
UNDO_UPDATE_LISTENER: undo_listener,
137135
COORDINATOR_FORECAST: coordinator_forecast,
138136
}
139137
if coordinator_rain and coordinator_rain.last_update_success:
@@ -163,7 +161,6 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
163161

164162
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
165163
if unload_ok:
166-
hass.data[DOMAIN][entry.entry_id][UNDO_UPDATE_LISTENER]()
167164
hass.data[DOMAIN].pop(entry.entry_id)
168165
if not hass.data[DOMAIN]:
169166
hass.data.pop(DOMAIN)

homeassistant/components/meteo_france/const.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
COORDINATOR_FORECAST = "coordinator_forecast"
2727
COORDINATOR_RAIN = "coordinator_rain"
2828
COORDINATOR_ALERT = "coordinator_alert"
29-
UNDO_UPDATE_LISTENER = "undo_update_listener"
3029
ATTRIBUTION = "Data provided by Météo-France"
3130
MODEL = "Météo-France mobile API"
3231
MANUFACTURER = "Météo-France"

0 commit comments

Comments
 (0)