Skip to content

Commit

Permalink
Update to not use deprecated method
Browse files Browse the repository at this point in the history
  • Loading branch information
PeteRager committed Aug 2, 2024
1 parent d76e0c0 commit 08ba029
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
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

0 comments on commit 08ba029

Please sign in to comment.