Class: NLHue::Light

Inherits:
Target show all
Defined in:
lib/nlhue/light.rb

Overview

A class representing a light known to a Hue bridge. Recommended use is to get a Light object by calling NLHue::Bridge#lights().

Instance Attribute Summary

Attributes inherited from Target

#bridge, #id, #name, #transitiontime, #type

Instance Method Summary collapse

Methods inherited from Target

#alert, #alert!, #alert=, #bri, #bri=, #clear_alert, #colormode, #ct, #ct=, #defer, #effect, #effect=, #handle_json, #hue, #hue=, #nodefer, #off!, #on!, #on=, #on?, #sat, #sat=, #send_changes, #state, #submit, #to_h, #to_json, #update, #x, #x=, #xy, #xy=, #y, #y=

Constructor Details

#initialize(bridge, id, info = nil) ⇒ Light

bridge - The Bridge that controls this light. id - The bulb number. info - Parsed Hash of the JSON light info object from the bridge.



11
12
13
# File 'lib/nlhue/light.rb', line 11

def initialize(bridge, id, info=nil)
	super bridge, id, info, :lights, 'state'
end

Instance Method Details

#to_sObject

“Light: [ID]: [name] ([type])”



16
17
18
# File 'lib/nlhue/light.rb', line 16

def to_s
	"Light: #{@id}: #{@name} (#{@type})"
end