Im working on doing some remote GPIO control (de)energizing relays. When I turn a relay on, it instantly turns off. That makes me assume that the output doesn't latch. I tried several of the classes used to control digital IO remotely but all of them behave the same.

from gpiozero import OutputDevice
from gpiozero.pins.pigpio import PiGPIOFactory

factory = PiGPIOFactory(host='d1p-woctorelay.local')

#RD1P Relays
las_test = OutputDevice(15, pin_factory=factory)
# las = LED(5, pin_factory=factory)
# rex = LED(6, pin_factory=factory)
# ras = LED(13, pin_factory=factory)

# las.on()
# rex.off()

Is there something I'm missing in the docs or some basic trick to latching remotely? I came across this SO post but it doesn't seem to work the same for remote control.

1 Answer 1


Im not sure about the why but as I built the script it started working as expected.

import argparse
from gpiozero import OutputDevice
from gpiozero.pins.pigpio import PiGPIOFactory

import argparse

parser = argparse.ArgumentParser(description='Start, stop, or start aux equipment')
parser.add_argument('func', type=str, required=False, help='Function to perform [startup, shutdown, auxstart]')

args = parser.parse_args()

factory = PiGPIOFactory(host='d1p-woctorelay.local')

#RD1P Relays
las = OutputDevice(15, pin_factory=factory)
rex = OutputDevice(6, pin_factory=factory)
ras = OutputDevice(13, pin_factory=factory)

def startup():
    print('Starting up the machine.')

def shutdown():
    print('Shutting down all equipment.')

def auxstart():
    print('Starting up the auxilliary equipment.')

if __name__ == "__main__":
    func = args.func
    if func == 'startup': startup()
    elif func == 'auxstart': auxstart()
    else: shutdown()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.