saunacontrol/heat/_Heat.py

23 lines
495 B
Python
Raw Permalink Normal View History

2021-04-19 05:57:29 +00:00
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