Code from this video: https://www.youtube.com/watch?v=ZszlVVY1LXo
BathroomStatus.py is run by the Raspberry Pi for door detection and to log data into a Sqlite database. You'll also need to run and setup Dropbox-Uploader (https://github.com/andreafabrizi/Dropbox-Uploader)
The other files are a sample database and code to upload to plot.ly for graphing. They have a bunch of Python tutorials to get you started https://plot.ly/python/
I'm not a good coder...feel free to send suggestions to diytryin@revision3.com