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)