From f72e751e42b6de631f666e2fefa26201eebdf3e5 Mon Sep 17 00:00:00 2001 From: Paul Rathgeb Date: Sat, 17 Oct 2015 21:33:54 +0200 Subject: [PATCH] Fix #172 : Auto to AP when STA is not reachable --- config.weio | 3 ++- weioWifi/weioWifi.py | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config.weio b/config.weio index 7407a763..47309c27 100755 --- a/config.weio +++ b/config.weio @@ -1,5 +1,6 @@ { "absolut_root_path": "", + "auto_to_ap": "YES", "debug_mode": "False", "dependencies_path": "www", "dns_name": "weio.local", @@ -31,4 +32,4 @@ "weio_update_official_repository": "https://api.github.com/repos/nodesign/weio/releases", "weio_update_use_official_repository": "YES", "weio_version": "1.1" -} \ No newline at end of file +} diff --git a/weioWifi/weioWifi.py b/weioWifi/weioWifi.py index d3bd1593..370eefcd 100644 --- a/weioWifi/weioWifi.py +++ b/weioWifi/weioWifi.py @@ -58,6 +58,7 @@ from weioLib import weioSubprocess from weioLib import weioIpAddress +from weioLib import weioConfig logging.basicConfig() @@ -112,7 +113,10 @@ def checkConnection(self) : else: self.disconnectedCounter = 0 - if ( self.disconnectedCounter >= 2 or (self.mode == "sta" and weioIpAddress.getLocalIpAddress() == '') ): + config = weioConfig.getConfiguration() + + if ((self.disconnectedCounter >= 2 or (self.mode == "sta" and weioIpAddress.getLocalIpAddress() == '')) + and config['auto_to_ap'] == "YES"): # Move to Master mode print "Trying to move to AP RESCUE mode..." subprocess.call("scripts/wifi_set_mode.sh rescue", shell=True)