Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to not use deprecated method async_forward_entry_setup #335

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions custom_components/lennoxs30/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,7 @@ async def s30_initialize(self):
await self.create_devices()
# Only add entities the first time, on reconnect we do not need to add them again
if self._climate_entities_initialized is False:
for platform in PLATFORMS:
self._hass.async_create_task(
self._hass.config_entries.async_forward_entry_setup(self._config, platform)
)
await self._hass.config_entries.async_forward_entry_setups(self._config, PLATFORMS)
self._climate_entities_initialized = True
self.updateState(DS_CONNECTED)

Expand Down
6 changes: 3 additions & 3 deletions tests/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ async def test_manager_s30_initialize(hass: HomeAssistant, manager_us_customary_
with patch.object(manager, "configuration_initialization") as configuration_initialization:
with patch("asyncio.create_task") as create_task:
create_task.return_value = "AWAITABLE_TASK"
with patch.object(manager, "create_devices") as create_devices:
with patch.object(hass, "async_create_task") as hass_create_task:
with patch.object(hass.config_entries, "async_forward_entry_setups") as forward_entry_setups:
with patch.object(manager, "create_devices") as create_devices:
await manager.s30_initialize()

assert update_state.call_count == 2
Expand All @@ -341,7 +341,7 @@ async def test_manager_s30_initialize(hass: HomeAssistant, manager_us_customary_
assert create_devices.call_count == 1
assert len(create_devices.mock_calls[0].args) == 0

assert hass_create_task.call_count == len(PLATFORMS)
assert forward_entry_setups.call_count == 1


@pytest.mark.asyncio
Expand Down
Loading