garage.py sensor status

This commit is contained in:
2020-12-10 18:11:43 +01:00
parent 0d227add2e
commit f95d9d55d5
+7 -2
View File
@@ -18,8 +18,8 @@ PIN_GATE_BUTTON = 24
PIN_GARAGE = 21
PIN_GATE = 26
PIN_LED = 11
PIN_DOOR_OPEN = 6
PIN_DOOR_CLOSED = 13
PIN_DOOR_OPEN = 13
PIN_DOOR_CLOSED = 6
PIN_SENSOR_GATE= 19
@@ -119,6 +119,11 @@ class GarageService(object):
Thread(target=gate_button,args=[0]).start()
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())