<filename>app/controllers/relaycontroller.py<gh_stars>0
from gpiozero import OutputDevice
from gpiozero.pins.pigpio import PiGPIOFactory
import time

class relaycontroller():
    relay=None
    def __init__(self, pin, remotehost=None):
        if remotehost==None:
            self.relay=OutputDevice(pin, active_high=False, initial_value=False)
        else:
            factory=PiGPIOFactory(host=remotehost)
            self.relay=OutputDevice(pin, active_high=False, initial_value=False, pin_factory=factory)

    def dothething(self):
        self.relay.on()
        time.sleep(0.5)
        self.relay.off()

<filename>app/controllers/relaycontroller.py<gh_stars>0
from gpiozero import OutputDevice
from gpiozero.pins.pigpio import PiGPIOFactory
import time

class relaycontroller():
    relay=None
    def __init__(self, pin, remotehost=None):
        if remotehost==None:
            self.relay=OutputDevice(pin, active_high=False, initial_value=False)
        else:
            factory=PiGPIOFactory(host=remotehost)
            self.relay=OutputDevice(pin, active_high=False, initial_value=False, pin_factory=factory)

    def dothething(self):
        self.relay.on()
        time.sleep(0.5)
        self.relay.off()
