Class: MQTT::Homie::Property

Inherits:
HomieObject show all
Includes:
Observable
Defined in:
lib/mqtt/homie/property.rb

Constant Summary collapse

DATA_TYPES =
[:integer, :float, :boolean, :string, :enum, :color]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from HomieObject

#topic

Methods included from HomieAttribute

included

Constructor Details

#initialize(options = {}) ⇒ Property

Returns a new instance of Property.



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/mqtt/homie/property.rb', line 20

def initialize(options = {})
  options = options.dup

  # enum shortcut
  if enum = options.delete(:enum)
    options[:datatype] = :enum
    options[:format] = enum.collect { |i| i.to_s }.join(",")
  end

  super(options)

  @value = options[:value]
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



18
19
20
# File 'lib/mqtt/homie/property.rb', line 18

def value
  @value
end

Instance Method Details

#settable?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/mqtt/homie/property.rb', line 43

def settable?
  @settable
end