From 779ce6216ca3877317a72197bd4aa3abea080460 Mon Sep 17 00:00:00 2001 From: Klaas Schoute Date: Sun, 19 Dec 2021 13:03:06 +0100 Subject: [PATCH] Change unload for P1 Monitor (#62213) --- homeassistant/components/p1_monitor/__init__.py | 3 +-- tests/components/p1_monitor/test_init.py | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/p1_monitor/__init__.py b/homeassistant/components/p1_monitor/__init__.py index d87c521332e..44a3c855c8c 100644 --- a/homeassistant/components/p1_monitor/__init__.py +++ b/homeassistant/components/p1_monitor/__init__.py @@ -45,8 +45,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload P1 Monitor config entry.""" unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) if unload_ok: - coordinator = hass.data[DOMAIN].pop(entry.entry_id) - await coordinator.p1monitor.close() + del hass.data[DOMAIN][entry.entry_id] return unload_ok diff --git a/tests/components/p1_monitor/test_init.py b/tests/components/p1_monitor/test_init.py index bddaff137e6..1cf9cf21966 100644 --- a/tests/components/p1_monitor/test_init.py +++ b/tests/components/p1_monitor/test_init.py @@ -24,6 +24,7 @@ async def test_load_unload_config_entry( await hass.async_block_till_done() assert not hass.data.get(DOMAIN) + assert mock_config_entry.state is ConfigEntryState.NOT_LOADED @patch(