Skip to content

samuelkadolph/doors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

doors

Description

Hardware

Preperation

Hardware

This will be mostly up to you because it will vary widly depending on what door controller you use. What you need to do is connect the PhidgetSBC3 to the relays and the relays to the door controller in such a way that when closing the relay, the door will be unlocked. I recommend the Kantech KT-300 and Kantech EntraPass because that is what we use at Shopify and we've got it working. The KT-300 has auxiliary inputs that can be configured as secondary Request to exit (REX) for each door.

Software

  1. Plug your PhidgetSBC3 into power and network
  2. Go to phidgetsbc.local and set a password Go to phidgetsbc.local and set a password
  3. Enable the SSH server Enable the SSH server
  4. Enable the full Debian Package Repository Enable the full Debian Package Repository
  5. Add your ssh key to the phidgetsbc (optional)
ssh root@phidgetsbc.local "mkdir -p .ssh && echo '$(cat ~/.ssh/id_rsa.pub)' >> .ssh/authorized_keys"
  1. SSH in
ssh root@phidgetsbc.local
  1. Add my apt key
apt-key adv --keyserver keys.gnupg.net --recv-keys B4F808A2
  1. Add my apt repo
echo "deb http://apt.samuelkadolph.com/ wheezy main" > /etc/apt/sources.list.d/samuelkadolph.list
  1. Update apt
apt-get update
  1. Install the required packages
apt-get install golang-tip build-essential git-core libphidget21-dev ca-certificates -y

Installation

  1. Go to phidgetsbc.local and log in Go to phidgetsbc.local and log in
  2. Create a project Create a project
  3. Install the application
GOPATH=$HOME/go go get github.com/samuelkadolph/doors
  1. Copy the binary to the project
cp $HOME/go/bin/doors /usr/userapps/doors/doors
  1. Create the config file
cd $HOME/go/bin/doors
    ./doors config:set secret=42
    ./doors config:add interfacekit
    ./doors config:add door -id=reception -name=Reception -lock=0 -lockfeedback=0
  1. Set the executable and enable boot startup for the project Set the executable and enable boot startup for the project
  2. Start the application Start the application
  3. Open a door!
curl http://phidgetsbc.local:4567/doors/reception/unlock -d "secret=42"

API

Secret should be passed in as a query string or as a url encoded body. All responses are in JSON.

Actions

GET /doors

Gets all the doors.
Returns: array of hashes

GET /doors/{id}

Gets a door.
Returns: hash with id, lock, mag, and name fields

POST /doors/{id}/unlock

Unlocks a door.
Returns: hash with success field and possibly error field

POST /doors/{id}/mag/engage

Engages the mag for a door.
Returns: hash with success field and possibly error field

POST /doors/{id}/mag/disengage

Disengages the mag for a door.
Returns: hash with success field and possibly error field

Fields

error

Error message.
Type: String

id

ID of a door.
Type: String

lock

Status of the lock of a door.
Type: String
Values: error, locked, unlocked, unsupported

mag

Status of a mag of a door.
Type: String
Values: disengaged, engaged, error, unsupported

name

Nice name of a door.
Type: String

success

Result of an action.
Type: Boolean

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages