Class: OpenHAB::Core::Things::ChannelUID
- Inherits:
- 
      UID
      
        - Object
- AbstractUID
- UID
- OpenHAB::Core::Things::ChannelUID
 
- Defined in:
- lib/openhab/core/things/channel_uid.rb
Overview
ChannelUID represents a unique identifier for a Channel.
Instance Attribute Summary collapse
- 
  
    
      #channel  ⇒ Channel? 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Return the channel object for this channel. 
- #group_id ⇒ String? readonly
- #id ⇒ String readonly
- #id_without_group ⇒ String readonly
- 
  
    
      #item  ⇒ Item? 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Return the item if this channel is linked with an item. 
- 
  
    
      #items  ⇒ Array<Item> 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns all of the channel's linked items. 
- 
  
    
      #thing  ⇒ Thing? 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Return the thing this channel is associated with. 
- #thing_uid ⇒ ThingUID readonly
Attributes inherited from UID
Instance Method Summary collapse
Methods inherited from AbstractUID
Instance Attribute Details
#channel ⇒ Channel? (readonly)
Return the channel object for this channel
| 48 49 50 | # File 'lib/openhab/core/things/channel_uid.rb', line 48 def channel thing.channels[self] end | 
#group_id ⇒ String? (readonly)
| 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 ⇒ String (readonly)
| 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_group ⇒ String (readonly)
| 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 | 
#item ⇒ Item? (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.
| 60 61 62 | # File 'lib/openhab/core/things/channel_uid.rb', line 60 def item items.first end | 
#items ⇒ Array<Item> (readonly)
Returns all of the channel's linked items.
| 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 | 
#thing ⇒ Thing? (readonly)
Return the thing this channel is associated with.
| 38 39 40 | # File 'lib/openhab/core/things/channel_uid.rb', line 38 def thing EntityLookup.lookup_thing(thing_uid) end | 
#thing_uid ⇒ ThingUID (readonly)
| 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
| 29 | # File 'lib/openhab/core/things/channel_uid.rb', line 29 alias_method :in_group?, :is_in_group | 
 
          