wemote

Wemote is a Ruby-agnostic gem for Wemo light switches


License
MIT
Install
gem install wemote -v 0.2.3

Documentation

Wemote Build Status Gem Version Code Climate

Wemote is an interface for controlling WeMo light switches (and possibly outlets in the future). Unlike other implementations, it does not rely upon playful for upnp discovery, which makes it compatible with alternative Ruby engines, such as JRuby.

Installation

Add this line to your application's Gemfile:

gem 'wemote'

And then execute:

$ bundle

Or install it yourself as:

$ gem install wemote

Usage

You can fetch all lightswitches on your network (providing you've set them up with your smartphone), via:

switches = Wemote::Switch.all #=> [#<Wemote::Switch:0x27f33aef @host="192.168.1.11", @name="Kitchen Switch", @port="49154">

Or select a switch by its friendly name:

switch = Wemote::Switch.find('Kitchen Switch') #=> #<Wemote::Switch:0x27f33aef @host="192.168.1.11", @name="Kitchen Switch", @port="49154">

Given a Switch instance, you can call the following methods:

switch.off? #=> [true,false]
switch.on? #=> [true,false]
switch.on!
switch.off!
switch.toggle!

Performance

Wemote is designed to be performant - and as such, it will leverage the best HTTP library available for making requests. Currently, Wemote will use (in order of preference): manticore, typhoeus, and finally (miserably) net/http. Because you probably like things fast too, we recommend you gem install manticore on JRuby, or gem install typhoeus on another engine. In order to keep the gem as flexible as possible, none of these are direct dependencies. They just make Wemote happy and fast.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request