Class: Sensor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Sensor.



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

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

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



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

def data
  @data
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#manufacturer_nameObject (readonly)

Returns the value of attribute manufacturer_name.



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

def manufacturer_name
  @manufacturer_name
end

#model_idObject (readonly)

Returns the value of attribute model_id.



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

def model_id
  @model_id
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#stateObject (readonly)

Returns the value of attribute state.



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

def state
  @state
end

#sw_versionObject (readonly)

Returns the value of attribute sw_version.



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

def sw_version
  @sw_version
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

#unique_idObject (readonly)

Returns the value of attribute unique_id.



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

def unique_id
  @unique_id
end