Class: OpenHAB::Core::Things::ChannelUID

Inherits:
UID show all
Defined in:
lib/openhab/core/things/channel_uid.rb

Overview

ChannelUID represents a unique identifier for a Channel.

Instance Attribute Summary collapse

Attributes inherited from UID

#binding_id, #category

Instance Method Summary collapse

Methods inherited from AbstractUID

#==, #inspect, #to_str

Instance Attribute Details

#channelChannel? (readonly)

Return the channel object for this channel

Returns:



48
49
50
# File 'lib/openhab/core/things/channel_uid.rb', line 48

def channel
  thing.channels[self]
end

#group_idString? (readonly)

Returns:

  • (String, nil)


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/openhab/core/things/channel_uid.rb', line 27

class ChannelUID < UID
  # @return [true, false]
  alias_method :in_group?, :is_in_group

  #
  # @attribute [r] thing
  #
  # Return the thing this channel is associated with.
  #
  # @return [Thing, nil]
  #
  def thing
    EntityLookup.lookup_thing(thing_uid)
  end

  # @attribute [r] channel
  #
  # Return the channel object for this channel
  #
  # @return [Channel, nil]
  #
  def channel
    thing.channels[self]
  end

  #
  # @attribute [r] item
  #
  # 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.
  #
  # @return [Item, nil]
  #
  def item
    items.first
  end

  #
  # @attribute [r] items
  #
  # Returns all of the channel's linked items.
  #
  # @return [Array<Item>] An array of things or an empty array
  #
  def items
    Links::Provider.registry.get_linked_items(self).map { |i| Items::Proxy.new(i) }
  end
end

#idString (readonly)

Returns:

  • (String)


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/openhab/core/things/channel_uid.rb', line 27

class ChannelUID < UID
  # @return [true, false]
  alias_method :in_group?, :is_in_group

  #
  # @attribute [r] thing
  #
  # Return the thing this channel is associated with.
  #
  # @return [Thing, nil]
  #
  def thing
    EntityLookup.lookup_thing(thing_uid)
  end

  # @attribute [r] channel
  #
  # Return the channel object for this channel
  #
  # @return [Channel, nil]
  #
  def channel
    thing.channels[self]
  end

  #
  # @attribute [r] item
  #
  # 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.
  #
  # @return [Item, nil]
  #
  def item
    items.first
  end

  #
  # @attribute [r] items
  #
  # Returns all of the channel's linked items.
  #
  # @return [Array<Item>] An array of things or an empty array
  #
  def items
    Links::Provider.registry.get_linked_items(self).map { |i| Items::Proxy.new(i) }
  end
end

#id_without_groupString (readonly)

Returns:

  • (String)


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/openhab/core/things/channel_uid.rb', line 27

class ChannelUID < UID
  # @return [true, false]
  alias_method :in_group?, :is_in_group

  #
  # @attribute [r] thing
  #
  # Return the thing this channel is associated with.
  #
  # @return [Thing, nil]
  #
  def thing
    EntityLookup.lookup_thing(thing_uid)
  end

  # @attribute [r] channel
  #
  # Return the channel object for this channel
  #
  # @return [Channel, nil]
  #
  def channel
    thing.channels[self]
  end

  #
  # @attribute [r] item
  #
  # 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.
  #
  # @return [Item, nil]
  #
  def item
    items.first
  end

  #
  # @attribute [r] items
  #
  # Returns all of the channel's linked items.
  #
  # @return [Array<Item>] An array of things or an empty array
  #
  def items
    Links::Provider.registry.get_linked_items(self).map { |i| Items::Proxy.new(i) }
  end
end

#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:



60
61
62
# File 'lib/openhab/core/things/channel_uid.rb', line 60

def item
  items.first
end

#itemsArray<Item> (readonly)

Returns all of the channel's linked items.

Returns:

  • (Array<Item>)

    An array of things or an empty array



71
72
73
# File 'lib/openhab/core/things/channel_uid.rb', line 71

def items
  Links::Provider.registry.get_linked_items(self).map { |i| Items::Proxy.new(i) }
end

#thingThing? (readonly)

Return the thing this channel is associated with.

Returns:



38
39
40
# File 'lib/openhab/core/things/channel_uid.rb', line 38

def thing
  EntityLookup.lookup_thing(thing_uid)
end

#thing_uidThingUID (readonly)

Returns:



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/openhab/core/things/channel_uid.rb', line 27

class ChannelUID < UID
  # @return [true, false]
  alias_method :in_group?, :is_in_group

  #
  # @attribute [r] thing
  #
  # Return the thing this channel is associated with.
  #
  # @return [Thing, nil]
  #
  def thing
    EntityLookup.lookup_thing(thing_uid)
  end

  # @attribute [r] channel
  #
  # Return the channel object for this channel
  #
  # @return [Channel, nil]
  #
  def channel
    thing.channels[self]
  end

  #
  # @attribute [r] item
  #
  # 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.
  #
  # @return [Item, nil]
  #
  def item
    items.first
  end

  #
  # @attribute [r] items
  #
  # Returns all of the channel's linked items.
  #
  # @return [Array<Item>] An array of things or an empty array
  #
  def items
    Links::Provider.registry.get_linked_items(self).map { |i| Items::Proxy.new(i) }
  end
end

Instance Method Details

#in_group?true, false

Returns:

  • (true, false)


29
# File 'lib/openhab/core/things/channel_uid.rb', line 29

alias_method :in_group?, :is_in_group