Class: OpenHAB::Core::Things::ChannelType

Inherits:
AbstractDescriptionType show all
Defined in:
lib/openhab/core/things/channel_type.rb

Overview

ChannelGroupType contains a list of channel definitions and further meta information such as label and description, which are generally used by user interfaces.

Instance Attribute Summary collapse

Attributes inherited from AbstractDescriptionType

#description, #label

Instance Method Summary collapse

Instance Attribute Details

#auto_update_policy:veto, ... (readonly)

Returns:

  • (:veto, :default, :recommend, nil)


51
52
53
# File 'lib/openhab/core/things/channel_type.rb', line 51

def auto_update_policy
  get_auto_update_policy&.to_s&.downcase&.to_sym
end

#categoryString? (readonly)

Returns:

  • (String, nil)


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
# File 'lib/openhab/core/things/channel_type.rb', line 28

class ChannelType < AbstractDescriptionType
  class << self
    # @!visibility private
    def registry
      @registry ||= OSGi.service("org.openhab.core.thing.type.ChannelTypeRegistry")
    end
  end

  # @!attribute [r] kind
  # @return [:state, :trigger]
  def kind
    get_kind.to_s.to_sym
  end

  # @!attribute [r] advanced?
  # @return [true, false]
  alias_method :advanced?, :advanced

  # @!visibility private
  alias_method :state_description, :state

  # @!attribute [r] auto_update_policy
  # @return [:veto, :default, :recommend, nil]
  def auto_update_policy
    get_auto_update_policy&.to_s&.downcase&.to_sym
  end

  # @return [String]
  def inspect
    r = "#<OpenHAB::Core::Things::ChannelType #{uid}"
    r += " (#{kind})" unless kind == :state
    r += " (advanced)" if advanced?
    r += " item_type=#{item_type}"
    r += " tags=(#{tags.join(", ")})" unless tags.empty?
    r += " category=#{category.inspect}" if category
    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
    "#{r}>"
  end

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

#item_typeString (readonly)

Returns:

  • (String)


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
# File 'lib/openhab/core/things/channel_type.rb', line 28

class ChannelType < AbstractDescriptionType
  class << self
    # @!visibility private
    def registry
      @registry ||= OSGi.service("org.openhab.core.thing.type.ChannelTypeRegistry")
    end
  end

  # @!attribute [r] kind
  # @return [:state, :trigger]
  def kind
    get_kind.to_s.to_sym
  end

  # @!attribute [r] advanced?
  # @return [true, false]
  alias_method :advanced?, :advanced

  # @!visibility private
  alias_method :state_description, :state

  # @!attribute [r] auto_update_policy
  # @return [:veto, :default, :recommend, nil]
  def auto_update_policy
    get_auto_update_policy&.to_s&.downcase&.to_sym
  end

  # @return [String]
  def inspect
    r = "#<OpenHAB::Core::Things::ChannelType #{uid}"
    r += " (#{kind})" unless kind == :state
    r += " (advanced)" if advanced?
    r += " item_type=#{item_type}"
    r += " tags=(#{tags.join(", ")})" unless tags.empty?
    r += " category=#{category.inspect}" if category
    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
    "#{r}>"
  end

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

#kind:state, :trigger (readonly)

Returns:

  • (:state, :trigger)


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

def kind
  get_kind.to_s.to_sym
end

#tagsSet<String> (readonly)

Returns:

  • (Set<String>)


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
# File 'lib/openhab/core/things/channel_type.rb', line 28

class ChannelType < AbstractDescriptionType
  class << self
    # @!visibility private
    def registry
      @registry ||= OSGi.service("org.openhab.core.thing.type.ChannelTypeRegistry")
    end
  end

  # @!attribute [r] kind
  # @return [:state, :trigger]
  def kind
    get_kind.to_s.to_sym
  end

  # @!attribute [r] advanced?
  # @return [true, false]
  alias_method :advanced?, :advanced

  # @!visibility private
  alias_method :state_description, :state

  # @!attribute [r] auto_update_policy
  # @return [:veto, :default, :recommend, nil]
  def auto_update_policy
    get_auto_update_policy&.to_s&.downcase&.to_sym
  end

  # @return [String]
  def inspect
    r = "#<OpenHAB::Core::Things::ChannelType #{uid}"
    r += " (#{kind})" unless kind == :state
    r += " (advanced)" if advanced?
    r += " item_type=#{item_type}"
    r += " tags=(#{tags.join(", ")})" unless tags.empty?
    r += " category=#{category.inspect}" if category
    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
    "#{r}>"
  end

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

#uidChannelTypeUID (readonly)

Returns:



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
# File 'lib/openhab/core/things/channel_type.rb', line 28

class ChannelType < AbstractDescriptionType
  class << self
    # @!visibility private
    def registry
      @registry ||= OSGi.service("org.openhab.core.thing.type.ChannelTypeRegistry")
    end
  end

  # @!attribute [r] kind
  # @return [:state, :trigger]
  def kind
    get_kind.to_s.to_sym
  end

  # @!attribute [r] advanced?
  # @return [true, false]
  alias_method :advanced?, :advanced

  # @!visibility private
  alias_method :state_description, :state

  # @!attribute [r] auto_update_policy
  # @return [:veto, :default, :recommend, nil]
  def auto_update_policy
    get_auto_update_policy&.to_s&.downcase&.to_sym
  end

  # @return [String]
  def inspect
    r = "#<OpenHAB::Core::Things::ChannelType #{uid}"
    r += " (#{kind})" unless kind == :state
    r += " (advanced)" if advanced?
    r += " item_type=#{item_type}"
    r += " tags=(#{tags.join(", ")})" unless tags.empty?
    r += " category=#{category.inspect}" if category
    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
    "#{r}>"
  end

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

Instance Method Details

#inspectString

Returns:

  • (String)


56
57
58
59
60
61
62
63
64
65
# File 'lib/openhab/core/things/channel_type.rb', line 56

def inspect
  r = "#<OpenHAB::Core::Things::ChannelType #{uid}"
  r += " (#{kind})" unless kind == :state
  r += " (advanced)" if advanced?
  r += " item_type=#{item_type}"
  r += " tags=(#{tags.join(", ")})" unless tags.empty?
  r += " category=#{category.inspect}" if category
  r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
  "#{r}>"
end

#to_sString

Returns:

  • (String)


68
69
70
# File 'lib/openhab/core/things/channel_type.rb', line 68

def to_s
  uid.to_s
end