Skip to content

Lock and unlock your lock your Lockitron-powered locks from bash and Ruby

License

Notifications You must be signed in to change notification settings

Jarred-Sumner/lockitron-ruby

Repository files navigation

Lockitron

This is really out of date. You probably don't want to use this!!

Lockitron lets you unlock your front door from anywhere in the world, including your smartphone. We have an iPhone app, an Android app, a webapp, a mobile web app, a REST API, and now, a RubyGem.

This is a very early version of the gem. With it, you can lock, or unlock Lockitrons by their name.

Prerequisites

You need two things for this gem. Firstly, you need a Lockitron-powered door lock, which you can buy at https://lockitron.com. Secondly, you'll need an access token. If you'll only use this for yourself, then go grab your access token. Right now, the gem doesn't handle authorization, so you'll need to manually switch out access tokens. We use OAuth2, and we have a guide on authenticating with it.

Setting an Access Token

To use the Lockitron gem or as a shell script, you'll need to set an access token. You can set it in Ruby or in bash, and it'll work either way. Although, I recommend that you set the access token as an environment variable. I've shown how to do that below

From Bash

Storing the access token as an environment variable: (Remember to replace MY_ACCESS_TOKEN with your access token!)

echo "export LOCKITRON_ACCESS_TOKEN=MY_ACCESS_TOKEN" >> ~/.bashrc && exec $SHELL

From Ruby:

Lockitron::Locks.access_token = MY_ACCESS_TOKEN

Usage (Bash)

You can lock or unlock your Lockitron-powered locks, and list the available locks.

Locking or Unlocking

To lock, run:

lockitron lock LOCK_NAME

To unlock, run:

lockitron unlock LOCK_NAME

Listing Locks

To list all available locks, run:

lockitron list

Usage (Ruby)

You can lock or unlock your locks by their name.

Locking & Unlocking

To unlock by name, run:

Lockitron::Locks.unlock("Lock Name")

To lock by name, run:

Lockitron::Locks.lock("Lock Name")

Listing Locks

To list all available locks, run:

Lockitron::Locks.list

About

Lock and unlock your lock your Lockitron-powered locks from bash and Ruby

Resources

License

Stars

Watchers

Forks

Packages

No packages published