OpenSprinkler Forums Comments, Suggestions, Requests Garage door monitoring and control Re: Re: Garage door monitoring and control



another update… Garage status code

This is all air code since I don’t have the OSpi yet, but I had a few minutes to kill this morning – so here goes. Since RPi.GPIO is being used by the interval program anyway, I should be able to connect a reed sensor directly to the RPi’s GPIO pins. If so, could I use the recently added functionality to get the status of the reed switch? Here’s an example (python is pretty far from my native programming language!):

import ospi

#### Add any new page urls here ####
'/gds', 'get_door_status',

class get_door_status:
"""Return a page containing the status of garage door sensor"""
def GET(self):
custpg = 'n'
door1_pin = 23
if GPIO.input(door1_pin):
custpg += 'TRUE'
custpg += 'FALSE'

return custpg

I just want to be able to use an HTTP command to find out if the door is open or closed. This would need to be expanded to handle multiple door sensors.