From 1ceddfd756a1f55e788cb55a090b92fbe0015ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20RAMAGE?= Date: Sat, 28 Nov 2020 19:47:18 +0100 Subject: [PATCH] Fix firmware download (ignore pdmonhost) --- zigate/firmware.py | 12 +++++++++++- zigate/version.py | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/zigate/firmware.py b/zigate/firmware.py index 5407bc17..c0c27df2 100644 --- a/zigate/firmware.py +++ b/zigate/firmware.py @@ -18,7 +18,16 @@ def get_releases(): r = requests.get(URL) if r.status_code == 200: for release in r.json(): + if release.get('draft'): + LOGGER.debug('ignoring draft %s', release['name']) + continue + if release.get('prerelease'): + LOGGER.debug('ignoring prerelease %s', release['name']) + continue for asset in release['assets']: + if 'pdmhost' in asset['name'].lower(): + LOGGER.debug('ignoring pdm on host firmware %s', release['name']) + continue if asset['name'].endswith('.bin'): LOGGER.info('Found %s', asset['name']) releases[asset['name']] = asset['browser_download_url'] @@ -39,6 +48,7 @@ def download(url, dest='/tmp'): def download_latest(dest='/tmp'): LOGGER.info('Download latest firmware') releases = get_releases() + LOGGER.debug('Available firmwares %s', releases) if releases: latest = list(releases.keys())[0] LOGGER.info('Latest is %s', latest) @@ -46,5 +56,5 @@ def download_latest(dest='/tmp'): if __name__ == '__main__': - logging.basicConfig(level=logging.INFO) + logging.basicConfig(level=logging.DEBUG) download_latest() diff --git a/zigate/version.py b/zigate/version.py index ab448868..d2e98b61 100644 --- a/zigate/version.py +++ b/zigate/version.py @@ -6,4 +6,4 @@ # -__version__ = '0.40.10' +__version__ = '0.40.11'