Skip to content

Commit

Permalink
Apply formatting tools (black) with pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeweerd committed Jul 30, 2024
1 parent a9b37ca commit b8903f9
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions custom_components/zha_toolkit/ota.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ async def download_sonoff_ota(listener, ota_dir):

async def download_zigpy_ota(app, listener):
LOGGER.debug("Zigpy download procedure starting")
if hasattr(app, 'ota') and hasattr(app.ota, '_listeners'):
if hasattr(app, "ota") and hasattr(app.ota, "_listeners"):
for _, (ota, _) in app.ota._listeners.items():
if isinstance(ota, zigpy.ota.provider.FileStore):
# Skip files provider
Expand All @@ -169,23 +169,29 @@ async def download_zigpy_ota(app, listener):
LOGGER.error("Try getting %r, %r, %r", image_key, url, image)
try:
img = await app.ota.get_ota_image(
image_key.manufacturer_id, image_key.image_type, model=None
image_key.manufacturer_id,
image_key.image_type,
model=None,
)
LOGGER.info("Got image %r", getattr(img, "header", None))
except Exception as e:
LOGGER.error("%r while getting %r - %s", e, image_key, url)
else:
LOGGER.warning("Could not get ota object for download_zigpy_ota, try again")
LOGGER.warning(
"Could not get ota object for download_zigpy_ota, try again"
)


async def ota_update_images(
app, listener, ieee, cmd, data, service, params, event_data
):
if hasattr(app, 'ota') and hasattr(app.ota, '_listeners'):
if hasattr(app, "ota") and hasattr(app.ota, "_listeners"):
for _, (ota, _) in app.ota._listeners.items():
await ota.refresh_firmware_list()
else:
LOGGER.warning("Could not get ota object for ota_update_images, try again")
LOGGER.warning(
"Could not get ota object for ota_update_images, try again"
)


async def ota_notify(
Expand Down

0 comments on commit b8903f9

Please sign in to comment.