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

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

Overview

ChannelUID represents a unique identifier for channels.

Instance Attribute Summary collapse

Instance Attribute Details

#channelChannel? (readonly)

Return the channel object for this channel

Returns:



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

def channel
  thing.channels[self]
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:



43
44
45
# File 'lib/openhab/core/things/channel_uid.rb', line 43

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



54
55
56
# File 'lib/openhab/core/things/channel_uid.rb', line 54

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:



21
22
23
# File 'lib/openhab/core/things/channel_uid.rb', line 21

def thing
  EntityLookup.lookup_thing(thing_uid)
end