Coder Social home page Coder Social logo

hue's Introduction

Hue

Work with Philips Hue light bulbs from Ruby.

Code Climate Dependency Status Gem Version

Installation

Add this line to your application's Gemfile:

gem 'hue'

And then execute:

$ bundle

Or install it yourself as:

$ gem install hue

Usage

The first time you use it, it will automatically create a user for you. Doing this requires you to have pushed the button on your bridge in the last 30 seconds. If you haven't it will throw an exception and let you know you need to push the button. Simply press the button and run the command again.

CLI

$ hue all on
$ hue all off
$ hue all --hue 65280 --brightness 20
$ hue light 2 on
$ hue light 2 --brightness 20

Ruby

client = Hue::Client.new

Lights

light = client.lights.first
light.on!
light.hue = 46920
light.color_temperature = 100
transition_time = 10*5 # Hue transition times are in 1/10 of a second.
light.set_state({:color_temperature => 400}, transition_time)

Groups

# Fetching
group = client.groups.first
group = client.group(1)

# Accessing group lights
group.lights.first.on!
group.lights.each { |light| light.hue = rand(0...65535) }

# Creating groups
group = client.group # Don't specify an ID
group.name = "My Group"
group.lights = [3, 4] # Can specify lights by ID
group.lights = client.lights.first(2) # Or by Light objects
group.new? # => true
group.create! # Once the group is created, you can continue to customize it
group.new? # => false

# Destroying groups
client.groups.last.destroy!

Contributing

See the contributing guide.

hue's People

Contributors

soffes avatar meltingice avatar sodabrew avatar shokai avatar mertdumenci avatar riywo avatar quicksander avatar csouls avatar lepht avatar

Watchers

James Cloos avatar ssh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.