open/close für Einfahrt

This commit is contained in:
2020-12-26 10:36:33 +01:00
parent 49daee7be5
commit 12ef30fe2b
+4 -5
View File
@@ -18,8 +18,8 @@ PIN_GATE_BUTTON = 24
PIN_GARAGE = 21
PIN_GATE = 26
PIN_LED = 11
PIN_DOOR_OPEN = 13
PIN_DOOR_CLOSED = 6
PIN_DOOR_OPEN = 6
PIN_DOOR_CLOSED = 13
PIN_SENSOR_GATE= 19
@@ -100,13 +100,12 @@ class GarageService(object):
@cherrypy.expose
def gate(self, action=None):
if action == "open":
if (action == "open" and not GPIO.input(PIN_SENSOR_GATE)):
Thread(target=gate_button,args=[0]).start()
return "{ action: open }"
elif action == "close":
elif (action == "close" and GPIO.input(PIN_SENSOR_GATE)):
Thread(target=gate_button,args=[0]).start()
return "{ action: close }"
if GPIO.input(PIN_SENSOR_GATE) == 0:
status = "false"
else: