Class: OpenHAB::Core::Things::Channel

Inherits:
Object
  • Object
show all
Defined in:
lib/openhab/core/things/channel.rb

Overview

Channel is a part of a Thing that represents a functionality of it. Therefore Items can be linked a to a channel.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#itemItem? (readonly)

Return the item if this channel is linked with an item. If a channel is linked to more than one item, this method only returns the first item.

Returns:



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/openhab/core/things/channel.rb', line 26

class Channel
  extend Forwardable

  delegate %i[item items thing] => :uid

  # @return [String]
  def inspect
    r = "#<OpenHAB::Core::Things::Channel #{uid}"
    r += " #{label.inspect}" if label
    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
    r += " properties=#{properties.to_h}" unless properties.empty?
    "#{r}>"
  end

  # @return [String]
  def to_s
    uid.to_s
  end
end

#itemsArray<Item> (readonly)

Returns all of the channel's linked items.

Returns:

  • (Array<Item>)

    An array of things or an empty array



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/openhab/core/things/channel.rb', line 26

class Channel
  extend Forwardable

  delegate %i[item items thing] => :uid

  # @return [String]
  def inspect
    r = "#<OpenHAB::Core::Things::Channel #{uid}"
    r += " #{label.inspect}" if label
    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
    r += " properties=#{properties.to_h}" unless properties.empty?
    "#{r}>"
  end

  # @return [String]
  def to_s
    uid.to_s
  end
end

#thingThing? (readonly)

Return the thing this channel is associated with.

Returns:



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/openhab/core/things/channel.rb', line 26

class Channel
  extend Forwardable

  delegate %i[item items thing] => :uid

  # @return [String]
  def inspect
    r = "#<OpenHAB::Core::Things::Channel #{uid}"
    r += " #{label.inspect}" if label
    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
    r += " properties=#{properties.to_h}" unless properties.empty?
    "#{r}>"
  end

  # @return [String]
  def to_s
    uid.to_s
  end
end

#uidChannelUID (readonly)

Returns:



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/openhab/core/things/channel.rb', line 26

class Channel
  extend Forwardable

  delegate %i[item items thing] => :uid

  # @return [String]
  def inspect
    r = "#<OpenHAB::Core::Things::Channel #{uid}"
    r += " #{label.inspect}" if label
    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
    r += " properties=#{properties.to_h}" unless properties.empty?
    "#{r}>"
  end

  # @return [String]
  def to_s
    uid.to_s
  end
end

Instance Method Details

#inspectString

Returns:

  • (String)


32
33
34
35
36
37
38
39
# File 'lib/openhab/core/things/channel.rb', line 32

def inspect
  r = "#<OpenHAB::Core::Things::Channel #{uid}"
  r += " #{label.inspect}" if label
  r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
  r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
  r += " properties=#{properties.to_h}" unless properties.empty?
  "#{r}>"
end

#to_sString

Returns:

  • (String)


42
43
44
# File 'lib/openhab/core/things/channel.rb', line 42

def to_s
  uid.to_s
end