https://github.com/subvisual/wc.subvisual.co
WC Ocupancy Detector™, aka the one thing we all needed in our office. Patent pending
https://github.com/subvisual/wc.subvisual.co
Last synced: 10 months ago
JSON representation
WC Ocupancy Detector™, aka the one thing we all needed in our office. Patent pending
- Host: GitHub
- URL: https://github.com/subvisual/wc.subvisual.co
- Owner: subvisual
- Created: 2014-09-26T19:03:34.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-10-19T15:36:01.000Z (over 10 years ago)
- Last Synced: 2025-03-27T21:11:13.356Z (11 months ago)
- Language: Python
- Homepage: http://wc.groupbuddies.com
- Size: 315 KB
- Stars: 9
- Watchers: 8
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WC Occupancy Detector

## Requirements
* [Raspberry PI](http://www.raspberrypi.org/)
* [AirPi](http://airpi.es/)
## Server Installation
As this is a hackaton project, there's no magic command that makes it all work.
Some manual work is required
1. Deploy this repo to a server of your choice. We used [heroku](http://heroku.com).
2. The database must be created manually, and must be PostgreSQL. Heroku has a [Postgres plugin](https://addons.heroku.com/heroku-postgresql) that helps with that.
Since we only need a single row per bathroom in our database, the free heroku
plan is enough (unless we eventually move into a really huge building).
To manually create the database, the following SQL should be enough:
```sql
CREATE table bathrooms (
name text,
status boolean DEFAULT false,
updated_at timestamp DEFAULT NULL,
PRIMARY KEY(name)
);
```
Now create a record for each of the bathrooms you want to manage, giving them
a unique name:
```
INSERT INTO bathrooms VALUES("bathroom-name");
```
Now your server is ready, with a public (insecure) API.
You can set the status of each of your bathrooms by sending PUT requests to the
appropriate URL
```
# set bathroom as busy
http://wc.groupbuddies.com/bathroom-name/true
# set bathroom as free
http://wc.groupbuddies.com/bathroom-name/false
```
# Sensor installation
1. Set up your Raspberry Pi + AirPi (we recommend Raspbian)
2. Download the repo to `/var/www/wc`
```
git clone http://github.com/groupbuddies/wc.groupbuddies.com /var/www/wc
```
3. Edit the `sensor/settings.cfg` file, particularly the `url` field, with the url
of the individual bathroom you're handling
4. An `init.d` script is included (no `systemd` yet, sorry), so assuming your distribution support is, just run:
```
ln -s /var/www/wc/sensor/init.sh /etc/init.d/wc
```
# TODO
* ~~Realtime updates~~
([done](https://github.com/groupbuddies/wc.groupbuddies.com/pull/1))
* ~~Fix server crashes~~
([done](https://github.com/groupbuddies/wc.groupbuddies.com/pull/3))
* More support for multiple bathrooms
* Security. Add a secret token to each bathroom
# Credits
* [Miguel Palhas](https://github.com/naps62) (Developer)
* [Pedro Costa](https://github.com/pfac) (Developer)
* [The AirPi project](https://github.com/tomhartley/AirPi) (source code base)