sensor conditional open/close
This commit is contained in:
+2
-2
@@ -86,10 +86,10 @@ class GarageService(object):
|
|||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def garage(self, action=None):
|
def garage(self, action=None):
|
||||||
if action == "open":
|
if (action == "open" and GPIO.input(PIN_DOOR_CLOSED) and not GPIO.input(PIN_DOOR_OPEN)):
|
||||||
Thread(target=garage_button,args=[0]).start()
|
Thread(target=garage_button,args=[0]).start()
|
||||||
return "{ action: open }"
|
return "{ action: open }"
|
||||||
elif action == "close":
|
elif (action == "close" and GPIO.input(PIN_DOOR_OPEN) and not GPIO.input(PIN_DOOR_CLOSED)):
|
||||||
Thread(target=garage_button,args=[0]).start()
|
Thread(target=garage_button,args=[0]).start()
|
||||||
return "{ action: close }"
|
return "{ action: close }"
|
||||||
if (GPIO.input(PIN_DOOR_OPEN) and not GPIO.input(PIN_DOOR_CLOSED)):
|
if (GPIO.input(PIN_DOOR_OPEN) and not GPIO.input(PIN_DOOR_CLOSED)):
|
||||||
|
|||||||
Reference in New Issue
Block a user