def __init__(self, relayPin=None, sensorPin=None): if relayPin: Logger.logit("Setting up a relay") self.relay = Relay(relayPin) if sensorPin: Logger.logit("Setting up a sensor") self.sensor = Sensor(sensorPin)
def turn_off(self): Logger.logit("Turning " + self.name + " off") GPIO.output(self.pin, GPIO.HIGH) self.state = 0
def turn_on(self): Logger.logit("Turning " + self.name + " on") GPIO.output(self.pin, GPIO.LOW) self.state = 1