Class: OpenHAB::Core::Things::ItemChannelLink

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

Overview

Represents the link between an Item and a Thing’s Channel.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#channelChannel (readonly)

Returns:



31
32
33
# File 'lib/openhab/core/things/item_channel_link.rb', line 31

def channel
  DSL.things[linked_uid.thing_uid].channels[linked_uid.id]
end

#itemItem (readonly)

Returns:



25
26
27
# File 'lib/openhab/core/things/item_channel_link.rb', line 25

def item
  DSL.items[item_name]
end

#thingThing (readonly)

Returns:



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/openhab/core/things/item_channel_link.rb', line 18

class ItemChannelLink
  extend Forwardable

  def_delegator :linked_uid, :thing

  # @!attribute [r] item
  # @return [Item]
  def item
    DSL.items[item_name]
  end

  # @!attribute [r] channel
  # @return [Channel]
  def channel
    DSL.things[linked_uid.thing_uid].channels[linked_uid.id]
  end

  alias_method :channel_uid, :linked_uid

  # @return [String]
  def inspect
    r = "#<OpenHAB::Core::Things::ItemChannelLink item_name=#{item_name} channel_uid=#{channel_uid}"
    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
    "#{r}>"
  end
end

Instance Method Details

#inspectString

Returns:

  • (String)


38
39
40
41
42
# File 'lib/openhab/core/things/item_channel_link.rb', line 38

def inspect
  r = "#<OpenHAB::Core::Things::ItemChannelLink item_name=#{item_name} channel_uid=#{channel_uid}"
  r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
  "#{r}>"
end