From ea8ca3fe7e6eea6141b8678d8b102235959455c0 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sun, 20 Sep 2026 17:29:30 +0200 Subject: [PATCH] Fix remote calendar downloading and parsing its feed twice at setup (#182630) --- homeassistant/components/remote_calendar/calendar.py | 2 +- tests/components/remote_calendar/test_init.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/remote_calendar/calendar.py b/homeassistant/components/remote_calendar/calendar.py index 30cdd57e303b..a5bfbab09546 100644 --- a/homeassistant/components/remote_calendar/calendar.py +++ b/homeassistant/components/remote_calendar/calendar.py @@ -39,7 +39,7 @@ async def async_setup_entry( """Set up the remote calendar platform.""" coordinator = entry.runtime_data entity = RemoteCalendarEntity(coordinator, entry) - async_add_entities([entity], True) + async_add_entities([entity]) class RemoteCalendarEntity( diff --git a/tests/components/remote_calendar/test_init.py b/tests/components/remote_calendar/test_init.py index e1a14f9eca2f..0acfe5d15997 100644 --- a/tests/components/remote_calendar/test_init.py +++ b/tests/components/remote_calendar/test_init.py @@ -26,7 +26,7 @@ async def test_load_unload( hass: HomeAssistant, config_entry: MockConfigEntry, ics_content: str ) -> None: """Test loading and unloading a config entry.""" - respx.get(CALENDER_URL).mock( + route = respx.get(CALENDER_URL).mock( return_value=Response( status_code=200, text=ics_content, @@ -34,6 +34,8 @@ async def test_load_unload( ) await setup_integration(hass, config_entry) assert config_entry.state is ConfigEntryState.LOADED + # the calendar is downloaded and parsed once for the whole setup + assert route.call_count == 1 state = hass.states.get(TEST_ENTITY) assert state