Huemote is an interface for controlling Philips Hue lights. Unlike other implementations, it does not rely on Philips backend servers for upnp discovery.
Add this line to your application's Gemfile:
gem 'huemote'
And then execute:
$ bundle
Or install it yourself as:
$ gem install huemote
- Added
Huemote::Light#kelvin
- which will delegate toHuemote::Light#ct
, by computing the mired value (constrained between 154-500 mired) - Added support for setting a static IP (honestly, the preferred mechanism at this point; getting a stable method of device detection has been a nightmare). Run
Huemote.set_ip '192.168.1.x'
or equivalent, and then use the library as normal.
You can fetch all lights on your network via:
lights = Huemote::Light.all #=> [#<Huemote::Light:0x511ee8dd @name="Hallway", @id="1">, #<Huemote::Light:0x444a2ec6 @name="Main Room", @id="2">, #<Huemote::Light:0x6244ec30 @name="Bathroom 1", @id="3">, #<Huemote::Light:0x1aee75b7 @name="Bathroom 2", @id="4">, #<Huemote::Light:0x1d724f31 @name="Bathroom 3", @id="5">]
Or select a light by its friendly name:
switch = Huemote::Light.find('Hallway') #=> #<Huemote::Light:0x511ee8dd @name="Hallway", @id="1">
Given a Light instance, you can call the following methods:
light.off? #=> [true,false]
light.on? #=> [true,false]
light.on!
light.off!
light.toggle!
light.brightness(250)
light.saturation(50)
light.effect('colorloop')
light.alert('select')
light.hue(5)
light.xy([0.123,0.425])
light.ct(300)
Huemote 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
, httparty
, 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.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request