open/close für Einfahrt
This commit is contained in:
+4
-5
@@ -18,8 +18,8 @@ PIN_GATE_BUTTON = 24
|
|||||||
PIN_GARAGE = 21
|
PIN_GARAGE = 21
|
||||||
PIN_GATE = 26
|
PIN_GATE = 26
|
||||||
PIN_LED = 11
|
PIN_LED = 11
|
||||||
PIN_DOOR_OPEN = 13
|
PIN_DOOR_OPEN = 6
|
||||||
PIN_DOOR_CLOSED = 6
|
PIN_DOOR_CLOSED = 13
|
||||||
PIN_SENSOR_GATE= 19
|
PIN_SENSOR_GATE= 19
|
||||||
|
|
||||||
|
|
||||||
@@ -100,13 +100,12 @@ class GarageService(object):
|
|||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def gate(self, action=None):
|
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()
|
Thread(target=gate_button,args=[0]).start()
|
||||||
return "{ action: open }"
|
return "{ action: open }"
|
||||||
elif action == "close":
|
elif (action == "close" and GPIO.input(PIN_SENSOR_GATE)):
|
||||||
Thread(target=gate_button,args=[0]).start()
|
Thread(target=gate_button,args=[0]).start()
|
||||||
return "{ action: close }"
|
return "{ action: close }"
|
||||||
|
|
||||||
if GPIO.input(PIN_SENSOR_GATE) == 0:
|
if GPIO.input(PIN_SENSOR_GATE) == 0:
|
||||||
status = "false"
|
status = "false"
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user