From 74a83194d7ded78095122c5fff5cb5dfea780a44 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 29 Jul 2026 12:35:05 -0400 Subject: [PATCH] Update pushbutton.py remove connection down --- pushbutton.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pushbutton.py b/pushbutton.py index 94c82bb2..ce1635a9 100644 --- a/pushbutton.py +++ b/pushbutton.py @@ -25,10 +25,10 @@ def change_mode(): sleep(0.75) if GPIO.input(push_button): ### os.system("sudo nmcli connection down preconfigured") - result = subprocess.run(['nmcli', 'connection', 'down', 'preconfigured'], capture_output=True, text=True) - print(result, flush=True) - result = subprocess.run(['nmcli', 'connection', 'down', 'Hotspot-Manual'], capture_output=True, text=True) - print(result, flush=True) +# result = subprocess.run(['nmcli', 'connection', 'down', 'preconfigured'], capture_output=True, text=True) +# print(result, flush=True) +# result = subprocess.run(['nmcli', 'connection', 'down', 'Hotspot-Manual'], capture_output=True, text=True) +# print(result, flush=True) ### os.system("sudo nmcli connection down Hotspot-Manual") print("sudo reboot -h now") os.system("echo 'reboot due to push button!' | wall") @@ -95,10 +95,10 @@ def change_mode(): if GPIO.input(push_button): print("sudo nmcli connection up preconfigured") ### os.system("sudo nmcli connection down preconfigured") - result = subprocess.run(['nmcli', 'connection', 'down', 'preconfigured'], capture_output=True, text=True) - print(result, flush=True) - result = subprocess.run(['nmcli', 'connection', 'down', 'Hotspot-Manual'], capture_output=True, text=True) - print(result, flush=True) +# result = subprocess.run(['nmcli', 'connection', 'down', 'preconfigured'], capture_output=True, text=True) +# print(result, flush=True) +# result = subprocess.run(['nmcli', 'connection', 'down', 'Hotspot-Manual'], capture_output=True, text=True) +# print(result, flush=True) ### os.system("sudo nmcli connection down Hotspot-Manual") print("sudo shutdown -h now") os.system("echo 'shutdown due to push button!' | wall") @@ -166,8 +166,8 @@ if not GPIO.input(push_button): # if pushbutton is held down during boot # os.system("sudo nmcli connection up uuid d437746a-411f-4f02-95ea-7b2f7665d59a") # Hotspot-Manual") result = subprocess.run(['nmcli', 'connection', 'modify', 'Hotspot-Manual', 'connection.interface-name', 'wlan0'], capture_output=True, text=True) print(result, flush=True) #.stdout) - result = subprocess.run(['nmcli', 'connection', 'down', 'preconfigured'], capture_output=True, text=True) - print(result, flush=True) #.stdout) +# result = subprocess.run(['nmcli', 'connection', 'down', 'preconfigured'], capture_output=True, text=True) +# print(result, flush=True) #.stdout) # os.system("sudo nmcli connection up Hotspot-Manual") result = subprocess.run(['nmcli', 'connection', 'up', 'Hotspot-Manual'], capture_output=True, text=True) print(result, flush=True) #.stdout) @@ -175,8 +175,8 @@ if not GPIO.input(push_button): # if pushbutton is held down during boot else: result = subprocess.run(['nmcli', 'connection', 'modify', 'preconfigured', 'connection.interface-name', 'wlan0'], capture_output=True, text=True) print(result, flush=True) #.stdout) - result = subprocess.run(['nmcli', 'connection', 'down', 'Hotspot-Manual'], capture_output=True, text=True) - print(result, flush=True) # .stdout) +# result = subprocess.run(['nmcli', 'connection', 'down', 'Hotspot-Manual'], capture_output=True, text=True) +# print(result, flush=True) # .stdout) result = subprocess.run(['nmcli', 'connection', 'up', 'preconfigured'], capture_output=True, text=True) print(result, flush=True) # .stdout) # os.system("sudo nmcli connection up preconfigured")