Skip to content
This repository has been archived by the owner on Oct 5, 2024. It is now read-only.

Commit

Permalink
Fix firmware download (ignore pdmonhost)
Browse files Browse the repository at this point in the history
  • Loading branch information
doudz committed Nov 28, 2020
1 parent f862715 commit 1ceddfd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion zigate/firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -39,12 +48,13 @@ 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)
return download(releases[latest], dest)


if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
logging.basicConfig(level=logging.DEBUG)
download_latest()
2 changes: 1 addition & 1 deletion zigate/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
#


__version__ = '0.40.10'
__version__ = '0.40.11'

0 comments on commit 1ceddfd

Please sign in to comment.