garage.py sensor status
This commit is contained in:
+7
-2
@@ -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 = 6
|
PIN_DOOR_OPEN = 13
|
||||||
PIN_DOOR_CLOSED = 13
|
PIN_DOOR_CLOSED = 6
|
||||||
PIN_SENSOR_GATE= 19
|
PIN_SENSOR_GATE= 19
|
||||||
|
|
||||||
|
|
||||||
@@ -119,6 +119,11 @@ class GarageService(object):
|
|||||||
Thread(target=gate_button,args=[0]).start()
|
Thread(target=gate_button,args=[0]).start()
|
||||||
return "trigger all"
|
return "trigger all"
|
||||||
|
|
||||||
|
@cherrypy.expose
|
||||||
|
def status(self):
|
||||||
|
return "{ open: " + str(GPIO.input(PIN_DOOR_OPEN)) + ", closed: " + str(GPIO.input(PIN_DOOR_CLOSED)) + ", gate: " + str(GPIO.input(PIN_SENSOR_GATE)) + " }"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cherrypy.quickstart(GarageService())
|
cherrypy.quickstart(GarageService())
|
||||||
|
|||||||
Reference in New Issue
Block a user