Class: MQTT::Homie::Node

Inherits:
HomieObject show all
Defined in:
lib/mqtt/homie/node.rb

Instance Method Summary collapse

Methods inherited from HomieObject

#initialize, #topic

Methods included from HomieAttribute

included

Constructor Details

This class inherits a constructor from MQTT::Homie::HomieObject

Instance Method Details

#homie_attributesObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/mqtt/homie/node.rb', line 13

def homie_attributes
  data = super

  @properties.each do |p|
    p.homie_attributes.each do |k, v|
      data[p.topic + "/" + k] = v
    end
    data[p.topic] = p.value
  end
  data
end

#property(id) ⇒ Object



9
10
11
# File 'lib/mqtt/homie/node.rb', line 9

def property(id)
  @properties.find { |i| i.id == id }
end