From f8627156508b713be6b63bec292870a01dd80e10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20RAMAGE?= Date: Sat, 28 Nov 2020 19:46:30 +0100 Subject: [PATCH 1/2] add raw command --- zigate/adminpanel/__init__.py | 13 +++++++++++++ zigate/adminpanel/views/index.tpl | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/zigate/adminpanel/__init__.py b/zigate/adminpanel/__init__.py index 5227beef..36adb24c 100644 --- a/zigate/adminpanel/__init__.py +++ b/zigate/adminpanel/__init__.py @@ -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(): diff --git a/zigate/adminpanel/views/index.tpl b/zigate/adminpanel/views/index.tpl index 7b2c0b99..e145fd1f 100644 --- a/zigate/adminpanel/views/index.tpl +++ b/zigate/adminpanel/views/index.tpl @@ -36,8 +36,15 @@

Actions

Permit Join + Reset Led ON Led OFF +
+ Raw command : + + + +

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 2/2] 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'