From 21003d130140d3d9731def762628d67ecaa55fed Mon Sep 17 00:00:00 2001 From: Alex Terrell Date: Wed, 18 Dec 2024 07:46:03 -0700 Subject: [PATCH] Update gpio_any_wan_connected.py added state tracking and logging --- gpio_any_wan_connected/gpio_any_wan_connected.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gpio_any_wan_connected/gpio_any_wan_connected.py b/gpio_any_wan_connected/gpio_any_wan_connected.py index 183fd1e6..b229d0bb 100644 --- a/gpio_any_wan_connected/gpio_any_wan_connected.py +++ b/gpio_any_wan_connected/gpio_any_wan_connected.py @@ -3,7 +3,11 @@ import time cp = EventingCSClient('gpio_any_wan_connected') cp.log('Starting...') +previous_state = None while True: state = int(cp.get('status/wan/connection_state') == 'connected') - cp.put('control/gpio/CONNECTOR_GPIO_1', state) + if state != previous_state: + cp.put('control/gpio/ACCESSORY_GPIO_1', state) + cp.log(f'Set control/gpio/ACCESSORY_GPIO_1 to {state}') + previous_state = state time.sleep(1)