Class: Insnergy::Sensor
- Inherits:
-
Object
- Object
- Insnergy::Sensor
- Defined in:
- lib/insnergy-api-ruby-client.rb
Instance Attribute Summary collapse
-
#dev_id ⇒ Object
readonly
Returns the value of attribute dev_id.
-
#dev_type_name ⇒ Object
readonly
Returns the value of attribute dev_type_name.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#widgets_alias ⇒ Object
readonly
Returns the value of attribute widgets_alias.
Instance Method Summary collapse
- #co2_meter ⇒ Object
- #co_meter ⇒ Object
-
#initialize(opts = {}) ⇒ Sensor
constructor
A new instance of Sensor.
- #sensor_th_ty ⇒ Object
- #widgets_info_value ⇒ Object
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 = 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_id ⇒ Object (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_name ⇒ Object (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 |
#status ⇒ Object (readonly)
Returns the value of attribute status.
128 129 130 |
# File 'lib/insnergy-api-ruby-client.rb', line 128 def status @status end |
#widgets_alias ⇒ Object (readonly)
Returns the value of attribute widgets_alias.
128 129 130 |
# File 'lib/insnergy-api-ruby-client.rb', line 128 def end |
Instance Method Details
#co2_meter ⇒ Object
149 150 151 |
# File 'lib/insnergy-api-ruby-client.rb', line 149 def co2_meter @infos['400600'] end |
#co_meter ⇒ Object
145 146 147 |
# File 'lib/insnergy-api-ruby-client.rb', line 145 def co_meter @infos['400700'] end |
#sensor_th_ty ⇒ Object
153 154 155 |
# File 'lib/insnergy-api-ruby-client.rb', line 153 def sensor_th_ty "#{@infos['400100']}|#{@infos['400200']}" end |
#widgets_info_value ⇒ Object
141 142 143 |
# File 'lib/insnergy-api-ruby-client.rb', line 141 def @dev_type_name end |