Class: Insnergy::Sensor

Inherits:
Object
  • Object
show all
Defined in:
lib/insnergy-api-ruby-client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Sensor

Returns a new instance of Sensor.



130
131
132
133
134
135
136
137
138
139
# File 'lib/insnergy-api-ruby-client.rb', line 130

def initialize(opts = {})
  @infos = Hash.new
  @widgets_alias = opts['alias']
  @dev_id = opts['dev_id']
  @dev_type_name = opts['dev_type_name']
  @status = opts['status']
  opts['widget_infos'].each do |ele|
    @infos[ele['info_name']] = ele['info_value']
  end
end

Instance Attribute Details

#dev_idObject (readonly)

Returns the value of attribute dev_id.



128
129
130
# File 'lib/insnergy-api-ruby-client.rb', line 128

def dev_id
  @dev_id
end

#dev_type_nameObject (readonly)

Returns the value of attribute dev_type_name.



128
129
130
# File 'lib/insnergy-api-ruby-client.rb', line 128

def dev_type_name
  @dev_type_name
end

#statusObject (readonly)

Returns the value of attribute status.



128
129
130
# File 'lib/insnergy-api-ruby-client.rb', line 128

def status
  @status
end

#widgets_aliasObject (readonly)

Returns the value of attribute widgets_alias.



128
129
130
# File 'lib/insnergy-api-ruby-client.rb', line 128

def widgets_alias
  @widgets_alias
end

Instance Method Details

#co2_meterObject



149
150
151
# File 'lib/insnergy-api-ruby-client.rb', line 149

def co2_meter
  @infos['400600']
end

#co_meterObject



145
146
147
# File 'lib/insnergy-api-ruby-client.rb', line 145

def co_meter
  @infos['400700']
end

#sensor_th_tyObject



153
154
155
# File 'lib/insnergy-api-ruby-client.rb', line 153

def sensor_th_ty
  "#{@infos['400100']}|#{@infos['400200']}"
end

#widgets_info_valueObject



141
142
143
# File 'lib/insnergy-api-ruby-client.rb', line 141

def widgets_info_value
  @dev_type_name
end