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

Commit

Permalink
Release 0.40.11
Browse files Browse the repository at this point in the history
  • Loading branch information
doudz committed Nov 28, 2020
2 parents b8be2ff + 1ceddfd commit 5b7d263
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
13 changes: 13 additions & 0 deletions zigate/adminpanel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,23 @@ def device(addr):
return redirect('index')
return {'device': device}

@app.route('/raw_command', name='raw_command', method=['POST'])
def raw_command():
cmd = bottle.request.forms.get('cmd')
data = bottle.request.forms.get('data')
cmd = int(cmd, 16)
zigate_instance.send_data(cmd, data)
return redirect('index')

@app.route('/api/permit_join', name='api_permit_join')
def permit_join():
zigate_instance.permit_join()
return redirect('index')

@app.route('/api/reset', name='api_reset')
def reset():
zigate_instance.reset()
return redirect('index')

@app.route('/api/led', name='api_led')
def set_led():
Expand Down
7 changes: 7 additions & 0 deletions zigate/adminpanel/views/index.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,15 @@
<div style="display: inline-block; vertical-align: top;">
<h3>Actions</h3>
<a class="pure-button" href="{{get_url('api_permit_join')}}">Permit Join</a>
<a class="pure-button" href="{{get_url('api_reset')}}">Reset</a>
<a class="pure-button" href="{{get_url('api_led', on='true')}}">Led ON</a>
<a class="pure-button" href="{{get_url('api_led', on='false')}}">Led OFF</a>
<form method="post" action="{{get_url('raw_command')}}">
Raw command :
<label for="cmd">Cmd : </label><input type="text" name="cmd" placeholder="0x0000">
<label for="data">Data : </label><input type="text" name="data" placeholder="optionnal binary payload">
<input type="submit" name="Send">
</form>
</div>

<br>
Expand Down
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 5b7d263

Please sign in to comment.