- PhidgetSBC3
- Relays (i.e. Dual SSR Relay Board or 8 Channel SSR Module Board)
- Door Controller (i.e KT-300)
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.
- Plug your PhidgetSBC3 into power and network
- Go to phidgetsbc.local and set a password
- Enable the SSH server
- Enable the full Debian Package Repository
- Add your ssh key to the phidgetsbc (optional)
ssh root@phidgetsbc.local "mkdir -p .ssh && echo '$(cat ~/.ssh/id_rsa.pub)' >> .ssh/authorized_keys"
- SSH in
ssh root@phidgetsbc.local
- Add my apt key
apt-key adv --keyserver keys.gnupg.net --recv-keys B4F808A2
- Add my apt repo
echo "deb http://apt.samuelkadolph.com/ wheezy main" > /etc/apt/sources.list.d/samuelkadolph.list
- Update apt
apt-get update
- Install the required packages
apt-get install golang-tip build-essential git-core libphidget21-dev ca-certificates -y
- Go to phidgetsbc.local and log in
- Create a project
- Install the application
GOPATH=$HOME/go go get github.com/samuelkadolph/doors
- Copy the binary to the project
cp $HOME/go/bin/doors /usr/userapps/doors/doors
- 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
curl http://phidgetsbc.local:4567/doors/reception/unlock -d "secret=42"
Secret should be passed in as a query string or as a url encoded body. All responses are in JSON.
GET /doors
Gets all the doors.
Returns: array of hashes
GET /doors/{id}
Gets a door.
Returns: hash withid
,lock
,mag
, andname
fields
POST /doors/{id}/unlock
Unlocks a door.
Returns: hash withsuccess
field and possiblyerror
field
POST /doors/{id}/mag/engage
Engages the mag for a door.
Returns: hash withsuccess
field and possiblyerror
field
POST /doors/{id}/mag/disengage
Disengages the mag for a door.
Returns: hash withsuccess
field and possiblyerror
field
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