Giter Club home page Giter Club logo

doorlock's Introduction

Chimera Doorlock

Overview

  • Cards are synced with Cobot
  • Cards are stored in cards.json in the root of the project (should be ~/doorlock/cards.json on the RaspberryPi)
  • Logs are stored in logs.json in the root of the project (should be ~/doorlock/logs.json on the RaspberryPi)

TODO

  • Update list of cards every few minutes from Cobot
  • Push up logs/checkins to management app
  • Get working with Nexedus
  • Protect card and log pages such that people can't just login to the wifi and copy-paste card ID numbers into the form
  • Handle card reading directly in hardware, no ability to manually type into the webform
  • Log error messages and other app issues remotely

Setting up Cobot

  • Register a new application at https://www.cobot.me/oauth2_clients
  • Set the Scope to checkin_tokens write write_check_ins read read_time_passes
  • Paste the Access Token (used for dev / non-interactive purposes) into the COBOT_ACCESS_TOKEN variable in .env (based on .env.example -- see below instructions)

Developing

  • Install dependencies with npm install
  • Run node src/server.js

Configuring Raspberry Pi

First, get a working RasPi. I suggest Raspbian (not NOOBS). Download and extract the ZIP. Then follow standard instructions to "burn" image to SD card. On Linux/Mac, that'd be something like: (TRIPLE CHECK THE IF AND OF HERE BEFORE COPY PASTING, ESPECIALLY OF=/dev/sdb BECAUSE ALL CONTENTS WILL BE INSTANTLY OVERWRITTEN DESTRUCTIVELY) sudo dd if=2018-11-13-raspbian-stretch-full.img of=/dev/sdb bs=1M

On the RPI:

# Change to "sudo" user
sudo su

# Install nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

# Install forever
npm i -g forever

# Clone the project and install dependencies
cd ~
git clone https://github.com/chimera/doorlock.git
cd doorlock
nvm install
nvm use
npm install

# Setup environment variables
cp .env.example .env
vi .env
# Add missing environment variables

# Start app
forever start src/server.js

Follow the install from source guide for node-hid becuase there is no pre-built binary for RaspberryPi

npm install -g node-gyp
apt install build-essential git libudev-dev gcc-4.8 g++-4.8 libusb-1.0-0 libusb-1.0-0-dev
export CXX=g++-4.8
npm install node-hid --build-from-source

You should now be able to view the app at http://localhost:3000

Autostart

On a RasPi, copy the contents of the autostart file into: ~/.config/lxsession/LXDE-pi/autostart (presuming you've downloaded this repo to /home/pi/doorlock. Note that autostart is the filename, not a folder. Messing this up will prevent you from logging in fully.)

Also, add the full cron.sh path to /etc/crontab to run every 5 minutes, i.e. */5 * * * * root /home/pi/doorlock/cron.sh

Optionally, to help users with debugging, run ln -s /home/pi/doorlock/start.sh ~/Desktop/start-doorlock.sh to give them a link on the desktop.

Or generally, find some way to run ./start.sh in this folder

Further reading

Contributing

Contributions welcome!

Want to contribute? Submit a Pull Request with your changes!

Using this in your own project? Let us know by creating an issue in Github!

Credits

Developed by Dana Woodman © 2018. Modified by Will Bradley 2019.

License

MIT

doorlock's People

Contributors

danawoodman avatar zyphlar avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

zyphlar

doorlock's Issues

Days remaining count is off

When this is your last day remaining (1 day remaining prior to check-in), the door says you have 2 days remaining.

When you have infinite (? unlimited plan ?) it perpetually says you have 5 days remaining.

On the last day of your billing-month, it often says you have 1 day remaining.

Even when you have no days remaining, the app still lets you in and does not notify anyone or enforce a limited grace period.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.