Skip to content

Commit

Permalink
Change unload for P1 Monitor (home-assistant#62213)
Browse files Browse the repository at this point in the history
  • Loading branch information
klaasnicolaas authored Dec 19, 2021
1 parent d52caf7 commit 779ce62
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions homeassistant/components/p1_monitor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
1 change: 1 addition & 0 deletions tests/components/p1_monitor/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 779ce62

Please sign in to comment.