Class: Light
- Inherits:
-
HueResource
- Object
- HueResource
- Light
- Defined in:
- lib/ha/light.rb
Instance Method Summary collapse
- #array(selectors) ⇒ Object
- #build_name ⇒ Object
-
#initialize(key, hashvalue, grouparray) ⇒ Light
constructor
A new instance of Light.
Methods inherited from HueResource
Constructor Details
#initialize(key, hashvalue, grouparray) ⇒ Light
Returns a new instance of Light.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/ha/light.rb', line 4 def initialize(key, hashvalue, grouparray) super(key, hashvalue) @grouparray = grouparray @onstate = hashvalue.dig("state", "on") @brightstate = hashvalue.dig("state", "bri") @combinedsate = "#{@onstate} (#{@brightstate})" @number = key @group = Group.owning(key, grouparray) gen_reskey("l") build_name @state.merge! ({"on" => @combinedsate}) end |
Instance Method Details
#array(selectors) ⇒ Object
21 22 23 |
# File 'lib/ha/light.rb', line 21 def array(selectors) selectors.map { |key| @state[key] } end |