import RPi.GPIO as GPIO class Heat(): def __init__(self, pin): self.__pin = pin self.__state = False GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(pin, GPIO.OUT) if GPIO.input(pin): self.__state = True def on(self): self.__state = True GPIO.output(self.__pin, 1) def off(self): self.__state = False GPIO.output(self.__pin, 0) def state(self): return self.__state