Skip to content

Commit

Permalink
Always maintain the reference to the controller application (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmulcahey authored Aug 2, 2024
1 parent 98ab2f5 commit 237d1a7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions zha/application/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,21 +233,19 @@ async def async_initialize(self) -> None:
self.shutting_down = False

app_controller_cls, app_config = self.get_application_controller_data()
app = await app_controller_cls.new(
self.application_controller = await app_controller_cls.new(
config=app_config,
auto_form=False,
start_radio=False,
)

try:
await app.startup(auto_form=True)
await self.application_controller.startup(auto_form=True)
except Exception:
# Explicitly shut down the controller application on failure
await app.shutdown()
await self.application_controller.shutdown()
raise

self.application_controller = app

self.coordinator_zha_device = self.get_or_create_device(
self._find_coordinator_device()
)
Expand Down

0 comments on commit 237d1a7

Please sign in to comment.