Class: GroupState

Inherits:
BulbState show all
Defined in:
lib/lights/groupstate.rb

Constant Summary

Constants inherited from BulbState

BulbState::MAX_BRI, BulbState::MAX_CT, BulbState::MAX_HUE, BulbState::MAX_SAT, BulbState::MAX_XY, BulbState::MIN_BRI, BulbState::MIN_CT, BulbState::MIN_HUE, BulbState::MIN_SAT, BulbState::MIN_TRANSITION_TIME, BulbState::MIN_XY

Instance Attribute Summary collapse

Attributes inherited from BulbState

#alert, #bri, #color_mode, #ct, #effect, #hue, #on, #reachable, #sat, #transition_time, #xy

Instance Method Summary collapse

Methods inherited from BulbState

#set_alert, #set_bri, #set_color_mode, #set_ct, #set_effect, #set_hue, #set_on, #set_sat, #set_transition_time, #set_xy

Methods inherited from HObject

#to_json

Constructor Details

#initialize(data = {}) ⇒ GroupState

Returns a new instance of GroupState.



5
6
7
8
# File 'lib/lights/groupstate.rb', line 5

def initialize(data={})
  super(data)
  set_scene data["scene"] if data["scene"]
end

Instance Attribute Details

#sceneObject

Returns the value of attribute scene.



4
5
6
# File 'lib/lights/groupstate.rb', line 4

def scene
  @scene
end

Instance Method Details

#dataObject



19
20
21
22
23
# File 'lib/lights/groupstate.rb', line 19

def data
  data = BulbState.instance_method(:data).bind(self).call
  data["scene"] = @scene if @scene
  data
end

#set_scene(value) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/lights/groupstate.rb', line 11

def set_scene(value)
  if value.class == String
    @scene = value
  else
    raise BulbStateValueTypeException, "Scene value has incorrect type. Requires String, got #{value.class}. Was #{value.inspect}"
  end
end