diff --git a/start_hotpots.sh b/start_hotpots.sh index 33a3090..8296765 100644 --- a/start_hotpots.sh +++ b/start_hotpots.sh @@ -1,4 +1,3 @@ -sudo python3 wifi_manager.py -cd .. -cd TakwayPlatform -sudo python3 ws_client.py \ No newline at end of file +python3 wifi_manager.py +cd ~/TakwayPlatform/ +python3 ws_client.py \ No newline at end of file diff --git a/wifi_manager.py b/wifi_manager.py index bbeaa0d..c140ee5 100644 --- a/wifi_manager.py +++ b/wifi_manager.py @@ -205,7 +205,8 @@ def load_saved_wifi(): def save_wifi(ssid, password): wifi_list = load_saved_wifi() - wifi_list.append({'ssid': ssid, 'password': password}) + if ssid not in [item['ssid'] for item in wifi_list]: + wifi_list.append({'ssid': ssid, 'password': password}) with open('wifi_list.json', 'w') as f: json.dump(wifi_list, f)