Class: Sensor

Inherits:
HObject show all
Defined in:
lib/lights/sensor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from HObject

#to_json

Constructor Details

#initialize(id, data = {}) ⇒ Sensor

Returns a new instance of Sensor.



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/lights/sensor.rb', line 22

def initialize( id, data = {} )
  @id = id
  @name = data["name"]
  @type = data["type"]
  @model_id = data["modelid"]
  @manufacturer_name = data["manufacturername"]
  @unique_id = data["uniqueid"]
  @sw_version = data["swversion"]
  @config = data["config"]
  @state = SensorState.new(data["state"])
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



19
20
21
# File 'lib/lights/sensor.rb', line 19

def data
  @data
end

#idObject (readonly)

Returns the value of attribute id.



19
20
21
# File 'lib/lights/sensor.rb', line 19

def id
  @id
end

#manufacturer_nameObject (readonly)

Returns the value of attribute manufacturer_name.



19
20
21
# File 'lib/lights/sensor.rb', line 19

def manufacturer_name
  @manufacturer_name
end

#model_idObject (readonly)

Returns the value of attribute model_id.



19
20
21
# File 'lib/lights/sensor.rb', line 19

def model_id
  @model_id
end

#nameObject (readonly)

Returns the value of attribute name.



19
20
21
# File 'lib/lights/sensor.rb', line 19

def name
  @name
end

#stateObject (readonly)

Returns the value of attribute state.



19
20
21
# File 'lib/lights/sensor.rb', line 19

def state
  @state
end

#sw_versionObject (readonly)

Returns the value of attribute sw_version.



19
20
21
# File 'lib/lights/sensor.rb', line 19

def sw_version
  @sw_version
end

#typeObject (readonly)

Returns the value of attribute type.



19
20
21
# File 'lib/lights/sensor.rb', line 19

def type
  @type
end

#unique_idObject (readonly)

Returns the value of attribute unique_id.



19
20
21
# File 'lib/lights/sensor.rb', line 19

def unique_id
  @unique_id
end