Skip to content

Commit

Permalink
Fix pairings being loaded before transports (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
soumya92 authored Nov 12, 2024
1 parent b9b55b6 commit 93a534a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions aiohomekit/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ async def get_controller(args: argparse.Namespace) -> AsyncIterator[Controller]:
char_cache=CharacteristicCacheFile(charmap_path),
)

try:
controller.load_data(args.file)
except Exception:
logger.exception(f"Error while loading {args.file}")
raise SystemExit

async with zeroconf:
listener = ZeroconfServiceListener()
browser = AsyncServiceBrowser(
Expand All @@ -70,6 +64,11 @@ async def get_controller(args: argparse.Namespace) -> AsyncIterator[Controller]:
)

async with controller:
try:
controller.load_data(args.file)
except Exception:
logger.exception(f"Error while loading {args.file}")
raise SystemExit
yield controller

await browser.async_cancel()
Expand Down

0 comments on commit 93a534a

Please sign in to comment.