Class: HueResource

Inherits:
Object
  • Object
show all
Defined in:
lib/ha/hue_resource.rb

Direct Known Subclasses

Group, Light, Rule, Sensor

Instance Method Summary collapse

Constructor Details

#initialize(key, hash_value) ⇒ HueResource

Returns a new instance of HueResource.



2
3
4
5
6
7
8
# File 'lib/ha/hue_resource.rb', line 2

def initialize(key, hash_value)
  @hash_value = hash_value
  @lastupdated = @hash_value.dig("state", "lastupdated")
  @detail = hash_value["type"]
  @name = hash_value["name"]
  @state = { "key" => key, "lastupdated" => @lastupdated, "detail" => @detail, "name" => @name}
end

Instance Method Details

#gen_reskey(detail) ⇒ Object



10
11
12
# File 'lib/ha/hue_resource.rb', line 10

def gen_reskey(detail)
  @state.merge!({ "id" => detail + @state["key"]})
end