From b38a7aabe9bcab2cf59420d28bc5819ed9220155 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 15 May 2023 21:20:20 +0200 Subject: [PATCH] Fix lingering timer in withings (#93085) --- homeassistant/components/withings/__init__.py | 2 +- tests/components/withings/test_init.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/withings/__init__.py b/homeassistant/components/withings/__init__.py index 94aaa9aa5a6..682efde8881 100644 --- a/homeassistant/components/withings/__init__.py +++ b/homeassistant/components/withings/__init__.py @@ -151,7 +151,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: ) # Start subscription check in the background, outside this component's setup. - async_call_later(hass, 1, async_call_later_callback) + entry.async_on_unload(async_call_later(hass, 1, async_call_later_callback)) await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) diff --git a/tests/components/withings/test_init.py b/tests/components/withings/test_init.py index 66d2f0eb29d..9ccc53d0b88 100644 --- a/tests/components/withings/test_init.py +++ b/tests/components/withings/test_init.py @@ -165,7 +165,11 @@ async def test_set_config_unique_id( config_entry = MockConfigEntry( domain=DOMAIN, - data={"token": {"userid": "my_user_id"}, "profile": person0.profile}, + data={ + "token": {"userid": "my_user_id"}, + "auth_implementation": "withings", + "profile": person0.profile, + }, ) with patch("homeassistant.components.withings.async_get_data_manager") as mock: