diff --git a/5.33/Array.html b/5.33/Array.html new file mode 100644 index 0000000000..e448ff156c --- /dev/null +++ b/5.33/Array.html @@ -0,0 +1,3733 @@ + + + + + + + Class: Array + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: Array + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core_ext/ruby/array.rb
+
+ +
+ +

Overview

+
+

Extensions to Array

+ + +
+
+
+ + +
+

Direct Known Subclasses

+

OpenHAB::Core::Things::Thing::ChannelsArray

+
+ + + + + + + + +

+ Class Method Summary + collapse +

+ + + +
    + +
  • + + + .wrap(object) ⇒ Array + + + + + + + + + + + + + +

    Ensure an object is an array, by wrapping it in an array if it's not already an array.

    +
    + +
  • + + +
+ + + + + +
+

Class Method Details

+ + +
+

+ + .wrap(object) ⇒ Array + + + + + +

+
+

Ensure an object is an array, by wrapping +it in an array if it's not already an array.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+12
+13
+14
+15
+16
+17
+18
+19
+20
+
+
# File 'lib/openhab/core_ext/ruby/array.rb', line 12
+
+def self.wrap(object)
+  if object.nil?
+    []
+  elsif object.respond_to?(:to_ary)
+    object.to_ary
+  else
+    [object]
+  end
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/Date.html b/5.33/Date.html new file mode 100644 index 0000000000..c208b22645 --- /dev/null +++ b/5.33/Date.html @@ -0,0 +1,4787 @@ + + + + + + + Class: Date + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: Date + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
OpenHAB::CoreExt::Between, OpenHAB::CoreExt::Ephemeris
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core_ext/ruby/date.rb
+
+ +
+ +

Overview

+
+

Extensions to Date

+ + +
+
+
+ + +
+

Direct Known Subclasses

+

DateTime

+
+ + + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from OpenHAB::CoreExt::Ephemeris

+

#days_until, #holiday, #holiday?, #in_dayset?, #next_holiday, #weekend?

+ + + + + + + + + +

Methods included from OpenHAB::CoreExt::Between

+

#between?

+ + +
+

Instance Method Details

+ + +
+

+ + #coerce(other) ⇒ Array? + + + + + +

+
+

Convert other to Date, if possible.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (#to_date) + + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Array, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+106
+107
+108
+109
+110
+111
+112
+
+
# File 'lib/openhab/core_ext/ruby/date.rb', line 106
+
+def coerce(other)
+  logger.trace { "Coercing #{self} as a request from #{other.class}" }
+  return nil unless other.respond_to?(:to_date)
+  return [other.to_date, self] if other.method(:to_date).arity.zero?
+
+  [other.to_date(self), self]
+end
+
+
+ +
+

+ + #compare_with_coercion(other) ⇒ Integer? + + + + Also known as: + <=> + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+
+
# File 'lib/openhab/core_ext/ruby/date.rb', line 86
+
+def compare_with_coercion(other)
+  return compare_without_coercion(other) if other.is_a?(self.class)
+
+  return self <=> other.to_date(self) if other.is_a?(java.time.MonthDay)
+
+  if other.respond_to?(:coerce) && (lhs, rhs = other.coerce(self))
+    return lhs <=> rhs
+  end
+
+  compare_without_coercion(other)
+end
+
+
+ +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+116
+
+
# File 'lib/openhab/core_ext/ruby/date.rb', line 116
+
+alias_method :inspect, :to_s
+
+
+ +
+

+ + #minus_with_temporal(other) ⇒ LocalDate + + + + Also known as: + - + + + + +

+
+

Extends #- to allow subtracting a TemporalAmount

+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+32
+33
+34
+35
+36
+37
+38
+39
+
+
# File 'lib/openhab/core_ext/ruby/date.rb', line 32
+
+def minus_with_temporal(other)
+  case other
+  when java.time.temporal.TemporalAmount, java.time.LocalDate
+    to_local_date - other
+  else
+    minus_without_temporal(other)
+  end
+end
+
+
+ +
+

+ + #plus_with_temporal(other) ⇒ LocalDate + + + + Also known as: + + + + + + +

+
+

Extends #+ to allow adding a TemporalAmount

+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+18
+19
+20
+21
+22
+
+
# File 'lib/openhab/core_ext/ruby/date.rb', line 18
+
+def plus_with_temporal(other)
+  return to_local_date + other if other.is_a?(java.time.temporal.TemporalAmount)
+
+  plus_without_temporal(other)
+end
+
+
+ +
+

+ + #to_instant(context = nil) ⇒ Instant + + + + + +

+
+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+80
+81
+82
+83
+
+
# File 'lib/openhab/core_ext/ruby/date.rb', line 80
+
+def to_instant(context = nil)
+  context ||= Instant.now.to_zoned_date_time
+  to_zoned_date_time(context).to_instant
+end
+
+
+ +
+

+ + #to_local_date(_context = nil) ⇒ LocalDate + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+44
+45
+46
+
+
# File 'lib/openhab/core_ext/ruby/date.rb', line 44
+
+def to_local_date(_context = nil)
+  java.time.LocalDate.of(year, month, day)
+end
+
+
+ +
+

+ + #to_monthMonth + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Month) + + + +
  • + +
+ +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/openhab/core_ext/ruby/date.rb', line 49
+
+def to_month
+  java.time.Month.of(month)
+end
+
+
+ +
+

+ + #to_month_dayMonthDay + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+54
+55
+56
+
+
# File 'lib/openhab/core_ext/ruby/date.rb', line 54
+
+def to_month_day
+  java.time.MonthDay.of(month, day)
+end
+
+
+ +
+

+ + #to_zoned_date_time(context = nil) ⇒ ZonedDateTime + + + + + +

+
+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+71
+72
+73
+
+
# File 'lib/openhab/core_ext/ruby/date.rb', line 71
+
+def to_zoned_date_time(context = nil)
+  to_local_date.to_zoned_date_time(context)
+end
+
+
+ +
+

+ + #today?true, false + + + + + +

+
+

Returns true if the date, converted to the system time zone, is today.

+

This is the equivalent of checking if the current datetime is between midnight and end of the day +of the system time zone.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+64
+
+
# File 'lib/openhab/core_ext/ruby/date.rb', line 64
+
+def_delegators :to_zoned_date_time, :yesterday?, :today?, :tomorrow?
+
+
+ +
+

+ + #tomorrow?true, false + + + + + +

+
+

Returns true if the date, converted to the system time zone, is tomorrow.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+64
+
+
# File 'lib/openhab/core_ext/ruby/date.rb', line 64
+
+def_delegators :to_zoned_date_time, :yesterday?, :today?, :tomorrow?
+
+
+ +
+

+ + #yesterday?true, false + + + + + +

+
+

Returns true if the date, converted to the system time zone, is yesterday.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+64
+
+
# File 'lib/openhab/core_ext/ruby/date.rb', line 64
+
+def_delegators :to_zoned_date_time, :yesterday?, :today?, :tomorrow?
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/DateTime.html b/5.33/DateTime.html new file mode 100644 index 0000000000..d5ae6c6f36 --- /dev/null +++ b/5.33/DateTime.html @@ -0,0 +1,4323 @@ + + + + + + + Class: DateTime + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: DateTime + + + +

+
+ +
+
Inherits:
+
+ Date + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
OpenHAB::CoreExt::Between, OpenHAB::CoreExt::Ephemeris
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core_ext/ruby/date_time.rb
+
+ +
+ +

Overview

+
+

Extensions to DateTime

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from OpenHAB::CoreExt::Ephemeris

+

#days_until, #holiday, #holiday?, #in_dayset?, #next_holiday, #weekend?

+ + + + + + + + + +

Methods included from OpenHAB::CoreExt::Between

+

#between?

+ + + + + + + + + +

Methods inherited from Date

+

#compare_with_coercion, #inspect, #to_local_date, #to_month, #to_month_day, #today?, #tomorrow?, #yesterday?

+ + +
+

Instance Method Details

+ + +
+

+ + #coerce(other) ⇒ Array? + + + + + +

+
+

Converts to a ZonedDateTime if other +is also convertible to a ZonedDateTime.

+ + +
+
+
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (Array, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+54
+55
+56
+57
+58
+59
+60
+
+
# File 'lib/openhab/core_ext/ruby/date_time.rb', line 54
+
+def coerce(other)
+  logger.trace { "Coercing #{self} as a request from #{other.class}" }
+  return unless other.respond_to?(:to_zoned_date_time)
+
+  zdt = to_zoned_date_time
+  [other.to_zoned_date_time(zdt), zdt]
+end
+
+
+ +
+

+ + #minus_with_temporal(other) ⇒ ZonedDateTime, ... + + + + Also known as: + - + + + + +

+
+

Extends #- to allow subtracting a TemporalAmount +or any other date/time class that responds to #to_zoned_date_time.

+

Subtractions with another object of the same class (e.g. Time - Other Time, or DateTime - Other DateTime) +remains unchanged from its original behavior.

+ + +
+
+
+ +
+

Examples:

+ + +

Time - Duration -> ZonedDateTime

+

+ +
zdt_one_hour_ago = Time.now - 1.hour
+ + +

Time - ZonedDateTime -> Duration

+

+ +
java_duration = Time.now - 1.hour.ago
+ + +

Time - Numeric -> Time

+

+ +
time_one_hour_ago = Time - 3600
+ + +

Time - Time -> Float

+

+ +
one_day_in_secs = Time.new(2002, 10, 31) - Time.new(2002, 10, 30)
+ +
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (ZonedDateTime) + + + + — +

    If other is a TemporalAmount

    +
    + +
  • + +
  • + + + (Duration) + + + + — +

    If other responds to #to_zoned_date_time

    +
    + +
  • + +
  • + + + (Time) + + + + — +

    If other is a Numeric

    +
    + +
  • + +
  • + + + (Float) + + + + — +

    If other is a Time

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+
+
# File 'lib/openhab/core_ext/ruby/date_time.rb', line 26
+
+def minus_with_temporal(other)
+  return to_zoned_date_time - other if other.is_a?(java.time.temporal.TemporalAmount)
+
+  # Exclude subtracting against the same class
+  if other.respond_to?(:to_zoned_date_time) && !other.is_a?(self.class)
+    return to_zoned_date_time - other.to_zoned_date_time
+  end
+
+  minus_without_temporal(other)
+end
+
+
+ +
+

+ + #plus_with_temporal(other) ⇒ ZonedDateTime, Time + + + + Also known as: + + + + + + +

+
+

Extends #+ to allow adding a TemporalAmount

+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+17
+18
+19
+20
+21
+
+
# File 'lib/openhab/core_ext/ruby/date_time.rb', line 17
+
+def plus_with_temporal(other)
+  return to_zoned_date_time + other if other.is_a?(java.time.temporal.TemporalAmount)
+
+  plus_without_temporal(other)
+end
+
+
+ +
+

+ + #to_instant(_context = nil) ⇒ Instant + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/openhab/core_ext/ruby/date_time.rb', line 49
+
+def to_instant(_context = nil)
+  to_java(Instant)
+end
+
+
+ +
+

+ + #to_local_timeLocalTime + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+41
+
+
# File 'lib/openhab/core_ext/ruby/date_time.rb', line 41
+
+def_delegator :to_zoned_date_time, :to_local_time
+
+
+ +
+

+ + #to_zoned_date_time(context = nil) ⇒ ZonedDateTime + + + + + +

+
+ + +
+
+
+

Parameters:

+
    + +
  • + + context + + + (ZonedDateTime, nil) + + + (defaults to: nil) + + + — +

    A ZonedDateTime used to fill in missing fields +during conversion. Not used in this class.

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+44
+45
+46
+
+
# File 'lib/openhab/core_ext/ruby/date_time.rb', line 44
+
+def to_zoned_date_time(context = nil) # rubocop:disable Lint/UnusedMethodArgument
+  to_java(ZonedDateTime)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/Enumerable.html b/5.33/Enumerable.html new file mode 100644 index 0000000000..6d658429e7 --- /dev/null +++ b/5.33/Enumerable.html @@ -0,0 +1,6157 @@ + + + + + + + Module: Enumerable + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: Enumerable + + + +

+
+ + + + + + + + + +
+
Included in:
+
OpenHAB::Core::EmulateHash, OpenHAB::Core::LazyArray, OpenHAB::Core::Provider
+
+ + + +
+
Defined in:
+
lib/openhab/core/items/semantics/enumerable.rb,
+ lib/openhab/core/items/semantics.rb
+
+
+ +
+ +

Overview

+
+

Additions to Enumerable to allow easily filtering groups of items based on the semantic model

+ + +
+
+
+ + +
+ + + + + + + +

+ Filtering Methods + collapse +

+ + + + + +

+ Items State and Command Methods + collapse +

+ + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #all_groupsArray<GroupItem> + + + + + +

+
+

Returns all groups all elements are a part of, recursively

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+91
+92
+93
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 91
+
+def all_groups
+  flat_map(&:all_groups).uniq
+end
+
+
+ +
+

+ + #all_membersArray<Item> + + + + + +

+
+

Returns all non-group members of all group elements, recursively

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+79
+80
+81
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 79
+
+def all_members
+  grep(OpenHAB::Core::Items::GroupItem).flat_map(&:all_members).uniq
+end
+
+
+ +
+

+ + #command(command, **kwargs) ⇒ self? + + + + + +

+
+

Send a command to every item in the collection

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self, nil) + + + + — +

    nil when ensure is in effect and all the items were already in the same state, +otherwise self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+100
+101
+102
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 100
+
+def command(command, **kwargs)
+  self if count { |i| i.command(command, **kwargs) }.positive?
+end
+
+
+ +
+

+ + #command!(command, **kwargs) ⇒ self + + + + + +

+
+

Send a command to every item in the collection, even when ensure_states! is in effect.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+106
+107
+108
+109
+110
+111
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 106
+
+def command!(command, **kwargs)
+  # We cannot alias this to #command above, otherwise it will call
+  # DSL::Items::Ensure::Item#command which checks for ensure_states
+  each { |i| i.command!(command, **kwargs) }
+  self
+end
+
+
+ +
+

+ + #decreaseself + + + + + +

+
+

Send the DECREASE command to every item in the collection

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 162
+
+
+
+
+ +
+

+ + #downself + + + + + +

+
+

Send the DOWN command to every item in the collection

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 146
+
+
+
+
+ +
+

+ + #equipments(*types) ⇒ Array<Item> + + + + + +

+
+ +
+ Note: +

As equipments are usually +GroupItems, this method therefore returns an array of +GroupItems. In order to get the points +that belong to the equipments, use #members +before calling #points. See the example with #points.

+
+
+ +

Returns a new array of items that are a semantics equipment (optionally of one of the given types)

+ + +
+
+
+ +
+

Examples:

+ + +

Get all TVs in a room

+

+ +
lGreatRoom.equipments(Semantics::Television)
+ + +

Get all TVs and Speakers in a room

+

+ +
lGreatRoom.equipments(Semantics::Television, Semantics::Speaker)
+ +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+
+
# File 'lib/openhab/core/items/semantics.rb', line 647
+
+def equipments(*types)
+  begin
+    raise ArgumentError unless types.all? { |type| type < Semantics::Equipment }
+  rescue ArgumentError, TypeError
+    raise ArgumentError, "type must be a subclass of Equipment"
+  end
+
+  result = select(&:equipment?)
+  result.select! { |i| types.any? { |type| i.equipment_type <= type } } unless types.empty?
+
+  result
+end
+
+
+ +
+

+ + #fast_forwardself + + + + + +

+
+

Send the FASTFORWARD command to every item in the collection

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 178
+
+
+
+
+ +
+

+ + #groupsArray<GroupItem> + + + + + +

+
+

Returns the groups of all elements

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+85
+86
+87
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 85
+
+def groups
+  flat_map(&:groups).uniq
+end
+
+
+ +
+

+ + #increaseself + + + + + +

+
+

Send the INCREASE command to every item in the collection

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 158
+
+
+
+
+ +
+

+ + #locations(*types) ⇒ Array<Item> + + + + + +

+
+

Returns a new array of items that are a semantics Location (optionally of one of the given types)

+ + +
+
+
+ +
+

Examples:

+ + +

Get all rooms

+

+ +
items.locations(Semantics::Room)
+ + +

Get all bedrooms and bathrooms

+

+ +
items.locations(Semantics::Bedroom, Semantics::Bathroom)
+ +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+
+
# File 'lib/openhab/core/items/semantics.rb', line 617
+
+def locations(*types)
+  begin
+    raise ArgumentError unless types.all? { |type| type < Semantics::Location }
+  rescue ArgumentError, TypeError
+    raise ArgumentError, "type must be a subclass of Location"
+  end
+
+  result = select(&:location?)
+  result.select! { |i| types.any? { |type| i.location_type <= type } } unless types.empty?
+
+  result
+end
+
+
+ +
+

+ + #member_of(*groups) ⇒ Array<Item> + + + + + +

+
+

Returns a new array of items that are a member of at least one of the given groups

+ + +
+
+
+

Parameters:

+
    + +
  • + + groups + + + (String, GroupItem) + + + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+60
+61
+62
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 60
+
+def member_of(*groups)
+  select { |i| i.member_of?(*groups) }
+end
+
+
+ +
+

+ + #membersArray<Item> + + + + + +

+
+

Returns the group members of all group elements

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+73
+74
+75
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 73
+
+def members
+  grep(OpenHAB::Core::Items::GroupItem).flat_map(&:members).uniq
+end
+
+
+ +
+

+ + #moveself + + + + + +

+
+

Send the MOVE command to every item in the collection

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 154
+
+
+
+
+ +
+

+ + #nextself + + + + + +

+
+

Send the NEXT command to every item in the collection

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 182
+
+
+
+
+ +
+

+ + #not_member_of(*groups) ⇒ Array<Item> + + + + + +

+
+

Returns a new array of items that are not a member of any of the given groups

+ + +
+
+
+

Parameters:

+
    + +
  • + + groups + + + (String, GroupItem) + + + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+67
+68
+69
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 67
+
+def not_member_of(*groups)
+  reject { |i| i.member_of?(*groups) }
+end
+
+
+ +
+

+ + #not_tagged(*tags) ⇒ Array<Item> + + + + + +

+
+

Returns a new array of items that do not have any of the given tags

+ + +
+
+
+

Parameters:

+
    + +
  • + + tags + + + (String, Module) + + + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+53
+54
+55
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 53
+
+def not_tagged(*tags)
+  reject { |i| i.tagged?(*tags) }
+end
+
+
+ +
+

+ + #offself + + + + + +

+
+

Send the OFF command to every item in the collection

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 138
+
+
+
+
+ +
+

+ + #onself + + + + + +

+
+

Send the ON command to every item in the collection

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 134
+
+
+
+
+ +
+

+ + #pauseself + + + + + +

+
+

Send the PAUSE command to every item in the collection

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 170
+
+
+
+
+ +
+

+ + #playself + + + + + +

+
+

Send the PLAY command to every item in the collection

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 166
+
+
+
+
+ +
+

+ + #points(*point_or_property_types) ⇒ Array<Item> + + + + + +

+
+

Returns a new array of items that are semantics points (optionally of a given type)

+ + +
+
+
+ +
+

Examples:

+ + +

Get all the power switch items for every equipment in a room

+

+ +
lGreatRoom.equipments.members.points(Semantics::Switch)
+ +
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+
+
# File 'lib/openhab/core/items/semantics.rb', line 669
+
+def points(*point_or_property_types)
+  unless (0..2).cover?(point_or_property_types.length)
+    raise ArgumentError, "wrong number of arguments (given #{point_or_property_types.length}, expected 0..2)"
+  end
+
+  begin
+    raise ArgumentError unless point_or_property_types.all? do |tag|
+                                 tag < Semantics::Point ||
+                                 tag < Semantics::Property
+                               end
+  rescue ArgumentError, TypeError
+    raise ArgumentError, "point_or_property_types must all be a subclass of Point or Property"
+  end
+  if point_or_property_types.count { |tag| tag < Semantics::Point } > 1 ||
+     point_or_property_types.count { |tag| tag < Semantics::Property } > 1
+    raise ArgumentError, "point_or_property_types cannot both be a subclass of Point or Property"
+  end
+
+  select do |point|
+    point.point? && point_or_property_types.all? do |tag|
+      (tag < Semantics::Point && point.point_type&.<=(tag)) ||
+        (tag < Semantics::Property && point.property_type&.<=(tag))
+    end
+  end
+end
+
+
+ +
+

+ + #previousself + + + + + +

+
+

Send the PREVIOUS command to every item in the collection

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 186
+
+
+
+
+ +
+

+ + #refreshself + + + + + +

+
+

Send the REFRESH command to every item in the collection

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 130
+
+
+
+
+ +
+

+ + #rewindself + + + + + +

+
+

Send the REWIND command to every item in the collection

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 174
+
+
+
+
+ +
+

+ + #stopself + + + + + +

+
+

Send the STOP command to every item in the collection

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 150
+
+
+
+
+ +
+

+ + #tagged(*tags) ⇒ Array<Item> + + + + + +

+
+

Returns a new array of items that have at least one of the given tags

+ + +
+
+
+

Parameters:

+
    + +
  • + + tags + + + (String, Module) + + + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+46
+47
+48
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 46
+
+def tagged(*tags)
+  select { |i| i.tagged?(*tags) }
+end
+
+
+ +
+

+ + #toggle(source: nil) ⇒ self + + + + + +

+
+

Send a toggle command to every item in the collection

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+201
+202
+203
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 201
+
+def toggle(source: nil)
+  each { |i| i.toggle(source: source) }
+end
+
+
+ +
+

+ + #upself + + + + + +

+
+

Send the UP command to every item in the collection

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 142
+
+
+
+
+ +
+

+ + #update(state) ⇒ self? + + + + + +

+
+

Update the state of every item in the collection

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self, nil) + + + + — +

    nil when ensure is in effect and all the items were already in the same state, +otherwise self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+116
+117
+118
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 116
+
+def update(state)
+  self if count { |i| i.update(state) }.positive?
+end
+
+
+ +
+

+ + #update!(state) ⇒ self + + + + + +

+
+

Update the state of every item in the collection, even when +ensure_states! is in effect.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+123
+124
+125
+126
+127
+128
+
+
# File 'lib/openhab/core/items/semantics/enumerable.rb', line 123
+
+def update!(state)
+  # We cannot alias this to #update above, otherwise it will call
+  # DSL::Items::Ensure::Item#update which checks for ensure_states
+  each { |i| i.update!(state) }
+  self
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/Float.html b/5.33/Float.html new file mode 100644 index 0000000000..8990f3b283 --- /dev/null +++ b/5.33/Float.html @@ -0,0 +1,4207 @@ + + + + + + + Class: Float + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: Float + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core_ext/ruby/numeric.rb
+
+ +
+ +

Overview

+
+

Extensions to Float

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #daysDuration + + + + Also known as: + day + + + + +

+
+

Create Duration of self days

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+113
+114
+115
+
+
# File 'lib/openhab/core_ext/ruby/numeric.rb', line 113
+
+def days
+  (self * 24).hours
+end
+
+
+ +
+

+ + #hoursDuration + + + + Also known as: + hour + + + + +

+
+

Create Duration of self hours

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+103
+104
+105
+
+
# File 'lib/openhab/core_ext/ruby/numeric.rb', line 103
+
+def hours
+  (self * 60).minutes
+end
+
+
+ +
+

+ + #millisecondsDuration + + + + Also known as: + millisecond, ms + + + + +

+
+

Create Duration of self milliseconds

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+72
+73
+74
+
+
# File 'lib/openhab/core_ext/ruby/numeric.rb', line 72
+
+def milliseconds
+  java.time.Duration.of_nanos((self * 1_000_000).to_i)
+end
+
+
+ +
+

+ + #minutesDuration + + + + Also known as: + minute + + + + +

+
+

Create Duration of self minutes

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+93
+94
+95
+
+
# File 'lib/openhab/core_ext/ruby/numeric.rb', line 93
+
+def minutes
+  (self * 60).seconds
+end
+
+
+ +
+

+ + #monthsDuration + + + + Also known as: + month + + + + +

+
+

Create Duration of self months

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+123
+124
+125
+
+
# File 'lib/openhab/core_ext/ruby/numeric.rb', line 123
+
+def months
+  (self * java.time.temporal.ChronoUnit::MONTHS.duration.to_i).seconds
+end
+
+
+ +
+

+ + #secondsDuration + + + + Also known as: + second + + + + +

+
+

Create Duration of self seconds

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+83
+84
+85
+
+
# File 'lib/openhab/core_ext/ruby/numeric.rb', line 83
+
+def seconds
+  (self * 1000).milliseconds
+end
+
+
+ +
+

+ + #yearsDuration + + + + Also known as: + year + + + + +

+
+

Create Duration of self years

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+133
+134
+135
+
+
# File 'lib/openhab/core_ext/ruby/numeric.rb', line 133
+
+def years
+  (self * java.time.temporal.ChronoUnit::YEARS.duration.to_i).seconds
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/Integer.html b/5.33/Integer.html new file mode 100644 index 0000000000..4958585fbe --- /dev/null +++ b/5.33/Integer.html @@ -0,0 +1,4199 @@ + + + + + + + Class: Integer + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: Integer + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
OpenHAB::CoreExt::Ruby::QuantityTypeConversion
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core_ext/ruby/numeric.rb
+
+ +
+ +

Overview

+
+

Extensions to Integer

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods included from OpenHAB::CoreExt::Ruby::QuantityTypeConversion

+

#|

+ + +
+

Instance Method Details

+ + +
+

+ + #daysPeriod + + + + Also known as: + day + + + + +

+
+

Create Period of self days

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Period) + + + +
  • + +
+ +
+ + + + +
+
+
+
+57
+
+
# File 'lib/openhab/core_ext/ruby/numeric.rb', line 57
+
+def_period_method(:days)
+
+
+ +
+

+ + #hoursDuration + + + + Also known as: + hour + + + + +

+
+

Create Duration of self hours

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+55
+
+
# File 'lib/openhab/core_ext/ruby/numeric.rb', line 55
+
+def_duration_method(:hours)
+
+
+ +
+

+ + #millisecondsDuration + + + + Also known as: + millisecond, ms + + + + +

+
+

Create Duration of self milliseconds

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+46
+47
+48
+
+
# File 'lib/openhab/core_ext/ruby/numeric.rb', line 46
+
+def milliseconds
+  Duration.of_millis(self)
+end
+
+
+ +
+

+ + #minutesDuration + + + + Also known as: + minute + + + + +

+
+

Create Duration of self minutes

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+53
+
+
# File 'lib/openhab/core_ext/ruby/numeric.rb', line 53
+
+def_duration_method(:minutes)
+
+
+ +
+

+ + #monthsPeriod + + + + Also known as: + month + + + + +

+
+

Create Period of self months

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Period) + + + +
  • + +
+ +
+ + + + +
+
+
+
+59
+
+
# File 'lib/openhab/core_ext/ruby/numeric.rb', line 59
+
+def_period_method(:months)
+
+
+ +
+

+ + #secondsDuration + + + + Also known as: + second + + + + +

+
+

Create Duration of self seconds

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+51
+
+
# File 'lib/openhab/core_ext/ruby/numeric.rb', line 51
+
+def_duration_method(:seconds)
+
+
+ +
+

+ + #yearsPeriod + + + + Also known as: + year + + + + +

+
+

Create Period of self years

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Period) + + + +
  • + +
+ +
+ + + + +
+
+
+
+61
+
+
# File 'lib/openhab/core_ext/ruby/numeric.rb', line 61
+
+def_period_method(:years)
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/Module.html b/5.33/Module.html new file mode 100644 index 0000000000..b43f12b5ab --- /dev/null +++ b/5.33/Module.html @@ -0,0 +1,3713 @@ + + + + + + + Class: Module + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: Module + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core_ext/ruby/module.rb
+
+ +
+ +

Overview

+
+

Extensions to Module

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + +
    + +
  • + + + #simple_name ⇒ String? + + + + + + + + + + + + + +

    Returns the name of the class or module, without any containing module or package.

    +
    + +
  • + + +
+ + + + + +
+

Instance Method Details

+ + +
+

+ + #simple_nameString? + + + + + +

+
+

Returns the name of the class or module, without any containing module or package.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+10
+11
+12
+13
+14
+
+
# File 'lib/openhab/core_ext/ruby/module.rb', line 10
+
+def simple_name
+  return unless name
+
+  @simple_name ||= java_class&.simple_name || name.split("::").last
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/Numeric.html b/5.33/Numeric.html new file mode 100644 index 0000000000..fa161b7c02 --- /dev/null +++ b/5.33/Numeric.html @@ -0,0 +1,3642 @@ + + + + + + + Class: Numeric + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: Numeric + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
OpenHAB::CoreExt::Ruby::Numeric
+
+ + + + + + +
+
Defined in:
+
lib/openhab/yard.rb
+
+ +
+ +

Overview

+
+

Extensions to Ruby Numeric

+ + +
+
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from OpenHAB::CoreExt::Ruby::QuantityTypeConversion

+

#|

+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB.html b/5.33/OpenHAB.html new file mode 100644 index 0000000000..3cf72ae9dc --- /dev/null +++ b/5.33/OpenHAB.html @@ -0,0 +1,3612 @@ + + + + + + + Module: OpenHAB + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl.rb,
+ lib/openhab/log.rb,
lib/openhab/core.rb,
lib/openhab/osgi.rb,
lib/openhab/core/dto.rb,
lib/openhab/core_ext.rb,
lib/openhab/dsl/rules.rb,
lib/openhab/core/items.rb,
lib/openhab/core/proxy.rb,
lib/openhab/core/rules.rb,
lib/openhab/core/timer.rb,
lib/openhab/core/types.rb,
lib/openhab/dsl/events.rb,
lib/openhab/core/events.rb,
lib/openhab/core/things.rb,
lib/openhab/dsl/version.rb,
lib/openhab/rspec/hooks.rb,
lib/openhab/rspec/shell.rb,
lib/openhab/core/actions.rb,
lib/openhab/core/provider.rb,
lib/openhab/core/registry.rb,
lib/openhab/dsl/debouncer.rb,
lib/openhab/rspec/helpers.rb,
lib/openhab/rspec/helpers.rb,
lib/openhab/core/dto/thing.rb,
lib/openhab/core/items/item.rb,
lib/openhab/core/lazy_array.rb,
lib/openhab/core/rules/rule.rb,
lib/openhab/core/things/uid.rb,
lib/openhab/core/types/type.rb,
lib/openhab/dsl/rules/guard.rb,
lib/openhab/dsl/rules/terse.rb,
lib/openhab/core/items/proxy.rb,
lib/openhab/core/value_cache.rb,
lib/openhab/core_ext/between.rb,
lib/openhab/dsl/items/ensure.rb,
lib/openhab/dsl/thread_local.rb,
lib/openhab/core/abstract_uid.rb,
lib/openhab/core/actions/exec.rb,
lib/openhab/core/actions/http.rb,
lib/openhab/core/actions/ping.rb,
lib/openhab/core/emulate_hash.rb,
lib/openhab/core/rules/module.rb,
lib/openhab/core/things/proxy.rb,
lib/openhab/core/things/thing.rb,
lib/openhab/dsl/items/builder.rb,
lib/openhab/dsl/rules/builder.rb,
lib/openhab/dsl/timer_manager.rb,
lib/openhab/core/actions/audio.rb,
lib/openhab/core/actions/voice.rb,
lib/openhab/core/configuration.rb,
lib/openhab/core/entity_lookup.rb,
lib/openhab/core_ext/ephemeris.rb,
lib/openhab/core_ext/java/time.rb,
lib/openhab/dsl/rules/property.rb,
lib/openhab/dsl/rules/triggers.rb,
lib/openhab/dsl/things/builder.rb,
lib/openhab/core/items/metadata.rb,
lib/openhab/core/items/provider.rb,
lib/openhab/core/items/registry.rb,
lib/openhab/core/rules/provider.rb,
lib/openhab/core/rules/registry.rb,
lib/openhab/core/things/channel.rb,
lib/openhab/core/types/hsb_type.rb,
lib/openhab/core/types/raw_type.rb,
lib/openhab/core_ext/java/class.rb,
lib/openhab/core_ext/java/month.rb,
lib/openhab/core_ext/ruby/range.rb,
lib/openhab/rspec/configuration.rb,
lib/openhab/rspec/example_group.rb,
lib/openhab/core/items/call_item.rb,
lib/openhab/core/items/semantics.rb,
lib/openhab/core/profile_factory.rb,
lib/openhab/core/script_handling.rb,
lib/openhab/core/things/provider.rb,
lib/openhab/core/things/registry.rb,
lib/openhab/core_ext/java/period.rb,
lib/openhab/core_ext/ruby/object.rb,
lib/openhab/dsl/sitemaps/builder.rb,
lib/openhab/core/items/color_item.rb,
lib/openhab/core/items/group_item.rb,
lib/openhab/core/items/image_item.rb,
lib/openhab/core/things/thing_uid.rb,
lib/openhab/core/types/point_type.rb,
lib/openhab/core_ext/java/instant.rb,
lib/openhab/core_ext/ruby/numeric.rb,
lib/openhab/core/actions/ephemeris.rb,
lib/openhab/core/events/item_event.rb,
lib/openhab/core/items/dimmer_item.rb,
lib/openhab/core/items/number_item.rb,
lib/openhab/core/items/persistence.rb,
lib/openhab/core/items/player_item.rb,
lib/openhab/core/items/string_item.rb,
lib/openhab/core/items/switch_item.rb,
lib/openhab/core/sitemaps/provider.rb,
lib/openhab/core/things/thing_type.rb,
lib/openhab/core/types/on_off_type.rb,
lib/openhab/core/types/string_type.rb,
lib/openhab/core/types/time_series.rb,
lib/openhab/core/types/un_def_type.rb,
lib/openhab/core_ext/java/duration.rb,
lib/openhab/dsl/events/watch_event.rb,
lib/openhab/core/events/timer_event.rb,
lib/openhab/core/items/contact_item.rb,
lib/openhab/core/items/generic_item.rb,
lib/openhab/core/items/numeric_item.rb,
lib/openhab/core/rules/tagged_array.rb,
lib/openhab/core/things/channel_uid.rb,
lib/openhab/core/types/decimal_type.rb,
lib/openhab/core/types/numeric_type.rb,
lib/openhab/core/types/percent_type.rb,
lib/openhab/core/types/refresh_type.rb,
lib/openhab/core/types/up_down_type.rb,
lib/openhab/core_ext/java/month_day.rb,
lib/openhab/dsl/items/timed_command.rb,
lib/openhab/dsl/rules/rule_triggers.rb,
lib/openhab/core/items/location_item.rb,
lib/openhab/core/items/metadata/hash.rb,
lib/openhab/core/items/state_storage.rb,
lib/openhab/core/things/channel_type.rb,
lib/openhab/core/types/quantity_type.rb,
lib/openhab/core_ext/java/local_date.rb,
lib/openhab/core_ext/java/local_time.rb,
lib/openhab/dsl/rules/name_inference.rb,
lib/openhab/core/actions/notification.rb,
lib/openhab/core/items/date_time_item.rb,
lib/openhab/core/items/group_function.rb,
lib/openhab/core/types/date_time_type.rb,
lib/openhab/core/types/stop_move_type.rb,
lib/openhab/dsl/rules/automation_rule.rb,
lib/openhab/core/dto/item_channel_link.rb,
lib/openhab/core/events/abstract_event.rb,
lib/openhab/core/things/links/provider.rb,
lib/openhab/core/things/thing_type_uid.rb,
lib/openhab/core/types/comparable_type.rb,
lib/openhab/core/types/play_pause_type.rb,
lib/openhab/dsl/rules/triggers/changed.rb,
lib/openhab/dsl/rules/triggers/channel.rb,
lib/openhab/dsl/rules/triggers/command.rb,
lib/openhab/dsl/rules/triggers/trigger.rb,
lib/openhab/dsl/rules/triggers/updated.rb,
lib/openhab/core/actions/transformation.rb,
lib/openhab/core/types/open_closed_type.rb,
lib/openhab/core/types/string_list_type.rb,
lib/openhab/core/events/item_state_event.rb,
lib/openhab/core/events/startlevel_event.rb,
lib/openhab/core/items/metadata/provider.rb,
lib/openhab/core/things/channel_type_uid.rb,
lib/openhab/core/things/profile_callback.rb,
lib/openhab/dsl/rules/triggers/cron/cron.rb,
lib/openhab/core/items/item_channel_links.rb,
lib/openhab/core/items/rollershutter_item.rb,
lib/openhab/core/items/semantics/provider.rb,
lib/openhab/core/things/channel_group_uid.rb,
lib/openhab/core/things/item_channel_link.rb,
lib/openhab/core/types/next_previous_type.rb,
lib/openhab/core_ext/java/temporal_amount.rb,
lib/openhab/core_ext/java/zoned_date_time.rb,
lib/openhab/dsl/rules/triggers/conditions.rb,
lib/openhab/core/events/item_command_event.rb,
lib/openhab/core/items/accepted_data_types.rb,
lib/openhab/core/things/channel_definition.rb,
lib/openhab/core/things/channel_group_type.rb,
lib/openhab/dsl/config_description/builder.rb,
lib/openhab/core/items/semantics/semantic_tag.rb,
lib/openhab/core/types/increase_decrease_type.rb,
lib/openhab/core/items/metadata/namespace_hash.rb,
lib/openhab/core/things/channel_group_type_uid.rb,
lib/openhab/core/types/rewind_fastforward_type.rb,
lib/openhab/core/events/channel_triggered_event.rb,
lib/openhab/core/events/thing_status_info_event.rb,
lib/openhab/core/events/item_state_changed_event.rb,
lib/openhab/core/events/item_state_updated_event.rb,
lib/openhab/core/things/channel_group_definition.rb,
lib/openhab/dsl/rules/triggers/cron/cron_handler.rb,
lib/openhab/core/things/abstract_description_type.rb,
lib/openhab/dsl/rules/triggers/conditions/generic.rb,
lib/openhab/core/items/semantics/tag_class_methods.rb,
lib/openhab/dsl/rules/triggers/conditions/duration.rb,
lib/openhab/dsl/rules/triggers/watch/watch_handler.rb,
lib/openhab/core/events/abstract_item_registry_event.rb,
lib/openhab/core/events/abstract_thing_registry_event.rb,
lib/openhab/core/events/item_time_series_updated_event.rb,
lib/openhab/core/events/abstract_item_channel_link_registry_event.rb
+
+
+ +
+ +

Overview

+
+

Main openHAB Module

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: Core, CoreExt, DSL, Log, OSGi, RSpec, Transform + + + + Classes: Logger + + +

+ + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core.html b/5.33/OpenHAB/Core.html new file mode 100644 index 0000000000..229609f319 --- /dev/null +++ b/5.33/OpenHAB/Core.html @@ -0,0 +1,3932 @@ + + + + + + + Module: OpenHAB::Core + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core.rb,
+ lib/openhab/core/dto.rb,
lib/openhab/core/items.rb,
lib/openhab/core/proxy.rb,
lib/openhab/core/rules.rb,
lib/openhab/core/timer.rb,
lib/openhab/core/types.rb,
lib/openhab/core/events.rb,
lib/openhab/core/things.rb,
lib/openhab/core/actions.rb,
lib/openhab/core/provider.rb,
lib/openhab/core/registry.rb,
lib/openhab/core/dto/thing.rb,
lib/openhab/core/items/item.rb,
lib/openhab/core/lazy_array.rb,
lib/openhab/core/rules/rule.rb,
lib/openhab/core/things/uid.rb,
lib/openhab/core/types/type.rb,
lib/openhab/core/items/proxy.rb,
lib/openhab/core/value_cache.rb,
lib/openhab/core/abstract_uid.rb,
lib/openhab/core/actions/exec.rb,
lib/openhab/core/actions/http.rb,
lib/openhab/core/actions/ping.rb,
lib/openhab/core/emulate_hash.rb,
lib/openhab/core/rules/module.rb,
lib/openhab/core/things/proxy.rb,
lib/openhab/core/things/thing.rb,
lib/openhab/core/actions/audio.rb,
lib/openhab/core/actions/voice.rb,
lib/openhab/core/configuration.rb,
lib/openhab/core/entity_lookup.rb,
lib/openhab/core/items/metadata.rb,
lib/openhab/core/items/provider.rb,
lib/openhab/core/items/registry.rb,
lib/openhab/core/rules/provider.rb,
lib/openhab/core/rules/registry.rb,
lib/openhab/core/things/channel.rb,
lib/openhab/core/types/hsb_type.rb,
lib/openhab/core/types/raw_type.rb,
lib/openhab/core/items/call_item.rb,
lib/openhab/core/items/semantics.rb,
lib/openhab/core/profile_factory.rb,
lib/openhab/core/script_handling.rb,
lib/openhab/core/things/provider.rb,
lib/openhab/core/things/registry.rb,
lib/openhab/core/items/color_item.rb,
lib/openhab/core/items/group_item.rb,
lib/openhab/core/items/image_item.rb,
lib/openhab/core/things/thing_uid.rb,
lib/openhab/core/types/point_type.rb,
lib/openhab/core/actions/ephemeris.rb,
lib/openhab/core/events/item_event.rb,
lib/openhab/core/items/dimmer_item.rb,
lib/openhab/core/items/number_item.rb,
lib/openhab/core/items/persistence.rb,
lib/openhab/core/items/player_item.rb,
lib/openhab/core/items/string_item.rb,
lib/openhab/core/items/switch_item.rb,
lib/openhab/core/sitemaps/provider.rb,
lib/openhab/core/things/thing_type.rb,
lib/openhab/core/types/on_off_type.rb,
lib/openhab/core/types/string_type.rb,
lib/openhab/core/types/time_series.rb,
lib/openhab/core/types/un_def_type.rb,
lib/openhab/core/events/timer_event.rb,
lib/openhab/core/items/contact_item.rb,
lib/openhab/core/items/generic_item.rb,
lib/openhab/core/items/numeric_item.rb,
lib/openhab/core/rules/tagged_array.rb,
lib/openhab/core/things/channel_uid.rb,
lib/openhab/core/types/decimal_type.rb,
lib/openhab/core/types/numeric_type.rb,
lib/openhab/core/types/percent_type.rb,
lib/openhab/core/types/refresh_type.rb,
lib/openhab/core/types/up_down_type.rb,
lib/openhab/core/items/location_item.rb,
lib/openhab/core/items/metadata/hash.rb,
lib/openhab/core/items/state_storage.rb,
lib/openhab/core/things/channel_type.rb,
lib/openhab/core/types/quantity_type.rb,
lib/openhab/core/actions/notification.rb,
lib/openhab/core/items/date_time_item.rb,
lib/openhab/core/items/group_function.rb,
lib/openhab/core/types/date_time_type.rb,
lib/openhab/core/types/stop_move_type.rb,
lib/openhab/core/dto/item_channel_link.rb,
lib/openhab/core/events/abstract_event.rb,
lib/openhab/core/things/links/provider.rb,
lib/openhab/core/things/thing_type_uid.rb,
lib/openhab/core/types/comparable_type.rb,
lib/openhab/core/types/play_pause_type.rb,
lib/openhab/core/actions/transformation.rb,
lib/openhab/core/types/open_closed_type.rb,
lib/openhab/core/types/string_list_type.rb,
lib/openhab/core/events/item_state_event.rb,
lib/openhab/core/events/startlevel_event.rb,
lib/openhab/core/items/metadata/provider.rb,
lib/openhab/core/things/channel_type_uid.rb,
lib/openhab/core/things/profile_callback.rb,
lib/openhab/core/items/item_channel_links.rb,
lib/openhab/core/items/rollershutter_item.rb,
lib/openhab/core/items/semantics/provider.rb,
lib/openhab/core/things/channel_group_uid.rb,
lib/openhab/core/things/item_channel_link.rb,
lib/openhab/core/types/next_previous_type.rb,
lib/openhab/core/events/item_command_event.rb,
lib/openhab/core/items/accepted_data_types.rb,
lib/openhab/core/things/channel_definition.rb,
lib/openhab/core/things/channel_group_type.rb,
lib/openhab/core/items/semantics/semantic_tag.rb,
lib/openhab/core/types/increase_decrease_type.rb,
lib/openhab/core/items/metadata/namespace_hash.rb,
lib/openhab/core/things/channel_group_type_uid.rb,
lib/openhab/core/types/rewind_fastforward_type.rb,
lib/openhab/core/events/channel_triggered_event.rb,
lib/openhab/core/events/thing_status_info_event.rb,
lib/openhab/core/events/item_state_changed_event.rb,
lib/openhab/core/events/item_state_updated_event.rb,
lib/openhab/core/things/channel_group_definition.rb,
lib/openhab/core/things/abstract_description_type.rb,
lib/openhab/core/items/semantics/tag_class_methods.rb,
lib/openhab/core/events/abstract_item_registry_event.rb,
lib/openhab/core/events/abstract_thing_registry_event.rb,
lib/openhab/core/events/item_time_series_updated_event.rb,
lib/openhab/core/events/abstract_item_channel_link_registry_event.rb
+
+
+ +
+ +

Overview

+
+

Contains classes and modules that wrap actual openHAB objects

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: Actions, DTO, EmulateHash, EntityLookup, Events, Items, LazyArray, Rules, ScriptHandling, Sitemaps, Things, Types, ValueCache + + + + Classes: AbstractUID, Configuration, Provider, Registry, Timer + + +

+ + +

+ Constant Summary + collapse +

+ +
+ +
VERSION = +
+
+

The openHAB Version. >= 3.4.0 is required.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+
+
org.openhab.core.OpenHAB.version.freeze
+ +
+ + + + + +

Class Attribute Summary collapse

+ + + + + + +

+ Class Method Summary + collapse +

+ + + + + + + + +
+

Class Attribute Details

+ + + +
+

+ + .automation_managerorg.openhab.core.automation.module.script.rulesupport.shared.ScriptedAutomationManager (readonly) + + + + + +

+
+

Returns The openHAB Automation manager.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+60
+61
+62
+
+
# File 'lib/openhab/core.rb', line 60
+
+def automation_manager
+  $se.get("automationManager")
+end
+
+
+ + + +
+

+ + .config_folderPathname (readonly) + + + + + +

+
+

Returns The configuration folder path.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Pathname) + + + + — +

    The configuration folder path.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+51
+52
+53
+
+
# File 'lib/openhab/core.rb', line 51
+
+def config_folder
+  Pathname.new(org.openhab.core.OpenHAB.config_folder)
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .import_preset(preset) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Imports a specific script extension preset into the global namespace

+ + +
+
+
+

Parameters:

+
    + +
  • + + preset + + + (String) + + + +
  • + +
+ + +
+ + + + +
+
+
+
+70
+71
+72
+
+
# File 'lib/openhab/core.rb', line 70
+
+def import_preset(preset)
+  import_scope_values($se.import_preset(preset))
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/AbstractUID.html b/5.33/OpenHAB/Core/AbstractUID.html new file mode 100644 index 0000000000..5cfbe702d3 --- /dev/null +++ b/5.33/OpenHAB/Core/AbstractUID.html @@ -0,0 +1,3835 @@ + + + + + + + Class: OpenHAB::Core::AbstractUID + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::AbstractUID + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/abstract_uid.rb
+
+ +
+ +

Overview

+
+

A non specific base class for unique identifiers.

+ + +
+
+
+ + +
+

Direct Known Subclasses

+

Things::UID

+
+ + + + + + + + +

+ Instance Method Summary + collapse +

+ + + +
    + +
  • + + + #==(other) ⇒ true, false + + + + + + + + + + + + + +

    compares if equal to other, including string conversion.

    +
    + +
  • + + +
  • + + + #inspect ⇒ Object + + + + + + + + + + + + + +

    inspect result is just the string representation.

    +
    + +
  • + + +
  • + + + #to_str ⇒ Object + + + + + + + + + + + + + +

    implicit conversion to string.

    +
    + +
  • + + +
+ + + + + +
+

Instance Method Details

+ + +
+

+ + #==(other) ⇒ true, false + + + + + +

+
+

compares if equal to other, including string conversion

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+16
+17
+18
+19
+20
+
+
# File 'lib/openhab/core/abstract_uid.rb', line 16
+
+def ==(other)
+  return true if equals(other)
+
+  to_s == other
+end
+
+
+ +
+

+ + #inspectObject + + + + + +

+
+

inspect result is just the string representation

+ + +
+
+
+ + +
+ + + + +
+
+
+
+12
+
+
# File 'lib/openhab/core/abstract_uid.rb', line 12
+
+alias_method :inspect, :to_s
+
+
+ +
+

+ + #to_strObject + + + + + +

+
+

implicit conversion to string

+ + +
+
+
+ + +
+ + + + +
+
+
+
+10
+
+
# File 'lib/openhab/core/abstract_uid.rb', line 10
+
+alias_method :to_str, :to_s
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Actions.html b/5.33/OpenHAB/Core/Actions.html new file mode 100644 index 0000000000..6552112b09 --- /dev/null +++ b/5.33/OpenHAB/Core/Actions.html @@ -0,0 +1,3737 @@ + + + + + + + Module: OpenHAB::Core::Actions + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Actions + + + +

+
+ + + + + + + + + +
+
Included in:
+
DSL
+
+ + + +
+
Defined in:
+
lib/openhab/core/actions.rb,
+ lib/openhab/core/actions/exec.rb,
lib/openhab/core/actions/http.rb,
lib/openhab/core/actions/ping.rb,
lib/openhab/core/actions/audio.rb,
lib/openhab/core/actions/voice.rb,
lib/openhab/core/actions/ephemeris.rb,
lib/openhab/core/actions/notification.rb,
lib/openhab/core/actions/transformation.rb
+
+
+ +
+ +

Overview

+
+

Access to global actions.

+

All openHAB's actions including those provided by add-ons are available, notably:

+ +

From add-ons, e.g.:

+ +

Thing-specific actions can be accessed from the Thing object. +See Thing#actions.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + + + Classes: Audio, Ephemeris, Exec, HTTP, Notification, Ping, Transformation, Voice + + +

+ + + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + + + + +
+

Class Method Details

+ + +
+

+ + .notify(msg, email: nil, icon: nil, tag: nil, severity: nil, id: nil, title: nil, on_click: nil, attachment: nil, buttons: nil) ⇒ Object + + + + + +

+
+
Deprecated.

Use Notification.send instead.

+
+ + +
+
+
+ + +
+ + + + +
+
+
+
+56
+57
+58
+59
+
+
# File 'lib/openhab/core/actions.rb', line 56
+
+def notify(*args, **kwargs)
+  logger.warn("`notify` method is deprecated. Use `Notification.send` instead.")
+  Notification.send(*args, **kwargs)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Actions/Audio.html b/5.33/OpenHAB/Core/Actions/Audio.html new file mode 100644 index 0000000000..e5acd44905 --- /dev/null +++ b/5.33/OpenHAB/Core/Actions/Audio.html @@ -0,0 +1,3889 @@ + + + + + + + Class: OpenHAB::Core::Actions::Audio + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Actions::Audio + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/actions/audio.rb
+
+ +
+ +

Overview

+
+ + +
+
+
+ + +

See Also:

+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + + + + +
+

Class Method Details

+ + +
+

+ + .play_sound(filename, sink: nil, volume: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Play an audio file via openHAB sound service, Audio.playSound()

+ + +
+
+
+ +
+

Examples:

+ + +

Play an audio file

+

+ +
rule 'Play an audio file' do
+  every :hour
+  run { Audio.play_sound "beep.mp3", volume: 100 }
+end
+ +
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +

    The sound file to play

    +
    + +
  • + +
  • + + sink + + + (String) + + + (defaults to: nil) + + + — +

    Specify a particular sink to output the speech

    +
    + +
  • + +
  • + + volume + + + (PercentType) + + + (defaults to: nil) + + + — +

    Specify the volume for the speech

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+24
+25
+26
+27
+28
+29
+30
+31
+
+
# File 'lib/openhab/core/actions/audio.rb', line 24
+
+def play_sound(filename, sink: nil, volume: nil)
+  volume = PercentType.new(volume) unless volume.is_a?(PercentType) || volume.nil?
+  java_send :playSound,
+            [java.lang.String, java.lang.String, PercentType.java_class],
+            sink,
+            filename.to_s,
+            volume
+end
+
+
+ +
+

+ + .play_stream(url, sink: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Play an audio stream from an URL to the given sink(s). Set url to nil if streaming should be stopped

+ + +
+
+
+ +
+

Examples:

+ + +

Play an audio stream

+

+ +
Audio.play_stream 'example.com'
+ +
+

Parameters:

+
    + +
  • + + url + + + (String) + + + + — +

    The URL of the audio stream

    +
    + +
  • + +
  • + + sink + + + (String) + + + (defaults to: nil) + + + — +

    The audio sink, or nil to use the default audio sink

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+44
+45
+46
+
+
# File 'lib/openhab/core/actions/audio.rb', line 44
+
+def play_stream(url, sink: nil)
+  playStream(sink&.to_s, url)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Actions/Ephemeris.html b/5.33/OpenHAB/Core/Actions/Ephemeris.html new file mode 100644 index 0000000000..c5e3122271 --- /dev/null +++ b/5.33/OpenHAB/Core/Actions/Ephemeris.html @@ -0,0 +1,3745 @@ + + + + + + + Class: OpenHAB::Core::Actions::Ephemeris + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Actions::Ephemeris + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/actions/ephemeris.rb
+
+ +
+ +

Overview

+
+ + +
+
+
+ + +

See Also:

+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + + + + +
+

Class Method Details

+ + +
+

+ + .holiday_name(holiday) ⇒ String? + + + + + +

+
+

Human readable name of the given holiday

+ + +
+
+
+ +
+

Examples:

+ + +
Ephemeris.holiday_name(Date.today) # => "Christmas"
+Ephemeris.holiday_name(:christmas) # => "Christmas"
+ +
+

Parameters:

+
    + +
  • + + holiday + + + (Symbol, #holiday, nil) + + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+19
+20
+21
+22
+23
+24
+
+
# File 'lib/openhab/core/actions/ephemeris.rb', line 19
+
+def holiday_name(holiday)
+  holiday = holiday.holiday if holiday.respond_to?(:holiday)
+  return nil if holiday.nil?
+
+  ::Ephemeris.get_holiday_description(to_holiday_property_key(holiday))
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Actions/Exec.html b/5.33/OpenHAB/Core/Actions/Exec.html new file mode 100644 index 0000000000..9b2869eaf4 --- /dev/null +++ b/5.33/OpenHAB/Core/Actions/Exec.html @@ -0,0 +1,3826 @@ + + + + + + + Class: OpenHAB::Core::Actions::Exec + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Actions::Exec + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/actions/exec.rb
+
+ +
+ +

Overview

+
+ + +
+
+
+ + +

See Also:

+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + + + + +
+

Class Method Details

+ + +
+

+ + + .execute_command_line(command_line) ⇒ void + + .execute_command_line(timeout, command_line) ⇒ String + + + + + + +

+
+

This method returns an undefined value.

+ +
+
+
+ +

Overloads:

+
    + + +
  • + .execute_command_line(command_line) ⇒ void +
    +
    +

    This method returns an undefined value.

    Executes a command on the command line without waiting for the +command to complete.

    + + +
    +
    +
    + +
    +

    Examples:

    + + +

    Execute an external command

    +

    + +
    rule 'Run a command' do
    +  every :day
    +  run do
    +    Exec.execute_command_line('/bin/true')
    +  end
    +end
    + +
    +

    Parameters:

    +
      + +
    • + + command_line + + + (String) + + + +
    • + +
    + + +
    +
  • + + +
  • + .execute_command_line(timeout, command_line) ⇒ String +
    +
    +

    Executes a command on the command and waits timeout seconds for +the command to complete, returning the output from the command +as a String.

    + + +
    +
    +
    + +
    +

    Examples:

    + + +

    Execute an external command and process its results

    +

    + +
    rule 'Run a command' do
    +  every :day
    +  run do
    +    TodaysHoliday_String.update(Exec.execute_command_line(5.seconds, '/home/cody/determine_holiday.rb')
    +  end
    +end
    + +
    +

    Parameters:

    +
      + +
    • + + timeout + + + (Duration) + + + +
    • + +
    • + + command_line + + + (String) + + + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + +
    • + +
    + +
    +
  • + +
+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/actions/exec.rb', line 10
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Actions/HTTP.html b/5.33/OpenHAB/Core/Actions/HTTP.html new file mode 100644 index 0000000000..71e169d0f0 --- /dev/null +++ b/5.33/OpenHAB/Core/Actions/HTTP.html @@ -0,0 +1,4322 @@ + + + + + + + Class: OpenHAB::Core::Actions::HTTP + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Actions::HTTP + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/actions/http.rb
+
+ +
+ +

Overview

+
+

The HTTP actions allow you to send HTTP requests and receive the response.

+ + +
+
+
+ +
+

Examples:

+ + +
# Send a GET request
+headers = {
+  "User-Agent": "JRuby/1.2.3", # enclose in quotes if the key contains dashes
+  Accept: "application/json",
+}
+response = HTTP.get("http://example.com/list", headers: headers)
+ +
+ + +

See Also:

+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + + + + +
+

Class Method Details

+ + +
+

+ + .send_http_delete_request(url, headers: {}, timeout: nil) ⇒ String? + + + + Also known as: + delete + + + + +

+
+

Sends an HTTP DELETE request and returns the result as a String.

+ + +
+
+
+

Parameters:

+
    + +
  • + + url + + + (String) + + + +
  • + +
  • + + headers + + + (Hash<String, String>, Hash<Symbol, String>) + + + (defaults to: {}) + + + — +

    A hash of headers to send with the request. Keys are strings or symbols, values are strings. +Underscores in symbolic keys are replaced with dashes.

    +
    + +
  • + +
  • + + timeout + + + (Duration, int, nil) + + + (defaults to: nil) + + + — +

    Timeout (in milliseconds, if given as an Integer)

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    the response body

    +
    + +
  • + +
  • + + + (nil) + + + + — +

    if an error occurred

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+89
+90
+91
+92
+93
+94
+
+
# File 'lib/openhab/core/actions/http.rb', line 89
+
+def send_http_delete_request(url, headers: {}, timeout: nil)
+  timeout ||= 1_000
+  timeout = timeout.to_millis if timeout.is_a?(Duration)
+
+  sendHttpDeleteRequest(url, headers.transform_keys(&:to_s), timeout)
+end
+
+
+ +
+

+ + .send_http_get_request(url, headers: {}, timeout: nil) ⇒ String? + + + + Also known as: + get + + + + +

+
+

Sends an HTTP GET request and returns the result as a String.

+ + +
+
+
+

Parameters:

+
    + +
  • + + url + + + (String) + + + +
  • + +
  • + + headers + + + (Hash<String, String>, Hash<Symbol, String>) + + + (defaults to: {}) + + + — +

    A hash of headers to send with the request. Symbolic keys will be converted to strings.

    +
    + +
  • + +
  • + + timeout + + + (Duration, int, nil) + + + (defaults to: nil) + + + — +

    Timeout (in milliseconds, if given as an Integer)

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    the response body

    +
    + +
  • + +
  • + + + (nil) + + + + — +

    if an error occurred

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+30
+31
+32
+33
+34
+35
+
+
# File 'lib/openhab/core/actions/http.rb', line 30
+
+def send_http_get_request(url, headers: {}, timeout: nil)
+  timeout ||= 5_000
+  timeout = timeout.to_millis if timeout.is_a?(Duration)
+
+  sendHttpGetRequest(url, headers.transform_keys(&:to_s), timeout)
+end
+
+
+ +
+

+ + .send_http_post_request(url, content_type = nil, content = nil, headers: {}, timeout: nil) ⇒ String? + + + + Also known as: + post + + + + +

+
+

Sends an HTTP POST request and returns the result as a String.

+ + +
+
+
+

Parameters:

+
    + +
  • + + url + + + (String) + + + +
  • + +
  • + + content_type + + + (String) + + + (defaults to: nil) + + +
  • + +
  • + + content + + + (String) + + + (defaults to: nil) + + +
  • + +
  • + + headers + + + (Hash<String, String>, Hash<Symbol, String>) + + + (defaults to: {}) + + + — +

    A hash of headers to send with the request. Symbolic keys will be converted to strings.

    +
    + +
  • + +
  • + + timeout + + + (Duration, int, nil) + + + (defaults to: nil) + + + — +

    Timeout (in milliseconds, if given as an Integer)

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    the response body

    +
    + +
  • + +
  • + + + (nil) + + + + — +

    if an error occurred

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+70
+71
+72
+73
+74
+75
+
+
# File 'lib/openhab/core/actions/http.rb', line 70
+
+def send_http_post_request(url, content_type = nil, content = nil, headers: {}, timeout: nil)
+  timeout ||= 1_000
+  timeout = timeout.to_millis if timeout.is_a?(Duration)
+
+  sendHttpPostRequest(url, content_type, content, headers.transform_keys(&:to_s), timeout)
+end
+
+
+ +
+

+ + .send_http_put_request(url, content_type = nil, content = nil, headers: {}, timeout: nil) ⇒ String? + + + + Also known as: + put + + + + +

+
+

Sends an HTTP PUT request and returns the result as a String.

+ + +
+
+
+

Parameters:

+
    + +
  • + + url + + + (String) + + + +
  • + +
  • + + content_type + + + (String) + + + (defaults to: nil) + + +
  • + +
  • + + content + + + (String) + + + (defaults to: nil) + + +
  • + +
  • + + headers + + + (Hash<String, String>, Hash<Symbol, String>) + + + (defaults to: {}) + + + — +

    A hash of headers to send with the request. Symbolic keys will be converted to strings.

    +
    + +
  • + +
  • + + timeout + + + (Duration, int, nil) + + + (defaults to: nil) + + + — +

    Timeout (in milliseconds, if given as an Integer)

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    the response body

    +
    + +
  • + +
  • + + + (nil) + + + + — +

    if an error occurred

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+50
+51
+52
+53
+54
+55
+
+
# File 'lib/openhab/core/actions/http.rb', line 50
+
+def send_http_put_request(url, content_type = nil, content = nil, headers: {}, timeout: nil)
+  timeout ||= 1_000
+  timeout = timeout.to_millis if timeout.is_a?(Duration)
+
+  sendHttpPutRequest(url, content_type, content, headers.transform_keys(&:to_s), timeout)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Actions/Notification.html b/5.33/OpenHAB/Core/Actions/Notification.html new file mode 100644 index 0000000000..823826b58e --- /dev/null +++ b/5.33/OpenHAB/Core/Actions/Notification.html @@ -0,0 +1,4298 @@ + + + + + + + Class: OpenHAB::Core::Actions::Notification + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Actions::Notification + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/actions/notification.rb
+
+ +
+ +

Overview

+
+

Provides methods for openHAB Cloud Notification Actions.

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + + + + +
+

Class Method Details

+ + +
+

+ + .hide(email: nil, id: nil, tag: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Hide a notification by ID or tag.

+

Either the id or tag parameter must be provided. +When both are provided, two calls will be made to the NotificationAction:

+
    +
  • Notifications matching the id will be hidden, and
  • +
  • Notifications matching the tag will be hidden, independently from the given tag.
  • +
+ + +
+
+
+

Parameters:

+
    + +
  • + + email + + + (String, nil) + + + (defaults to: nil) + + + — +

    The email address to hide notifications for. +If nil, hide broadcast notifications.

    +
    + +
  • + +
  • + + id + + + (String, nil) + + + (defaults to: nil) + + + — +

    hide notifications associated with the given reference ID.

    +
    + +
  • + +
  • + + tag + + + (String, nil) + + + (defaults to: nil) + + + — +

    hide notifications associated with the given tag.

    +
    + +
  • + +
+ +

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +
+ + + + +
+
+
+
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+
+
# File 'lib/openhab/core/actions/notification.rb', line 128
+
+def hide(email: nil, id: nil, tag: nil)
+  unless Actions.const_defined?(:NotificationAction)
+    raise NotImplementedError, "NotificationAction is not available. Please install the openHAB Cloud addon."
+  end
+
+  raise ArgumentError, "Either id or tag must be provided." unless id || tag
+
+  args = []
+  if email
+    args.push(email)
+    notification = :notification
+  else
+    notification = :broadcast_notification
+  end
+
+  NotificationAction.__send__(:"hide_#{notification}_by_reference_id", *args, id) if id
+  NotificationAction.__send__(:"hide_#{notification}_by_tag", *args, tag) if tag
+end
+
+
+ +
+

+ + .log(msg, icon: nil, tag: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Sends a log notification.

+

Log notifications do not trigger a notification on the device.

+ + +
+
+
+

Parameters:

+
    + +
  • + + msg + + + (String) + + + + — +

    The message to send.

    +
    + +
  • + +
  • + + icon + + + (String, Symbol, nil) + + + (defaults to: nil) + + + — +

    The icon name

    +
    + +
  • + +
  • + + tag + + + (String, Symbol, nil) + + + (defaults to: nil) + + + — +

    a name to group the type or severity of the notification.

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+157
+158
+159
+
+
# File 'lib/openhab/core/actions/notification.rb', line 157
+
+def log(msg, icon: nil, tag: nil)
+  NotificationAction.send_log_notification(msg.to_s, icon&.to_s, tag&.to_s)
+end
+
+
+ +
+

+ + .send(msg, email: nil, icon: nil, tag: nil, severity: nil, id: nil, title: nil, on_click: nil, attachment: nil, buttons: nil) ⇒ void + + + + + +

+
+ +
+ Note: +

The parameters title, id, on_click, attachment, and buttons were added in openHAB 4.2.

+
+
+ +

This method returns an undefined value.

Send a notification using +openHAB Cloud Notification Action.

+ + +
+
+
+ +
+

Examples:

+ + +

Send a broadcast notification via openHAB Cloud

+

+ +
rule "Send an alert" do
+  changed Alarm_Triggered, to: ON
+  run { Notification.send "Red Alert!" }
+end
+ + +

Provide action buttons in a notification

+

+ +
rule "Doorbell" do
+  changed Doorbell, to: ON
+  run do
+    Notification.send "Someone pressed the doorbell!",
+      title: "Doorbell",
+      attachment: "http://myserver.local/cameras/frontdoor.jpg",
+      buttons: {
+        "Show Camera" => "ui:/basicui/app?w=0001&sitemap=cameras",
+        "Unlock Door" => "command:FrontDoor_Lock:OFF"
+      }
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + msg + + + (String) + + + + — +

    The message to send.

    +
    + +
  • + +
  • + + email + + + (String, nil) + + + (defaults to: nil) + + + — +

    The email address to send to. If nil, the message will be broadcasted.

    +
    + +
  • + +
  • + + icon + + + (String, Symbol, nil) + + + (defaults to: nil) + + + — +

    The icon name +(as described in Items).

    +
    + +
  • + +
  • + + tag + + + (String, Symbol, nil) + + + (defaults to: nil) + + + — +

    a name to group the type or severity of the notification.

    +
    + +
  • + +
  • + + severity + + + (String, Symbol, nil) + + + (defaults to: nil) + + + — +

    Deprecated - an alias for tag for backwards compatibility.

    +
    + +
  • + +
  • + + title + + + (String, nil) + + + (defaults to: nil) + + + — +

    The title of the notification. +When nil, it defaults to openHAB inside the Android and iOS apps.

    +
    + +
  • + +
  • + + id + + + (String, nil) + + + (defaults to: nil) + + + — +

    An optional reference ID which can then be used +to hide or update the notification. +Subsequent notifications using the same reference ID will +update/overwrite the existing notification with the same ID.

    +
    + +
  • + +
  • + + on_click + + + (String, nil) + + + (defaults to: nil) + + + — +

    The action to be performed when the user clicks on the notification. +Specified using the action syntax.

    +
    + +
  • + +
  • + + attachment + + + (String, Item, nil) + + + (defaults to: nil) + + + — +

    The URL of the media attachment to be displayed with the notification. +This can either be a fully qualified URL, prefixed with +http:// or https:// and reachable by the client device, +a relative path on the user's openHAB instance starting with /, +or an image item.

    +
    + +
  • + +
  • + + buttons + + + (Array<String>, Hash<String, String>, nil) + + + (defaults to: nil) + + + — +

    Buttons to include in the notification.

    +
      +
    • In array form, each element is specified as Title=$action, where $action follows the +action syntax.
    • +
    • In hash form, the keys are the button titles and the values are the actions.
    • +
    +

    The maximum number of buttons is 3.

    +
    + +
  • + +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+
+
# File 'lib/openhab/core/actions/notification.rb', line 69
+
+def send(
+  msg,
+  email: nil,
+  icon: nil,
+  tag: nil,
+  severity: nil,
+  id: nil,
+  title: nil,
+  on_click: nil,
+  attachment: nil,
+  buttons: nil
+)
+  unless Actions.const_defined?(:NotificationAction)
+    raise NotImplementedError, "NotificationAction is not available. Please install the openHAB Cloud addon."
+  end
+
+  args = []
+  if email
+    args.push(:send_notification, email)
+  else
+    args.push(:send_broadcast_notification)
+  end
+  tag ||= severity
+  args.push(msg.to_s, icon&.to_s, tag&.to_s)
+
+  # @deprecated OH 4.1
+  if Core.version >= Core::V4_2
+    buttons ||= []
+    buttons = buttons.map { |title, action| "#{title}=#{action}" } if buttons.is_a?(Hash)
+    raise ArgumentError, "buttons must contain (0..3) elements." unless (0..3).cover?(buttons.size)
+
+    attachment = "item:#{attachment.name}" if attachment.is_a?(Item) && attachment.image_item?
+
+    args.push(title&.to_s,
+              id&.to_s,
+              on_click&.to_s,
+              attachment&.to_s,
+              buttons[0]&.to_s,
+              buttons[1]&.to_s,
+              buttons[2]&.to_s)
+  end
+
+  NotificationAction.__send__(*args)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Actions/Ping.html b/5.33/OpenHAB/Core/Actions/Ping.html new file mode 100644 index 0000000000..ba4f9b1f47 --- /dev/null +++ b/5.33/OpenHAB/Core/Actions/Ping.html @@ -0,0 +1,3768 @@ + + + + + + + Class: OpenHAB::Core::Actions::Ping + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Actions::Ping + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/actions/ping.rb
+
+ +
+ +

Overview

+
+ + +
+
+
+ + +

See Also:

+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + + + + +
+

Class Method Details

+ + +
+

+ + .check_vitality(host, port = nil, timeout = nil) ⇒ true, false + + + + + +

+
+

Checks the vitality of host.

+

If port is nil, a regular ping is issued. If other ports are +specified we try to open a new Socket with the given timeout.

+ + +
+
+
+

Parameters:

+
    + +
  • + + host + + + (String) + + + +
  • + +
  • + + port + + + (int, nil) + + + (defaults to: nil) + + +
  • + +
  • + + timeout + + + (Duration, Integer, nil) + + + (defaults to: nil) + + + — +

    Connect timeout (in milliseconds, if given as an Integer)

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+20
+21
+22
+23
+24
+25
+
+
# File 'lib/openhab/core/actions/ping.rb', line 20
+
+def check_vitality(host, port = nil, timeout = nil)
+  port ||= 0
+  timeout ||= 0
+  timeout = timeout.to_millis if timeout.is_a?(Duration)
+  checkVitality(host, port, timeout)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Actions/Transformation.html b/5.33/OpenHAB/Core/Actions/Transformation.html new file mode 100644 index 0000000000..cc264c22a8 --- /dev/null +++ b/5.33/OpenHAB/Core/Actions/Transformation.html @@ -0,0 +1,3781 @@ + + + + + + + Class: OpenHAB::Core::Actions::Transformation + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Actions::Transformation + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/actions/transformation.rb
+
+ +
+ +

Overview

+
+ + +
+
+ + + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + + + + +
+

Class Method Details

+ + +
+

+ + .transform(type, function, value) ⇒ String + + + + + +

+
+

Applies a transformation of a given type with some function to a value.

+ + +
+
+
+ +
+

Examples:

+ + +

Run a transformation

+

+ +
transform(:map, "myfan.map", 0)
+ +
+

Parameters:

+
    + +
  • + + type + + + (String, Symbol) + + + + — +

    The transformation type, e.g. REGEX +or MAP

    +
    + +
  • + +
  • + + function + + + (String, Symbol) + + + + — +

    The function to call. This value depends +on the transformation type

    +
    + +
  • + +
  • + + value + + + (String) + + + + — +

    The value to apply the transformation to

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    the transformed value, or the original value if an error occurred

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+25
+26
+27
+
+
# File 'lib/openhab/core/actions/transformation.rb', line 25
+
+def transform(type, function, value)
+  raw_transform(type.to_s.upcase, function.to_s, value.to_s)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Actions/Voice.html b/5.33/OpenHAB/Core/Actions/Voice.html new file mode 100644 index 0000000000..083ca4b7c0 --- /dev/null +++ b/5.33/OpenHAB/Core/Actions/Voice.html @@ -0,0 +1,3788 @@ + + + + + + + Class: OpenHAB::Core::Actions::Voice + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Actions::Voice + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/actions/voice.rb
+
+ +
+ +

Overview

+
+ + +
+
+
+ + +

See Also:

+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + + + + +
+

Class Method Details

+ + +
+

+ + .say(text, voice: nil, sink: nil, volume: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Say text via openHAB Text-To-Speech service, Voice.say()

+ + +
+
+
+ +
+

Examples:

+ + +

Run the TTS engine and output to the default audio sink.

+

+ +
rule 'Say the time every hour' do
+  every :hour
+  run { Voice.say "The time is #{TimeOfDay.now}" }
+end
+ +
+

Parameters:

+
    + +
  • + + text + + + (String) + + + + — +

    The text to say

    +
    + +
  • + +
  • + + voice + + + (String) + + + (defaults to: nil) + + + — +

    Specify a particular voice to use

    +
    + +
  • + +
  • + + sink + + + (String) + + + (defaults to: nil) + + + — +

    Specify a particular sink to output the speech

    +
    + +
  • + +
  • + + volume + + + (PercentType) + + + (defaults to: nil) + + + — +

    Specify the volume for the speech

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+28
+29
+30
+31
+
+
# File 'lib/openhab/core/actions/voice.rb', line 28
+
+def say(text, voice: nil, sink: nil, volume: nil)
+  volume = PercentType.new(volume) unless volume.is_a?(PercentType) || volume.nil?
+  raw_say(text.to_s, voice&.to_s, sink&.to_s, volume)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Configuration.html b/5.33/OpenHAB/Core/Configuration.html new file mode 100644 index 0000000000..368fd00c68 --- /dev/null +++ b/5.33/OpenHAB/Core/Configuration.html @@ -0,0 +1,3647 @@ + + + + + + + Class: OpenHAB::Core::Configuration + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Configuration + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
EmulateHash
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/configuration.rb
+
+ +
+ +

Overview

+
+

Configuration represents openHAB's org.openhab.core.config.core.Configuration data +with the full interface of Hash.

+

All keys are converted to strings.

+ + +
+
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update, #update!

+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/DTO.html b/5.33/OpenHAB/Core/DTO.html new file mode 100644 index 0000000000..399840f098 --- /dev/null +++ b/5.33/OpenHAB/Core/DTO.html @@ -0,0 +1,3614 @@ + + + + + + + Module: OpenHAB::Core::DTO + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::DTO + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/dto.rb,
+ lib/openhab/core/dto/thing.rb,
lib/openhab/core/dto/item_channel_link.rb
+
+
+ +
+ +

Overview

+
+

Contains data transfer objects that represent other openHAB objects +when they need to be represented with simple classes, such as for JSON +responses, or when being attached to events sent over the event bus.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + + + Classes: AbstractThingDTO, ItemChannelLinkDTO + + +

+ + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/DTO/AbstractThingDTO.html b/5.33/OpenHAB/Core/DTO/AbstractThingDTO.html new file mode 100644 index 0000000000..7e11ceffa9 --- /dev/null +++ b/5.33/OpenHAB/Core/DTO/AbstractThingDTO.html @@ -0,0 +1,3861 @@ + + + + + + + Class: OpenHAB::Core::DTO::AbstractThingDTO + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::DTO::AbstractThingDTO + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/dto/thing.rb
+
+ +
+ +

Overview

+
+

Adds methods to core openHAB AbstractThingDTO to make it more natural in Ruby

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #bridge_uidString? (readonly) + + + + + +

+
+

The Bridge's UID

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+23
+
+
# File 'lib/openhab/core/dto/thing.rb', line 23
+
+alias_method :bridge_uid, :bridgeUID
+
+
+ + + +
+

+ + #thing_type_uidString (readonly) + + + + + +

+
+

The thing type's UID

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+18
+
+
# File 'lib/openhab/core/dto/thing.rb', line 18
+
+alias_method :thing_type_uid, :thingTypeUID
+
+
+ + + +
+

+ + #uidString (readonly) + + + + + +

+
+

The thing's UID

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+13
+
+
# File 'lib/openhab/core/dto/thing.rb', line 13
+
+alias_method :uid, :UID
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/DTO/ItemChannelLinkDTO.html b/5.33/OpenHAB/Core/DTO/ItemChannelLinkDTO.html new file mode 100644 index 0000000000..14f4eafd9f --- /dev/null +++ b/5.33/OpenHAB/Core/DTO/ItemChannelLinkDTO.html @@ -0,0 +1,3974 @@ + + + + + + + Class: OpenHAB::Core::DTO::ItemChannelLinkDTO + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::DTO::ItemChannelLinkDTO + + + +

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

Overview

+
+

Adds methods to core openHAB ItemChannelLinkDTO to make it more natural in Ruby

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #channel_uid ⇒ Things::ChannelUID + + + + + + + + + readonly + + + + + + + + + +

    The UID of the channel that was linked or unlinked.

    +
    + +
  • + + +
  • + + + #item ⇒ Item + + + + + + + + + readonly + + + + + + + + + +

    The item that was linked or unlinked.

    +
    + +
  • + + +
  • + + + #item_name ⇒ String + + + + + + + + + readonly + + + + + + + + + +

    The name of the item that was linked or unlinked.

    +
    + +
  • + + +
+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #channel_uidThings::ChannelUID (readonly) + + + + + +

+
+

Returns The UID of the channel that was linked or unlinked.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Things::ChannelUID) + + + + — +

    The UID of the channel that was linked or unlinked.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+27
+28
+29
+
+
# File 'lib/openhab/core/dto/item_channel_link.rb', line 27
+
+def channel_uid
+  Things::ChannelUID.new(channelUID)
+end
+
+
+ + + +
+

+ + #itemItem (readonly) + + + + + +

+
+

Returns The item that was linked or unlinked.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Item) + + + + — +

    The item that was linked or unlinked

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+19
+20
+21
+
+
# File 'lib/openhab/core/dto/item_channel_link.rb', line 19
+
+def item
+  EntityLookup.lookup_item(itemName)
+end
+
+
+ + + +
+

+ + #item_nameString (readonly) + + + + + +

+
+

Returns The name of the item that was linked or unlinked.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    The name of the item that was linked or unlinked.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/dto/item_channel_link.rb', line 10
+
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #to_sString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+32
+33
+34
+
+
# File 'lib/openhab/core/dto/item_channel_link.rb', line 32
+
+def to_s
+  "#{item_name} -> #{channelUID}"
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/EmulateHash.html b/5.33/OpenHAB/Core/EmulateHash.html new file mode 100644 index 0000000000..5e23b36872 --- /dev/null +++ b/5.33/OpenHAB/Core/EmulateHash.html @@ -0,0 +1,3647 @@ + + + + + + + Module: OpenHAB::Core::EmulateHash + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::EmulateHash + + + +

+
+ + + + + + +
+
Includes:
+
Enumerable
+
+ + + + +
+
Included in:
+
Configuration, Items::Metadata::Hash, Items::Metadata::NamespaceHash
+
+ + + +
+
Defined in:
+
lib/openhab/core/emulate_hash.rb
+
+ +
+ +

Overview

+
+

Make a class acts like a Ruby Hash that supports indifferent keys.

+

Methods that accepts keys will convert symbolic keys to string keys, but only shallowly. +This key indifference does not extend to Hash return values, however. +Hash return values will behave like a normal Hash +which treats symbolic and string keys differently.

+

The including class must implement at least:

+
    +
  • #to_map to provide the hash-like data
  • +
  • #replace
  • +
  • #store
  • +
  • Other methods and mutators as applicable to the underlying storage.
  • +
+ + +
+
+
+ + +
+ + + + + + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update!

+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/EntityLookup.html b/5.33/OpenHAB/Core/EntityLookup.html new file mode 100644 index 0000000000..7efdaf4733 --- /dev/null +++ b/5.33/OpenHAB/Core/EntityLookup.html @@ -0,0 +1,3948 @@ + + + + + + + Module: OpenHAB::Core::EntityLookup + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::EntityLookup + + + +

+
+ + + + + + + + + +
+
Included in:
+
DSL, DSL::Items::Builder, DSL::Items::ItemBuilder, DSL::Rules::Builder, DSL::Rules::BuilderDSL, DSL::Sitemaps::WidgetBuilder
+
+ + + +
+
Defined in:
+
lib/openhab/core/entity_lookup.rb
+
+ +
+ +

Overview

+
+ +
+ Note: +

Thing UIDs are separated by a colon :. Since it is not a valid symbol for an identifier, +it must be replaced with an underscore _. So to access astro:sun:home, use astro_sun_home +as an alternative to things["astro:sun:home"]

+
+
+ +

Manages access to openHAB entities

+

You can access openHAB items and things directly using their name, anywhere EntityLookup is available.

+ + +
+
+
+ +
+

Examples:

+ + +

Accessing Items and Groups

+

+ +
gAll_Lights       # Access the gAll_Lights group. It is the same as items["gAll_Lights"]
+Kitchen_Light.on  # The openHAB object for the Kitchen_Light item and send an ON command
+ + +

Accessing Things

+

+ +
smtp_mail_local.send_mail('me@example.com', 'Subject', 'Dear Person, ...')
+# Is equivalent to:
+things['smtp:mail:local'].send_mail('me@example.com', 'Subject', 'Dear Person, ...')
+ +
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + +
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + +

+ +
+

+ + #method_missingItem, ... + + + + + +

+
+

Automatically looks up openHAB items and things in appropriate registries

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+126
+127
+128
+129
+130
+131
+132
+133
+
+
# File 'lib/openhab/core/entity_lookup.rb', line 126
+
+ruby2_keywords def method_missing(method, *args)
+  return super unless args.empty? && !block_given?
+
+  logger.trace { "method missing, performing openHAB Lookup for: #{method}" }
+  EntityLookup.lookup_entity(method,
+                             create_dummy_items: self.class.respond_to?(:create_dummy_items?) &&
+                               self.class.create_dummy_items?) || super
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #itemsCore::Items::Registry + + + + + +

+
+

Fetches all items from the item registry

+

The examples all assume the following items exist.

+
Dimmer DimmerTest "Test Dimmer"
+Switch SwitchTest "Test Switch"
+
+ + +
+
+
+ +
+

Examples:

+ + +
logger.info("Item Count: #{items.count}")  # Item Count: 2
+logger.info("Items: #{items.map(&:label).sort.join(', ')}")  # Items: Test Dimmer, Test Switch'
+logger.info("DimmerTest exists? #{items.key?('DimmerTest')}") # DimmerTest exists? true
+logger.info("StringTest exists? #{items.key?('StringTest')}") # StringTest exists? false
+ + +
rule 'Use dynamic item lookup to increase related dimmer brightness when switch is turned on' do
+  changed SwitchTest, to: ON
+  triggered { |item| items[item.name.gsub('Switch','Dimmer')].brighten(10) }
+end
+ + +
rule 'search for a suitable item' do
+  on_load
+  triggered do
+    # Send ON to DimmerTest if it exists, otherwise send it to SwitchTest
+    (items['DimmerTest'] || items['SwitchTest'])&.on
+  end
+end
+ +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+99
+100
+101
+
+
# File 'lib/openhab/core/entity_lookup.rb', line 99
+
+def items
+  Core::Items::Registry.instance
+end
+
+
+ +
+

+ + #thingsCore::Things::Registry + + + + + +

+
+

Get all things known to openHAB

+ + +
+
+
+ +
+

Examples:

+ + +
things.each { |thing| logger.info("Thing: #{thing.uid}")}
+logger.info("Thing: #{things['astro:sun:home'].uid}")
+homie_things = things.select { |t| t.thing_type_uid == "mqtt:homie300" }
+zwave_things = things.select { |t| t.binding_id == "zwave" }
+homeseer_dimmers = zwave_things.select { |t| t.thing_type_uid.id == "homeseer_hswd200_00_000" }
+things['zwave:device:512:node90'].uid.bridge_ids # => ["512"]
+things['mqtt:topic:4'].uid.bridge_ids # => []
+ +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+117
+118
+119
+
+
# File 'lib/openhab/core/entity_lookup.rb', line 117
+
+def things
+  Core::Things::Registry.instance
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events.html b/5.33/OpenHAB/Core/Events.html new file mode 100644 index 0000000000..c70ebb1bd0 --- /dev/null +++ b/5.33/OpenHAB/Core/Events.html @@ -0,0 +1,3630 @@ + + + + + + + Module: OpenHAB::Core::Events + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Events + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events.rb,
+ lib/openhab/core/events/item_event.rb,
lib/openhab/core/events/timer_event.rb,
lib/openhab/core/events/abstract_event.rb,
lib/openhab/core/events/item_state_event.rb,
lib/openhab/core/events/startlevel_event.rb,
lib/openhab/core/events/item_command_event.rb,
lib/openhab/core/events/channel_triggered_event.rb,
lib/openhab/core/events/thing_status_info_event.rb,
lib/openhab/core/events/item_state_changed_event.rb,
lib/openhab/core/events/item_state_updated_event.rb,
lib/openhab/core/events/abstract_item_registry_event.rb,
lib/openhab/core/events/abstract_thing_registry_event.rb,
lib/openhab/core/events/item_time_series_updated_event.rb,
lib/openhab/core/events/abstract_item_channel_link_registry_event.rb
+
+
+ +
+ +

Overview

+
+

Contains objects sent to event handlers containing context around the +triggered event.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: ItemState + + + + Classes: AbstractEvent, AbstractItemChannelLinkRegistryEvent, AbstractItemRegistryEvent, AbstractThingRegistryEvent, ChannelTriggeredEvent, ItemAddedEvent, ItemChannelLinkAddedEvent, ItemChannelLinkRemovedEvent, ItemCommandEvent, ItemEvent, ItemRemovedEvent, ItemStateChangedEvent, ItemStateEvent, ItemStateUpdatedEvent, ItemTimeSeriesUpdatedEvent, ItemUpdatedEvent, StartlevelEvent, ThingAddedEvent, ThingRemovedEvent, ThingStatusInfoChangedEvent, ThingStatusInfoEvent, ThingUpdatedEvent, TimerEvent + + +

+ + +

+ Constant Summary + collapse +

+ +
+ +
ItemEventFactory = + +
+
org.openhab.core.items.events.ItemEventFactory
+ +
+ + + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/AbstractEvent.html b/5.33/OpenHAB/Core/Events/AbstractEvent.html new file mode 100644 index 0000000000..99fc9c8021 --- /dev/null +++ b/5.33/OpenHAB/Core/Events/AbstractEvent.html @@ -0,0 +1,4049 @@ + + + + + + + Class: OpenHAB::Core::Events::AbstractEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::AbstractEvent + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/abstract_event.rb
+
+ +
+ +

Overview

+
+

Add attachments event data.

+ + +
+
+
+ + +
+ + + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #attachmentObject + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + +
  • + +
+ +
+ + + + +
+
+
+
+11
+12
+13
+
+
# File 'lib/openhab/core/events/abstract_event.rb', line 11
+
+def attachment
+  @attachment
+end
+
+
+ + + +
+

+ + #inputsHash + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash) + + + +
  • + +
+ +
+ + + + +
+
+
+
+14
+15
+16
+
+
# File 'lib/openhab/core/events/abstract_event.rb', line 14
+
+def inputs
+  @inputs
+end
+
+
+ + + +
+

+ + #sourceString (readonly) + + + + + +

+
+

Returns The component that sent the event.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    The component that sent the event.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/abstract_event.rb', line 16
+
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+31
+32
+33
+34
+35
+
+
# File 'lib/openhab/core/events/abstract_event.rb', line 31
+
+def inspect
+  s = "#<OpenHAB::Core::Events::#{self.class.simple_name} topic=#{topic} payload=#{payload.inspect}"
+  s += " source=#{source.inspect}" if source
+  "#{s}>"
+end
+
+
+ +
+

+ + #payloadHash? + + + + + +

+
+

Returns the event payload as a Hash.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash, nil) + + + + — +

    The payload object parsed by JSON. The keys are symbolized. +nil when the payload is empty.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+25
+26
+27
+28
+
+
# File 'lib/openhab/core/events/abstract_event.rb', line 25
+
+def payload
+  require "json"
+  @payload ||= JSON.parse(get_payload, symbolize_names: true) unless get_payload.empty?
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/AbstractItemChannelLinkRegistryEvent.html b/5.33/OpenHAB/Core/Events/AbstractItemChannelLinkRegistryEvent.html new file mode 100644 index 0000000000..5b6f4e87c2 --- /dev/null +++ b/5.33/OpenHAB/Core/Events/AbstractItemChannelLinkRegistryEvent.html @@ -0,0 +1,3731 @@ + + + + + + + Class: OpenHAB::Core::Events::AbstractItemChannelLinkRegistryEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::AbstractItemChannelLinkRegistryEvent + + + +

+
+ +
+
Inherits:
+
+ AbstractEvent + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/abstract_item_channel_link_registry_event.rb
+
+ +
+ +

Overview

+
+

The AbstractEvent sent when an Things::ItemChannelLink is added or removed +from its registry.

+ + +
+
+
+ + +
+ + + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractEvent

+

#inspect, #payload

+ +
+

Instance Attribute Details

+ + + +
+
+
+

Returns The link that triggered this event.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+17
+
+
# File 'lib/openhab/core/events/abstract_item_channel_link_registry_event.rb', line 17
+
+class AbstractItemChannelLinkRegistryEvent < AbstractEvent; end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/AbstractItemRegistryEvent.html b/5.33/OpenHAB/Core/Events/AbstractItemRegistryEvent.html new file mode 100644 index 0000000000..09837a8a43 --- /dev/null +++ b/5.33/OpenHAB/Core/Events/AbstractItemRegistryEvent.html @@ -0,0 +1,3731 @@ + + + + + + + Class: OpenHAB::Core::Events::AbstractItemRegistryEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::AbstractItemRegistryEvent + + + +

+
+ +
+
Inherits:
+
+ AbstractEvent + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/abstract_item_registry_event.rb
+
+ +
+ +

Overview

+
+

The AbstractEvent sent when an Item is added, updated, or removed +from its registry.

+ + +
+
+
+ + +
+

Direct Known Subclasses

+

ItemAddedEvent, ItemRemovedEvent, ItemUpdatedEvent

+
+ + + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #item ⇒ DTO::ItemDTO + + + + + + + + + readonly + + + + + + + + + +

    The item that triggered this event.

    +
    + +
  • + + +
+ + + + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractEvent

+

#inspect, #payload

+ +
+

Instance Attribute Details

+ + + +
+

+ + #itemDTO::ItemDTO (readonly) + + + + + +

+
+

Returns The item that triggered this event.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (DTO::ItemDTO) + + + + — +

    The item that triggered this event.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+18
+
+
# File 'lib/openhab/core/events/abstract_item_registry_event.rb', line 18
+
+class AbstractItemRegistryEvent < AbstractEvent; end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/AbstractThingRegistryEvent.html b/5.33/OpenHAB/Core/Events/AbstractThingRegistryEvent.html new file mode 100644 index 0000000000..71e5e0deae --- /dev/null +++ b/5.33/OpenHAB/Core/Events/AbstractThingRegistryEvent.html @@ -0,0 +1,3731 @@ + + + + + + + Class: OpenHAB::Core::Events::AbstractThingRegistryEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::AbstractThingRegistryEvent + + + +

+
+ +
+
Inherits:
+
+ AbstractEvent + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/abstract_thing_registry_event.rb
+
+ +
+ +

Overview

+
+

The AbstractEvent sent when a Thing is added, +updated, or removed from its registry.

+ + +
+
+
+ + +
+

Direct Known Subclasses

+

ThingAddedEvent, ThingRemovedEvent, ThingUpdatedEvent

+
+ + + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractEvent

+

#inspect, #payload

+ +
+

Instance Attribute Details

+ + + +
+

+ + #thingDTO::AbstractThingDTO (readonly) + + + + + +

+
+

Returns The thing that triggered this event.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+19
+
+
# File 'lib/openhab/core/events/abstract_thing_registry_event.rb', line 19
+
+class AbstractThingRegistryEvent < AbstractEvent; end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/ChannelTriggeredEvent.html b/5.33/OpenHAB/Core/Events/ChannelTriggeredEvent.html new file mode 100644 index 0000000000..20821f09db --- /dev/null +++ b/5.33/OpenHAB/Core/Events/ChannelTriggeredEvent.html @@ -0,0 +1,4077 @@ + + + + + + + Class: OpenHAB::Core::Events::ChannelTriggeredEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::ChannelTriggeredEvent + + + +

+
+ +
+
Inherits:
+
+ AbstractEvent + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/channel_triggered_event.rb
+
+ +
+ +

Overview

+
+

AbstractEvent sent when a channel triggers.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods inherited from AbstractEvent

+

#payload

+ +
+

Instance Attribute Details

+ + + +
+

+ + #channelThings::Channel? (readonly) + + + + + +

+
+

Returns The channel that triggered this event.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Things::Channel, nil) + + + + — +

    The channel that triggered this event.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/channel_triggered_event.rb', line 18
+
+
+
+
+ + + +
+

+ + #channel_uidThings::ChannelUID (readonly) + + + + + +

+
+

Returns The UID of the Channel that triggered this event.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+16
+
+
# File 'lib/openhab/core/events/channel_triggered_event.rb', line 16
+
+alias_method :channel_uid, :get_channel
+
+
+ + + +
+

+ + #eventString (readonly) + + + + + +

+
+

Returns The event data.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    The event data

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/channel_triggered_event.rb', line 25
+
+
+
+
+ + + +
+

+ + #thingThings::Thing? (readonly) + + + + + +

+
+

Returns The thing that triggered this event.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Things::Thing, nil) + + + + — +

    The thing that triggered this event.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+23
+
+
# File 'lib/openhab/core/events/channel_triggered_event.rb', line 23
+
+def_delegators :channel_uid, :thing, :channel
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+29
+30
+31
+32
+33
+
+
# File 'lib/openhab/core/events/channel_triggered_event.rb', line 29
+
+def inspect
+  s = "#<OpenHAB::Core::Events::ChannelTriggeredEvent channel=#{channel} event=#{event.inspect}"
+  s += " source=#{source.inspect}" if source
+  "#{s}>"
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/ItemAddedEvent.html b/5.33/OpenHAB/Core/Events/ItemAddedEvent.html new file mode 100644 index 0000000000..9a39092123 --- /dev/null +++ b/5.33/OpenHAB/Core/Events/ItemAddedEvent.html @@ -0,0 +1,3645 @@ + + + + + + + Class: OpenHAB::Core::Events::ItemAddedEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::ItemAddedEvent + + + +

+
+ +
+
Inherits:
+
+ AbstractItemRegistryEvent + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/abstract_item_registry_event.rb
+
+ +
+ +

Overview

+
+

The AbstractEvent sent with an item_added trigger.

+ + +
+
+
+ + +
+ + + + + +

Instance Attribute Summary

+ +

Attributes inherited from AbstractItemRegistryEvent

+

#item

+ + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractEvent

+

#inspect, #payload

+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/ItemChannelLinkAddedEvent.html b/5.33/OpenHAB/Core/Events/ItemChannelLinkAddedEvent.html new file mode 100644 index 0000000000..555caa7844 --- /dev/null +++ b/5.33/OpenHAB/Core/Events/ItemChannelLinkAddedEvent.html @@ -0,0 +1,3645 @@ + + + + + + + Class: OpenHAB::Core::Events::ItemChannelLinkAddedEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::ItemChannelLinkAddedEvent + + + +

+
+ +
+
Inherits:
+
+ AbstractItemChannelLinkRegistryEvent + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/abstract_item_channel_link_registry_event.rb
+
+ +
+ +

Overview

+
+

The AbstractEvent sent with an channel_linked trigger.

+ + +
+
+
+ + +
+ + + + + +

Instance Attribute Summary

+ +

Attributes inherited from AbstractItemChannelLinkRegistryEvent

+

#link

+ + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractEvent

+

#inspect, #payload

+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/ItemChannelLinkRemovedEvent.html b/5.33/OpenHAB/Core/Events/ItemChannelLinkRemovedEvent.html new file mode 100644 index 0000000000..2291ee7369 --- /dev/null +++ b/5.33/OpenHAB/Core/Events/ItemChannelLinkRemovedEvent.html @@ -0,0 +1,3645 @@ + + + + + + + Class: OpenHAB::Core::Events::ItemChannelLinkRemovedEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::ItemChannelLinkRemovedEvent + + + +

+
+ +
+
Inherits:
+
+ AbstractItemChannelLinkRegistryEvent + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/abstract_item_channel_link_registry_event.rb
+
+ +
+ +

Overview

+
+

The AbstractEvent sent with an channel_unlinked trigger.

+ + +
+
+
+ + +
+ + + + + +

Instance Attribute Summary

+ +

Attributes inherited from AbstractItemChannelLinkRegistryEvent

+

#link

+ + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractEvent

+

#inspect, #payload

+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/ItemCommandEvent.html b/5.33/OpenHAB/Core/Events/ItemCommandEvent.html new file mode 100644 index 0000000000..df987ebb62 --- /dev/null +++ b/5.33/OpenHAB/Core/Events/ItemCommandEvent.html @@ -0,0 +1,4915 @@ + + + + + + + Class: OpenHAB::Core::Events::ItemCommandEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::ItemCommandEvent + + + +

+
+ +
+
Inherits:
+
+ ItemEvent + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/item_command_event.rb
+
+ +
+ +

Overview

+
+

AbstractEvent sent when an item receives a command.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #command ⇒ Command + + + + + + + + + readonly + + + + + + + + + +

    The command sent to the item.

    +
    + +
  • + + +
+ + + + + +

Attributes inherited from ItemEvent

+

#group, #item

+ + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods inherited from AbstractEvent

+

#payload

+ +
+

Instance Attribute Details

+ + + +
+

+ + #commandCommand (readonly) + + + + + +

+
+

Returns The command sent to the item.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Command) + + + + — +

    The command sent to the item.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+14
+
+
# File 'lib/openhab/core/events/item_command_event.rb', line 14
+
+alias_method :command, :item_command
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #decrease?true, false + + + + + +

+
+

Check if #command is DECREASE

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_command_event.rb', line 48
+
+
+
+
+ +
+

+ + #down?true, false + + + + + +

+
+

Check if #command is (implicitly convertible to) DOWN

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_command_event.rb', line 32
+
+
+
+
+ +
+

+ + #fast_forward?true, false + + + + + +

+
+

Check if #command is FASTFORWARD

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_command_event.rb', line 64
+
+
+
+
+ +
+

+ + #increase?true, false + + + + + +

+
+

Check if #command is INCREASE

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_command_event.rb', line 44
+
+
+
+
+ +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+77
+78
+79
+80
+81
+
+
# File 'lib/openhab/core/events/item_command_event.rb', line 77
+
+def inspect
+  s = "#<OpenHAB::Core::Events::ItemCommandEvent item=#{itemName} command=#{command.inspect}"
+  s += " source=#{source.inspect}" if source
+  "#{s}>"
+end
+
+
+ +
+

+ + #move?true, false + + + + + +

+
+

Check if #command is MOVE

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_command_event.rb', line 40
+
+
+
+
+ +
+

+ + #next?true, false + + + + + +

+
+

Check if #command is NEXT

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_command_event.rb', line 68
+
+
+
+
+ +
+

+ + #off?true, false + + + + + +

+
+

Check if #command is (implicitly convertible to) OFF

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_command_event.rb', line 24
+
+
+
+
+ +
+

+ + #on?true, false + + + + + +

+
+

Check if #command is (implicitly convertible to) ON

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_command_event.rb', line 20
+
+
+
+
+ +
+

+ + #pause?true, false + + + + + +

+
+

Check if #command is PAUSE

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_command_event.rb', line 56
+
+
+
+
+ +
+

+ + #play?true, false + + + + + +

+
+

Check if #command is PLAY

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_command_event.rb', line 52
+
+
+
+
+ +
+

+ + #previous?true, false + + + + + +

+
+

Check if #command is PREVIOUS

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_command_event.rb', line 72
+
+
+
+
+ +
+

+ + #refresh?true, false + + + + + +

+
+

Check if #command is REFRESH

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_command_event.rb', line 16
+
+
+
+
+ +
+

+ + #rewind?true, false + + + + + +

+
+

Check if #command is REWIND

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_command_event.rb', line 60
+
+
+
+
+ +
+

+ + #stop?true, false + + + + + +

+
+

Check if #command is STOP

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_command_event.rb', line 36
+
+
+
+
+ +
+

+ + #up?true, false + + + + + +

+
+

Check if #command is (implicitly convertible to) UP

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_command_event.rb', line 28
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/ItemEvent.html b/5.33/OpenHAB/Core/Events/ItemEvent.html new file mode 100644 index 0000000000..150606674c --- /dev/null +++ b/5.33/OpenHAB/Core/Events/ItemEvent.html @@ -0,0 +1,3851 @@ + + + + + + + Class: OpenHAB::Core::Events::ItemEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::ItemEvent + + + +

+
+ +
+
Inherits:
+
+ AbstractEvent + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/item_event.rb
+
+ +
+ +

Overview

+
+

Adds methods to core openHAB ItemEvent to make it more natural in Ruby

+ + +
+
+
+ + +
+ + + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #group ⇒ Item? + + + + + + + + + readonly + + + + + + + + + +

    Returns the group item whose member had triggered this event.

    +
    + +
  • + + +
  • + + + #item ⇒ Item + + + + + + + + + readonly + + + + + + + + + +

    The item that triggered this event.

    +
    + +
  • + + +
+ + + + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractEvent

+

#inspect, #payload

+ +
+

Instance Attribute Details

+ + + +
+

+ + #groupItem? (readonly) + + + + + +

+
+

Returns the group item whose member had triggered this event.

+

This is the equivalent of openHAB's triggeringGroup, and it is only available +on a member-of-group trigger.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Item, nil) + + + + — +

    The group item whose member had triggered this event. +nil when the event wasn't triggered by a member-of-group trigger.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.0 for file-based rules

    +
    + +
  • + +
  • + + + + + +

    openHAB 4.1 for UI rules

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+34
+35
+36
+37
+
+
# File 'lib/openhab/core/events/item_event.rb', line 34
+
+def group
+  triggering_group = inputs&.[]("triggeringGroup") || Core.ui_context&.[](:triggeringGroup)
+  Items::Proxy.new(triggering_group) if triggering_group
+end
+
+
+ + + +
+

+ + #itemItem (readonly) + + + + + +

+
+

Returns The item that triggered this event.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Item) + + + + — +

    The item that triggered this event.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+16
+17
+18
+
+
# File 'lib/openhab/core/events/item_event.rb', line 16
+
+def item
+  EntityLookup.lookup_item(item_name)
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/ItemRemovedEvent.html b/5.33/OpenHAB/Core/Events/ItemRemovedEvent.html new file mode 100644 index 0000000000..bfb830d11e --- /dev/null +++ b/5.33/OpenHAB/Core/Events/ItemRemovedEvent.html @@ -0,0 +1,3645 @@ + + + + + + + Class: OpenHAB::Core::Events::ItemRemovedEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::ItemRemovedEvent + + + +

+
+ +
+
Inherits:
+
+ AbstractItemRegistryEvent + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/abstract_item_registry_event.rb
+
+ +
+ +

Overview

+
+

The AbstractEvent sent with an item_removed trigger.

+ + +
+
+
+ + +
+ + + + + +

Instance Attribute Summary

+ +

Attributes inherited from AbstractItemRegistryEvent

+

#item

+ + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractEvent

+

#inspect, #payload

+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/ItemState.html b/5.33/OpenHAB/Core/Events/ItemState.html new file mode 100644 index 0000000000..a0939acad8 --- /dev/null +++ b/5.33/OpenHAB/Core/Events/ItemState.html @@ -0,0 +1,4598 @@ + + + + + + + Module: OpenHAB::Core::Events::ItemState + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Events::ItemState + + + +

+
+ + + + + + + + + +
+
Included in:
+
ItemStateChangedEvent, ItemStateEvent, ItemStateUpdatedEvent
+
+ + + +
+
Defined in:
+
lib/openhab/core/events/item_state_event.rb
+
+ +
+ +

Overview

+
+

Helpers common to ItemStateEvent and ItemStateChangedEvent.

+

Methods that refer to implicit conversion mean that for example +a PercentType of 100% will be true for #on?, etc.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #state ⇒ State? + + + + + + + + + readonly + + + + + + + + + +

    The state of the item if it is not UNDEF or NULL, nil otherwise.

    +
    + +
  • + + +
+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #stateState? (readonly) + + + + + +

+
+

Returns the state of the item if it is not UNDEF or NULL, nil otherwise.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (State, nil) + + + + — +

    the state of the item if it is not UNDEF or NULL, nil otherwise.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+68
+69
+70
+
+
# File 'lib/openhab/core/events/item_state_event.rb', line 68
+
+def state
+  item_state if state?
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #closed?true, false + + + + + +

+
+

Check if #state is (implicitly convertible to) CLOSED

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_event.rb', line 43
+
+
+
+
+ +
+

+ + #down?true, false + + + + + +

+
+

Check if #state is (implicitly convertible to) DOWN

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_event.rb', line 35
+
+
+
+
+ +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+73
+74
+75
+76
+77
+
+
# File 'lib/openhab/core/events/item_state_event.rb', line 73
+
+def inspect
+  s = "#<OpenHAB::Core::Events::#{self.class.simple_name} item=#{item_name} state=#{item_state.inspect}"
+  s += " source=#{source.inspect}" if source
+  "#{s}>"
+end
+
+
+ +
+

+ + #null?true, false + + + + + +

+
+

Check if #state is NULL

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_event.rb', line 19
+
+
+
+
+ +
+

+ + #off?true, false + + + + + +

+
+

Check if #state is (implicitly convertible to) OFF

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_event.rb', line 27
+
+
+
+
+ +
+

+ + #on?true, false + + + + + +

+
+

Check if #state is (implicitly convertible to) ON

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_event.rb', line 23
+
+
+
+
+ +
+

+ + #open?true, false + + + + + +

+
+

Check if #state is (implicitly convertible to) OPEN

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_event.rb', line 39
+
+
+
+
+ +
+

+ + #paused?true, false + + + + + +

+
+

Check if #state is PAUSE

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_event.rb', line 51
+
+
+
+
+ +
+

+ + #playing?true, false + + + + + +

+
+

Check if #state is PLAY

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_event.rb', line 47
+
+
+
+
+ +
+

+ + #state?true, false + + + + + +

+
+

Check if #state is defined (not UNDEF or NULL)

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+60
+61
+62
+
+
# File 'lib/openhab/core/events/item_state_event.rb', line 60
+
+def state?
+  !item_state.is_a?(UnDefType)
+end
+
+
+ +
+

+ + #undef?true, false + + + + + +

+
+

Check if #state is UNDEF

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_event.rb', line 15
+
+
+
+
+ +
+

+ + #up?true, false + + + + + +

+
+

Check if #state is (implicitly convertible to) UP

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_event.rb', line 31
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/ItemStateChangedEvent.html b/5.33/OpenHAB/Core/Events/ItemStateChangedEvent.html new file mode 100644 index 0000000000..f45e166deb --- /dev/null +++ b/5.33/OpenHAB/Core/Events/ItemStateChangedEvent.html @@ -0,0 +1,4658 @@ + + + + + + + Class: OpenHAB::Core::Events::ItemStateChangedEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::ItemStateChangedEvent + + + +

+
+ +
+
Inherits:
+
+ ItemEvent + + + show all + +
+
+ + + + + + +
+
Includes:
+
ItemState
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/events/item_state_changed_event.rb
+
+ +
+ +

Overview

+
+

AbstractEvent sent when an item's state has changed.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #was ⇒ State? + + + + + + + + + readonly + + + + + + + + + +

    The prior state of the item if it was not UNDEF or NULL, nil otherwise.

    +
    + +
  • + + +
+ + + + + +

Attributes included from ItemState

+

#state

+ + + +

Attributes inherited from ItemEvent

+

#group, #item

+ + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods included from ItemState

+

#closed?, #down?, #null?, #off?, #on?, #open?, #paused?, #playing?, #state?, #undef?, #up?

+ + + + + + + + + + + + + + + +

Methods inherited from AbstractEvent

+

#payload

+ +
+

Instance Attribute Details

+ + + +
+

+ + #wasState? (readonly) + + + + + +

+
+

Returns the prior state of the item if it was not UNDEF or NULL, nil otherwise.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (State, nil) + + + + — +

    the prior state of the item if it was not UNDEF or NULL, nil otherwise.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+69
+70
+71
+
+
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 69
+
+def was
+  old_item_state if was?
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+74
+75
+76
+77
+78
+79
+
+
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 74
+
+def inspect
+  s = "#<OpenHAB::Core::Events::ItemStateChangedEvent item=#{item_name} " \
+      "state=#{item_state.inspect} was=#{old_item_state.inspect}"
+  s += " source=#{source.inspect}" if source
+  "#{s}>"
+end
+
+
+ +
+

+ + #was?true, false + + + + + +

+
+

Check if state was defined (not UNDEF or NULL)

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+61
+62
+63
+
+
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 61
+
+def was?
+  !old_item_state.is_a?(UnDefType)
+end
+
+
+ +
+

+ + #was_closed?true, false + + + + + +

+
+

Check if #was is (implicitly convertible to) CLOSED

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 44
+
+
+
+
+ +
+

+ + #was_down?true, false + + + + + +

+
+

Check if #was is (implicitly convertible to) DOWN

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 36
+
+
+
+
+ +
+

+ + #was_null?true, false + + + + + +

+
+

Check if #was is NULL

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 20
+
+
+
+
+ +
+

+ + #was_off?true, false + + + + + +

+
+

Check if #was is (implicitly convertible to) OFF

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 28
+
+
+
+
+ +
+

+ + #was_on?true, false + + + + + +

+
+

Check if #was is (implicitly convertible to) ON

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 24
+
+
+
+
+ +
+

+ + #was_open?true, false + + + + + +

+
+

Check if #was is (implicitly convertible to) OPEN

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 40
+
+
+
+
+ +
+

+ + #was_paused?true, false + + + + + +

+
+

Check if #was is PAUSE

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 52
+
+
+
+
+ +
+

+ + #was_playing?true, false + + + + + +

+
+

Check if #was is PLAY

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 48
+
+
+
+
+ +
+

+ + #was_undef?true, false + + + + + +

+
+

Check if #was is UNDEF

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 16
+
+
+
+
+ +
+

+ + #was_up?true, false + + + + + +

+
+

Check if #was is (implicitly convertible to) UP

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 32
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/ItemStateEvent.html b/5.33/OpenHAB/Core/Events/ItemStateEvent.html new file mode 100644 index 0000000000..eebf522a51 --- /dev/null +++ b/5.33/OpenHAB/Core/Events/ItemStateEvent.html @@ -0,0 +1,3666 @@ + + + + + + + Class: OpenHAB::Core::Events::ItemStateEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::ItemStateEvent + + + +

+
+ +
+
Inherits:
+
+ ItemEvent + + + show all + +
+
+ + + + + + +
+
Includes:
+
ItemState
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/events/item_state_event.rb
+
+ +
+ +

Overview

+
+

AbstractEvent sent when an item's state is updated (regardless of if it changed or not).

+ + +
+
+
+ + +
+ + + + + +

Instance Attribute Summary

+ +

Attributes included from ItemState

+

#state

+ + + +

Attributes inherited from ItemEvent

+

#group, #item

+ + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + + + + + + + + +

Method Summary

+ +

Methods included from ItemState

+

#closed?, #down?, #inspect, #null?, #off?, #on?, #open?, #paused?, #playing?, #state?, #undef?, #up?

+ + + + + + + + + + + + + + + +

Methods inherited from AbstractEvent

+

#inspect, #payload

+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/ItemStateUpdatedEvent.html b/5.33/OpenHAB/Core/Events/ItemStateUpdatedEvent.html new file mode 100644 index 0000000000..078f4b770d --- /dev/null +++ b/5.33/OpenHAB/Core/Events/ItemStateUpdatedEvent.html @@ -0,0 +1,3681 @@ + + + + + + + Class: OpenHAB::Core::Events::ItemStateUpdatedEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::ItemStateUpdatedEvent + + + +

+
+ +
+
Inherits:
+
+ ItemEvent + + + show all + +
+
+ + + + + + +
+
Includes:
+
ItemState
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/events/item_state_updated_event.rb
+
+ +
+ +

Overview

+
+

AbstractEvent sent when an item's state has updated.

+ + +
+
+
+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.0

    +
    + +
  • + +
+ +
+ + + + + +

Instance Attribute Summary

+ +

Attributes included from ItemState

+

#state

+ + + +

Attributes inherited from ItemEvent

+

#group, #item

+ + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + + + + + + + + +

Method Summary

+ +

Methods included from ItemState

+

#closed?, #down?, #inspect, #null?, #off?, #on?, #open?, #paused?, #playing?, #state?, #undef?, #up?

+ + + + + + + + + + + + + + + +

Methods inherited from AbstractEvent

+

#inspect, #payload

+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/ItemTimeSeriesUpdatedEvent.html b/5.33/OpenHAB/Core/Events/ItemTimeSeriesUpdatedEvent.html new file mode 100644 index 0000000000..525837cc3f --- /dev/null +++ b/5.33/OpenHAB/Core/Events/ItemTimeSeriesUpdatedEvent.html @@ -0,0 +1,3760 @@ + + + + + + + Class: OpenHAB::Core::Events::ItemTimeSeriesUpdatedEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::ItemTimeSeriesUpdatedEvent + + + +

+
+ +
+
Inherits:
+
+ ItemEvent + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/item_time_series_updated_event.rb
+
+ +
+ +

Overview

+
+

AbstractEvent sent when an item received a time series update.

+ + +
+
+
+ + +

See Also:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.1

    +
    + +
  • + +
+ +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from ItemEvent

+

#group, #item

+ + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractEvent

+

#inspect, #payload

+ +
+

Instance Attribute Details

+ + + +
+

+ + #time_seriesTimeSeries (readonly) + + + + + +

+
+

Returns The updated time series.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (TimeSeries) + + + + — +

    The updated time series.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+20
+
+
# File 'lib/openhab/core/events/item_time_series_updated_event.rb', line 20
+
+class ItemTimeSeriesUpdatedEvent < ItemEvent; end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/ItemUpdatedEvent.html b/5.33/OpenHAB/Core/Events/ItemUpdatedEvent.html new file mode 100644 index 0000000000..ad50034dfe --- /dev/null +++ b/5.33/OpenHAB/Core/Events/ItemUpdatedEvent.html @@ -0,0 +1,3738 @@ + + + + + + + Class: OpenHAB::Core::Events::ItemUpdatedEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::ItemUpdatedEvent + + + +

+
+ +
+
Inherits:
+
+ AbstractItemRegistryEvent + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/abstract_item_registry_event.rb
+
+ +
+ +

Overview

+
+

The AbstractEvent sent with an item_updated trigger.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from AbstractItemRegistryEvent

+

#item

+ + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractEvent

+

#inspect, #payload

+ +
+

Instance Attribute Details

+ + + +
+

+ + #old_itemDTO::ItemDTO (readonly) + + + + + +

+
+

Returns the old item before the update.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (DTO::ItemDTO) + + + + — +

    the old item before the update.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+31
+
+
# File 'lib/openhab/core/events/abstract_item_registry_event.rb', line 31
+
+class ItemUpdatedEvent < AbstractItemRegistryEvent; end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/StartlevelEvent.html b/5.33/OpenHAB/Core/Events/StartlevelEvent.html new file mode 100644 index 0000000000..e6626d370b --- /dev/null +++ b/5.33/OpenHAB/Core/Events/StartlevelEvent.html @@ -0,0 +1,3725 @@ + + + + + + + Class: OpenHAB::Core::Events::StartlevelEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::StartlevelEvent + + + +

+
+ +
+
Inherits:
+
+ AbstractEvent + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/startlevel_event.rb
+
+ +
+ +

Overview

+
+

The AbstractEvent sent when the system start level changed.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractEvent

+

#inspect, #payload

+ +
+

Instance Attribute Details

+ + + +
+

+ + #startlevelInteger (readonly) + + + + + +

+
+

Returns The new start level.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    The new start level.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+17
+
+
# File 'lib/openhab/core/events/startlevel_event.rb', line 17
+
+class StartlevelEvent < AbstractEvent; end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/ThingAddedEvent.html b/5.33/OpenHAB/Core/Events/ThingAddedEvent.html new file mode 100644 index 0000000000..9f809358d9 --- /dev/null +++ b/5.33/OpenHAB/Core/Events/ThingAddedEvent.html @@ -0,0 +1,3647 @@ + + + + + + + Class: OpenHAB::Core::Events::ThingAddedEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::ThingAddedEvent + + + +

+
+ +
+
Inherits:
+
+ AbstractThingRegistryEvent + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/abstract_thing_registry_event.rb
+
+ +
+ +

Overview

+
+

The AbstractEvent sent with a +thing_added trigger.

+ + +
+
+
+ + +
+ + + + + +

Instance Attribute Summary

+ +

Attributes inherited from AbstractThingRegistryEvent

+

#thing

+ + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractEvent

+

#inspect, #payload

+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/ThingRemovedEvent.html b/5.33/OpenHAB/Core/Events/ThingRemovedEvent.html new file mode 100644 index 0000000000..d2f5fc0b29 --- /dev/null +++ b/5.33/OpenHAB/Core/Events/ThingRemovedEvent.html @@ -0,0 +1,3647 @@ + + + + + + + Class: OpenHAB::Core::Events::ThingRemovedEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::ThingRemovedEvent + + + +

+
+ +
+
Inherits:
+
+ AbstractThingRegistryEvent + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/abstract_thing_registry_event.rb
+
+ +
+ +

Overview

+
+

The AbstractEvent sent with a +thing_removed trigger.

+ + +
+
+
+ + +
+ + + + + +

Instance Attribute Summary

+ +

Attributes inherited from AbstractThingRegistryEvent

+

#thing

+ + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractEvent

+

#inspect, #payload

+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/ThingStatusInfoChangedEvent.html b/5.33/OpenHAB/Core/Events/ThingStatusInfoChangedEvent.html new file mode 100644 index 0000000000..e8eaa539ef --- /dev/null +++ b/5.33/OpenHAB/Core/Events/ThingStatusInfoChangedEvent.html @@ -0,0 +1,4077 @@ + + + + + + + Class: OpenHAB::Core::Events::ThingStatusInfoChangedEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::ThingStatusInfoChangedEvent + + + +

+
+ +
+
Inherits:
+
+ AbstractEvent + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/thing_status_info_event.rb
+
+ +
+ +

Overview

+
+

The AbstractEvent sent when a Thing's status has changed.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods inherited from AbstractEvent

+

#payload

+ +
+

Instance Attribute Details

+ + + +
+

+ + #statusorg.openhab.core.thing.ThingStatusInfo (readonly) + + + + + +

+
+

Returns The thing's status.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+21
+
+
# File 'lib/openhab/core/events/thing_status_info_event.rb', line 21
+
+alias_method :status, :status_info
+
+
+ + + +
+

+ + #thingThings::Thing (readonly) + + + + + +

+
+

Returns The thing that triggered this event.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Things::Thing) + + + + — +

    The thing that triggered this event.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+27
+28
+29
+
+
# File 'lib/openhab/core/events/thing_status_info_event.rb', line 27
+
+def thing
+  EntityLookup.lookup_thing(uid)
+end
+
+
+ + + +
+

+ + #uidThings::ThingUID (readonly) + + + + + +

+
+

Returns The UID of the Thing that triggered this event.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+15
+
+
# File 'lib/openhab/core/events/thing_status_info_event.rb', line 15
+
+alias_method :uid, :get_thing_uid
+
+
+ + + +
+

+ + #wasorg.openhab.core.thing.ThingStatusInfo (readonly) + + + + + +

+
+

Returns The thing's prior status.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+18
+
+
# File 'lib/openhab/core/events/thing_status_info_event.rb', line 18
+
+alias_method :was, :get_old_status_info
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+32
+33
+34
+35
+36
+37
+
+
# File 'lib/openhab/core/events/thing_status_info_event.rb', line 32
+
+def inspect
+  s = "#<OpenHAB::Core::Events::ThingStatusInfoChangedEvent thing=#{uid} " \
+      "status=#{status.inspect} was=#{was.inspect}"
+  s += " source=#{source.inspect}" if source
+  "#{s}>"
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/ThingStatusInfoEvent.html b/5.33/OpenHAB/Core/Events/ThingStatusInfoEvent.html new file mode 100644 index 0000000000..186905ea8f --- /dev/null +++ b/5.33/OpenHAB/Core/Events/ThingStatusInfoEvent.html @@ -0,0 +1,3994 @@ + + + + + + + Class: OpenHAB::Core::Events::ThingStatusInfoEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::ThingStatusInfoEvent + + + +

+
+ +
+
Inherits:
+
+ AbstractEvent + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/thing_status_info_event.rb
+
+ +
+ +

Overview

+
+

The AbstractEvent sent when a Things::Thing's status is set.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods inherited from AbstractEvent

+

#payload

+ +
+

Instance Attribute Details

+ + + +
+

+ + #statusorg.openhab.core.thing.ThingStatusInfo (readonly) + + + + + +

+
+

Returns The thing's status.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+51
+
+
# File 'lib/openhab/core/events/thing_status_info_event.rb', line 51
+
+alias_method :status, :status_info
+
+
+ + + +
+

+ + #thingThings::Thing (readonly) + + + + + +

+
+

Returns The thing that triggered this event.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Things::Thing) + + + + — +

    The thing that triggered this event.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+57
+58
+59
+
+
# File 'lib/openhab/core/events/thing_status_info_event.rb', line 57
+
+def thing
+  EntityLookup.lookup_thing(uid)
+end
+
+
+ + + +
+

+ + #uidThings::ThingUID (readonly) + + + + + +

+
+

Returns The UID of the Thing that triggered this event.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+46
+
+
# File 'lib/openhab/core/events/thing_status_info_event.rb', line 46
+
+alias_method :uid, :get_thing_uid
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+62
+63
+64
+65
+66
+67
+
+
# File 'lib/openhab/core/events/thing_status_info_event.rb', line 62
+
+def inspect
+  s = "#<OpenHAB::Core::Events::ThingStatusInfoEvent thing=#{uid} " \
+      "status=#{status.inspect}"
+  s += " source=#{source.inspect}" if source
+  "#{s}>"
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/ThingUpdatedEvent.html b/5.33/OpenHAB/Core/Events/ThingUpdatedEvent.html new file mode 100644 index 0000000000..fd070b6d69 --- /dev/null +++ b/5.33/OpenHAB/Core/Events/ThingUpdatedEvent.html @@ -0,0 +1,3740 @@ + + + + + + + Class: OpenHAB::Core::Events::ThingUpdatedEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::ThingUpdatedEvent + + + +

+
+ +
+
Inherits:
+
+ AbstractThingRegistryEvent + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/abstract_thing_registry_event.rb
+
+ +
+ +

Overview

+
+

The AbstractEvent sent with a +thing_updated trigger.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from AbstractThingRegistryEvent

+

#thing

+ + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractEvent

+

#inspect, #payload

+ +
+

Instance Attribute Details

+ + + +
+

+ + #old_thingDTO::AbstractThingDTO (readonly) + + + + + +

+
+

Returns the old thing before the update.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+34
+
+
# File 'lib/openhab/core/events/abstract_thing_registry_event.rb', line 34
+
+class ThingUpdatedEvent < AbstractThingRegistryEvent; end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Events/TimerEvent.html b/5.33/OpenHAB/Core/Events/TimerEvent.html new file mode 100644 index 0000000000..c01f0f6861 --- /dev/null +++ b/5.33/OpenHAB/Core/Events/TimerEvent.html @@ -0,0 +1,4189 @@ + + + + + + + Class: OpenHAB::Core::Events::TimerEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Events::TimerEvent + + + +

+
+ +
+
Inherits:
+
+ AbstractEvent + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/events/timer_event.rb
+
+ +
+ +

Overview

+
+

Adds methods to core openHAB TimerEvent to make it more natural in Ruby

+

This event can be triggered by a DateTimeTrigger, cron, or TimeOfDay trigger.

+ + +
+
+
+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.0

    +
    + +
  • + +
+ +
+ + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #cron_expression ⇒ String? + + + + + + + + + readonly + + + + + + + + + +

    The cron expression that triggered this event.

    +
    + +
  • + + +
  • + + + #item ⇒ Item? + + + + + + + + + readonly + + + + + + + + + +

    The DateTime item that triggered this event.

    +
    + +
  • + + +
  • + + + #offset ⇒ Duration? + + + + + + + + + readonly + + + + + + + + + +

    The offset from the configured time for this DateTime trigger event.

    +
    + +
  • + + +
  • + + + #time ⇒ LocalTime? + + + + + + + + + readonly + + + + + + + + + +

    The configured time for this TimeOfDay trigger event.

    +
    + +
  • + + +
  • + + + #time_only? ⇒ Boolean + + + + + + + + + readonly + + + + + + + + + +

    true when this event was triggered by a DateTimeItem with timeOnly set.

    +
    + +
  • + + +
+ + + + + +

Attributes inherited from AbstractEvent

+

#attachment, #inputs, #source

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractEvent

+

#inspect, #payload

+ +
+

Instance Attribute Details

+ + + +
+

+ + #cron_expressionString? (readonly) + + + + + +

+
+

Returns The cron expression that triggered this event. +nil when this event wasn't triggered by a cron trigger.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + + — +

    The cron expression that triggered this event. +nil when this event wasn't triggered by a cron trigger.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.0

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+24
+25
+26
+
+
# File 'lib/openhab/core/events/timer_event.rb', line 24
+
+def cron_expression
+  payload&.[](:cronExpression)
+end
+
+
+ + + +
+

+ + #itemItem? (readonly) + + + + + +

+
+

Returns The DateTime item that triggered this event. +nil when this event wasn't triggered by a DateTimeItem trigger.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Item, nil) + + + + — +

    The DateTime item that triggered this event. +nil when this event wasn't triggered by a DateTimeItem trigger.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.0

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+33
+34
+35
+
+
# File 'lib/openhab/core/events/timer_event.rb', line 33
+
+def item
+  payload&.[](:itemName)&.then { |item_name| EntityLookup.lookup_item(item_name) }
+end
+
+
+ + + +
+

+ + #offsetDuration? (readonly) + + + + + +

+
+

Returns The offset from the configured time for this DateTime trigger event. +nil when this event wasn't triggered by a DateTime trigger.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Duration, nil) + + + + — +

    The offset from the configured time for this DateTime trigger event. +nil when this event wasn't triggered by a DateTime trigger.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.3

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+56
+57
+58
+
+
# File 'lib/openhab/core/events/timer_event.rb', line 56
+
+def offset
+  payload&.[](:offset)&.seconds
+end
+
+
+ + + +
+

+ + #timeLocalTime? (readonly) + + + + + +

+
+

Returns The configured time for this TimeOfDay trigger event. +nil when this event wasn't triggered by a TimeOfDay trigger.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (LocalTime, nil) + + + + — +

    The configured time for this TimeOfDay trigger event. +nil when this event wasn't triggered by a TimeOfDay trigger.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.0

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+65
+66
+67
+
+
# File 'lib/openhab/core/events/timer_event.rb', line 65
+
+def time
+  payload&.[](:time)&.then { |time| LocalTime.parse(time) }
+end
+
+
+ + + +
+

+ + #time_only?Boolean (readonly) + + + + + +

+
+

Returns true when this event was triggered by a DateTimeItem with timeOnly set. +false when this event wasn't triggered by a DateTimeItem or the timeOnly flag is not set.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    true when this event was triggered by a DateTimeItem with timeOnly set. +false when this event wasn't triggered by a DateTimeItem or the timeOnly flag is not set.

    +
    + +
  • + +
+ +

See Also:

+
    + +
  • #every trigger
  • + +
  • #at trigger
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.3

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+46
+47
+48
+
+
# File 'lib/openhab/core/events/timer_event.rb', line 46
+
+def time_only?
+  !!payload&.[](:timeOnly)
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items.html b/5.33/OpenHAB/Core/Items.html new file mode 100644 index 0000000000..1aa6c3f807 --- /dev/null +++ b/5.33/OpenHAB/Core/Items.html @@ -0,0 +1,4922 @@ + + + + + + + Module: OpenHAB::Core::Items + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Items + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items.rb,
+ lib/openhab/core/items/item.rb,
lib/openhab/core/items/proxy.rb,
lib/openhab/core/items/metadata.rb,
lib/openhab/core/items/provider.rb,
lib/openhab/core/items/registry.rb,
lib/openhab/core/items/call_item.rb,
lib/openhab/core/items/semantics.rb,
lib/openhab/core/items/color_item.rb,
lib/openhab/core/items/group_item.rb,
lib/openhab/core/items/image_item.rb,
lib/openhab/core/items/dimmer_item.rb,
lib/openhab/core/items/number_item.rb,
lib/openhab/core/items/persistence.rb,
lib/openhab/core/items/player_item.rb,
lib/openhab/core/items/string_item.rb,
lib/openhab/core/items/switch_item.rb,
lib/openhab/core/items/contact_item.rb,
lib/openhab/core/items/generic_item.rb,
lib/openhab/core/items/numeric_item.rb,
lib/openhab/core/items/location_item.rb,
lib/openhab/core/items/metadata/hash.rb,
lib/openhab/core/items/state_storage.rb,
lib/openhab/core/items/date_time_item.rb,
lib/openhab/core/items/group_function.rb,
lib/openhab/core/items/metadata/provider.rb,
lib/openhab/core/items/item_channel_links.rb,
lib/openhab/core/items/rollershutter_item.rb,
lib/openhab/core/items/semantics/provider.rb,
lib/openhab/core/items/accepted_data_types.rb,
lib/openhab/core/items/semantics/semantic_tag.rb,
lib/openhab/core/items/metadata/namespace_hash.rb,
lib/openhab/core/items/semantics/tag_class_methods.rb
+
+
+ +
+ +

Overview

+
+

Contains the core types that openHAB uses to represent items. +Items have states from the Types module.

+

You may use an item or group name anywhere DSL (or just EntityLookup) +is available, and it will automatically be loaded.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: GroupFunction, Item, Metadata, NumericItem, Persistence, Semantics + + + + Classes: CallItem, ColorItem, ContactItem, DateTimeItem, DimmerItem, GenericItem, GroupItem, ImageItem, ItemChannelLinks, LocationItem, NumberItem, PlayerItem, Provider, Registry, RollershutterItem, StateStorage, StringItem, SwitchItem + + +

+ + + + + + + + +

+ Class Method Summary + collapse +

+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + +
+

Class Method Details

+ + +
+

+ + .import_into_global_namespaceObject + + + + + +

+
+

Imports all of the item classes into the global namespace +for convenient access.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+22
+23
+24
+25
+26
+27
+28
+29
+
+
# File 'lib/openhab/core/items.rb', line 22
+
+def import_into_global_namespace
+  concrete_item_classes.each do |k|
+    const_name = k.java_class.simple_name
+    Object.const_set(const_name, k) unless Object.const_defined?(const_name)
+  end
+  Object.const_set(:GenericItem, GenericItem) unless Object.const_defined?(:GenericItem)
+  Object.const_set(:Item, Item) unless Object.const_defined?(:Item)
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #closed?true, false + + + + + +

+
+

Check if the item state == CLOSED

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/contact_item.rb', line 41
+
+
+
+
+ +
+

+ + #fast_forwardPlayerItem + + + + + +

+
+

Send the FASTFORWARD command to the item

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (PlayerItem) + + + + — +

    self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/player_item.rb', line 62
+
+
+
+
+ +
+

+ + #fast_forward!PlayerItem + + + + + +

+
+

Send the FASTFORWARD command to the item, even when +ensure_states! is in effect.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (PlayerItem) + + + + — +

    self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/player_item.rb', line 66
+
+
+
+
+ +
+

+ + #fast_forwarding?true, false + + + + + +

+
+

Check if the item state == FASTFORWARD

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/player_item.rb', line 34
+
+
+
+
+ +
+

+ + #nextPlayerItem + + + + + +

+
+

Send the NEXT command to the item

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (PlayerItem) + + + + — +

    self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/player_item.rb', line 71
+
+
+
+
+ +
+

+ + #open?true, false + + + + + +

+
+

Check if the item state == OPEN

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/contact_item.rb', line 34
+
+
+
+
+ +
+

+ + #pausePlayerItem + + + + + +

+
+

Send the PAUSE command to the item

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (PlayerItem) + + + + — +

    self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/player_item.rb', line 46
+
+
+
+
+ +
+

+ + #pause!PlayerItem + + + + + +

+
+

Send the PAUSE command to the item, even when ensure_states! is in effect.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (PlayerItem) + + + + — +

    self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/player_item.rb', line 50
+
+
+
+
+ +
+

+ + #paused?true, false + + + + + +

+
+

Check if the item state == PAUSE

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/player_item.rb', line 26
+
+
+
+
+ +
+

+ + #playPlayerItem + + + + + +

+
+

Send the PLAY command to the item

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (PlayerItem) + + + + — +

    self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/player_item.rb', line 38
+
+
+
+
+ +
+

+ + #play!PlayerItem + + + + + +

+
+

Send the PLAY command to the item, even when ensure_states! is in effect.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (PlayerItem) + + + + — +

    self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/player_item.rb', line 42
+
+
+
+
+ +
+

+ + #play?true, false + + + + + +

+
+

Check if the item state == PLAY

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/player_item.rb', line 22
+
+
+
+
+ +
+

+ + #previousPlayerItem + + + + + +

+
+

Send the PREVIOUS command to the item

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (PlayerItem) + + + + — +

    self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/player_item.rb', line 75
+
+
+
+
+ +
+

+ + #rewindPlayerItem + + + + + +

+
+

Send the REWIND command to the item

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (PlayerItem) + + + + — +

    self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/player_item.rb', line 54
+
+
+
+
+ +
+

+ + #rewind!PlayerItem + + + + + +

+
+

Send the REWIND command to the item, even when ensure_states! is in effect.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (PlayerItem) + + + + — +

    self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/player_item.rb', line 58
+
+
+
+
+ +
+

+ + #rewinding?true, false + + + + + +

+
+

Check if the item state == REWIND

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/player_item.rb', line 30
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/CallItem.html b/5.33/OpenHAB/Core/Items/CallItem.html new file mode 100644 index 0000000000..2a5c45e1f5 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/CallItem.html @@ -0,0 +1,3818 @@ + + + + + + + Class: OpenHAB::Core::Items::CallItem + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::CallItem + + + +

+
+ +
+
Inherits:
+
+ GenericItem + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/call_item.rb
+
+ +
+ +

Overview

+
+

A CallItem identifies a telephone call by its origin and destination.

+ + +
+
+
+ + +
+ + +

Constant Summary

+ +

Constants included + from Semantics

+

Semantics::Equipment, Semantics::Location, Semantics::Point, Semantics::Property, Semantics::Tag

+ + + +

Constants included + from Persistence

+

Persistence::HistoricState

+ + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from GenericItem

+

#category, #formatted_state, #label, #name, #raw_state, #tags

+ + + +

Attributes included from Semantics

+

#equipment, #equipment_type, #location, #location_type, #point_type, #property_type, #semantic_type

+ + + +

Attributes included from Item

+

#accepted_command_types, #accepted_data_types, #all_groups, #channel, #channel_uid, #channel_uids, #channels, #groups, #links, #metadata, #name, #provider, #thing, #things

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from GenericItem

+

#command, #modify, #null?, #refresh, #state?, #time_series=, #undef?, #update

+ + + + + + + + + +

Methods included from Semantics

+

add, #equipment?, #location?, lookup, #point?, #points, remove, #semantic?, tags

+ + + + + + + + + +

Methods included from Item

+

#call_item?, #color_item?, #contact_item?, #date_time_item?, #dimmer_item?, #group_item?, #image_item?, #inspect, #link, #location_item?, #member_of?, #number_item?, #player_item?, #rollershutter_item?, #string_item?, #switch_item?, #tagged?, #to_s, #unlink

+ + + + + + + + + +

Methods included from DSL::Items::TimedCommand

+

#command

+ + + + + + + + + +

Methods included from Persistence

+

#all_states_between, #all_states_since, #all_states_until, #average_between, #average_since, #average_until, #changed_between?, #changed_since?, #changed_until?, #count_between, #count_since, #count_state_changes_between, #count_state_changes_since, #count_state_changes_until, #count_until, #delta_between, #delta_since, #delta_until, #deviation_between, #deviation_since, #deviation_until, #evolution_rate, #evolution_rate_between, #evolution_rate_since, #evolution_rate_until, #historic_state, #last_change, #last_update, #maximum_between, #maximum_since, #maximum_until, #median_between, #median_since, #median_until, #minimum_between, #minimum_since, #minimum_until, #next_change, #next_state, #next_update, #persist, #persisted_state, #previous_state, #remove_all_states_between, #remove_all_states_since, #remove_all_states_until, #sum_between, #sum_since, #sum_until, #updated_between?, #updated_since?, #updated_until?, #variance_between, #variance_since, #variance_until

+ + + + + + + + + + + + + + + +

Methods included from DSL::Items::Ensure::Ensurable

+

#ensure

+ +
+

Instance Attribute Details

+ + + +
+

+ + #stateStringListType? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+16
+17
+18
+19
+20
+21
+22
+23
+24
+
+
# File 'lib/openhab/core/items/call_item.rb', line 16
+
+class CallItem < GenericItem
+  # @!visibility private
+  def format_type(command)
+    return command if command.is_a?(Types::StringListType)
+    return Types::StringListType.new(command.to_ary.map(&:to_s)) if command.respond_to?(:to_ary)
+
+    super
+  end
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/ColorItem.html b/5.33/OpenHAB/Core/Items/ColorItem.html new file mode 100644 index 0000000000..d6268750ef --- /dev/null +++ b/5.33/OpenHAB/Core/Items/ColorItem.html @@ -0,0 +1,3889 @@ + + + + + + + Class: OpenHAB::Core::Items::ColorItem + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::ColorItem + + + +

+
+ +
+
Inherits:
+
+ DimmerItem + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/color_item.rb
+
+ +
+ +

Overview

+
+

ColorItem represents a color values, e.g. for LED lights.

+

Note that it inherits from DimmerItem, so you can call SwitchItem#on, SwitchItem#off, +SwitchItem#on?, SwitchItem#off?, etc. on it. Its state type is an HSBType, +which is stored as Hue, Saturation, and Brightness, but has easy +helpers for working with RGB values of various forms.

+ + +
+
+
+ +
+

Examples:

+ + +

Sending commands

+

+ +
HueBulb << "#ff0000" # send 'red' as a command
+HueBulb.on
+HueBulb.dim
+ + +

Inspect state

+

+ +
HueBulb.on? # => true
+HueBulb.state.red # => 100%
+HueBulb.state.hue # => 0 °
+HueBulb.state.brightness # => 100%
+HueBulb.state.to_rgb # => [100%, 0%, 0%]
+HueBulb.state.rgb # => 16711680
+HueBulb.state.to_hex # => "0xff0000"
+HueBulb.state.on? # => true
+HueBulb.state.red.to_byte # => 255
+HueBulb.state.blue.to_byte # => 0
+ +
+ + +
+ + +

Constant Summary

+ +

Constants included + from Semantics

+

Semantics::Equipment, Semantics::Location, Semantics::Point, Semantics::Property, Semantics::Tag

+ + + +

Constants included + from Persistence

+

Persistence::HistoricState

+ + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from GenericItem

+

#category, #formatted_state, #label, #name, #raw_state, #tags

+ + + +

Attributes included from Semantics

+

#equipment, #equipment_type, #location, #location_type, #point_type, #property_type, #semantic_type

+ + + +

Attributes included from Item

+

#accepted_command_types, #accepted_data_types, #all_groups, #channel, #channel_uid, #channel_uids, #channels, #groups, #links, #metadata, #name, #provider, #thing, #things

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from DimmerItem

+

#brighten, #decrease, #dim, #increase

+ + + + + + + + + + + + + + + +

Methods inherited from SwitchItem

+

#off, #off!, #off?, #on, #on!, #on?, #toggle

+ + + + + + + + + +

Methods inherited from GenericItem

+

#command, #modify, #null?, #refresh, #state?, #time_series=, #undef?, #update

+ + + + + + + + + +

Methods included from Semantics

+

add, #equipment?, #location?, lookup, #point?, #points, remove, #semantic?, tags

+ + + + + + + + + +

Methods included from Item

+

#call_item?, #color_item?, #contact_item?, #date_time_item?, #dimmer_item?, #group_item?, #image_item?, #inspect, #link, #location_item?, #member_of?, #number_item?, #player_item?, #rollershutter_item?, #string_item?, #switch_item?, #tagged?, #to_s, #unlink

+ + + + + + + + + +

Methods included from DSL::Items::TimedCommand

+

#command

+ + + + + + + + + +

Methods included from Persistence

+

#all_states_between, #all_states_since, #all_states_until, #average_between, #average_since, #average_until, #changed_between?, #changed_since?, #changed_until?, #count_between, #count_since, #count_state_changes_between, #count_state_changes_since, #count_state_changes_until, #count_until, #delta_between, #delta_since, #delta_until, #deviation_between, #deviation_since, #deviation_until, #evolution_rate, #evolution_rate_between, #evolution_rate_since, #evolution_rate_until, #historic_state, #last_change, #last_update, #maximum_between, #maximum_since, #maximum_until, #median_between, #median_since, #median_until, #minimum_between, #minimum_since, #minimum_until, #next_change, #next_state, #next_update, #persist, #persisted_state, #previous_state, #remove_all_states_between, #remove_all_states_since, #remove_all_states_until, #sum_between, #sum_since, #sum_until, #updated_between?, #updated_since?, #updated_until?, #variance_between, #variance_since, #variance_until

+ + + + + + + + + + + + + + + +

Methods included from DSL::Items::Ensure::Ensurable

+

#ensure

+ +
+

Instance Attribute Details

+ + + +
+

+ + #stateHSBType? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (HSBType, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+
+
# File 'lib/openhab/core/items/color_item.rb', line 38
+
+class ColorItem < DimmerItem
+  # Make sure to do the String => HSBType conversion in Ruby,
+  # where we add support for hex
+  # @!visibility private
+  def format_type(type)
+    return Types::HSBType.new(type) if type.respond_to?(:to_str)
+
+    super
+  end
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/ContactItem.html b/5.33/OpenHAB/Core/Items/ContactItem.html new file mode 100644 index 0000000000..7c92c06cb0 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/ContactItem.html @@ -0,0 +1,3854 @@ + + + + + + + Class: OpenHAB::Core::Items::ContactItem + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::ContactItem + + + +

+
+ +
+
Inherits:
+
+ GenericItem + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/contact_item.rb
+
+ +
+ +

Overview

+
+

A ContactItem can be used for sensors that return an "open" or +"closed" as a state.

+

This is useful for doors, windows, etc.

+ + +
+
+
+ +
+

Examples:

+ + +
rule 'Log state of all doors on system startup' do
+  on_load
+  run do
+    Doors.each do |door|
+      case door.state
+      when OPEN then logger.info("#{door.name} is Open")
+      when CLOSED then logger.info("#{door.name} is Open")
+      else logger.info("#{door.name} is not initialized")
+      end
+    end
+  end
+end
+ +
+ + +
+ + +

Constant Summary

+ +

Constants included + from Semantics

+

Semantics::Equipment, Semantics::Location, Semantics::Point, Semantics::Property, Semantics::Tag

+ + + +

Constants included + from Persistence

+

Persistence::HistoricState

+ + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from GenericItem

+

#category, #formatted_state, #label, #name, #raw_state, #tags

+ + + +

Attributes included from Semantics

+

#equipment, #equipment_type, #location, #location_type, #point_type, #property_type, #semantic_type

+ + + +

Attributes included from Item

+

#accepted_command_types, #accepted_data_types, #all_groups, #channel, #channel_uid, #channel_uids, #channels, #groups, #links, #metadata, #name, #provider, #thing, #things

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from GenericItem

+

#command, #modify, #null?, #refresh, #state?, #time_series=, #undef?, #update

+ + + + + + + + + +

Methods included from Semantics

+

add, #equipment?, #location?, lookup, #point?, #points, remove, #semantic?, tags

+ + + + + + + + + +

Methods included from Item

+

#call_item?, #color_item?, #contact_item?, #date_time_item?, #dimmer_item?, #group_item?, #image_item?, #inspect, #link, #location_item?, #member_of?, #number_item?, #player_item?, #rollershutter_item?, #string_item?, #switch_item?, #tagged?, #to_s, #unlink

+ + + + + + + + + +

Methods included from DSL::Items::TimedCommand

+

#command

+ + + + + + + + + +

Methods included from Persistence

+

#all_states_between, #all_states_since, #all_states_until, #average_between, #average_since, #average_until, #changed_between?, #changed_since?, #changed_until?, #count_between, #count_since, #count_state_changes_between, #count_state_changes_since, #count_state_changes_until, #count_until, #delta_between, #delta_since, #delta_until, #deviation_between, #deviation_since, #deviation_until, #evolution_rate, #evolution_rate_between, #evolution_rate_since, #evolution_rate_until, #historic_state, #last_change, #last_update, #maximum_between, #maximum_since, #maximum_until, #median_between, #median_since, #median_until, #minimum_between, #minimum_since, #minimum_until, #next_change, #next_state, #next_update, #persist, #persisted_state, #previous_state, #remove_all_states_between, #remove_all_states_since, #remove_all_states_until, #sum_between, #sum_since, #sum_until, #updated_between?, #updated_since?, #updated_until?, #variance_between, #variance_since, #variance_until

+ + + + + + + + + + + + + + + +

Methods included from DSL::Items::Ensure::Ensurable

+

#ensure

+ +
+

Instance Attribute Details

+ + + +
+

+ + #stateOpenClosedType? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+
+
# File 'lib/openhab/core/items/contact_item.rb', line 33
+
+class ContactItem < GenericItem
+  # @!method open?
+  #   Check if the item state == {OPEN}
+  #   @return [true,false]
+  #
+  # @example Log open contacts
+  #   Contacts.select(&:open?).each { |contact| logger.info("Contact #{contact.name} is open")}
+
+  # @!method closed?
+  #   Check if the item state == {CLOSED}
+  #   @return [true,false]
+  #
+  # @example Log closed contacts
+  #   Contacts.select(&:closed?).each { |contact| logger.info("Contact #{contact.name} is closed")}
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/DateTimeItem.html b/5.33/OpenHAB/Core/Items/DateTimeItem.html new file mode 100644 index 0000000000..23dbb607a2 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/DateTimeItem.html @@ -0,0 +1,3883 @@ + + + + + + + Class: OpenHAB::Core::Items::DateTimeItem + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::DateTimeItem + + + +

+
+ +
+
Inherits:
+
+ GenericItem + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/date_time_item.rb
+
+ +
+ +

Overview

+
+

A DateTimeItem stores a timestamp including a valid time zone.

+ + +
+
+
+ +
+

Examples:

+ + +

DateTime items can be updated and commanded with Ruby Time objects or Java ZonedDateTime objects

+

+ +
Example_DateTimeItem << Time.now
+Example_DateTimeItem << ZonedDateTime.now
+ + +

Math operations (+ and -) are available to make calculations with time in a few different ways

+

+ +
Example_DateTimeItem.state + 600 # Number of seconds
+Example_DateTimeItem.state - '01:15' # Subtracts 1h 15 min
+Example_DateTimeItem.state + 2.hours # Use the helper library's duration methods
+
+Example_DateTimeItem.state - Example_DateTimeItem2.state # Calculate the time difference, in seconds
+Example_DateTimeItem.state - '2021-01-01 15:40' # Calculates time difference
+ + +

Comparisons between different time objects can be performed

+

+ +
Example_DateTimeItem.state == Example_DateTimeItem2.state # Equality, works across time zones
+Example_DateTimeItem.state > Date.parse('2021-01-31') # After midnight jan 31st 2021
+Example_DateTimeItem.state <= Time.now # Before or equal to now
+Example_DateTimeItem.state < LocalTime::NOON # Before noon
+ + +

LocalTime ranges created also work

+

+ +
case Example_DateTimeItem.state
+when LocalTime.parse('00:00')...LocalTime.parse('08:00')
+  logger.info('Example_DateTimeItem is between 00:00..08:00')
+when LocalTime.parse('08:00')...LocalTime.parse('16:00')
+  logger.info('Example_DateTimeItem is between 08:00..16:00')
+when LocalTime.parse('16:00')..LocalTime.parse'23:59')
+  logger.info('Example_DateTimeItem is between 16:00...23:59')
+end
+ +
+ + +
+ + +

Constant Summary

+ +

Constants included + from Semantics

+

Semantics::Equipment, Semantics::Location, Semantics::Point, Semantics::Property, Semantics::Tag

+ + + +

Constants included + from Persistence

+

Persistence::HistoricState

+ + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from GenericItem

+

#category, #formatted_state, #label, #name, #raw_state, #tags

+ + + +

Attributes included from Semantics

+

#equipment, #equipment_type, #location, #location_type, #point_type, #property_type, #semantic_type

+ + + +

Attributes included from Item

+

#accepted_command_types, #accepted_data_types, #all_groups, #channel, #channel_uid, #channel_uids, #channels, #groups, #links, #metadata, #name, #provider, #thing, #things

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from GenericItem

+

#command, #modify, #null?, #refresh, #state?, #time_series=, #undef?, #update

+ + + + + + + + + +

Methods included from Semantics

+

add, #equipment?, #location?, lookup, #point?, #points, remove, #semantic?, tags

+ + + + + + + + + +

Methods included from Item

+

#call_item?, #color_item?, #contact_item?, #date_time_item?, #dimmer_item?, #group_item?, #image_item?, #inspect, #link, #location_item?, #member_of?, #number_item?, #player_item?, #rollershutter_item?, #string_item?, #switch_item?, #tagged?, #to_s, #unlink

+ + + + + + + + + +

Methods included from DSL::Items::TimedCommand

+

#command

+ + + + + + + + + +

Methods included from Persistence

+

#all_states_between, #all_states_since, #all_states_until, #average_between, #average_since, #average_until, #changed_between?, #changed_since?, #changed_until?, #count_between, #count_since, #count_state_changes_between, #count_state_changes_since, #count_state_changes_until, #count_until, #delta_between, #delta_since, #delta_until, #deviation_between, #deviation_since, #deviation_until, #evolution_rate, #evolution_rate_between, #evolution_rate_since, #evolution_rate_until, #historic_state, #last_change, #last_update, #maximum_between, #maximum_since, #maximum_until, #median_between, #median_since, #median_until, #minimum_between, #minimum_since, #minimum_until, #next_change, #next_state, #next_update, #persist, #persisted_state, #previous_state, #remove_all_states_between, #remove_all_states_since, #remove_all_states_until, #sum_between, #sum_since, #sum_until, #updated_between?, #updated_since?, #updated_until?, #variance_between, #variance_since, #variance_until

+ + + + + + + + + + + + + + + +

Methods included from DSL::Items::Ensure::Ensurable

+

#ensure

+ +
+

Instance Attribute Details

+ + + +
+

+ + #stateDateTimeType? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+
+
# File 'lib/openhab/core/items/date_time_item.rb', line 44
+
+class DateTimeItem < GenericItem
+  # Time types need formatted as ISO8601
+  # @!visibility private
+  def format_type(command)
+    return command if command.is_a?(Types::DateTimeType)
+    return Types::DateTimeType.new(command.to_zoned_date_time) if command.respond_to?(:to_zoned_date_time)
+
+    if command.respond_to?(:to_str)
+      command = command.to_str
+      begin
+        return Types::DateTimeType.new(DSL.try_parse_time_like(command))
+      rescue ArgumentError
+        return Types::DateTimeType.new(command)
+      end
+    end
+
+    super
+  end
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/DimmerItem.html b/5.33/OpenHAB/Core/Items/DimmerItem.html new file mode 100644 index 0000000000..74b4c05264 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/DimmerItem.html @@ -0,0 +1,4439 @@ + + + + + + + Class: OpenHAB::Core::Items::DimmerItem + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::DimmerItem + + + +

+
+ +
+
Inherits:
+
+ SwitchItem + + + show all + +
+
+ + + + + + +
+
Includes:
+
NumericItem
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/items/dimmer_item.rb
+
+ +
+ +

Overview

+
+

A DimmerItem can be used as a switch (ON/OFF), but it also accepts +percent values to reflect the dimmed state.

+ + +
+
+
+ +
+

Examples:

+ + +
DimmerOne << DimmerOne.state - 5
+DimmerOne << 100 - DimmerOne.state
+ + +

Turn on all dimmers in group

+

+ +
Dimmers.members.each(&:on)
+ + +

Turn off all dimmers in group

+

+ +
Dimmers.members.each(&:off)
+ + +

Turn on switches that are off

+

+ +
Dimmers.select(&:off?).each(&:on)
+ + +

Turn off switches that are on

+

+ +
Dimmers.select(&:on?).each(&:off)
+ + +

Dimmers can be selected in an enumerable with grep.

+

+ +
items.grep(DimmerItem)
+     .each { |dimmer| logger.info("#{dimmer.name} is a Dimmer") }
+ + +

Dimmers can also be used in case statements with ranges.

+

+ +
items.grep(DimmerItem)
+     .each do |dimmer|
+  case dimmer.state
+  when (0..50)
+    logger.info("#{dimmer.name} is less than 50%")
+  when (51..100)
+    logger.info("#{dimmer.name} is greater than 50%")
+  end
+end
+ + +
rule 'Dim a switch on system startup over 100 seconds' do
+  on_load
+  100.times do
+    run { DimmerSwitch.dim }
+    delay 1.second
+  end
+end
+ + +
rule 'Dim a switch on system startup by 5, pausing every second' do
+  on_load
+  100.step(-5, 0) do |level|
+    run { DimmerSwitch << level }
+    delay 1.second
+  end
+end
+ + +
rule 'Turn off any dimmers curently on at midnight' do
+  every :day
+  run do
+    items.grep(DimmerItem)
+         .select(&:on?)
+         .each(&:off)
+    end
+end
+ + +
rule 'Turn off any dimmers set to less than 50 at midnight' do
+  every :day
+  run do
+    items.grep(DimmerItem)
+         .select { |i| (1...50).cover?(i.state) }
+         .each(&:off)
+    end
+end
+ +
+ + +
+

Direct Known Subclasses

+

ColorItem

+
+ + + +

Constant Summary

+ +

Constants included + from Semantics

+

Semantics::Equipment, Semantics::Location, Semantics::Point, Semantics::Property, Semantics::Tag

+ + + +

Constants included + from Persistence

+

Persistence::HistoricState

+ + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from GenericItem

+

#category, #formatted_state, #label, #name, #raw_state, #tags

+ + + +

Attributes included from Semantics

+

#equipment, #equipment_type, #location, #location_type, #point_type, #property_type, #semantic_type

+ + + +

Attributes included from Item

+

#accepted_command_types, #accepted_data_types, #all_groups, #channel, #channel_uid, #channel_uids, #channels, #groups, #links, #metadata, #name, #provider, #thing, #things

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods inherited from SwitchItem

+

#off, #off!, #off?, #on, #on!, #on?, #toggle

+ + + + + + + + + +

Methods inherited from GenericItem

+

#command, #modify, #null?, #refresh, #state?, #time_series=, #undef?, #update

+ + + + + + + + + +

Methods included from Semantics

+

add, #equipment?, #location?, lookup, #point?, #points, remove, #semantic?, tags

+ + + + + + + + + +

Methods included from Item

+

#call_item?, #color_item?, #contact_item?, #date_time_item?, #dimmer_item?, #group_item?, #image_item?, #inspect, #link, #location_item?, #member_of?, #number_item?, #player_item?, #rollershutter_item?, #string_item?, #switch_item?, #tagged?, #to_s, #unlink

+ + + + + + + + + +

Methods included from DSL::Items::TimedCommand

+

#command

+ + + + + + + + + +

Methods included from Persistence

+

#all_states_between, #all_states_since, #all_states_until, #average_between, #average_since, #average_until, #changed_between?, #changed_since?, #changed_until?, #count_between, #count_since, #count_state_changes_between, #count_state_changes_since, #count_state_changes_until, #count_until, #delta_between, #delta_since, #delta_until, #deviation_between, #deviation_since, #deviation_until, #evolution_rate, #evolution_rate_between, #evolution_rate_since, #evolution_rate_until, #historic_state, #last_change, #last_update, #maximum_between, #maximum_since, #maximum_until, #median_between, #median_since, #median_until, #minimum_between, #minimum_since, #minimum_until, #next_change, #next_state, #next_update, #persist, #persisted_state, #previous_state, #remove_all_states_between, #remove_all_states_since, #remove_all_states_until, #sum_between, #sum_since, #sum_until, #updated_between?, #updated_since?, #updated_until?, #variance_between, #variance_since, #variance_until

+ + + + + + + + + + + + + + + +

Methods included from DSL::Items::Ensure::Ensurable

+

#ensure

+ +
+

Instance Attribute Details

+ + + +
+

+ + #statePercentType? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+
+
# File 'lib/openhab/core/items/dimmer_item.rb', line 87
+
+class DimmerItem < SwitchItem
+  include NumericItem
+
+  #
+  # Dim the dimmer
+  #
+  # @param [Integer] amount to dim by
+  #  If 1 is the amount, the DECREASE command is sent, otherwise the
+  #  current state - amount is sent as a command.
+  #
+  # @return [Integer] level target for dimmer
+  #
+  # @example
+  #   DimmerOne.dim
+  #   DimmerOne.dim(2)
+  #
+  def dim(amount = 1)
+    target = [state&.-(amount), 0].compact.max
+    command!(target)
+    target
+  end
+
+  #
+  # Brighten the dimmer
+  #
+  # @param [Integer] amount to brighten by
+  #   If 1 is the amount, the INCREASE command is sent, otherwise the
+  # current state + amount is sent as a command.
+  #
+  # @return [Integer] level target for dimmer
+  #
+  # @example
+  #   DimmerOne.brighten
+  #   DimmerOne.brighten(2)
+  #
+  def brighten(amount = 1)
+    target = [state&.+(amount), 100].compact.min
+    command!(target)
+    target
+  end
+
+  # @!method increase
+  #   Send the {INCREASE} command to the item
+  #   @return [DimmerItem] `self`
+
+  # @!method decrease
+  #   Send the {DECREASE} command to the item
+  #   @return [DimmerItem] `self`
+
+  # raw numbers translate directly to PercentType, not a DecimalType
+  # @!visibility private
+  def format_type(command)
+    return Types::PercentType.new(command) if command.is_a?(Numeric)
+
+    super
+  end
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #brighten(amount = 1) ⇒ Integer + + + + + +

+
+

Brighten the dimmer

+

current state + amount is sent as a command.

+ + +
+
+
+ +
+

Examples:

+ + +
DimmerOne.brighten
+DimmerOne.brighten(2)
+ +
+

Parameters:

+
    + +
  • + + amount + + + (Integer) + + + (defaults to: 1) + + + — +

    to brighten by +If 1 is the amount, the INCREASE command is sent, otherwise the

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    level target for dimmer

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+122
+123
+124
+125
+126
+
+
# File 'lib/openhab/core/items/dimmer_item.rb', line 122
+
+def brighten(amount = 1)
+  target = [state&.+(amount), 100].compact.min
+  command!(target)
+  target
+end
+
+
+ +
+

+ + #decreaseDimmerItem + + + + + +

+
+

Send the DECREASE command to the item

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (DimmerItem) + + + + — +

    self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/dimmer_item.rb', line 132
+
+
+
+
+ +
+

+ + #dim(amount = 1) ⇒ Integer + + + + + +

+
+

Dim the dimmer

+ + +
+
+
+ +
+

Examples:

+ + +
DimmerOne.dim
+DimmerOne.dim(2)
+ +
+

Parameters:

+
    + +
  • + + amount + + + (Integer) + + + (defaults to: 1) + + + — +

    to dim by +If 1 is the amount, the DECREASE command is sent, otherwise the +current state - amount is sent as a command.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    level target for dimmer

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+103
+104
+105
+106
+107
+
+
# File 'lib/openhab/core/items/dimmer_item.rb', line 103
+
+def dim(amount = 1)
+  target = [state&.-(amount), 0].compact.max
+  command!(target)
+  target
+end
+
+
+ +
+

+ + #increaseDimmerItem + + + + + +

+
+

Send the INCREASE command to the item

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (DimmerItem) + + + + — +

    self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/dimmer_item.rb', line 128
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/GenericItem.html b/5.33/OpenHAB/Core/Items/GenericItem.html new file mode 100644 index 0000000000..b37316fc1c --- /dev/null +++ b/5.33/OpenHAB/Core/Items/GenericItem.html @@ -0,0 +1,5333 @@ + + + + + + + Class: OpenHAB::Core::Items::GenericItem + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::GenericItem + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Item, Persistence, Semantics, DSL::Items::Ensure::Item, DSL::Items::TimedCommand
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/items/generic_item.rb
+
+ +
+ +

Overview

+
+

The abstract base class for all items.

+ + +
+
+
+ + +

See Also:

+ + +
+ + + +

Constant Summary

+ +

Constants included + from Semantics

+

Semantics::Equipment, Semantics::Location, Semantics::Point, Semantics::Property, Semantics::Tag

+ + + +

Constants included + from Persistence

+

Persistence::HistoricState

+ + +

Instance Attribute Summary collapse

+
    + +
  • + + + #category ⇒ String + + + + (also: #icon) + + + + + + + + + + + + + + +

    The item's category (icon).

    +
    + +
  • + + +
  • + + + #formatted_state ⇒ String + + + + + + + + + readonly + + + + + + + + + +

    Format the item's state according to its state description.

    +
    + +
  • + + +
  • + + + #label ⇒ String + + + + + + + + + + + + + + + + +

    The item's descriptive label.

    +
    + +
  • + + +
  • + + + #name ⇒ String + + + + + + + + + readonly + + + + + + + + + +

    The item's name.

    +
    + +
  • + + +
  • + + + #raw_state ⇒ State + + + + + + + + + readonly + + + + + + + + + +

    Get the raw item state.

    +
    + +
  • + + +
  • + + + #state ⇒ State? + + + + + + + + + readonly + + + + + + + + + +

    OpenHAB item state if state is not UNDEF or NULL, nil otherwise.

    +
    + +
  • + + +
  • + + + #tags ⇒ Array<String> + + + + + + + + + + + + + + + + +

    The item's tags.

    +
    + +
  • + + +
+ + + + + +

Attributes included from Semantics

+

#equipment, #equipment_type, #location, #location_type, #point_type, #property_type, #semantic_type

+ + + +

Attributes included from Item

+

#accepted_command_types, #accepted_data_types, #all_groups, #channel, #channel_uid, #channel_uids, #channels, #groups, #links, #metadata, #provider, #thing, #things

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods included from Semantics

+

add, #equipment?, #location?, lookup, #point?, #points, remove, #semantic?, tags

+ + + + + + + + + +

Methods included from Item

+

#call_item?, #color_item?, #contact_item?, #date_time_item?, #dimmer_item?, #group_item?, #image_item?, #inspect, #link, #location_item?, #member_of?, #number_item?, #player_item?, #rollershutter_item?, #string_item?, #switch_item?, #tagged?, #to_s, #unlink

+ + + + + + + + + + + + + + + +

Methods included from Persistence

+

#all_states_between, #all_states_since, #all_states_until, #average_between, #average_since, #average_until, #changed_between?, #changed_since?, #changed_until?, #count_between, #count_since, #count_state_changes_between, #count_state_changes_since, #count_state_changes_until, #count_until, #delta_between, #delta_since, #delta_until, #deviation_between, #deviation_since, #deviation_until, #evolution_rate, #evolution_rate_between, #evolution_rate_since, #evolution_rate_until, #historic_state, #last_change, #last_update, #maximum_between, #maximum_since, #maximum_until, #median_between, #median_since, #median_until, #minimum_between, #minimum_since, #minimum_until, #next_change, #next_state, #next_update, #persist, #persisted_state, #previous_state, #remove_all_states_between, #remove_all_states_since, #remove_all_states_until, #sum_between, #sum_since, #sum_until, #updated_between?, #updated_since?, #updated_until?, #variance_between, #variance_since, #variance_until

+ + + + + + + + + + + + + + + +

Methods included from DSL::Items::Ensure::Ensurable

+

#ensure

+ +
+

Instance Attribute Details

+ + + +
+

+ + #categoryString + + + + Also known as: + icon + + + + +

+
+

The item's category (icon).

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+313
+314
+315
+316
+317
+318
+319
+320
+321
+
+
# File 'lib/openhab/core/items/generic_item.rb', line 313
+
+def category=(value)
+  modify do
+    value = value&.to_s
+    next if category == value
+
+    @modified = true
+    set_category(value)
+  end
+end
+
+
+ + + +
+

+ + #formatted_stateString (readonly) + + + + + +

+
+

Format the item's state according to its state description

+

This may include running a transformation.

+ + +
+
+
+ +
+

Examples:

+ + +
logger.info(Exterior_WindDirection.formatted_state) # => "NE (36°)"
+ +
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    The formatted state

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+103
+104
+105
+
+
# File 'lib/openhab/core/items/generic_item.rb', line 103
+
+def formatted_state
+  GenericItem.item_states_event_builder.get_display_state(self)
+end
+
+
+ + + +
+

+ + #labelString + + + + + +

+
+

The item's descriptive label.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/generic_item.rb', line 66
+
+
+
+
+ + + +
+

+ + #nameString (readonly) + + + + + +

+
+

The item's name.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/generic_item.rb', line 62
+
+
+
+
+ + + +
+

+ + #raw_stateState (readonly) + + + + + +

+
+

Get the raw item state.

+

The state of the item, including possibly NULL or UNDEF

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (State) + + + +
  • + +
+ +
+ + + + +
+
+
+
+81
+
+
# File 'lib/openhab/core/items/generic_item.rb', line 81
+
+alias_method :raw_state, :state
+
+
+ + + +
+

+ + #stateState? (readonly) + + + + + +

+
+

Returns openHAB item state if state is not UNDEF or NULL, nil otherwise. +This makes it easy to use with the +Ruby safe navigation operator &. +Use #undef? or #null? to check for those states.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+115
+116
+117
+
+
# File 'lib/openhab/core/items/generic_item.rb', line 115
+
+def state
+  raw_state if state?
+end
+
+
+ + + +
+

+ + + #tagsArray<String> + + #tags=(values) ⇒ void + + + + + + +

+
+

The item's tags

+ + +
+
+
+ +

Overloads:

+
    + + +
  • + #tagsArray<String> +
    +
    +

    Returns the item's tags.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Array<String>) + + + +
    • + +
    + +
    +
  • + + +
  • + #tags=(values) ⇒ void +
    +
    +

    This method returns an undefined value.

    Sets the item's tags.

    +

    To remove all tags, assign an empty array or nil.

    + + +
    +
    +
    +

    Parameters:

    + + + +
    +
  • + +
+ +

Returns:

+
    + +
  • + + + (Array<String>) + + + +
  • + +
+ +
+ + + + +
+
+
+
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+
+
# File 'lib/openhab/core/items/generic_item.rb', line 337
+
+def tags=(values)
+  modify do
+    values = DSL::Items::ItemBuilder.normalize_tags(*values)
+    next if values.to_set == tags.to_set
+
+    @modified = true
+    remove_all_tags
+    add_tags(values)
+  end
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #command(command, source: nil) ⇒ self? + + + + Also known as: + command!, << + + + + +

+
+

Send a command to this item

+

When this method is chained after the ensure +method, or issued inside an ensure_states block, or after +ensure_states! have been called, +the command will only be sent if the item is not already in the same state.

+

The similar method command!, however, will always send the command regardless of the item's state.

+ + +
+
+
+ +
+

Examples:

+ + +

Sending a Command to an item

+

+ +
MySwitch.command(ON) # The preferred method is `MySwitch.on`
+Garage_Door.command(DOWN) # The preferred method is `Garage_Door.down`
+SetTemperature.command 20 | "°C"
+ + +

Sending a plain number to a NumberItem

+

+ +
SetTemperature.command(22.5) # if it accepts a DecimalType
+ + +

Sending a string to a dimensioned NumberItem

+

+ +
SetTemperature.command("22.5 °C") # The string will be parsed and converted to a QuantityType
+ +
+

Parameters:

+
    + +
  • + + command + + + (Command, #to_s) + + + + — +

    command to send to the item. +When given a Command argument, it will be passed directly. +Otherwise, the result of #to_s will be parsed into a Command.

    +
    + +
  • + +
  • + + source + + + (String, nil) + + + (defaults to: nil) + + + — +

    Optional string to identify what sent the event.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (self, nil) + + + + — +

    nil when ensure is in effect and the item was already in the same state, +otherwise the item.

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+
+
# File 'lib/openhab/core/items/generic_item.rb', line 160
+
+def command(command, source: nil)
+  command = format_command(command)
+  logger.trace { "Sending Command #{command} to #{name}" }
+  if source
+    Events.publisher.post(Events::ItemEventFactory.create_command_event(name, command, source.to_s))
+  else
+    $events.send_command(self, command)
+  end
+  Proxy.new(self)
+end
+
+
+ +
+

+ + #modify(force: false) { ... } ⇒ Object + + + + + +

+
+

Defers notifying openHAB of modifications to multiple attributes until the block is complete.

+ + +
+
+
+ +
+

Examples:

+ + +

Modify label and tags for an item

+

+ +
MySwitch.modify do
+  MySwitch.label = "New Label"
+  MySwitch.tags = :labeled
+end
+ +
+

Parameters:

+
    + +
  • + + force + + + (true, false) + + + (defaults to: false) + + + — +

    When true, allow modifications to file-based items. +Normally a FrozenError is raised when attempting to modify file-based items, since +they will then be out-of-sync with the definition on disk. Advanced users may do this +knowingly and intentionally though, so an escape hatch is provided to allow runtime +modifications.

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + +
  • + +
+

Returns:

+
    + +
  • + + + (Object) + + + + — +

    the block's return value

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +
+ + + + +
+
+
+
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+
+
# File 'lib/openhab/core/items/generic_item.rb', line 274
+
+def modify(force: false)
+  raise ArgumentError, "you must pass a block to modify" unless block_given?
+  return yield if instance_variable_defined?(:@modifying) && @modifying
+
+  begin
+    provider = self.provider
+    if provider && !provider.is_a?(org.openhab.core.common.registry.ManagedProvider)
+      raise FrozenError, "Cannot modify item #{name} from provider #{provider.inspect}." unless force
+
+      provider = nil
+      logger.debug { "Forcing modifications to non-managed item #{name}" }
+    end
+    @modified = false
+    @modifying = true
+
+    r = yield
+
+    provider&.update(self) if @modified
+    r
+  ensure
+    @modifying = false
+  end
+end
+
+
+ +
+

+ + #null?true, false + + + + + +

+
+

Check if the item state == NULL

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/generic_item.rb', line 119
+
+
+
+
+ +
+

+ + #refreshItem + + + + + +

+
+

Send the REFRESH command to the item

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Item) + + + + — +

    self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/generic_item.rb', line 179
+
+
+
+
+ +
+

+ + #state?true, false + + + + + +

+
+

Check if the item has a state (not UNDEF or NULL)

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+88
+89
+90
+
+
# File 'lib/openhab/core/items/generic_item.rb', line 88
+
+def state?
+  !raw_state.is_a?(Types::UnDefType)
+end
+
+
+ +
+

+ + #time_series=(time_series) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Set a new time series.

+

This will trigger a time_series_updated event.

+ + +
+
+
+

Parameters:

+ + +

Since:

+
    + +
  • + + + + + +

    openHAB 4.1

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/generic_item.rb', line 245
+
+
+
+
+ +
+

+ + #undef?true, false + + + + + +

+
+

Check if the item state == UNDEF

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/generic_item.rb', line 123
+
+
+
+
+ +
+

+ + #update(state) ⇒ self? + + + + Also known as: + update! + + + + +

+
+

Send an update to this item

+ + +
+
+
+ +
+

Examples:

+ + +

Updating to a State

+

+ +
DoorStatus.update(OPEN)
+InsideTemperature.update 20 | "°C"
+ + +

Updating to NULL, the two following are equivalent:

+

+ +
DoorStatus.update(nil)
+DoorStatus.update(NULL)
+ + +

Updating with a plain number

+

+ +
PeopleCount.update(5) # A plain NumberItem
+ + +

Updating with a string to a dimensioned NumberItem

+

+ +
InsideTemperature.update("22.5 °C") # The string will be parsed and converted to a QuantityType
+ +
+

Parameters:

+
    + +
  • + + state + + + (State, #to_s, nil) + + + + — +

    the state to update the item. +When given a State argument, it will be passed directly. +Otherwise, the result of #to_s will be parsed into a State first. +If nil is passed, the item will be updated to NULL.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (self, nil) + + + + — +

    nil when ensure is in effect and the item was already in the same state, +otherwise the item.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+207
+208
+209
+210
+211
+212
+
+
# File 'lib/openhab/core/items/generic_item.rb', line 207
+
+def update(state)
+  state = format_update(state)
+  logger.trace { "Sending Update #{state} to #{name}" }
+  $events.post_update(self, state)
+  Proxy.new(self)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/GroupFunction.html b/5.33/OpenHAB/Core/Items/GroupFunction.html new file mode 100644 index 0000000000..e92390f754 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/GroupFunction.html @@ -0,0 +1,3783 @@ + + + + + + + Module: OpenHAB::Core::Items::GroupFunction + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Items::GroupFunction + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/group_function.rb
+
+ +
+ +

Overview

+
+

Adds #to_s and #inspect to group function.

+ + +
+
+
+ +
+

Examples:

+ + +
# Group:SWITCH:OR(ON,OFF) Switches
+logger.info "The Switches group function is: #{Switches.function}" # => "OR"
+logger.info "The Switches group function: #{Switches.function.inspect}" # => "OR(ON,OFF)"
+ +
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + +
    + +
  • + + + #inspect ⇒ String + + + + + + + + + + + + + +

    Returns the group function and its parameters as a string.

    +
    + +
  • + + +
  • + + + #to_s ⇒ String + + + + + + + + + + + + + +

    Returns the group function as an uppercase string.

    +
    + +
  • + + +
+ + + + + +
+

Instance Method Details

+ + +
+

+ + #inspectString + + + + + +

+
+

Returns the group function and its parameters as a string

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+29
+30
+31
+32
+33
+
+
# File 'lib/openhab/core/items/group_function.rb', line 29
+
+def inspect
+  params = parameters.map(&:inspect).join(",")
+  params = "(#{params})" unless params.empty?
+  "#{self}#{params}"
+end
+
+
+ +
+

+ + #to_sString + + + + + +

+
+

Returns the group function as an uppercase string

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+21
+22
+23
+
+
# File 'lib/openhab/core/items/group_function.rb', line 21
+
+def to_s
+  self.class.simple_name.upcase
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/GroupItem.html b/5.33/OpenHAB/Core/Items/GroupItem.html new file mode 100644 index 0000000000..da2986d856 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/GroupItem.html @@ -0,0 +1,4699 @@ + + + + + + + Class: OpenHAB::Core::Items::GroupItem + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::GroupItem + + + +

+
+ +
+
Inherits:
+
+ GenericItem + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
DSL::Items::TimedCommand
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/items/group_item.rb,
+ lib/openhab/core/items/semantics.rb
+
+
+ +
+ +

Overview

+
+

A group behaves like a regular item, but also has #members which are +nested items that can be enumerated.

+

If the group has a particular type, the methods from that type are +directly available.

+

The examples all assume the following items exist.

+
Group House
+// Location perspective
+Group GroundFloor  (House)
+Group Livingroom   (GroundFloor)
+// Functional perspective
+Group Sensors      (House)
+Group Temperatures (Sensors)
+
+Number Livingroom_Temperature "Living Room temperature" (Livingroom, Temperatures)
+Number Bedroom_Temp "Bedroom temperature" (GroundFloor, Temperatures)
+Number Den_Temp "Den temperature" (GroundFloor, Temperatures)
+
+ + +
+
+
+ +
+

Examples:

+ + +

Operate on items in a group using enumerable methods

+

+ +
logger.info("Total Temperatures: #{Temperatures.members.count}")
+# Total Temperatures: 3
+logger.info("Temperatures: #{House.members.map(&:name).sort.join(', ')}")
+# Temperatures: GroundFloor, Sensors
+ + +

Access to the methods and attributes like any item

+

+ +
logger.info("Group: #{Temperatures.name}" # Group: Temperatures'
+ + +

Operates on items in nested groups using enumerable methods

+

+ +
logger.info("House Count: #{House.all_members.count}")
+# House Count: 7
+logger.info("Items: #{House.all_members.grep_v(GroupItem).map(&:label).sort.join(', ')}")
+# Items: Bedroom temperature, Den temperature, Living Room temperature
+ + +

Iterate through the direct members of the group

+

+ +
Temperatures.members.each do |item|
+  logger.info("#{item.label} is: #{item.state}")
+end
+# Living Room temperature is 22
+# Bedroom temperature is 21
+# Den temperature is 19
+ + +
rule 'Turn off any switch that changes' do
+  changed Switches.members
+  triggered(&:off)
+end
+ + +

Built in Enumerable functions can be applied to groups.

+

+ +
logger.info("Max is #{Temperatures.members.map(&:state).max}")
+logger.info("Min is #{Temperatures.members.map(&:state).min}")
+ +
+ + +

Defined Under Namespace

+

+ + + + + Classes: Members + + +

+ + + +

Constant Summary

+ +

Constants included + from Semantics

+

Semantics::Equipment, Semantics::Location, Semantics::Point, Semantics::Property, Semantics::Tag

+ + + +

Constants included + from Persistence

+

Persistence::HistoricState

+ + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from GenericItem

+

#category, #formatted_state, #label, #name, #raw_state, #state, #tags

+ + + +

Attributes included from Semantics

+

#equipment, #equipment_type, #location, #location_type, #point_type, #property_type, #semantic_type

+ + + +

Attributes included from Item

+

#accepted_command_types, #accepted_data_types, #all_groups, #channel, #channel_uid, #channel_uids, #channels, #groups, #links, #metadata, #name, #provider, #thing, #things

+ + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from DSL::Items::TimedCommand

+

#command

+ + + + + + + + + +

Methods inherited from GenericItem

+

#command, #modify, #null?, #refresh, #state?, #time_series=, #undef?, #update

+ + + + + + + + + +

Methods included from Semantics

+

add, #equipment?, #location?, lookup, #point?, #points, remove, #semantic?, tags

+ + + + + + + + + +

Methods included from Item

+

#call_item?, #color_item?, #contact_item?, #date_time_item?, #dimmer_item?, #group_item?, #image_item?, #inspect, #link, #location_item?, #member_of?, #number_item?, #player_item?, #rollershutter_item?, #string_item?, #switch_item?, #tagged?, #to_s, #unlink

+ + + + + + + + + +

Methods included from Persistence

+

#all_states_between, #all_states_since, #all_states_until, #average_between, #average_since, #average_until, #changed_between?, #changed_since?, #changed_until?, #count_between, #count_since, #count_state_changes_between, #count_state_changes_since, #count_state_changes_until, #count_until, #delta_between, #delta_since, #delta_until, #deviation_between, #deviation_since, #deviation_until, #evolution_rate, #evolution_rate_between, #evolution_rate_since, #evolution_rate_until, #historic_state, #last_change, #last_update, #maximum_between, #maximum_since, #maximum_until, #median_between, #median_since, #median_until, #minimum_between, #minimum_since, #minimum_until, #next_change, #next_state, #next_update, #persist, #persisted_state, #previous_state, #remove_all_states_between, #remove_all_states_since, #remove_all_states_until, #sum_between, #sum_since, #sum_until, #updated_between?, #updated_since?, #updated_until?, #variance_between, #variance_since, #variance_until

+ + + + + + + + + + + + + + + +

Methods included from DSL::Items::Ensure::Ensurable

+

#ensure

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + +

+ +
+

+ + #method_missing(method, *args, &block) ⇒ Object (private) + + + + + +

+
+

Delegate missing methods to #base_item if possible

+ + +
+
+
+ + +
+ + + + +
+
+
+
+202
+203
+204
+205
+206
+
+
# File 'lib/openhab/core/items/group_item.rb', line 202
+
+def method_missing(method, *args, &block)
+  return base_item.__send__(method, *args, &block) if base_item&.respond_to?(method) # rubocop:disable Lint/RedundantSafeNavigation nil responds to :to_a
+
+  super
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #all_membersArray (readonly) + + + + + +

+
+

Returns Get all non-group members of the group recursively.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array) + + + + — +

    Get all non-group members of the group recursively.

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+157
+158
+159
+
+
# File 'lib/openhab/core/items/group_item.rb', line 157
+
+def all_members
+  getAllMembers.map { |m| Proxy.new(m) }
+end
+
+
+ + + +
+

+ + #base_itemItem? (readonly) + + + + + +

+
+

Returns A typed item if the group has a particular type.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Item, nil) + + + + — +

    A typed item if the group has a particular type.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+
+
# File 'lib/openhab/core/items/group_item.rb', line 71
+
+class GroupItem < GenericItem
+  #
+  # Class for indicating to triggers that a group trigger should be used
+  #
+  class Members
+    include LazyArray
+
+    # @return [GroupItem]
+    attr_reader :group
+
+    # @!visibility private
+    def initialize(group_item)
+      @group = group_item
+    end
+
+    #
+    # Adds a member to the group
+    #
+    # @param [Item, String] member The item to add to the group
+    # @return [Members] self
+    #
+    def add(member)
+      if member.is_a?(String)
+        member = items[member]
+        raise ArgumentError, "Item not found: #{member}" if member.nil?
+      end
+
+      member = member.__getobj__ if member.is_a?(Proxy)
+      raise ArgumentError, "Member must be an Item" unless member.is_a?(Item)
+
+      group.add_member(member)
+      self
+    end
+    alias_method :<<, :add
+
+    # Explicit conversion to Array
+    #
+    # @return [Array]
+    def to_a
+      group.get_members.map { |i| Proxy.new(i) }
+    end
+
+    # Name of the group
+    #
+    # @return [String]
+    def name
+      group.name
+    end
+
+    # @return [String]
+    def inspect
+      r = "#<OpenHAB::Core::Items::GroupItems::Members #{name}"
+      r += " #{map(&:name).inspect}>" unless @group.__getobj__.nil?
+      "#{r}>"
+    end
+    alias_method :to_s, :inspect
+  end
+
+  # @!attribute [r] function
+  # @return [GroupFunction] Returns the function of this GroupItem
+
+  # Override because we want to send them to the base item if possible
+  %i[command update].each do |method|
+    define_method(method) do |command, **kwargs|
+      return base_item.__send__(method, command, **kwargs) if base_item
+
+      super(command, **kwargs)
+    end
+  end
+
+  #
+  # @!attribute [r] members
+  # @return [Members] Get an Array-like object representing the members of the group
+  #
+  # @see Enumerable
+  #
+  def members
+    Members.new(Proxy.new(self))
+  end
+
+  #
+  # @!attribute [r] all_members
+  # @return [Array] Get all non-group members of the group recursively.
+  #
+  # @see Enumerable
+  #
+  def all_members
+    getAllMembers.map { |m| Proxy.new(m) }
+  end
+
+  # give the base item type a chance to format commands
+  # @!visibility private
+  def format_type(command)
+    return super unless base_item
+
+    base_item.format_type(command)
+  end
+
+  %w[call color contact date_time dimmer image location number player rollershutter string switch].each do |type|
+    type_class = type.gsub(/(^[a-z]|_[a-z])/) { |letter| letter[-1].upcase }
+    class_eval <<~RUBY, __FILE__, __LINE__ + 1
+      def #{type}_item?                      # def date_time_item?
+        base_item&.is_a?(#{type_class}Item)  #   base_item&.is_a?(DateTimeItem)
+      end                                    # end
+    RUBY
+  end
+
+  #
+  # Compares all attributes of the item with another item.
+  #
+  # @param other [Item] The item to compare with
+  # @return [true,false] true if all attributes are equal, false otherwise
+  #
+  # @!visibility private
+  def config_eql?(other)
+    return false unless super
+
+    base_item&.type == other.base_item&.type && function&.inspect == other.function&.inspect
+  end
+
+  private
+
+  # Add base type and function details
+  def type_details
+    r = ""
+    r += ":#{base_item.type}#{base_item.__send__(:type_details)}" if base_item
+    r += ":#{function.inspect}" if function && function.to_s != "EQUALITY"
+    r
+  end
+
+  # Delegate missing methods to {base_item} if possible
+  def method_missing(method, *args, &block)
+    return base_item.__send__(method, *args, &block) if base_item&.respond_to?(method) # rubocop:disable Lint/RedundantSafeNavigation nil responds to :to_a
+
+    super
+  end
+
+  def respond_to_missing?(method, include_private = false)
+    return true if base_item&.respond_to?(method) # rubocop:disable Lint/RedundantSafeNavigation
+
+    super
+  end
+end
+
+
+ + + +
+

+ + #equipmentsArray<Item> (readonly) + + + + + +

+
+

Calls members.equipments.

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+11
+
+
# File 'lib/openhab/core/items/semantics.rb', line 11
+
+def equipments; end
+
+
+ + + +
+

+ + #functionGroupFunction (readonly) + + + + + +

+
+

Returns the function of this GroupItem

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (GroupFunction) + + + + — +

    Returns the function of this GroupItem

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/group_item.rb', line 129
+
+
+
+
+ + + +
+

+ + #locationsArray<Item> (readonly) + + + + + +

+
+

Calls members.locations.

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+22
+
+
# File 'lib/openhab/core/items/semantics.rb', line 22
+
+def locations; end
+
+
+ + + +
+

+ + #membersMembers (readonly) + + + + + +

+
+

Returns Get an Array-like object representing the members of the group.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Members) + + + + — +

    Get an Array-like object representing the members of the group

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+147
+148
+149
+
+
# File 'lib/openhab/core/items/group_item.rb', line 147
+
+def members
+  Members.new(Proxy.new(self))
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/GroupItem/Members.html b/5.33/OpenHAB/Core/Items/GroupItem/Members.html new file mode 100644 index 0000000000..f7e18bfc61 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/GroupItem/Members.html @@ -0,0 +1,4144 @@ + + + + + + + Class: OpenHAB::Core::Items::GroupItem::Members + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::GroupItem::Members + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
LazyArray, DSL::Items::Ensure::Ensurable
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/items/group_item.rb
+
+ +
+ +

Overview

+
+

Class for indicating to triggers that a group trigger should be used

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods included from DSL::Items::Ensure::Ensurable

+

#ensure

+ + + + + + + + + +

Methods included from LazyArray

+

#each, #method_missing, #to_ary

+ + + + + + + + + +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update, #update!

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::LazyArray + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #groupGroupItem (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+79
+80
+81
+
+
# File 'lib/openhab/core/items/group_item.rb', line 79
+
+def group
+  @group
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #add(member) ⇒ Members + + + + Also known as: + << + + + + +

+
+

Adds a member to the group

+ + +
+
+
+

Parameters:

+
    + +
  • + + member + + + (Item, String) + + + + — +

    The item to add to the group

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Members) + + + + — +

    self

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +
+ + + + +
+
+
+
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+
+
# File 'lib/openhab/core/items/group_item.rb', line 92
+
+def add(member)
+  if member.is_a?(String)
+    member = items[member]
+    raise ArgumentError, "Item not found: #{member}" if member.nil?
+  end
+
+  member = member.__getobj__ if member.is_a?(Proxy)
+  raise ArgumentError, "Member must be an Item" unless member.is_a?(Item)
+
+  group.add_member(member)
+  self
+end
+
+
+ +
+

+ + #inspectString + + + + Also known as: + to_s + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+121
+122
+123
+124
+125
+
+
# File 'lib/openhab/core/items/group_item.rb', line 121
+
+def inspect
+  r = "#<OpenHAB::Core::Items::GroupItems::Members #{name}"
+  r += " #{map(&:name).inspect}>" unless @group.__getobj__.nil?
+  "#{r}>"
+end
+
+
+ +
+

+ + #nameString + + + + + +

+
+

Name of the group

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+116
+117
+118
+
+
# File 'lib/openhab/core/items/group_item.rb', line 116
+
+def name
+  group.name
+end
+
+
+ +
+

+ + #to_aArray + + + + + +

+
+

Explicit conversion to Array

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array) + + + +
  • + +
+ +
+ + + + +
+
+
+
+109
+110
+111
+
+
# File 'lib/openhab/core/items/group_item.rb', line 109
+
+def to_a
+  group.get_members.map { |i| Proxy.new(i) }
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/ImageItem.html b/5.33/OpenHAB/Core/Items/ImageItem.html new file mode 100644 index 0000000000..ac61870851 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/ImageItem.html @@ -0,0 +1,4289 @@ + + + + + + + Class: OpenHAB::Core::Items::ImageItem + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::ImageItem + + + +

+
+ +
+
Inherits:
+
+ GenericItem + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/image_item.rb
+
+ +
+ +

Overview

+
+

An ImageItem holds the binary image data as its state.

+ + +
+
+
+ +
+

Examples:

+ + +

Update from a base 64 encode image string

+

+ +
Image.update("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=")
+ + +

Update from image bytes and mime type

+

+ +
Image.update_from_bytes(File.binread(File.join(Dir.tmpdir,'1x1.png')), mime_type: 'image/png')
+ + +

Update from URL

+

+ +
Image.update_from_url('https://raw.githubusercontent.com/boc-tothefuture/openhab-jruby/main/features/assets/1x1.png')
+ + +

Update from File

+

+ +
Image.update_from_file('/tmp/1x1.png')
+ + +

Log image data

+

+ +
logger.info("Mime type: #{Image.state.mime_type}")
+logger.info("Number of bytes: #{Image.state.bytes.length}")
+ +
+ + +
+ + +

Constant Summary

+ +

Constants included + from Semantics

+

Semantics::Equipment, Semantics::Location, Semantics::Point, Semantics::Property, Semantics::Tag

+ + + +

Constants included + from Persistence

+

Persistence::HistoricState

+ + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from GenericItem

+

#category, #formatted_state, #label, #name, #raw_state, #tags

+ + + +

Attributes included from Semantics

+

#equipment, #equipment_type, #location, #location_type, #point_type, #property_type, #semantic_type

+ + + +

Attributes included from Item

+

#accepted_command_types, #accepted_data_types, #all_groups, #channel, #channel_uid, #channel_uids, #channels, #groups, #links, #metadata, #name, #provider, #thing, #things

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods inherited from GenericItem

+

#command, #modify, #null?, #refresh, #state?, #time_series=, #undef?, #update

+ + + + + + + + + +

Methods included from Semantics

+

add, #equipment?, #location?, lookup, #point?, #points, remove, #semantic?, tags

+ + + + + + + + + +

Methods included from Item

+

#call_item?, #color_item?, #contact_item?, #date_time_item?, #dimmer_item?, #group_item?, #image_item?, #inspect, #link, #location_item?, #member_of?, #number_item?, #player_item?, #rollershutter_item?, #string_item?, #switch_item?, #tagged?, #to_s, #unlink

+ + + + + + + + + +

Methods included from DSL::Items::TimedCommand

+

#command

+ + + + + + + + + +

Methods included from Persistence

+

#all_states_between, #all_states_since, #all_states_until, #average_between, #average_since, #average_until, #changed_between?, #changed_since?, #changed_until?, #count_between, #count_since, #count_state_changes_between, #count_state_changes_since, #count_state_changes_until, #count_until, #delta_between, #delta_since, #delta_until, #deviation_between, #deviation_since, #deviation_until, #evolution_rate, #evolution_rate_between, #evolution_rate_since, #evolution_rate_until, #historic_state, #last_change, #last_update, #maximum_between, #maximum_since, #maximum_until, #median_between, #median_since, #median_until, #minimum_between, #minimum_since, #minimum_until, #next_change, #next_state, #next_update, #persist, #persisted_state, #previous_state, #remove_all_states_between, #remove_all_states_since, #remove_all_states_until, #sum_between, #sum_since, #sum_until, #updated_between?, #updated_since?, #updated_until?, #variance_between, #variance_since, #variance_until

+ + + + + + + + + + + + + + + +

Methods included from DSL::Items::Ensure::Ensurable

+

#ensure

+ +
+

Instance Attribute Details

+ + + +
+

+ + #stateRawType? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (RawType, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+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
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+
+
# File 'lib/openhab/core/items/image_item.rb', line 37
+
+class ImageItem < GenericItem
+  #
+  # Update image from file
+  #
+  # @param [String] file location
+  # @param [String] mime_type of image
+  #
+  #
+  def update_from_file(file, mime_type: nil)
+    file_data = File.binread(file)
+    mime_type ||= Marcel::MimeType.for(Pathname.new(file)) || Marcel::MimeType.for(file_data)
+    update_from_bytes(file_data, mime_type: mime_type)
+  end
+
+  #
+  # Update image from image at URL
+  #
+  # @param [String] uri location of image
+  #
+  #
+  def update_from_url(uri)
+    logger.trace { "Downloading image from #{uri}" }
+    response = Net::HTTP.get_response(URI(uri))
+    mime_type = response["content-type"]
+    bytes = response.body
+    mime_type ||= detect_mime_from_bytes(bytes: bytes)
+    update_from_bytes(bytes, mime_type: mime_type)
+  end
+
+  #
+  # Update image from image bytes
+  #
+  # @param [String] mime_type of image
+  # @param [Object] bytes image data
+  #
+  #
+  def update_from_bytes(bytes, mime_type: nil)
+    mime_type ||= detect_mime_from_bytes(bytes: bytes)
+    base_64_image = encode_image(mime_type: mime_type, bytes: bytes)
+    update(base_64_image)
+  end
+
+  private
+
+  #
+  # Encode image information in the format required by openHAB
+  #
+  # @param [String] mime_type for image
+  # @param [Object] bytes image data
+  #
+  # @return [String] openHAB image format with image data Base64 encoded
+  #
+  def encode_image(mime_type:, bytes:)
+    "data:#{mime_type};base64,#{Base64.strict_encode64(bytes)}"
+  end
+
+  #
+  # Detect the mime type based on bytes
+  #
+  # @param [Array] bytes representing image data
+  #
+  # @return [String] mime type if it can be detected, nil otherwise
+  #
+  def detect_mime_from_bytes(bytes:)
+    logger.trace("Detecting mime type from file image contents")
+    Marcel::MimeType.for(bytes)
+  end
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #update_from_bytes(bytes, mime_type: nil) ⇒ Object + + + + + +

+
+

Update image from image bytes

+ + +
+
+
+

Parameters:

+
    + +
  • + + mime_type + + + (String) + + + (defaults to: nil) + + + — +

    of image

    +
    + +
  • + +
  • + + bytes + + + (Object) + + + + — +

    image data

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+73
+74
+75
+76
+77
+
+
# File 'lib/openhab/core/items/image_item.rb', line 73
+
+def update_from_bytes(bytes, mime_type: nil)
+  mime_type ||= detect_mime_from_bytes(bytes: bytes)
+  base_64_image = encode_image(mime_type: mime_type, bytes: bytes)
+  update(base_64_image)
+end
+
+
+ +
+

+ + #update_from_file(file, mime_type: nil) ⇒ Object + + + + + +

+
+

Update image from file

+ + +
+
+
+

Parameters:

+
    + +
  • + + file + + + (String) + + + + — +

    location

    +
    + +
  • + +
  • + + mime_type + + + (String) + + + (defaults to: nil) + + + — +

    of image

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+45
+46
+47
+48
+49
+
+
# File 'lib/openhab/core/items/image_item.rb', line 45
+
+def update_from_file(file, mime_type: nil)
+  file_data = File.binread(file)
+  mime_type ||= Marcel::MimeType.for(Pathname.new(file)) || Marcel::MimeType.for(file_data)
+  update_from_bytes(file_data, mime_type: mime_type)
+end
+
+
+ +
+

+ + #update_from_url(uri) ⇒ Object + + + + + +

+
+

Update image from image at URL

+ + +
+
+
+

Parameters:

+
    + +
  • + + uri + + + (String) + + + + — +

    location of image

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+57
+58
+59
+60
+61
+62
+63
+64
+
+
# File 'lib/openhab/core/items/image_item.rb', line 57
+
+def update_from_url(uri)
+  logger.trace { "Downloading image from #{uri}" }
+  response = Net::HTTP.get_response(URI(uri))
+  mime_type = response["content-type"]
+  bytes = response.body
+  mime_type ||= detect_mime_from_bytes(bytes: bytes)
+  update_from_bytes(bytes, mime_type: mime_type)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/Item.html b/5.33/OpenHAB/Core/Items/Item.html new file mode 100644 index 0000000000..d3f3137be8 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/Item.html @@ -0,0 +1,6863 @@ + + + + + + + Module: OpenHAB::Core::Items::Item + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Items::Item + + + +

+
+ + + + + + + + + +
+
Included in:
+
GenericItem
+
+ + + +
+
Defined in:
+
lib/openhab/core/items/item.rb
+
+ +
+ +

Overview

+
+

The core features of an openHAB item.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #accepted_command_typesArray<Class> (readonly) + + + + + +

+
+

Returns An array of Commands that can be sent as commands to this item.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array<Class>) + + + + — +

    An array of Commands that can be sent as commands to this item

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/item.rb', line 43
+
+
+
+
+ + + +
+

+ + #accepted_data_typesArray<Class> (readonly) + + + + + +

+
+

Returns An array of States that can be sent as commands to this item.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array<Class>) + + + + — +

    An array of States that can be sent as commands to this item

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/item.rb', line 46
+
+
+
+
+ + + +
+

+ + #all_groupsArray<GroupItem> (readonly) + + + + + +

+
+

Returns all groups that this item is a part of, as well as those groups' groups, recursively

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+
+
# File 'lib/openhab/core/items/item.rb', line 92
+
+def all_groups
+  result = []
+  new_groups = Set.new(groups)
+
+  until new_groups.empty?
+    result.concat(new_groups.to_a)
+    new_groups.replace(new_groups.flat_map(&:groups))
+    # remove any groups we already have in the result to avoid loops
+    new_groups.subtract(result)
+  end
+
+  result
+end
+
+
+ + + +
+

+ + #channelThings::Channel? (readonly) + + + + + +

+
+

Return the channel this item is linked to. If an item is linked to more than one channel, +this method only returns the first channel.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+295
+296
+297
+
+
# File 'lib/openhab/core/items/item.rb', line 295
+
+def channel
+  channel_uids.first&.channel
+end
+
+
+ + + +
+

+ + #channel_uidThings::ChannelUID? (readonly) + + + + + +

+
+

Return the UID of the channel this item is linked to. If an item is linked to more than one channel, +this method only returns the first channel.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+278
+279
+280
+
+
# File 'lib/openhab/core/items/item.rb', line 278
+
+def channel_uid
+  channel_uids.first
+end
+
+
+ + + +
+

+ + #channel_uidsArray<Things::ChannelUID> (readonly) + + + + + +

+
+

Return the UIDs of all of the channels this item is linked to.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+286
+287
+288
+
+
# File 'lib/openhab/core/items/item.rb', line 286
+
+def channel_uids
+  Things::Links::Provider.registry.get_bound_channels(name)
+end
+
+
+ + + +
+

+ + #channelsArray<Things::Channel> (readonly) + + + + + +

+
+

Return all of the channels this item is linked to.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+303
+304
+305
+
+
# File 'lib/openhab/core/items/item.rb', line 303
+
+def channels
+  channel_uids.map(&:channel)
+end
+
+
+ + + +
+

+ + #groupsArray<GroupItem> (readonly) + + + + + +

+
+

Returns all groups that this item is part of

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array<GroupItem>) + + + + — +

    All groups that this item is part of

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+65
+66
+67
+
+
# File 'lib/openhab/core/items/item.rb', line 65
+
+def groups
+  group_names.map { |name| EntityLookup.lookup_item(name) }.compact
+end
+
+
+ + + +
+
+
+

Returns all of the item's links (channels and link configurations).

+ + +
+
+
+ +
+

Examples:

+ + +

Get the configuration of the first link

+

+ +
LivingRoom_Light_Power.links.first.configuration
+ + +

Remove all managed links

+

+ +
LivingRoom_Light_Power.links.clear
+ +
+ +

Returns:

+
    + +
  • + + + (ItemChannelLinks) + + + + — +

    An array of ItemChannelLink or an empty array

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+322
+323
+324
+
+
# File 'lib/openhab/core/items/item.rb', line 322
+
+def links
+  ItemChannelLinks.new(name, Things::Links::Provider.registry.get_links(name))
+end
+
+
+ + + +
+

+ + #metadataMetadata::NamespaceHash (readonly) + + + + + +

+
+

Access to the item's metadata.

+

Both the return value of this method as well as the individual +namespaces can be treated as Hashes.

+

Examples assume the following items:

+
Switch Item1 { namespace1="value" [ config1="foo", config2="bar" ] }
+String StringItem1
+
+ + +
+
+
+ +
+

Examples:

+ + +

Check namespace's existence

+

+ +
Item1.metadata["namespace"].nil?
+Item1.metadata.key?("namespace")
+ + +

Access item's metadata value

+

+ +
Item1.metadata["namespace1"].value
+ + +

Access namespace1's configuration

+

+ +
Item1.metadata["namespace1"]["config1"]
+ + +

Safely search for the specified value - no errors are raised, only nil returned if a key in the chain doesn't exist

+

+ +
Item1.metadata.dig("namespace1", "config1") # => "foo"
+Item1.metadata.dig("namespace2", "config1") # => nil
+ + +

Set item's metadata value, preserving its config

+

+ +
# Item1's metadata before: {"namespace1"=>["value", {"config1"=>"foo", "config2"=>"bar"}]}
+Item1.metadata["namespace1"].value = "new value"
+# Item1's metadata after: {"namespace1"=>["new value", {"config1"=>"foo", "config2"=>"bar"]}}
+ + +

Set item's metadata config, preserving its value

+

+ +
# Item1's metadata before: {"namespace1"=>["value", {"config1"=>"foo", "config2"=>"bar"}]}
+Item1.metadata["namespace1"].replace({ "scooby"=>"doo" })
+# Item1's metadata after: {"namespace1"=>["value", {scooby="doo"}]}
+ + +

Set a namespace to a new value and config in one line

+

+ +
# Item1's metadata before: {"namespace1"=>"value", {"config1"=>"foo", "config2"=>"bar"}}
+Item1.metadata["namespace1"] = "new value", { "scooby"=>"doo" }
+# Item1's metadata after: {"namespace1"=>["new value", {scooby="doo"}]}
+ + +

Set item's metadata value and clear its previous config

+

+ +
# Item1's metadata before: {"namespace1"=>["value", {"config1"=>"foo", "config2"=>"bar"}]}
+Item1.metadata["namespace1"] = "new value"
+# Item1's metadata after: {"namespace1"=>"value" }
+ + +

Set item's metadata config, set its value to nil, and wiping out previous config

+

+ +
# Item1's metadata before: {"namespace1"=>["value", {"config1"=>"foo", "config2"=>"bar"}]}
+Item1.metadata["namespace1"] = { "newconfig"=>"value" }
+# Item1's metadata after: {"namespace1"=>{"config1"=>"foo", "config2"=>"bar"}}
+ + +

Update namespace1's specific configuration, preserving its value and other config

+

+ +
# Item1's metadata before: {"namespace1"=>["value", {"config1"=>"foo", "config2"=>"bar"}]}
+Item1.metadata["namespace1"]["config1"] = "doo"
+# Item1's metadata will be: {"namespace1"=>["value", {"config1"=>"doo", "config2"=>"bar"}]}
+ + +

Add a new configuration to namespace1

+

+ +
# Item1's metadata before: {"namespace1"=>["value", {"config1"=>"foo", "config2"=>"bar"}]}
+Item1.metadata["namespace1"]["config3"] = "boo"
+# Item1's metadata after: {"namespace1"=>["value", {"config1"=>"foo", "config2"=>"bar", config3="boo"}]}
+ + +

Delete a config

+

+ +
# Item1's metadata before: {"namespace1"=>["value", {"config1"=>"foo", "config2"=>"bar"}]}
+Item1.metadata["namespace1"].delete("config2")
+# Item1's metadata after: {"namespace1"=>["value", {"config1"=>"foo"}]}
+ + +

Add a namespace and set it to a value

+

+ +
# Item1's metadata before: {"namespace1"=>["value", {"config1"=>"foo", "config2"=>"bar"}]}
+Item1.metadata["namespace2"] = "qx"
+# Item1's metadata after: {"namespace1"=>["value", {"config1"=>"foo", "config2"=>"bar"}], "namespace2"=>"qx"}
+ + +

Add a namespace and set it to a value and config

+

+ +
# Item1's metadata before: {"namespace1"=>["value", {"config1"=>"foo", "config2"=>"bar"}]}
+Item1.metadata["namespace2"] = "qx", { "config1"=>"doo" }
+# Item1's metadata after: {"namespace1"=>["value", {"config1"=>"foo", "config2"=>"bar"}], "namespace2"=>["qx", {"config1"=>"doo"}]}
+ + +

Enumerate Item1's namespaces

+

+ +
Item1.metadata.each { |namespace, metadata| logger.info("Item1's namespace: #{namespace}=#{metadata}") }
+ + +

Add metadata from a hash

+

+ +
Item1.metadata.merge!({"namespace1"=>{"foo", {"config1"=>"baz"} ], "namespace2"=>{"qux", {"config"=>"quu"} ]})
+ + +

Merge Item2's metadata into Item1's metadata

+

+ +
Item1.metadata.merge!(Item2.metadata)
+ + +

Delete a namespace

+

+ +
Item1.metadata.delete("namespace1")
+ + +

Delete all metadata of the item

+

+ +
Item1.metadata.clear
+ + +

Does this item have any metadata?

+

+ +
Item1.metadata.any?
+ + +

Store another item's state

+

+ +
StringItem1.update "TEST"
+Item1.metadata["other_state"] = StringItem1.state
+ + +

Store event's state

+

+ +
rule "save event state" do
+  changed StringItem1
+  run { |event| Item1.metadata["last_event"] = event.was }
+end
+ + +

If the namespace already exists: Update the value of a namespace but preserve its config; otherwise create a new namespace with the given value and nil config.

+

+ +
Item1.metadata["namespace"] = "value", Item1.metadata["namespace"]
+ + +

Copy another namespace

+

+ +
# Item1's metadata before: {"namespace2"=>["value", {"config1"=>"foo", "config2"=>"bar"}]}
+Item1.metadata["namespace"] = Item1.metadata["namespace2"]
+# Item1's metadata after: {"namespace2"=>["value", {"config1"=>"foo", "config2"=>"bar"}], "namespace"=>["value", {"config1"=>"foo", "config2"=>"bar"}]}
+ +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+223
+224
+225
+
+
# File 'lib/openhab/core/items/item.rb', line 223
+
+def metadata
+  @metadata ||= Metadata::NamespaceHash.new(name)
+end
+
+
+ + + +
+

+ + #nameString (readonly) + + + + + +

+
+

The item's name.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/item.rb', line 39
+
+
+
+
+ + + +
+

+ + #providerorg.openhab.core.common.registry.Provider? (readonly) + + + + + +

+
+

Returns the provider for this item.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+409
+410
+411
+
+
# File 'lib/openhab/core/items/item.rb', line 409
+
+def provider
+  Provider.registry.provider_for(self)
+end
+
+
+ + + +
+

+ + #thingThings::Thing? (readonly) + + + + Also known as: + linked_thing + + + + +

+
+

Return the item's thing if this item is linked with a thing. If an item is linked to more than one channel, +this method only returns the first thing.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+259
+260
+261
+
+
# File 'lib/openhab/core/items/item.rb', line 259
+
+def thing
+  all_linked_things.first
+end
+
+
+ + + +
+

+ + #thingsArray<Things::Thing> (readonly) + + + + Also known as: + all_linked_things + + + + +

+
+

Returns all of the item's linked things.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array<Things::Thing>) + + + + — +

    An array of things or an empty array

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+268
+269
+270
+
+
# File 'lib/openhab/core/items/item.rb', line 268
+
+def things
+  Things::Links::Provider.registry.get_bound_things(name).map { |thing| Things::Proxy.new(thing) }
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #call_item?true, false + + + + + +

+
+ +
+ Note: +

If the item is a group item, it will also return true if the base item is a call item.

+
+
+ +

Check if the item is a call item.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+430
+
+
# File 'lib/openhab/core/items/item.rb', line 430
+
+def_type_predicate(:call)
+
+
+ +
+

+ + #color_item?true, false + + + + + +

+
+ +
+ Note: +

If the item is a group item, it will also return true if the base item is a color item.

+
+
+ +

Check if the item is a color item.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+431
+
+
# File 'lib/openhab/core/items/item.rb', line 431
+
+def_type_predicate(:color)
+
+
+ +
+

+ + #contact_item?true, false + + + + + +

+
+ +
+ Note: +

If the item is a group item, it will also return true if the base item is a contact item.

+
+
+ +

Check if the item is a contact item.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+432
+
+
# File 'lib/openhab/core/items/item.rb', line 432
+
+def_type_predicate(:contact)
+
+
+ +
+

+ + #date_time_item?true, false + + + + + +

+
+ +
+ Note: +

If the item is a group item, it will also return true if the base item is a date_time item.

+
+
+ +

Check if the item is a date_time item.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+433
+
+
# File 'lib/openhab/core/items/item.rb', line 433
+
+def_type_predicate(:date_time)
+
+
+ +
+

+ + #dimmer_item?true, false + + + + + +

+
+ +
+ Note: +

Color items are also considered dimmer items.

+
+
+ +
+ Note: +

If the item is a group item, it will also return true if the base item is a dimmer item.

+
+
+ +

Check if the item is a dimmer item.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+435
+
+
# File 'lib/openhab/core/items/item.rb', line 435
+
+def_type_predicate(:dimmer)
+
+
+ +
+

+ + #group_item?true, false + + + + + +

+
+ +
+ Note: +

If the item is a group item, it will also return true if the base item is a group item.

+
+
+ +

Check if the item is a group item.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+436
+
+
# File 'lib/openhab/core/items/item.rb', line 436
+
+def_type_predicate(:group)
+
+
+ +
+

+ + #image_item?true, false + + + + + +

+
+ +
+ Note: +

If the item is a group item, it will also return true if the base item is a image item.

+
+
+ +

Check if the item is a image item.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+437
+
+
# File 'lib/openhab/core/items/item.rb', line 437
+
+def_type_predicate(:image)
+
+
+ +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+397
+398
+399
+400
+401
+402
+403
+404
+405
+
+
# File 'lib/openhab/core/items/item.rb', line 397
+
+def inspect
+  s = "#<OpenHAB::Core::Items::#{type}Item#{type_details} #{name} #{label.inspect} state=#{raw_state.inspect}"
+  s += " category=#{category.inspect}" if category
+  s += " tags=#{tags.to_a.inspect}" unless tags.empty?
+  s += " groups=#{group_names}" unless group_names.empty?
+  meta = metadata.to_h
+  s += " metadata=#{meta.inspect}" unless meta.empty?
+  "#{s}>"
+end
+
+
+ +
+
+
+ + +
+
+
+ +

Overloads:

+
    + + +
  • + #linkThings::ItemChannelLink? +
    +
    +

    Returns the item's link. If an item is linked to more than one channel, +this method only returns the first link.

    + + +
    +
    +
    + +

    Returns:

    + + +
    +
  • + + +
  • + #link(channel, config = {}) ⇒ Things::ItemChannelLink +
    +
    +

    Links the item to a channel.

    + + +
    +
    +
    + +
    +

    Examples:

    + + +

    Link an item to a channel

    +

    + +
    LivingRoom_Light_Power.link("mqtt:topic:livingroom-light:power")
    + + +

    Link to a Thing's channel

    +

    + +
    LivingRoom_Light_Power.link(things["mqtt:topic:livingroom-light"].channels["power"])
    + + +

    Specify a link configuration

    +

    + +
    High_Temperature_Alert.link(
    +  "mqtt:topic:outdoor-thermometer:temperature",
    +  profile: "system:hysteresis",
    +  lower: "29 °C",
    +  upper: "30 °C")
    + +
    +

    Parameters:

    +
      + +
    • + + channel + + + (String, Things::Channel, Things::ChannelUID) + + + + — +

      The channel to link to.

      +
      + +
    • + +
    • + + config + + + (Hash) + + + (defaults to: {}) + + + — +

      The configuration for the link.

      +
      + +
    • + +
    + +

    Returns:

    + + +

    See Also:

    + + +
    +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+
+
# File 'lib/openhab/core/items/item.rb', line 360
+
+def link(channel = nil, config = nil)
+  return Things::Links::Provider.registry.get_links(name).first if channel.nil? && config.nil?
+
+  config ||= {}
+  Core::Things::Links::Provider.create_link(self, channel, config).tap do |new_link|
+    provider = Core::Things::Links::Provider.current
+    if !(current_link = provider.get(new_link.uid))
+      provider.add(new_link)
+    elsif current_link.configuration != config
+      provider.update(new_link)
+    end
+  end
+end
+
+
+ +
+

+ + #location_item?true, false + + + + + +

+
+ +
+ Note: +

If the item is a group item, it will also return true if the base item is a location item.

+
+
+ +

Check if the item is a location item.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+438
+
+
# File 'lib/openhab/core/items/item.rb', line 438
+
+def_type_predicate(:location)
+
+
+ +
+

+ + #member_of?(*groups) ⇒ true, false + + + + + +

+
+

Checks if this item is a member of at least one of the given groups.

+ + +
+
+
+ +
+

Examples:

+ + +
event.item.member_of?(gFullOn)
+ +
+

Parameters:

+
    + +
  • + + groups + + + (String, GroupItem) + + + + — +

    the group to check membership in

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+78
+79
+80
+81
+82
+83
+
+
# File 'lib/openhab/core/items/item.rb', line 78
+
+def member_of?(*groups)
+  groups.map! do |group|
+    group.is_a?(GroupItem) ? group.name : group
+  end
+  !(group_names & groups).empty?
+end
+
+
+ +
+

+ + #number_item?true, false + + + + + +

+
+ +
+ Note: +

If the item is a group item, it will also return true if the base item is a number item.

+
+
+ +

Check if the item is a number item.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+439
+
+
# File 'lib/openhab/core/items/item.rb', line 439
+
+def_type_predicate(:number)
+
+
+ +
+

+ + #player_item?true, false + + + + + +

+
+ +
+ Note: +

If the item is a group item, it will also return true if the base item is a player item.

+
+
+ +

Check if the item is a player item.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+440
+
+
# File 'lib/openhab/core/items/item.rb', line 440
+
+def_type_predicate(:player)
+
+
+ +
+

+ + #rollershutter_item?true, false + + + + + +

+
+ +
+ Note: +

If the item is a group item, it will also return true if the base item is a rollershutter item.

+
+
+ +

Check if the item is a rollershutter item.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+441
+
+
# File 'lib/openhab/core/items/item.rb', line 441
+
+def_type_predicate(:rollershutter)
+
+
+ +
+

+ + #string_item?true, false + + + + + +

+
+ +
+ Note: +

If the item is a group item, it will also return true if the base item is a string item.

+
+
+ +

Check if the item is a string item.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+442
+
+
# File 'lib/openhab/core/items/item.rb', line 442
+
+def_type_predicate(:string)
+
+
+ +
+

+ + #switch_item?true, false + + + + + +

+
+ +
+ Note: +

Color and dimmer items are also considered switch items.

+
+
+ +
+ Note: +

If the item is a group item, it will also return true if the base item is a switch item.

+
+
+ +

Check if the item is a switch item.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+444
+
+
# File 'lib/openhab/core/items/item.rb', line 444
+
+def_type_predicate(:switch)
+
+
+ +
+

+ + #tagged?(*tags) ⇒ true, false + + + + + +

+
+

Checks if this item has at least one of the given tags.

+ + +
+
+
+ +
+

Examples:

+ + +
event.item.tagged?("Setpoint")
+ + +
event.item.tagged?(Semantics::Switch)
+ +
+

Parameters:

+
    + +
  • + + tags + + + (String, Module) + + + + — +

    the tag(s) to check

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+
+
# File 'lib/openhab/core/items/item.rb', line 240
+
+def tagged?(*tags)
+  tags.map! do |tag|
+    # @deprecated OH3.4
+    if tag.is_a?(Module)
+      tag.simple_name
+    elsif defined?(Semantics::SemanticTag) && tag.is_a?(Semantics::SemanticTag)
+      tag.name
+    else
+      tag
+    end
+  end
+  !(self.tags.to_a & tags).empty?
+end
+
+
+ +
+

+ + #to_sString + + + + + +

+
+

The item's label if one is defined, otherwise its #name.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+54
+55
+56
+
+
# File 'lib/openhab/core/items/item.rb', line 54
+
+def to_s
+  label || name
+end
+
+
+ +
+
+
+

Removes a link to a channel from managed link providers.

+ + +
+
+
+

Parameters:

+ + +

Returns:

+ +

Raises:

+
    + +
  • + + + (FrozenError) + + + + — +

    if the link is not managed by a managed link provider.

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+
+
# File 'lib/openhab/core/items/item.rb', line 385
+
+def unlink(channel)
+  link_to_delete = Things::Links::Provider.create_link(self, channel, {})
+  provider = Things::Links::Provider.registry.provider_for(link_to_delete.uid)
+  unless provider.is_a?(ManagedProvider)
+    raise FrozenError,
+          "Cannot remove the link #{link_to_delete.uid} from non-managed provider #{provider.inspect}"
+  end
+
+  provider.remove(link_to_delete.uid)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/ItemChannelLinks.html b/5.33/OpenHAB/Core/Items/ItemChannelLinks.html new file mode 100644 index 0000000000..d565fe8283 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/ItemChannelLinks.html @@ -0,0 +1,3743 @@ + + + + + + + Class: OpenHAB::Core::Items::ItemChannelLinks + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::ItemChannelLinks + + + +

+
+ +
+
Inherits:
+
+ SimpleDelegator + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/item_channel_links.rb
+
+ +
+ +

Overview

+
+

A wrapper for OpenHAB::Core::Items::Item#links delegated to Set<org.openhab.core.thing.link.ItemChannelLink>.

+

Adds methods for clearing item's links to channels.

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + +
    + +
  • + + + #clear ⇒ self + + + + + + + + + + + + + +

    Removes all links to channels from managed link providers.

    +
    + +
  • + + +
+ + + + + + +
+

Instance Method Details

+ + +
+

+ + #clearself + + + + + +

+
+

Removes all links to channels from managed link providers.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+
+
# File 'lib/openhab/core/items/item_channel_links.rb', line 28
+
+def clear
+  Things::Links::Provider.registry.all.each do |link|
+    if @owner.is_a?(String)
+      next unless link.item_name == @owner
+    else
+      next unless link.linked_uid == @owner
+    end
+
+    provider = Things::Links::Provider.registry.provider_for(link.uid)
+    if provider.is_a?(ManagedProvider)
+      provider.remove(link.uid)
+    else
+      logger.warn("Cannot remove the link #{link.uid} from non-managed provider #{provider.inspect}")
+    end
+  end
+  self
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/LocationItem.html b/5.33/OpenHAB/Core/Items/LocationItem.html new file mode 100644 index 0000000000..6a4fe51989 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/LocationItem.html @@ -0,0 +1,3829 @@ + + + + + + + Class: OpenHAB::Core::Items::LocationItem + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::LocationItem + + + +

+
+ +
+
Inherits:
+
+ GenericItem + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/location_item.rb
+
+ +
+ +

Overview

+
+

A LocationItem can be used to store GPS related information, addresses +etc.

+

This is useful for location awareness related functions

+ + +
+
+
+ +
+

Examples:

+ + +

Send point commands

+

+ +
Location << '30,20'   # latitude of 30, longitude of 20
+Location << '30,20,80' # latitude of 30, longitude of 20, altitude of 80
+Location << PointType.new('40,20')
+ + +

Determine the distance between two locations

+

+ +
logger.info "Distance from Location 1 to Location 2: #{Location1.state - Location2.state}"
+logger.info "Distance from Location 1 to Location 2: #{Location1.state - PointType.new('40,20')}"
+ +
+ + +
+ + +

Constant Summary

+ +

Constants included + from Semantics

+

Semantics::Equipment, Semantics::Location, Semantics::Point, Semantics::Property, Semantics::Tag

+ + + +

Constants included + from Persistence

+

Persistence::HistoricState

+ + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from GenericItem

+

#category, #formatted_state, #label, #name, #raw_state, #tags

+ + + +

Attributes included from Semantics

+

#equipment, #equipment_type, #location, #location_type, #point_type, #property_type, #semantic_type

+ + + +

Attributes included from Item

+

#accepted_command_types, #accepted_data_types, #all_groups, #channel, #channel_uid, #channel_uids, #channels, #groups, #links, #metadata, #name, #provider, #thing, #things

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from GenericItem

+

#command, #modify, #null?, #refresh, #state?, #time_series=, #undef?, #update

+ + + + + + + + + +

Methods included from Semantics

+

add, #equipment?, #location?, lookup, #point?, #points, remove, #semantic?, tags

+ + + + + + + + + +

Methods included from Item

+

#call_item?, #color_item?, #contact_item?, #date_time_item?, #dimmer_item?, #group_item?, #image_item?, #inspect, #link, #location_item?, #member_of?, #number_item?, #player_item?, #rollershutter_item?, #string_item?, #switch_item?, #tagged?, #to_s, #unlink

+ + + + + + + + + +

Methods included from DSL::Items::TimedCommand

+

#command

+ + + + + + + + + +

Methods included from Persistence

+

#all_states_between, #all_states_since, #all_states_until, #average_between, #average_since, #average_until, #changed_between?, #changed_since?, #changed_until?, #count_between, #count_since, #count_state_changes_between, #count_state_changes_since, #count_state_changes_until, #count_until, #delta_between, #delta_since, #delta_until, #deviation_between, #deviation_since, #deviation_until, #evolution_rate, #evolution_rate_between, #evolution_rate_since, #evolution_rate_until, #historic_state, #last_change, #last_update, #maximum_between, #maximum_since, #maximum_until, #median_between, #median_since, #median_until, #minimum_between, #minimum_since, #minimum_until, #next_change, #next_state, #next_update, #persist, #persisted_state, #previous_state, #remove_all_states_between, #remove_all_states_since, #remove_all_states_until, #sum_between, #sum_since, #sum_until, #updated_between?, #updated_since?, #updated_until?, #variance_between, #variance_since, #variance_until

+ + + + + + + + + + + + + + + +

Methods included from DSL::Items::Ensure::Ensurable

+

#ensure

+ +
+

Instance Attribute Details

+ + + +
+

+ + #statePointType? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+28
+29
+
+
# File 'lib/openhab/core/items/location_item.rb', line 28
+
+class LocationItem < GenericItem
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/Metadata.html b/5.33/OpenHAB/Core/Items/Metadata.html new file mode 100644 index 0000000000..7e1dc545ad --- /dev/null +++ b/5.33/OpenHAB/Core/Items/Metadata.html @@ -0,0 +1,3610 @@ + + + + + + + Module: OpenHAB::Core::Items::Metadata + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Items::Metadata + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/metadata.rb,
+ lib/openhab/core/items/metadata/hash.rb,
lib/openhab/core/items/metadata/provider.rb,
lib/openhab/core/items/metadata/namespace_hash.rb
+
+
+ +
+ +

Overview

+
+

Contains classes wrapping interactions with item metadata.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + + + Classes: Hash, NamespaceHash, Provider + + +

+ + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/Metadata/Hash.html b/5.33/OpenHAB/Core/Items/Metadata/Hash.html new file mode 100644 index 0000000000..7355beb0e3 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/Metadata/Hash.html @@ -0,0 +1,5271 @@ + + + + + + + Class: OpenHAB::Core::Items::Metadata::Hash + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::Metadata::Hash + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
EmulateHash
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/items/metadata/hash.rb
+
+ +
+ +

Overview

+
+

Hash represents the configuration for a single metadata namespace.

+

It implements the entire interface of Hash.

+

All keys are converted to strings.

+

As a special case, a #== comparison can be done against a [value, config] array.

+ + +
+
+
+ +
+

Examples:

+ + +
MyItem.metadata[:namespace] = "value", { key: "value" }
+MyItem.metadata[:namespace] == ["value", { "key" => "value" }] #=> true
+ +
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update, #update!

+ +
+

Instance Attribute Details

+ + + +
+

+ + #itemObject (readonly) + + + + + +

+ + + + +
+
+
+
+85
+86
+87
+88
+89
+
+
# File 'lib/openhab/core/items/metadata/hash.rb', line 85
+
+def item
+  return nil unless attached?
+
+  DSL.items[uid.item_name]
+end
+
+
+ + + +
+

+ + #namespaceString (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+26
+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
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+
+
# File 'lib/openhab/core/items/metadata/hash.rb', line 26
+
+class Hash
+  java_import org.openhab.core.items.Metadata
+  private_constant :Metadata
+
+  # Mutators are manually implemented below.
+  include EmulateHash
+  extend Forwardable
+
+  def_delegators :@metadata, :configuration, :hash, :uid, :value
+  private :configuration
+
+  def_delegator :uid, :namespace
+
+  alias_method :to_map, :configuration
+  private :to_map
+
+  class << self
+    # @!visibility private
+    def from_item(item_name, namespace, value)
+      namespace = namespace.to_s
+      value = case value
+              when Hash
+                return value if value.uid.item_name == item_name && value.uid.namespace == namespace
+
+                [value.value, value.send(:configuration)]
+              when Array
+                raise ArgumentError, "Array must contain 2 elements: value, config" if value.length != 2
+
+                [value.first, (value.last || {}).transform_keys(&:to_s)]
+              when ::Hash then ["", value.transform_keys(&:to_s)]
+              else [value.to_s, {}]
+              end
+      new(Metadata.new(org.openhab.core.items.MetadataKey.new(namespace.to_s, item_name), *value))
+    end
+
+    # @!visibility private
+    def from_value(namespace, value)
+      from_item("-", namespace, value)
+    end
+  end
+
+  # @!visibility private
+  def initialize(metadata = nil)
+    @metadata = metadata
+  end
+
+  # @!visibility private
+  def dup
+    new(Metadata.new(org.openhab.core.items.MetadataKey.new(uid.namespace, "-"), value, configuration))
+  end
+
+  # Is this object attached to an actual Item?
+  # @return [true,false]
+  def attached?
+    uid.item_name != "-"
+  end
+
+  # @!attribute [r] item
+  #   @return [Item, nil] The item this namespace is attached to.
+  def item
+    return nil unless attached?
+
+    DSL.items[uid.item_name]
+  end
+
+  # @!visibility private
+  def commit
+    return unless attached?
+
+    javaify
+    provider!.update(@metadata)
+  end
+
+  # @!visibility private
+  def create_or_update
+    return unless attached?
+
+    javaify
+    (p = provider!).get(uid) ? p.update(@metadata) : p.add(@metadata)
+  end
+
+  # @!visibility private
+  def remove
+    provider!.remove(uid)
+  end
+
+  # @!visibility private
+  def eql?(other)
+    return true if equal?(other)
+    return false unless other.is_a?(Hash)
+    return false unless value == other.value
+
+    configuration == other.configuration
+  end
+
+  #
+  # Set the metadata value
+  #
+  def value=(value)
+    @metadata = org.openhab.core.items.Metadata.new(uid, value.to_s, configuration)
+    commit
+  end
+
+  # @!visibility private
+  def <(other)
+    if other.is_a?(Hash)
+      return false if attached? && uid == other.uid
+      return false unless value == other.value
+    end
+
+    configuration < other
+  end
+
+  # @!visibility private
+  def <=(other)
+    if other.is_a?(Hash)
+      return true if attached? && uid == other.uid
+      return false unless value == other.value
+    end
+
+    configuration <= other
+  end
+
+  # @!visibility private
+  def ==(other)
+    if other.is_a?(Hash)
+      return false unless value == other.value
+
+      return configuration == other.configuration
+    elsif value.empty? && other.respond_to?(:to_hash)
+      return configuration == other.to_hash
+    elsif other.is_a?(Array)
+      return other == [value, configuration]
+    end
+    false
+  end
+
+  # @!visibility private
+  def >(other)
+    if other.is_a?(Hash)
+      return false if attached? && uid == other.uid
+      return false unless value == other.value
+    end
+
+    configuration > other
+  end
+
+  # @!visibility private
+  def >=(other)
+    if other.is_a?(Hash)
+      return true if attached? && uid == other.uid
+      return false unless value == other.value
+    end
+
+    configuration >= other
+  end
+
+  # @!visibility private
+  def store(key, value)
+    key = key.to_s
+    new_config = to_h
+    new_config[key] = value
+    replace(new_config)
+    value
+  end
+
+  # @!visibility private
+  def delete(key)
+    key = key.to_s
+    new_config = to_h
+    return yield(key) if block_given? && !new_config.key?(key)
+
+    old_value = new_config.delete(key)
+    replace(new_config)
+    old_value
+  end
+
+  #
+  # Replace the configuration with a new {::Hash}.
+  #
+  # @param [::Hash] new_config
+  # @return [self]
+  #
+  def replace(new_config)
+    @metadata = org.openhab.core.items.Metadata.new(uid, value, new_config.transform_keys(&:to_s))
+    commit
+    self
+  end
+
+  # @!visibility private
+  def inspect
+    return to_h.inspect if value.empty?
+    return value.inspect if configuration.empty?
+
+    [value, to_h].inspect
+  end
+
+  # @return [org.openhab.core.common.registry.Provider, nil]
+  def provider
+    Provider.registry.provider_for(uid)
+  end
+
+  #
+  # @raise [FrozenError] if the provider is not a
+  #   {org.openhab.core.common.registry.ManagedProvider ManagedProvider} that can be updated.
+  # @return [org.openhab.core.common.registry.ManagedProvider]
+  #
+  def provider!
+    preferred_provider = Provider.current(
+      Thread.current[:openhab_providers]&.dig(:metadata_items, uid.item_name) ||
+        Thread.current[:openhab_providers]&.dig(:metadata_namespaces, uid.namespace),
+      self
+    )
+
+    if attached?
+      provider = self.provider
+      return preferred_provider unless provider
+
+      unless provider.is_a?(ManagedProvider)
+        raise FrozenError, "Cannot modify metadata from provider #{provider.inspect} for #{uid}."
+      end
+
+      if preferred_provider != provider
+        logger.warn("Provider #{preferred_provider.inspect} cannot be used with #{uid}; " \
+                    "reverting to provider #{provider.inspect}. " \
+                    "This may cause unexpected issues, like metadata persisting that you did not expect to.")
+        preferred_provider = provider
+      end
+
+    end
+    preferred_provider
+  end
+
+  private
+
+  #
+  # @see https://github.com/openhab/openhab-core/issues/3169
+  #
+  # in the meantime, force the serialization round-trip right now
+  #
+  def javaify
+    mapper = Provider.registry.managed_provider.get.storage.entityMapper
+
+    @metadata = mapper.from_json(mapper.to_json_tree(@metadata), Metadata.java_class)
+  end
+end
+
+
+ + + +
+

+ + #valueString + + + + + +

+
+

Returns The main value for the metadata namespace.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    The main value for the metadata namespace.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+26
+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
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+
+
# File 'lib/openhab/core/items/metadata/hash.rb', line 26
+
+class Hash
+  java_import org.openhab.core.items.Metadata
+  private_constant :Metadata
+
+  # Mutators are manually implemented below.
+  include EmulateHash
+  extend Forwardable
+
+  def_delegators :@metadata, :configuration, :hash, :uid, :value
+  private :configuration
+
+  def_delegator :uid, :namespace
+
+  alias_method :to_map, :configuration
+  private :to_map
+
+  class << self
+    # @!visibility private
+    def from_item(item_name, namespace, value)
+      namespace = namespace.to_s
+      value = case value
+              when Hash
+                return value if value.uid.item_name == item_name && value.uid.namespace == namespace
+
+                [value.value, value.send(:configuration)]
+              when Array
+                raise ArgumentError, "Array must contain 2 elements: value, config" if value.length != 2
+
+                [value.first, (value.last || {}).transform_keys(&:to_s)]
+              when ::Hash then ["", value.transform_keys(&:to_s)]
+              else [value.to_s, {}]
+              end
+      new(Metadata.new(org.openhab.core.items.MetadataKey.new(namespace.to_s, item_name), *value))
+    end
+
+    # @!visibility private
+    def from_value(namespace, value)
+      from_item("-", namespace, value)
+    end
+  end
+
+  # @!visibility private
+  def initialize(metadata = nil)
+    @metadata = metadata
+  end
+
+  # @!visibility private
+  def dup
+    new(Metadata.new(org.openhab.core.items.MetadataKey.new(uid.namespace, "-"), value, configuration))
+  end
+
+  # Is this object attached to an actual Item?
+  # @return [true,false]
+  def attached?
+    uid.item_name != "-"
+  end
+
+  # @!attribute [r] item
+  #   @return [Item, nil] The item this namespace is attached to.
+  def item
+    return nil unless attached?
+
+    DSL.items[uid.item_name]
+  end
+
+  # @!visibility private
+  def commit
+    return unless attached?
+
+    javaify
+    provider!.update(@metadata)
+  end
+
+  # @!visibility private
+  def create_or_update
+    return unless attached?
+
+    javaify
+    (p = provider!).get(uid) ? p.update(@metadata) : p.add(@metadata)
+  end
+
+  # @!visibility private
+  def remove
+    provider!.remove(uid)
+  end
+
+  # @!visibility private
+  def eql?(other)
+    return true if equal?(other)
+    return false unless other.is_a?(Hash)
+    return false unless value == other.value
+
+    configuration == other.configuration
+  end
+
+  #
+  # Set the metadata value
+  #
+  def value=(value)
+    @metadata = org.openhab.core.items.Metadata.new(uid, value.to_s, configuration)
+    commit
+  end
+
+  # @!visibility private
+  def <(other)
+    if other.is_a?(Hash)
+      return false if attached? && uid == other.uid
+      return false unless value == other.value
+    end
+
+    configuration < other
+  end
+
+  # @!visibility private
+  def <=(other)
+    if other.is_a?(Hash)
+      return true if attached? && uid == other.uid
+      return false unless value == other.value
+    end
+
+    configuration <= other
+  end
+
+  # @!visibility private
+  def ==(other)
+    if other.is_a?(Hash)
+      return false unless value == other.value
+
+      return configuration == other.configuration
+    elsif value.empty? && other.respond_to?(:to_hash)
+      return configuration == other.to_hash
+    elsif other.is_a?(Array)
+      return other == [value, configuration]
+    end
+    false
+  end
+
+  # @!visibility private
+  def >(other)
+    if other.is_a?(Hash)
+      return false if attached? && uid == other.uid
+      return false unless value == other.value
+    end
+
+    configuration > other
+  end
+
+  # @!visibility private
+  def >=(other)
+    if other.is_a?(Hash)
+      return true if attached? && uid == other.uid
+      return false unless value == other.value
+    end
+
+    configuration >= other
+  end
+
+  # @!visibility private
+  def store(key, value)
+    key = key.to_s
+    new_config = to_h
+    new_config[key] = value
+    replace(new_config)
+    value
+  end
+
+  # @!visibility private
+  def delete(key)
+    key = key.to_s
+    new_config = to_h
+    return yield(key) if block_given? && !new_config.key?(key)
+
+    old_value = new_config.delete(key)
+    replace(new_config)
+    old_value
+  end
+
+  #
+  # Replace the configuration with a new {::Hash}.
+  #
+  # @param [::Hash] new_config
+  # @return [self]
+  #
+  def replace(new_config)
+    @metadata = org.openhab.core.items.Metadata.new(uid, value, new_config.transform_keys(&:to_s))
+    commit
+    self
+  end
+
+  # @!visibility private
+  def inspect
+    return to_h.inspect if value.empty?
+    return value.inspect if configuration.empty?
+
+    [value, to_h].inspect
+  end
+
+  # @return [org.openhab.core.common.registry.Provider, nil]
+  def provider
+    Provider.registry.provider_for(uid)
+  end
+
+  #
+  # @raise [FrozenError] if the provider is not a
+  #   {org.openhab.core.common.registry.ManagedProvider ManagedProvider} that can be updated.
+  # @return [org.openhab.core.common.registry.ManagedProvider]
+  #
+  def provider!
+    preferred_provider = Provider.current(
+      Thread.current[:openhab_providers]&.dig(:metadata_items, uid.item_name) ||
+        Thread.current[:openhab_providers]&.dig(:metadata_namespaces, uid.namespace),
+      self
+    )
+
+    if attached?
+      provider = self.provider
+      return preferred_provider unless provider
+
+      unless provider.is_a?(ManagedProvider)
+        raise FrozenError, "Cannot modify metadata from provider #{provider.inspect} for #{uid}."
+      end
+
+      if preferred_provider != provider
+        logger.warn("Provider #{preferred_provider.inspect} cannot be used with #{uid}; " \
+                    "reverting to provider #{provider.inspect}. " \
+                    "This may cause unexpected issues, like metadata persisting that you did not expect to.")
+        preferred_provider = provider
+      end
+
+    end
+    preferred_provider
+  end
+
+  private
+
+  #
+  # @see https://github.com/openhab/openhab-core/issues/3169
+  #
+  # in the meantime, force the serialization round-trip right now
+  #
+  def javaify
+    mapper = Provider.registry.managed_provider.get.storage.entityMapper
+
+    @metadata = mapper.from_json(mapper.to_json_tree(@metadata), Metadata.java_class)
+  end
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #attached?true, false + + + + + +

+
+

Is this object attached to an actual Item?

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+79
+80
+81
+
+
# File 'lib/openhab/core/items/metadata/hash.rb', line 79
+
+def attached?
+  uid.item_name != "-"
+end
+
+
+ +
+

+ + #providerorg.openhab.core.common.registry.Provider? + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+224
+225
+226
+
+
# File 'lib/openhab/core/items/metadata/hash.rb', line 224
+
+def provider
+  Provider.registry.provider_for(uid)
+end
+
+
+ +
+

+ + #provider!org.openhab.core.common.registry.ManagedProvider + + + + + +

+
+ + +
+
+
+ +

Returns:

+ +

Raises:

+
    + +
  • + + + (FrozenError) + + + + — +

    if the provider is not a +ManagedProvider that can be updated.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+
+
# File 'lib/openhab/core/items/metadata/hash.rb', line 233
+
+def provider!
+  preferred_provider = Provider.current(
+    Thread.current[:openhab_providers]&.dig(:metadata_items, uid.item_name) ||
+      Thread.current[:openhab_providers]&.dig(:metadata_namespaces, uid.namespace),
+    self
+  )
+
+  if attached?
+    provider = self.provider
+    return preferred_provider unless provider
+
+    unless provider.is_a?(ManagedProvider)
+      raise FrozenError, "Cannot modify metadata from provider #{provider.inspect} for #{uid}."
+    end
+
+    if preferred_provider != provider
+      logger.warn("Provider #{preferred_provider.inspect} cannot be used with #{uid}; " \
+                  "reverting to provider #{provider.inspect}. " \
+                  "This may cause unexpected issues, like metadata persisting that you did not expect to.")
+      preferred_provider = provider
+    end
+
+  end
+  preferred_provider
+end
+
+
+ +
+

+ + #replace(new_config) ⇒ self + + + + + +

+
+

Replace the configuration with a new Hash.

+ + +
+
+
+

Parameters:

+
    + +
  • + + new_config + + + (::Hash) + + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+209
+210
+211
+212
+213
+
+
# File 'lib/openhab/core/items/metadata/hash.rb', line 209
+
+def replace(new_config)
+  @metadata = org.openhab.core.items.Metadata.new(uid, value, new_config.transform_keys(&:to_s))
+  commit
+  self
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/Metadata/NamespaceHash.html b/5.33/OpenHAB/Core/Items/Metadata/NamespaceHash.html new file mode 100644 index 0000000000..8a6d6ee11d --- /dev/null +++ b/5.33/OpenHAB/Core/Items/Metadata/NamespaceHash.html @@ -0,0 +1,3832 @@ + + + + + + + Class: OpenHAB::Core::Items::Metadata::NamespaceHash + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::Metadata::NamespaceHash + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
EmulateHash
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/items/metadata/namespace_hash.rb
+
+ +
+ +

Overview

+
+

NamespaceHash represents the full metadata for the item.

+

It implements the entire interface of Hash.

+

Keys are namespaces, values are always Hash, though assignment allows +using a Hash, a String, a ::Hash, or an array of two items: +[String, ::Hash].

+

All keys are converted to strings.

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + +
    + +
  • + + + #attached? ⇒ true, false + + + + + + + + + + + + + +

    Is this object attached to an actual Item?.

    +
    + +
  • + + +
  • + + + #to_hash ⇒ ::Hash + + + + (also: #to_h, #to_map) + + + + + + + + + + + +

    Implicit conversion to Hash.

    +
    + +
  • + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update, #update!

+ + +
+

Instance Method Details

+ + +
+

+ + #attached?true, false + + + + + +

+
+

Is this object attached to an actual Item?

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/openhab/core/items/metadata/namespace_hash.rb', line 49
+
+def attached?
+  @hash.nil?
+end
+
+
+ +
+

+ + #to_hash::Hash + + + + Also known as: + to_h, to_map + + + + +

+
+

Implicit conversion to Hash

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (::Hash) + + + +
  • + +
+ +
+ + + + +
+
+
+
+60
+61
+62
+
+
# File 'lib/openhab/core/items/metadata/namespace_hash.rb', line 60
+
+def to_hash
+  each.to_h { |namespace, meta| [namespace, meta] }
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/Metadata/Provider.html b/5.33/OpenHAB/Core/Items/Metadata/Provider.html new file mode 100644 index 0000000000..1b4560d43c --- /dev/null +++ b/5.33/OpenHAB/Core/Items/Metadata/Provider.html @@ -0,0 +1,3872 @@ + + + + + + + Class: OpenHAB::Core::Items::Metadata::Provider + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::Metadata::Provider + + + +

+
+ +
+
Inherits:
+
+ Provider + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/metadata/provider.rb
+
+ +
+ +

Overview

+
+

Provides metadata created in Ruby to openHAB

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods inherited from Provider

+

#[], #all, current, #inspect

+ + + + + + + + + + + + + + + +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update, #update!

+ + + + + + + + + + + + + + +
+

Class Method Details

+ + +
+

+ + .registryorg.openhab.core.items.MetadataRegistry + + + + + +

+
+

The Metadata registry

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+19
+20
+21
+
+
# File 'lib/openhab/core/items/metadata/provider.rb', line 19
+
+def registry
+  @registry ||= OSGi.service("org.openhab.core.items.MetadataRegistry")
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #remove_item_metadata(item_name) ⇒ void + + + + Also known as: + removeItemMetadata + + + + +

+
+

This method returns an undefined value.

Removes all metadata of a given item.

+ + +
+
+
+

Parameters:

+
    + +
  • + + item_name + + + (String) + + + +
  • + +
+ + +
+ + + + +
+
+
+
+34
+35
+36
+37
+38
+39
+40
+41
+42
+
+
# File 'lib/openhab/core/items/metadata/provider.rb', line 34
+
+def remove_item_metadata(item_name)
+  @elements.delete_if do |_k, v|
+    next unless v.uid.item_name == item_name
+
+    notify_listeners_about_removed_element(v)
+    true
+  end
+  nil
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/NumberItem.html b/5.33/OpenHAB/Core/Items/NumberItem.html new file mode 100644 index 0000000000..998ff6f436 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/NumberItem.html @@ -0,0 +1,4511 @@ + + + + + + + Class: OpenHAB::Core::Items::NumberItem + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::NumberItem + + + +

+
+ +
+
Inherits:
+
+ GenericItem + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
NumericItem
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/items/number_item.rb
+
+ +
+ +

Overview

+
+

A NumberItem has a decimal value and is usually used for all kinds +of sensors, like temperature, brightness, wind, etc. +It can also be used as a counter or as any other thing that can be expressed +as a number.

+

Non-dimensioned numbers will have a state of DecimalType, while +dimensioned numbers will have a state of QuantityType. Be sure +to read the documentation for those two classes for how to work with +the different states of a NumberItem.

+ + +
+
+
+ +
+

Examples:

+ + +

Number Items can be selected in an enumerable with grep.

+

+ +
# Get all NumberItems
+items.grep(NumberItem)
+     .each { |number| logger.info("#{item.name} is a Number Item") }
+ +
+ + +
+ + +

Constant Summary

+ +

Constants included + from Semantics

+

Semantics::Equipment, Semantics::Location, Semantics::Point, Semantics::Property, Semantics::Tag

+ + + +

Constants included + from Persistence

+

Persistence::HistoricState

+ + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from GenericItem

+

#category, #formatted_state, #label, #name, #raw_state, #tags

+ + + +

Attributes included from Semantics

+

#equipment, #equipment_type, #location, #location_type, #point_type, #property_type, #semantic_type

+ + + +

Attributes included from Item

+

#accepted_command_types, #accepted_data_types, #all_groups, #channel, #channel_uid, #channel_uids, #channels, #groups, #links, #metadata, #name, #provider, #thing, #things

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods inherited from GenericItem

+

#command, #modify, #null?, #refresh, #state?, #time_series=, #undef?, #update

+ + + + + + + + + +

Methods included from Semantics

+

add, #equipment?, #location?, lookup, #point?, #points, remove, #semantic?, tags

+ + + + + + + + + +

Methods included from Item

+

#call_item?, #color_item?, #contact_item?, #date_time_item?, #dimmer_item?, #group_item?, #image_item?, #inspect, #link, #location_item?, #member_of?, #number_item?, #player_item?, #rollershutter_item?, #string_item?, #switch_item?, #tagged?, #to_s, #unlink

+ + + + + + + + + +

Methods included from DSL::Items::TimedCommand

+

#command

+ + + + + + + + + +

Methods included from Persistence

+

#all_states_between, #all_states_since, #all_states_until, #average_between, #average_since, #average_until, #changed_between?, #changed_since?, #changed_until?, #count_between, #count_since, #count_state_changes_between, #count_state_changes_since, #count_state_changes_until, #count_until, #delta_between, #delta_since, #delta_until, #deviation_between, #deviation_since, #deviation_until, #evolution_rate, #evolution_rate_between, #evolution_rate_since, #evolution_rate_until, #historic_state, #last_change, #last_update, #maximum_between, #maximum_since, #maximum_until, #median_between, #median_since, #median_until, #minimum_between, #minimum_since, #minimum_until, #next_change, #next_state, #next_update, #persist, #persisted_state, #previous_state, #remove_all_states_between, #remove_all_states_since, #remove_all_states_until, #sum_between, #sum_since, #sum_until, #updated_between?, #updated_since?, #updated_until?, #variance_between, #variance_since, #variance_until

+ + + + + + + + + + + + + + + +

Methods included from DSL::Items::Ensure::Ensurable

+

#ensure

+ +
+

Instance Attribute Details

+ + + +
+

+ + #dimensionClass? (readonly) + + + + + +

+
+

Returns The dimension of the number item.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Class, nil) + + + + — +

    The dimension of the number item.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+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
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+
+
# File 'lib/openhab/core/items/number_item.rb', line 34
+
+class NumberItem < GenericItem
+  include NumericItem
+
+  # raw numbers translate directly to {DecimalType}, not a string
+  # @!visibility private
+  def format_type(command)
+    if command.is_a?(Numeric)
+      if unit && (target_unit = DSL.unit(unit.dimension) || unit)
+        return Types::QuantityType.new(command, target_unit)
+      end
+
+      return Types::DecimalType.new(command)
+    end
+
+    super
+  end
+
+  # @!visibility private
+  def config_eql?(other)
+    super && dimension == other.dimension
+  end
+
+  # @!attribute [r] range
+  # Returns the range of values allowed for this item, as defined by its
+  # state description.
+  #
+  # If this item has a {#unit}, it will be applied to the result, returning
+  # a range of {QuantityType} instead of BigDecimal.
+  # @return [Range, nil]
+  # @note State descriptions can be provided by bindings, defined in
+  #   metadata, or theoretically come from other sources.
+  def range
+    return unless (sd = state_description)
+
+    # check if we have a unit, even if the item's metadata doesn't declare
+    # it properly
+    unit = self.unit || ((s = state) && s.is_a?(QuantityType) && s.unit)
+    min = sd.minimum&.to_d
+    max = sd.maximum&.to_d
+    return nil unless min || max
+
+    min |= unit if min && unit
+    max |= unit if max && unit
+    min..max
+  end
+
+  protected
+
+  # Adds the unit dimension
+  def type_details
+    ":#{dimension}" if dimension
+  end
+end
+
+
+ + + +
+

+ + #rangeRange? (readonly) + + + + + +

+
+ +
+ Note: +

State descriptions can be provided by bindings, defined in +metadata, or theoretically come from other sources.

+
+
+ +

Returns the range of values allowed for this item, as defined by its +state description.

+

If this item has a #unit, it will be applied to the result, returning +a range of QuantityType instead of BigDecimal.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Range, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+
+
# File 'lib/openhab/core/items/number_item.rb', line 65
+
+def range
+  return unless (sd = state_description)
+
+  # check if we have a unit, even if the item's metadata doesn't declare
+  # it properly
+  unit = self.unit || ((s = state) && s.is_a?(QuantityType) && s.unit)
+  min = sd.minimum&.to_d
+  max = sd.maximum&.to_d
+  return nil unless min || max
+
+  min |= unit if min && unit
+  max |= unit if max && unit
+  min..max
+end
+
+
+ + + +
+

+ + #stateDecimalType, ... (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+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
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+
+
# File 'lib/openhab/core/items/number_item.rb', line 34
+
+class NumberItem < GenericItem
+  include NumericItem
+
+  # raw numbers translate directly to {DecimalType}, not a string
+  # @!visibility private
+  def format_type(command)
+    if command.is_a?(Numeric)
+      if unit && (target_unit = DSL.unit(unit.dimension) || unit)
+        return Types::QuantityType.new(command, target_unit)
+      end
+
+      return Types::DecimalType.new(command)
+    end
+
+    super
+  end
+
+  # @!visibility private
+  def config_eql?(other)
+    super && dimension == other.dimension
+  end
+
+  # @!attribute [r] range
+  # Returns the range of values allowed for this item, as defined by its
+  # state description.
+  #
+  # If this item has a {#unit}, it will be applied to the result, returning
+  # a range of {QuantityType} instead of BigDecimal.
+  # @return [Range, nil]
+  # @note State descriptions can be provided by bindings, defined in
+  #   metadata, or theoretically come from other sources.
+  def range
+    return unless (sd = state_description)
+
+    # check if we have a unit, even if the item's metadata doesn't declare
+    # it properly
+    unit = self.unit || ((s = state) && s.is_a?(QuantityType) && s.unit)
+    min = sd.minimum&.to_d
+    max = sd.maximum&.to_d
+    return nil unless min || max
+
+    min |= unit if min && unit
+    max |= unit if max && unit
+    min..max
+  end
+
+  protected
+
+  # Adds the unit dimension
+  def type_details
+    ":#{dimension}" if dimension
+  end
+end
+
+
+ + + +
+

+ + #unitjavax.measure.Unit? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+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
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+
+
# File 'lib/openhab/core/items/number_item.rb', line 34
+
+class NumberItem < GenericItem
+  include NumericItem
+
+  # raw numbers translate directly to {DecimalType}, not a string
+  # @!visibility private
+  def format_type(command)
+    if command.is_a?(Numeric)
+      if unit && (target_unit = DSL.unit(unit.dimension) || unit)
+        return Types::QuantityType.new(command, target_unit)
+      end
+
+      return Types::DecimalType.new(command)
+    end
+
+    super
+  end
+
+  # @!visibility private
+  def config_eql?(other)
+    super && dimension == other.dimension
+  end
+
+  # @!attribute [r] range
+  # Returns the range of values allowed for this item, as defined by its
+  # state description.
+  #
+  # If this item has a {#unit}, it will be applied to the result, returning
+  # a range of {QuantityType} instead of BigDecimal.
+  # @return [Range, nil]
+  # @note State descriptions can be provided by bindings, defined in
+  #   metadata, or theoretically come from other sources.
+  def range
+    return unless (sd = state_description)
+
+    # check if we have a unit, even if the item's metadata doesn't declare
+    # it properly
+    unit = self.unit || ((s = state) && s.is_a?(QuantityType) && s.unit)
+    min = sd.minimum&.to_d
+    max = sd.maximum&.to_d
+    return nil unless min || max
+
+    min |= unit if min && unit
+    max |= unit if max && unit
+    min..max
+  end
+
+  protected
+
+  # Adds the unit dimension
+  def type_details
+    ":#{dimension}" if dimension
+  end
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #type_detailsObject (protected) + + + + + +

+
+

Adds the unit dimension

+ + +
+
+
+ + +
+ + + + +
+
+
+
+83
+84
+85
+
+
# File 'lib/openhab/core/items/number_item.rb', line 83
+
+def type_details
+  ":#{dimension}" if dimension
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/NumericItem.html b/5.33/OpenHAB/Core/Items/NumericItem.html new file mode 100644 index 0000000000..9bfd11c4d2 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/NumericItem.html @@ -0,0 +1,3603 @@ + + + + + + + Module: OpenHAB::Core::Items::NumericItem + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Items::NumericItem + + + +

+
+ + + + + + + + + +
+
Included in:
+
DimmerItem, NumberItem, RollershutterItem
+
+ + + +
+
Defined in:
+
lib/openhab/core/items/numeric_item.rb
+
+ +
+ +

Overview

+
+

Mixin for implementing type coercion for number-like items

+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/Persistence.html b/5.33/OpenHAB/Core/Items/Persistence.html new file mode 100644 index 0000000000..70ad3afd59 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/Persistence.html @@ -0,0 +1,10762 @@ + + + + + + + Module: OpenHAB::Core::Items::Persistence + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Items::Persistence + + + +

+
+ + + + + + + + + +
+
Included in:
+
GenericItem
+
+ + + +
+
Defined in:
+
lib/openhab/core/items/persistence.rb
+
+ +
+ +

Overview

+
+

Items extensions to support +openHAB's Persistence feature.

+ + +
+
+
+ +
+

Examples:

+ + +

The following examples are based on these items

+

+ +
Number        UV_Index
+Number:Power  Power_Usage "Power Usage [%.2f W]"
+ + +

Getting persistence data from the system default persistence service

+

+ +
UV_Index.average_since(1.hour.ago)      # returns a DecimalType
+Power_Usage.average_since(12.hours.ago) # returns a QuantityType that corresponds to the item's type
+ + +

Querying a non-default persistence service

+

+ +
UV_Index.average_since(1.hour.ago, :influxdb)
+Power_Usage.average_since(12.hours.ago, :rrd4j)
+ + +

Time of day shortcuts

+

+ +
# Persistence methods accept any object that responds to #to_zoned_date_time, which includes
+# LocalTime, LocalDate, and Ruby's Time, Date, and DateTime.
+# This allows for easy querying of start of day
+logger.info Power_Usage.average_since(LocalTime::MIDNIGHT)
+logger.info Power_Usage.average_since(LocalDate.now)
+# Ruby's Date can be used too
+logger.info Power_Usage.average_since(Date.today)
+
+# Yesterday
+logger.info Power_Usage.average_between(Date.today - 1, Date.today)
+# or
+logger.info Power_Usage.average_between(LocalDate.now - 1, LocalDate.now)
+
+# When passing the local time, today's date is assumed
+logger.info Power_Usage.average_between(LocalTime.parse("4pm"), LocalTime.parse("9pm"))
+# or
+logger.info Power_Usage.average_between(Time.parse("4pm"), Time.parse("9pm"))
+
+# Beware that Date, LocalDate, and LocalTime arithmetics will produce the same type, so
+Power_Usage.average_between(LocalTime.parse("4pm") - 1.day, LocalTime.parse("9pm") - 1.day)
+# Will still give you TODAY's data between 4pm and 9pm
+# To get yesterday's data, use Time.parse, i.e.
+Power_Usage.average_between(Time.parse("4pm") - 1.day, Time.parse("9pm") - 1.day)
+ + +

Comparison using Quantity

+

+ +
# Because Power_Usage has a unit, the return value
+# from average_since is a QuantityType
+if Power_Usage.average_since(15.minutes.ago) > 5 | "kW"
+  logger.info("The power usage exceeded its 15 min average)
+end
+ + +

PersistedState

+

+ +
max = Power_Usage.maximum_since(LocalTime::MIDNIGHT)
+logger.info("Max power usage today: #{max}, at: #{max.timestamp})
+ +
+ + +

See Also:

+ + +

Defined Under Namespace

+

+ + + + + Classes: PersistedState + + +

+ + +

+ Constant Summary + collapse +

+ +
+ +
HistoricState = +
+
+
Deprecated.

Use PersistedState instead

+
+ + +
+
+
+ + +
+
+
PersistedState
+ +
+ + + + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #all_states_between(start, finish, service = nil) ⇒ Array<PersistedState> + + + + + +

+
+

Returns all the states between two points in time.

+ + +
+
+
+

Parameters:

+
    + +
  • + + start + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + finish + + + (#to_zoned_date_time) + + + + — +

    The point in time to which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.0

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 456
+
+
+
+
+ +
+

+ + #all_states_since(timestamp, service = nil) ⇒ Array<PersistedState> + + + + + +

+
+

Returns all the states from a point in time until now.

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.0

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 442
+
+
+
+
+ +
+

+ + #all_states_until(timestamp, service = nil) ⇒ Array<PersistedState> + + + + + +

+
+

Returns all the states between now until the given time.

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time until which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 449
+
+
+
+
+ +
+

+ + #average_between(start, finish, service = nil) ⇒ DecimalType, ... + + + + + +

+
+

Returns the average value of the item's state between two points in time

+ + +
+
+
+

Parameters:

+
    + +
  • + + start + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + finish + + + (#to_zoned_date_time) + + + + — +

    The point in time to which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, QuantityType, nil) + + + + — +

    The average value between start and finish, +or nil if no states could be found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 129
+
+
+
+
+ +
+

+ + #average_since(timestamp, service = nil) ⇒ DecimalType, ... + + + + + +

+
+

Returns the average value of the item's state since the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, QuantityType, nil) + + + + — +

    The average value since timestamp, +or nil if no previous states could be found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 114
+
+
+
+
+ +
+

+ + #average_until(timestamp, service = nil) ⇒ DecimalType, ... + + + + + +

+
+

Returns the average value of the item's state between now until the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time until which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, QuantityType, nil) + + + + — +

    The average value until timestamp, +or nil if no future states could be found.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 121
+
+
+
+
+ +
+

+ + #changed_between?(start, finish, service = nil) ⇒ true, false + + + + + +

+
+

Whether the item's state changed between two points in time

+ + +
+
+
+

Parameters:

+
    + +
  • + + start + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + finish + + + (#to_zoned_date_time) + + + + — +

    The point in time to which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    True if the item's state changed between start and finish, False otherwise.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 267
+
+
+
+
+ +
+

+ + #changed_since?(timestamp, service = nil) ⇒ true, false + + + + + +

+
+

Whether the item's state has changed since the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    True if the item's state has changed since the given timestamp, False otherwise.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 254
+
+
+
+
+ +
+

+ + #changed_until?(timestamp, service = nil) ⇒ true, false + + + + + +

+
+

Whether the item's state has changed between now until the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time until which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    True if the item's state has changed until the given timestamp, False otherwise.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 260
+
+
+
+
+ +
+

+ + #count_between(start, finish, service = nil) ⇒ Integer + + + + + +

+
+

Returns the number of available data points between two points in time.

+ + +
+
+
+

Parameters:

+
    + +
  • + + start + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + finish + + + (#to_zoned_date_time) + + + + — +

    The point in time to which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    The number of values persisted for this item.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 415
+
+
+
+
+ +
+

+ + #count_since(timestamp, service = nil) ⇒ Integer + + + + + +

+
+

Returns the number of available historic data points from a point in time until now.

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    The number of values persisted for this item.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 402
+
+
+
+
+ +
+

+ + #count_state_changes_between(start, finish, service = nil) ⇒ Integer + + + + Also known as: + state_changes_between + + + + +

+
+

Returns the number of changes in data points between two points in time.

+ + +
+
+
+

Parameters:

+
    + +
  • + + start + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + finish + + + (#to_zoned_date_time) + + + + — +

    The point in time to which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    The number of values persisted for this item.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 435
+
+
+
+
+ +
+

+ + #count_state_changes_since(timestamp, service = nil) ⇒ Integer + + + + Also known as: + state_changes_since + + + + +

+
+

Returns the number of changes in historic data points from a point in time until now.

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    The number of values persisted for this item.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 422
+
+
+
+
+ +
+

+ + #count_state_changes_until(timestamp, service = nil) ⇒ Integer + + + + Also known as: + state_changes_until + + + + +

+
+

Returns the number of changes in data points between now until the given time.

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time until which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    The number of values persisted for this item.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 428
+
+
+
+
+ +
+

+ + #count_until(timestamp, service = nil) ⇒ Integer + + + + + +

+
+

Returns the number of available data points between now until the given time.

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time until which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    The number of values persisted for this item.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 408
+
+
+
+
+ +
+

+ + #delta_between(start, finish, service = nil) ⇒ DecimalType, ... + + + + + +

+
+

Returns the difference value of the item's state between two points in time

+ + +
+
+
+

Parameters:

+
    + +
  • + + start + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + finish + + + (#to_zoned_date_time) + + + + — +

    The point in time to which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, QuantityType, nil) + + + + — +

    The difference value between start and finish, +or nil if no states could be found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 152
+
+
+
+
+ +
+

+ + #delta_since(timestamp, service = nil) ⇒ DecimalType, ... + + + + + +

+
+

Returns the difference value of the item's state since the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, QuantityType, nil) + + + + — +

    The difference value since timestamp, +or nil if no previous states could be found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 137
+
+
+
+
+ +
+

+ + #delta_until(timestamp, service = nil) ⇒ DecimalType, ... + + + + + +

+
+

Returns the difference value of the item's state between now until the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time until which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, QuantityType, nil) + + + + — +

    The difference value until timestamp, +or nil if no future states could be found.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 144
+
+
+
+
+ +
+

+ + #deviation_between(start, finish, service = nil) ⇒ DecimalType, ... + + + + + +

+
+

Returns the standard deviation of the item's state between two points in time

+ + +
+
+
+

Parameters:

+
    + +
  • + + start + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + finish + + + (#to_zoned_date_time) + + + + — +

    The point in time to which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, QuantityType, nil) + + + + — +

    The standard deviation between start and finish, +or nil if no states could be found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 175
+
+
+
+
+ +
+

+ + #deviation_since(timestamp, service = nil) ⇒ DecimalType, ... + + + + + +

+
+

Returns the standard deviation of the item's state since the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, QuantityType, nil) + + + + — +

    The standard deviation since timestamp, +or nil if no previous states could be found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 160
+
+
+
+
+ +
+

+ + #deviation_until(timestamp, service = nil) ⇒ DecimalType, ... + + + + + +

+
+

Returns the standard deviation of the item's state beetween now until the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time until which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, QuantityType, nil) + + + + — +

    The standard deviation until timestamp, +or nil if no future states could be found.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 167
+
+
+
+
+ +
+

+ + #evolution_rate(start, finish_or_service = nil, service = nil) ⇒ Object + + + + + +

+
+
Deprecated.

OH 4.2 this method is deprecated in OH 4.2 and may be removed in a future version

+
+ + +
+
+
+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 274
+
+
+
+
+ +
+

+ + #evolution_rate_between(start, finish, service = nil) ⇒ DecimalType? + + + + + +

+
+

Returns the evolution rate of the item's state between two points in time

+ + +
+
+
+

Parameters:

+
    + +
  • + + start + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + finish + + + (#to_zoned_date_time) + + + + — +

    The point in time to which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, nil) + + + + — +

    The evolution rate between start and finish, +or nil if no states could be found.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 311
+
+
+
+
+ +
+

+ + #evolution_rate_since(timestamp, service = nil) ⇒ DecimalType? + + + + + +

+
+

Returns the evolution rate of the item's state since the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, nil) + + + + — +

    The evolution rate since timestamp, +or nil if no previous states could be found.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 295
+
+
+
+
+ +
+

+ + #evolution_rate_until(timestamp, service = nil) ⇒ DecimalType? + + + + + +

+
+

Returns the evolution rate of the item's state between now until the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time until which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, nil) + + + + — +

    The evolution rate until timestamp, +or nil if no future states could be found.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 303
+
+
+
+
+ +
+

+ + #historic_state(timestamp, service = nil) ⇒ PersistedState? + + + + + +

+
+
Deprecated.

In openHAB 4.2, use #persisted_state instead

+
+

Returns the the item's state at the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time at which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (PersistedState, nil) + + + + — +

    The item's state at timestamp, +or nil if no previous state could be found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 320
+
+
+
+
+ +
+

+ + #last_change(service = nil) ⇒ ZonedDateTime? + + + + + +

+
+

Returns the time the item was last changed.

+ + +
+
+
+

Parameters:

+
    + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (ZonedDateTime, nil) + + + + — +

    The timestamp of the last update

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 576
+
+
+
+
+ +
+

+ + #last_update(service = nil) ⇒ ZonedDateTime? + + + + + +

+
+

Returns the time the item was last updated.

+ + +
+
+
+

Parameters:

+
    + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (ZonedDateTime, nil) + + + + — +

    The timestamp of the last update

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 564
+
+
+
+
+ +
+

+ + #maximum_between(start, finish, service = nil) ⇒ PersistedState? + + + + + +

+
+

Returns the maximum value of the item's state between two points in time

+ + +
+
+
+

Parameters:

+
    + +
  • + + start + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + finish + + + (#to_zoned_date_time) + + + + — +

    The point in time to which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (PersistedState, nil) + + + + — +

    The maximum value between start and finish, +or nil if no states could be found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 351
+
+
+
+
+ +
+

+ + #maximum_since(timestamp, service = nil) ⇒ PersistedState? + + + + + +

+
+

Returns the maximum value of the item's state since the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (PersistedState, nil) + + + + — +

    The maximum value since timestamp, +or nil if no previous states could be found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 336
+
+
+
+
+ +
+

+ + #maximum_until(timestamp, service = nil) ⇒ PersistedState? + + + + + +

+
+

Returns the maximum value of the item's state between now until the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time until which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (PersistedState, nil) + + + + — +

    The maximum value until timestamp, +or nil if no future states could be found.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 343
+
+
+
+
+ +
+

+ + #median_between(start, finish, service = nil) ⇒ DecimalType, ... + + + + + +

+
+

Returns the median of the item's state between two points in time

+ + +
+
+
+

Parameters:

+
    + +
  • + + start + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + finish + + + (#to_zoned_date_time) + + + + — +

    The point in time to which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, QuantityType, nil) + + + + — +

    The median between start and finish, +or nil if no states could be found.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.3

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 199
+
+
+
+
+ +
+

+ + #median_since(timestamp, service = nil) ⇒ DecimalType, ... + + + + + +

+
+

Returns the median of the item's state since the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, QuantityType, nil) + + + + — +

    The median since timestamp, +or nil if no previous states could be found.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.3

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 183
+
+
+
+
+ +
+

+ + #median_until(timestamp, service = nil) ⇒ DecimalType, ... + + + + + +

+
+

Returns the median of the item's state beetween now until the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time until which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, QuantityType, nil) + + + + — +

    The median until timestamp, +or nil if no future states could be found.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.3

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 191
+
+
+
+
+ +
+

+ + #minimum_between(start, finish, service = nil) ⇒ PersistedState? + + + + + +

+
+

Returns the minimum value of the item's state between two points in time

+ + +
+
+
+

Parameters:

+
    + +
  • + + start + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + finish + + + (#to_zoned_date_time) + + + + — +

    The point in time to which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (PersistedState, nil) + + + + — +

    The minimum value between start and finish, +or nil if no states could be found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 374
+
+
+
+
+ +
+

+ + #minimum_since(timestamp, service = nil) ⇒ PersistedState? + + + + + +

+
+

Returns the minimum value of the item's state since the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (PersistedState, nil) + + + + — +

    The minimum value since timestamp, +or nil if no previous states could be found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 359
+
+
+
+
+ +
+

+ + #minimum_until(timestamp, service = nil) ⇒ PersistedState? + + + + + +

+
+

Returns the minimum value of the item's state between now until the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time until which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (PersistedState, nil) + + + + — +

    The minimum value until timestamp, +or nil if no future states could be found.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 366
+
+
+
+
+ +
+

+ + #next_change(service = nil) ⇒ ZonedDateTime? + + + + + +

+
+

Returns the first future change time of the item.

+ + +
+
+
+

Parameters:

+
    + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (ZonedDateTime, nil) + + + + — +

    The timestamp of the next update

    +
    + +
  • + +
+ +

See Also:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+
+
# File 'lib/openhab/core/items/persistence.rb', line 589
+
+%i[last_update next_update last_change next_change].each do |method|
+  # @deprecated OH 4.1 remove this guard when dropping OH 4.1
+  next unless Actions::PersistenceExtensions.respond_to?(method)
+
+  class_eval <<~RUBY, __FILE__, __LINE__ + 1
+    def #{method}(service = nil)                            # def last_update(service = nil)
+      service ||= persistence_service                       #   service ||= persistence_service
+      result = Actions::PersistenceExtensions.#{method}(    #   result = Actions::PersistenceExtensions.last_update(
+        self,                                               #     self,
+        service&.to_s                                       #     service&.to_s
+      )                                                     #   )
+      wrap_result(result)                                   #   wrap_result(result)
+    end                                                     # end
+  RUBY
+end
+
+
+ +
+

+ + #next_state(service = nil, skip_equal: false) ⇒ PersistedState? + + + + + +

+
+

Return the next state of the item

+ + +
+
+
+

Parameters:

+
    + +
  • + + skip_equal + + + (true, false) + + + (defaults to: false) + + + — +

    if true, skips equal state values and +searches the first state not equal the current state

    +
    + +
  • + +
  • + + service + + + (String) + + + (defaults to: nil) + + + — +

    the name of the PersistenceService to use

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (PersistedState, nil) + + + + — +

    the previous state or nil if no previous state could be found, +or if the default persistence service is not configured or +does not refer to a valid service

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+
+
# File 'lib/openhab/core/items/persistence.rb', line 629
+
+%i[previous_state next_state].each do |method|
+  # @deprecated OH 4.1 remove this guard when dropping OH 4.1
+  next unless Actions::PersistenceExtensions.respond_to?(method)
+
+  class_eval <<~RUBY, __FILE__, __LINE__ + 1
+    def #{method}(service = nil, skip_equal: false)       # def previous_state(service = nil, skip_equal: false)
+      service ||= persistence_service                     #   service ||= persistence_service
+      result = Actions::PersistenceExtensions.#{method}(  #   result = Actions::PersistenceExtensions.previous_state(
+        self,                                             #     self,
+        skip_equal,                                       #     skip_equal,
+        service&.to_s                                     #     service&.to_s
+      )                                                   #   )
+      wrap_result(result, quantify: true)                 #   wrap_result(result, quantify: true)
+    end                                                   # end
+  RUBY
+end
+
+
+ +
+

+ + #next_update(service = nil) ⇒ ZonedDateTime? + + + + + +

+
+

Returns the first future update time of the item.

+ + +
+
+
+

Parameters:

+
    + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (ZonedDateTime, nil) + + + + — +

    The timestamp of the next update

    +
    + +
  • + +
+ +

See Also:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 569
+
+
+
+
+ +
+

+ + + #persist(service = nil) ⇒ void + + #persist(timestamp, state, service = nil) ⇒ void + + #persist(time_series, service = nil) ⇒ void + + + + + + +

+
+

Persist item state to the persistence service

+ + +
+
+
+ +

Overloads:

+
    + + +
  • + #persist(service = nil) ⇒ void +
    +
    +

    This method returns an undefined value.

    Persists the current state of the item

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

      An optional persistence id instead of the default persistence service.

      +
      + +
    • + +
    + + +
    +
  • + + +
  • + #persist(timestamp, state, service = nil) ⇒ void +
    +
    +

    This method returns an undefined value.

    Persists a state at a given timestamp

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + timestamp + + + (#to_zoned_date_time) + + + + — +

      The timestamp for the given state to be stored

      +
      + +
    • + +
    • + + state + + + (Types::State, #to_s) + + + + — +

      The state to be stored

      +
      + +
    • + +
    • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

      An optional persistence id instead of the default persistence service.

      +
      + +
    • + +
    + +

    Since:

    +
      + +
    • + + + + + +

      openHAB 4.2

      +
      + +
    • + +
    + +
    +
  • + + +
  • + #persist(time_series, service = nil) ⇒ void +
    +
    +

    This method returns an undefined value.

    Persists a time series

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + time_series + + + (Types::TimeSeries) + + + + — +

      The time series of states to be stored

      +
      + +
    • + +
    • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

      An optional persistence id instead of the default persistence service.

      +
      + +
    • + +
    + +

    Since:

    +
      + +
    • + + + + + +

      openHAB 4.2

      +
      + +
    • + +
    + +
    +
  • + +
+ + +
+ + + + +
+
+
+
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+
+
# File 'lib/openhab/core/items/persistence.rb', line 509
+
+def persist(*args)
+  # @deprecated OH 4.1 this if block content can be removed when dropping OH 4.1 support
+  if Core.version < Core::V4_2
+    raise ArgumentError, "wrong number of arguments (given #{args.size}, expected 0..1)" if args.size > 1
+
+    service = args.last || persistence_service
+    Actions::PersistenceExtensions.persist(self, service&.to_s)
+    return
+  end
+
+  first_arg = args.first
+  if first_arg.is_a?(TimeSeries)
+    if args.size > 2
+      raise ArgumentError,
+            "wrong number of arguments to persist a time series (given #{args.size}, expected 1..2)"
+    end
+
+    service = args[1] || persistence_service
+    Actions::PersistenceExtensions.java_send :persist,
+                                             [Item.java_class, Types::TimeSeries.java_class, java.lang.String],
+                                             self,
+                                             first_arg,
+                                             service&.to_s
+  elsif first_arg.respond_to?(:to_zoned_date_time)
+    unless args.size.between?(2, 3)
+      raise ArgumentError, "wrong number of arguments to persist a state (given #{args.size}, expected 2..3)"
+    end
+
+    timestamp = first_arg.to_zoned_date_time
+    state = format_update(args[1])
+    service = args[2] || persistence_service
+    Actions::PersistenceExtensions.java_send :persist,
+                                             [Item.java_class,
+                                              ZonedDateTime.java_class,
+                                              org.openhab.core.types.State,
+                                              java.lang.String],
+                                             self,
+                                             timestamp,
+                                             state,
+                                             service&.to_s
+
+  else
+    if args.size > 1
+      raise ArgumentError,
+            "wrong number of arguments to persist the current state (given #{args.size}, expected 0..1)"
+    end
+    service = first_arg || persistence_service
+    Actions::PersistenceExtensions.java_send :persist,
+                                             [Item.java_class, java.lang.String],
+                                             self,
+                                             service&.to_s
+
+  end
+end
+
+
+ +
+

+ + #persisted_state(timestamp, service = nil) ⇒ PersistedState? + + + + + +

+
+

Returns the the item's state at the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time at which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (PersistedState, nil) + + + + — +

    The item's state at timestamp, +or nil if no state could be found.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 328
+
+
+
+
+ +
+

+ + #previous_state(service = nil, skip_equal: false) ⇒ PersistedState? + + + + + +

+
+

Return the previous state of the item

+ + +
+
+
+

Parameters:

+
    + +
  • + + skip_equal + + + (true, false) + + + (defaults to: false) + + + — +

    if true, skips equal state values and +searches the first state not equal the current state

    +
    + +
  • + +
  • + + service + + + (String) + + + (defaults to: nil) + + + — +

    the name of the PersistenceService to use

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (PersistedState, nil) + + + + — +

    the previous state or nil if no previous state could be found, +or if the default persistence service is not configured or +does not refer to a valid service

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 605
+
+
+
+
+ +
+

+ + #remove_all_states_between(start, finish, service = nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Removes persisted data points between two points in time.

+ + +
+
+
+

Parameters:

+
    + +
  • + + start + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to remove

    +
    + +
  • + +
  • + + finish + + + (#to_zoned_date_time) + + + + — +

    The point in time to which to remove

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 478
+
+
+
+
+ +
+

+ + #remove_all_states_since(timestamp, service = nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Removes persisted data points since a certain point in time.

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to remove

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 464
+
+
+
+
+ +
+

+ + #remove_all_states_until(timestamp, service = nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Removes persisted data points from now until the given point in time.

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time until which to remove

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 471
+
+
+
+
+ +
+

+ + #sum_between(start, finish, service = nil) ⇒ DecimalType, ... + + + + + +

+
+

Returns the sum of the item's state between two points in time

+ + +
+
+
+

Parameters:

+
    + +
  • + + start + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + finish + + + (#to_zoned_date_time) + + + + — +

    The point in time to which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, QuantityType, nil) + + + + — +

    The sum between start and finish, +or nil if no states could be found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 223
+
+
+
+
+ +
+

+ + #sum_since(timestamp, service = nil) ⇒ DecimalType, ... + + + + + +

+
+

Returns the sum of the item's state since the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, QuantityType, nil) + + + + — +

    The sum since timestamp, +or nil if no previous states could be found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 208
+
+
+
+
+ +
+

+ + #sum_until(timestamp, service = nil) ⇒ DecimalType, ... + + + + + +

+
+

Returns the sum of the item's state between now until the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time until which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, QuantityType, nil) + + + + — +

    The sum until timestamp, +or nil if no future states could be found.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 215
+
+
+
+
+ +
+

+ + #updated_between?(start, finish, service = nil) ⇒ true, false + + + + + +

+
+

Whether the item's state was updated between two points in time

+ + +
+
+
+

Parameters:

+
    + +
  • + + start + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + finish + + + (#to_zoned_date_time) + + + + — +

    The point in time to which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    True if the item's state was updated between start and finish, False otherwise.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 395
+
+
+
+
+ +
+

+ + #updated_since?(timestamp, service = nil) ⇒ true, false + + + + + +

+
+

Whether the item's state has been updated since the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    True if the item's state has been updated since the given timestamp, False otherwise.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 382
+
+
+
+
+ +
+

+ + #updated_until?(timestamp, service = nil) ⇒ true, false + + + + + +

+
+

Whether the item's state will be updated between now until the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time until which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    True if the item's state will be updated until the given timestamp, False otherwise.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 388
+
+
+
+
+ +
+

+ + #variance_between(start, finish, service = nil) ⇒ DecimalType, ... + + + + + +

+
+

Returns the variance of the item's state between two points in time

+ + +
+
+
+

Parameters:

+
    + +
  • + + start + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + finish + + + (#to_zoned_date_time) + + + + — +

    The point in time to which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, QuantityType, nil) + + + + — +

    The variance between start and finish, +or nil if no states could be found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 246
+
+
+
+
+ +
+

+ + #variance_since(timestamp, service = nil) ⇒ DecimalType, ... + + + + + +

+
+

Returns the variance of the item's state since the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time from which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, QuantityType, nil) + + + + — +

    The variance since timestamp, +or nil if no previous states could be found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 231
+
+
+
+
+ +
+

+ + #variance_until(timestamp, service = nil) ⇒ DecimalType, ... + + + + + +

+
+

Returns the variance of the item's state between now until the given time

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (#to_zoned_date_time) + + + + — +

    The point in time until which to search

    +
    + +
  • + +
  • + + service + + + (Symbol, String) + + + (defaults to: nil) + + + — +

    An optional persistence id instead of the default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (DecimalType, QuantityType, nil) + + + + — +

    The variance until timestamp, +or nil if no future states could be found.

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 238
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/Persistence/PersistedState.html b/5.33/OpenHAB/Core/Items/Persistence/PersistedState.html new file mode 100644 index 0000000000..c911cd50af --- /dev/null +++ b/5.33/OpenHAB/Core/Items/Persistence/PersistedState.html @@ -0,0 +1,4073 @@ + + + + + + + Class: OpenHAB::Core::Items::Persistence::PersistedState + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::Persistence::PersistedState + + + +

+
+ +
+
Inherits:
+
+ SimpleDelegator + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/persistence.rb
+
+ +
+ +

Overview

+
+

A wrapper for HistoricItem that delegates to its state.

+

A PersistedState object can be directly used in arithmetic operations with State and +other PersistedState objects.

+ + +
+
+
+ +
+

Examples:

+ + +
max = Power_Usage.maximum_since(LocalTime::MIDNIGHT)
+logger.info "Highest power usage: #{max} occurred at #{max.timestamp}" if max > 5 | "kW"
+ + +

Arithmetic operations

+

+ +
todays_rate = Energy_Prices.persisted_state(Date.today) # Energy_Prices' unit is "<CURRENCY>/kWh"
+todays_cost = Daily_Energy_Consumption.state * todays_rate
+ +
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + +
+

Constructor Details

+ +
+

+ + #initialize(historic_item, state = nil) ⇒ PersistedState + + + + + +

+
+

Returns a new instance of PersistedState.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+100
+101
+102
+103
+
+
# File 'lib/openhab/core/items/persistence.rb', line 100
+
+def initialize(historic_item, state = nil)
+  @historic_item = historic_item
+  super(state || historic_item.state)
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #instantInstant (readonly) + + + + + +

+
+

Returns The timestamp as an Instant.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Instant) + + + + — +

    The timestamp as an Instant

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.3

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 91
+
+
+
+
+ + + +
+

+ + #nameString (readonly) + + + + + +

+
+

Returns Item name.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    Item name

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+98
+
+
# File 'lib/openhab/core/items/persistence.rb', line 98
+
+delegate %i[timestamp instant name] => :@historic_item
+
+
+ + + +
+

+ + #stateTypes::State (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+86
+
+
# File 'lib/openhab/core/items/persistence.rb', line 86
+
+alias_method :state, :__getobj__
+
+
+ + + +
+

+ + #timestampZonedDateTime (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/persistence.rb', line 88
+
+
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/PlayerItem.html b/5.33/OpenHAB/Core/Items/PlayerItem.html new file mode 100644 index 0000000000..0fbbc581b7 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/PlayerItem.html @@ -0,0 +1,3933 @@ + + + + + + + Class: OpenHAB::Core::Items::PlayerItem + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::PlayerItem + + + +

+
+ +
+
Inherits:
+
+ GenericItem + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/player_item.rb
+
+ +
+ +

Overview

+
+

A PlayerItem allows control of a player, e.g. an audio player.

+ + +
+
+
+ +
+

Examples:

+ + +

Start playing on a player item

+

+ +
Chromecast.play
+ + +

Check if a player is paused

+

+ +
logger.warn("#{item.name} is paused") if Chromecast.paused?
+ +
+ + +
+ + +

Constant Summary

+ +

Constants included + from Semantics

+

Semantics::Equipment, Semantics::Location, Semantics::Point, Semantics::Property, Semantics::Tag

+ + + +

Constants included + from Persistence

+

OpenHAB::Core::Items::Persistence::HistoricState

+ + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from GenericItem

+

#category, #formatted_state, #label, #name, #raw_state, #tags

+ + + +

Attributes included from Semantics

+

#equipment, #equipment_type, #location, #location_type, #point_type, #property_type, #semantic_type

+ + + +

Attributes included from Item

+

#accepted_command_types, #accepted_data_types, #all_groups, #channel, #channel_uid, #channel_uids, #channels, #groups, #links, #metadata, #name, #provider, #thing, #things

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from GenericItem

+

#command, #modify, #null?, #refresh, #state?, #time_series=, #undef?, #update

+ + + + + + + + + +

Methods included from Semantics

+

add, #equipment?, #location?, lookup, #point?, #points, remove, #semantic?, tags

+ + + + + + + + + +

Methods included from Item

+

#call_item?, #color_item?, #contact_item?, #date_time_item?, #dimmer_item?, #group_item?, #image_item?, #inspect, #link, #location_item?, #member_of?, #number_item?, #player_item?, #rollershutter_item?, #string_item?, #switch_item?, #tagged?, #to_s, #unlink

+ + + + + + + + + +

Methods included from DSL::Items::TimedCommand

+

#command

+ + + + + + + + + +

Methods included from Persistence

+

#all_states_between, #all_states_since, #all_states_until, #average_between, #average_since, #average_until, #changed_between?, #changed_since?, #changed_until?, #count_between, #count_since, #count_state_changes_between, #count_state_changes_since, #count_state_changes_until, #count_until, #delta_between, #delta_since, #delta_until, #deviation_between, #deviation_since, #deviation_until, #evolution_rate, #evolution_rate_between, #evolution_rate_since, #evolution_rate_until, #historic_state, #last_change, #last_update, #maximum_between, #maximum_since, #maximum_until, #median_between, #median_since, #median_until, #minimum_between, #minimum_since, #minimum_until, #next_change, #next_state, #next_update, #persist, #persisted_state, #previous_state, #remove_all_states_between, #remove_all_states_since, #remove_all_states_until, #sum_between, #sum_since, #sum_until, #updated_between?, #updated_since?, #updated_until?, #variance_between, #variance_since, #variance_until

+ + + + + + + + + + + + + + + +

Methods included from DSL::Items::Ensure::Ensurable

+

#ensure

+ +
+

Instance Attribute Details

+ + + +
+

+ + #statePlayPauseType, ... (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+21
+22
+23
+24
+25
+26
+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
+75
+76
+77
+78
+
+
# File 'lib/openhab/core/items/player_item.rb', line 21
+
+class PlayerItem < GenericItem
+  # @!method play?
+  #   Check if the item state == {PLAY}
+  #   @return [true,false]
+
+  # @!method paused?
+  #   Check if the item state == {PAUSE}
+  #   @return [true,false]
+
+  # @!method rewinding?
+  #   Check if the item state == {REWIND}
+  #   @return [true,false]
+
+  # @!method fast_forwarding?
+  #   Check if the item state == {FASTFORWARD}
+  #   @return [true,false]
+
+  # @!method play
+  #   Send the {PLAY} command to the item
+  #   @return [PlayerItem] `self`
+
+  # @!method play!
+  #   Send the {PLAY} command to the item, even when {OpenHAB::DSL.ensure_states! ensure_states!} is in effect.
+  #   @return [PlayerItem] `self`
+
+  # @!method pause
+  #   Send the {PAUSE} command to the item
+  #   @return [PlayerItem] `self`
+
+  # @!method pause!
+  #   Send the {PAUSE} command to the item, even when {OpenHAB::DSL.ensure_states! ensure_states!} is in effect.
+  #   @return [PlayerItem] `self`
+
+  # @!method rewind
+  #   Send the {REWIND} command to the item
+  #   @return [PlayerItem] `self`
+
+  # @!method rewind!
+  #   Send the {REWIND} command to the item, even when {OpenHAB::DSL.ensure_states! ensure_states!} is in effect.
+  #   @return [PlayerItem] `self`
+
+  # @!method fast_forward
+  #   Send the {FASTFORWARD} command to the item
+  #   @return [PlayerItem] `self`
+
+  # @!method fast_forward!
+  #   Send the {FASTFORWARD} command to the item, even when
+  #     {OpenHAB::DSL.ensure_states! ensure_states!} is in effect.
+  #   @return [PlayerItem] `self`
+
+  # @!method next
+  #   Send the {NEXT} command to the item
+  #   @return [PlayerItem] `self`
+
+  # @!method previous
+  #   Send the {PREVIOUS} command to the item
+  #   @return [PlayerItem] `self`
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/Provider.html b/5.33/OpenHAB/Core/Items/Provider.html new file mode 100644 index 0000000000..872f5cad1f --- /dev/null +++ b/5.33/OpenHAB/Core/Items/Provider.html @@ -0,0 +1,3961 @@ + + + + + + + Class: OpenHAB::Core::Items::Provider + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::Provider + + + +

+
+ +
+
Inherits:
+
+ Provider + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/provider.rb
+
+ +
+ +

Overview

+
+

Provides Items created in Ruby to openHAB

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods inherited from Provider

+

#[], #all, current, #inspect

+ + + + + + + + + + + + + + + +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update, #update!

+ + + + + + + + + + + + +
+

Constructor Details

+ +
+

+ + #initializeProvider + + + + + +

+
+

Returns a new instance of Provider.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+38
+39
+40
+
+
# File 'lib/openhab/core/items/provider.rb', line 38
+
+def initialize
+  super(unload_priority: 50)
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .registryorg.openhab.core.items.ItemRegistry + + + + + +

+
+

The Item registry

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+18
+19
+20
+
+
# File 'lib/openhab/core/items/provider.rb', line 18
+
+def registry
+  $ir
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #remove(item_name, recursive = false) ⇒ Item? + + + + + +

+
+

Remove an item from this provider

+ + +
+
+
+

Parameters:

+
    + +
  • + + item_name + + + (String) + + + +
  • + +
  • + + recursive + + + (true, false) + + + (defaults to: false) + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Item, nil) + + + + — +

    The removed item, if found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+30
+31
+32
+33
+34
+35
+36
+
+
# File 'lib/openhab/core/items/provider.rb', line 30
+
+def remove(item_name, recursive = false) # rubocop:disable Style/OptionalBooleanParameter matches Java method
+  return nil unless @elements.key?(item_name)
+
+  item = super(item_name)
+  item.members.each { |member| remove(member.name, true) } if recursive && item.is_a?(GroupItem)
+  item
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/Registry.html b/5.33/OpenHAB/Core/Items/Registry.html new file mode 100644 index 0000000000..b35a648577 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/Registry.html @@ -0,0 +1,4287 @@ + + + + + + + Class: OpenHAB::Core::Items::Registry + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::Registry + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
LazyArray
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/items/registry.rb
+
+ +
+ +

Overview

+
+

Provides access to all openHAB items, and acts like an array.

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from LazyArray

+

#each, #method_missing, #to_ary

+ + + + + + + + + +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update, #update!

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::LazyArray + +

+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #[](name) ⇒ Item + + + + + +

+
+

Fetches the named item from the the ItemRegistry

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String) + + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Item) + + + + — +

    Item from registry, nil if item missing or requested item is a Group Type

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+22
+23
+24
+
+
# File 'lib/openhab/core/items/registry.rb', line 22
+
+def [](name)
+  EntityLookup.lookup_item(name)
+end
+
+
+ +
+

+ + #build(preferred_provider = nil, update: true) { ... } ⇒ Object + + + + + +

+
+

Enter the Item Builder DSL.

+ + +
+
+
+

Parameters:

+
    + +
  • + + update + + + (true, false) + + + (defaults to: true) + + + — +

    Update existing items with the same name. +When false, an error will be raised if an item with the same name already exists.

    +
    + +
  • + +
  • + + preferred_provider + + + (org.openhab.core.common.registry.Provider, Proc, :persistent, :transient, nil) + + + (defaults to: nil) + + + — +

    An optional preferred provider to use. Can be one of several types:

    +
      +
    • An explicit instance of ManagedProvider
    • +
    • A Proc, which can calculate the preferred provider based on whatever conditions it wants, +and then is further processed as this parameter.
    • +
    • :persistent, meaning the default ManagedProvider +for this registry. Managed providers persist their objects to JSON, and will survive after the +Ruby script is unloaded. This is where objects you configure with MainUI are stored. You should +use this provider when you're creating something in response to a one-time event.
    • +
    • :transient, meaning a ManagedProvider that +will remove all of its contents when the Ruby script is unloaded. You should use this if you're +generating objects dynamically, either based on some sort of other configuration, or simply +hard coded and you're using Ruby as a more expressive way to define things than a .items or +.things file. If you don't use this provider for something such as metadata, then you +may have issues such as metadata still showing up even though you're no longer creating items +with it anymore.
    • +
    • nil, meaning to fall back to the current thread setting. See DSL.provider. +If there is no thread setting (or the thread setting was Proc that returned nil), +it defaults to :transient.
    • +
    +
    + +
  • + +
+ +

Yields:

+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +

    The return value of the block.

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + + — +

    if an item with the same name already exists and update is false.

    +
    + +
  • + +
  • + + + (FrozenError) + + + + — +

    if update is true but the existing item with the same name +wasn't created by the current provider.

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+56
+57
+58
+59
+
+
# File 'lib/openhab/core/items/registry.rb', line 56
+
+def build(preferred_provider = nil, update: true, &block)
+  DSL::Items::BaseBuilderDSL.new(preferred_provider, update: update)
+                            .instance_eval_with_dummy_items(&block)
+end
+
+
+ +
+

+ + #key?(name) ⇒ true, false + + + + Also known as: + include?, has_key? + + + + +

+
+

Returns true if the given item name exists

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String) + + + + — +

    Item name to check

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    true if the item exists, false otherwise

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+29
+30
+31
+
+
# File 'lib/openhab/core/items/registry.rb', line 29
+
+def key?(name)
+  !$ir.get(name).nil?
+end
+
+
+ +
+

+ + #remove(item_name, recursive: false) ⇒ Item? + + + + + +

+
+

Remove an item.

+

The item must be a managed item (typically created by Ruby or in the UI).

+

Any associated metadata or channel links are also removed.

+ + +
+
+
+

Parameters:

+
    + +
  • + + item_name + + + (String, Item) + + + +
  • + +
  • + + recursive + + + (true, false) + + + (defaults to: false) + + + — +

    Remove the item's members if it's a group

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Item, nil) + + + + — +

    The removed item, if found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+
+
# File 'lib/openhab/core/items/registry.rb', line 71
+
+def remove(item_name, recursive: false)
+  item_name = item_name.name if item_name.is_a?(Item)
+  provider = Provider.registry.provider_for(item_name)
+  unless provider.is_a?(ManagedProvider)
+    raise "Cannot remove item #{item_name} from non-managed provider #{provider.inspect}"
+  end
+
+  Metadata::Provider.registry.providers.grep(ManagedProvider).each do |managed_provider|
+    managed_provider.remove_item_metadata(item_name)
+  end
+
+  Things::Links::Provider.registry.providers.grep(ManagedProvider).each do |managed_provider|
+    managed_provider.remove_links_for_item(item_name)
+  end
+  provider.remove(item_name, recursive)
+end
+
+
+ +
+

+ + #to_aArray + + + + + +

+
+

Explicit conversion to array

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array) + + + +
  • + +
+ +
+ + + + +
+
+
+
+38
+39
+40
+
+
# File 'lib/openhab/core/items/registry.rb', line 38
+
+def to_a
+  $ir.items.map { |item| Proxy.new(item) }
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/RollershutterItem.html b/5.33/OpenHAB/Core/Items/RollershutterItem.html new file mode 100644 index 0000000000..e1c93130b5 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/RollershutterItem.html @@ -0,0 +1,4545 @@ + + + + + + + Class: OpenHAB::Core::Items::RollershutterItem + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::RollershutterItem + + + +

+
+ +
+
Inherits:
+
+ GenericItem + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
NumericItem
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/items/rollershutter_item.rb
+
+ +
+ +

Overview

+
+

A RollershutterItem allows the control of roller shutters, i.e. +moving them up, down, stopping or setting it to close to a certain +percentage.

+ + +
+
+
+ +
+

Examples:

+ + +

Roll up all Rollershutters in a group

+

+ +
Shutters.up
+ + +

Log a warning for all rollershutters that are not up

+

+ +
Shutters.reject(&:up?).each do |item|
+  logger.warn("#{item.name} is not rolled up!")
+end
+ + +

Set rollershutter to a specified position

+

+ +
Example_Rollershutter << 40
+ +
+ + +
+ + +

Constant Summary

+ +

Constants included + from Semantics

+

Semantics::Equipment, Semantics::Location, Semantics::Point, Semantics::Property, Semantics::Tag

+ + + +

Constants included + from Persistence

+

Persistence::HistoricState

+ + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from GenericItem

+

#category, #formatted_state, #label, #name, #raw_state, #tags

+ + + +

Attributes included from Semantics

+

#equipment, #equipment_type, #location, #location_type, #point_type, #property_type, #semantic_type

+ + + +

Attributes included from Item

+

#accepted_command_types, #accepted_data_types, #all_groups, #channel, #channel_uid, #channel_uids, #channels, #groups, #links, #metadata, #name, #provider, #thing, #things

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods inherited from GenericItem

+

#command, #modify, #null?, #refresh, #state?, #time_series=, #undef?, #update

+ + + + + + + + + +

Methods included from Semantics

+

add, #equipment?, #location?, lookup, #point?, #points, remove, #semantic?, tags

+ + + + + + + + + +

Methods included from Item

+

#call_item?, #color_item?, #contact_item?, #date_time_item?, #dimmer_item?, #group_item?, #image_item?, #inspect, #link, #location_item?, #member_of?, #number_item?, #player_item?, #rollershutter_item?, #string_item?, #switch_item?, #tagged?, #to_s, #unlink

+ + + + + + + + + +

Methods included from DSL::Items::TimedCommand

+

#command

+ + + + + + + + + +

Methods included from Persistence

+

#all_states_between, #all_states_since, #all_states_until, #average_between, #average_since, #average_until, #changed_between?, #changed_since?, #changed_until?, #count_between, #count_since, #count_state_changes_between, #count_state_changes_since, #count_state_changes_until, #count_until, #delta_between, #delta_since, #delta_until, #deviation_between, #deviation_since, #deviation_until, #evolution_rate, #evolution_rate_between, #evolution_rate_since, #evolution_rate_until, #historic_state, #last_change, #last_update, #maximum_between, #maximum_since, #maximum_until, #median_between, #median_since, #median_until, #minimum_between, #minimum_since, #minimum_until, #next_change, #next_state, #next_update, #persist, #persisted_state, #previous_state, #remove_all_states_between, #remove_all_states_since, #remove_all_states_until, #sum_between, #sum_since, #sum_until, #updated_between?, #updated_since?, #updated_until?, #variance_between, #variance_since, #variance_until

+ + + + + + + + + + + + + + + +

Methods included from DSL::Items::Ensure::Ensurable

+

#ensure

+ +
+

Instance Attribute Details

+ + + +
+

+ + #statePercentType, ... (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+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/items/rollershutter_item.rb', line 29
+
+class RollershutterItem < GenericItem
+  include NumericItem
+
+  # @!method up?
+  #   Check if the item state == {UP}
+  #   @return [true,false]
+
+  # @!method down?
+  #   Check if the item state == {DOWN}
+  #   @return [true,false]
+
+  # @!method up
+  #   Send the {UP} command to the item
+  #   @return [RollershutterItem] `self`
+
+  # @!method up!
+  #   Send the {UP} command to the item, even when {OpenHAB::DSL.ensure_states! ensure_states!} is in effect.
+  #   @return [RollershutterItem] `self`
+
+  # @!method down
+  #   Send the {DOWN} command to the item
+  #   @return [RollershutterItem] `self`
+
+  # @!method down!
+  #   Send the {DOWN} command to the item, even when {OpenHAB::DSL.ensure_states! ensure_states!} is in effect.
+  #   @return [RollershutterItem] `self`
+
+  # @!method stop
+  #   Send the {STOP} command to the item
+  #   @return [RollershutterItem] `self`
+
+  # @!method move
+  #   Send the {MOVE} command to the item
+  #   @return [RollershutterItem] `self`
+
+  # raw numbers translate directly to PercentType, not a DecimalType
+  # @!visibility private
+  def format_type(command)
+    return Types::PercentType.new(command) if command.is_a?(Numeric)
+
+    super
+  end
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #downRollershutterItem + + + + + +

+
+

Send the DOWN command to the item

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/rollershutter_item.rb', line 48
+
+
+
+
+ +
+

+ + #down!RollershutterItem + + + + + +

+
+

Send the DOWN command to the item, even when ensure_states! is in effect.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/rollershutter_item.rb', line 52
+
+
+
+
+ +
+

+ + #down?true, false + + + + + +

+
+

Check if the item state == DOWN

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/rollershutter_item.rb', line 36
+
+
+
+
+ +
+

+ + #moveRollershutterItem + + + + + +

+
+

Send the MOVE command to the item

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/rollershutter_item.rb', line 60
+
+
+
+
+ +
+

+ + #stopRollershutterItem + + + + + +

+
+

Send the STOP command to the item

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/rollershutter_item.rb', line 56
+
+
+
+
+ +
+

+ + #upRollershutterItem + + + + + +

+
+

Send the UP command to the item

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/rollershutter_item.rb', line 40
+
+
+
+
+ +
+

+ + #up!RollershutterItem + + + + + +

+
+

Send the UP command to the item, even when ensure_states! is in effect.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/rollershutter_item.rb', line 44
+
+
+
+
+ +
+

+ + #up?true, false + + + + + +

+
+

Check if the item state == UP

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/rollershutter_item.rb', line 32
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/Semantics.html b/5.33/OpenHAB/Core/Items/Semantics.html new file mode 100644 index 0000000000..563539a0e9 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/Semantics.html @@ -0,0 +1,5884 @@ + + + + + + + Module: OpenHAB::Core::Items::Semantics + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Items::Semantics + + + +

+
+ + + + + + + + + +
+
Included in:
+
GenericItem
+
+ + + +
+
Defined in:
+
lib/openhab/core/items/semantics.rb,
+ lib/openhab/core/items/semantics/provider.rb,
lib/openhab/core/items/semantics/semantic_tag.rb,
lib/openhab/core/items/semantics/tag_class_methods.rb
+
+
+ +
+ +

Overview

+
+

Module for implementing semantics helper methods on Item in order to easily navigate +the Semantic Model in your scripts. +This can be extremely useful to find related items in rules that are executed for any member of a group.

+

Wraps org.openhab.core.model.script.actions.Semantics as well as adding a few additional convenience methods. +Also includes classes for each semantic tag.

+

Be warned that the Semantic model is stricter than can actually be +described by tags and groups on an Item. It makes assumptions that any +given item only belongs to one semantic type (Location, Equipment, Point).

+

#Enumerable helper methods

+

Enumerable helper methods are also provided to complement the semantic model. These methods can be +chained together to find specific item(s) based on custom tags or group memberships that are outside +the semantic model.

+

The Enumerable helper methods apply to:

+ +

#Semantic Classes

+

Each Semantic +Tag +has a corresponding class within the org.openhab.core.semantics class hierarchy. +These "semantic classes" are available as constants in the Semantics module with the corresponding name. +The following table illustrates the semantic constants:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Semantic ConstantopenHAB's Semantic Class
Semantics::LivingRoomorg.openhab.core.semantics.model.location.LivingRoom
Semantics::Lightbulborg.openhab.core.semantics.model.equipment.Lightbulb
Semantics::Controlorg.openhab.core.semantics.model.point.Control
Semantics::Switchorg.openhab.core.semantics.model.point.Switch
Semantics::Powerorg.openhab.core.semantics.model.property.Power
......
+

These constants can be used as arguments to the #points, +Enumerable#locations and Enumerable#equipments methods to filter +their results. They can also be compared against the return value of +#semantic_type, #location_type, #equipment_type, #point_type, +and #property_type. They can even be used with +DSL::Items::ItemBuilder#tag.

+

In openHAB 4.0, all of the tag objects implement SemanticTag.

+

In openHAB 3.4, the constants in the Semantics module are enhanced with TagClassMethods +to provide easy access to the tags' additional attributes: label, +synonyms, and description. +For example, to get the synonyms for Semantics::Lightbulb in German: +Semantics::Lightbulb.synonyms(java.util.Locale::GERMAN)

+

#Adding Custom Semantic Tags

+

openHAB 4.0 supports adding custom semantic tags to augment the standard set of tags to better suit +your particular requirements.

+

For more information, see Semantics.add

+ + +
+
+
+ +
+

Examples:

+ + +

Working with tags

+

+ +
# Return an array of sibling points with a "Switch" tag
+Light_Color.points(Semantics::Switch)
+
+# check semantic type
+LoungeRoom_Light.equipment_type == Semantics::Lightbulb
+Light_Color.property_type == Semantics::Light
+ + +

switches.items

+

+ +
Group   gFullOn
+Group   gRoomOff
+
+Group   eGarageLights        "Garage Lights"             (lGarage)                 [ "Lightbulb" ]
+Dimmer  GarageLights_Dimmer  "Garage Lights"    <light>  (eGarageLights)           [ "Switch" ]
+Number  GarageLights_Scene   "Scene"                     (eGarageLights, gFullOn, gRoomOff)
+
+Group   eMudLights           "Mud Room Lights"           (lMud)                    [ "Lightbulb" ]
+Dimmer  MudLights_Dimmer     "Garage Lights"    <light>  (eMudLights)              [ "Switch" ]
+Number  MudLights_Scene      "Scene"                     (eMudLights, gFullOn, gRoomOff)
+ + +

Find the switch item for a scene channel on a zwave dimmer

+

+ +
rule "turn dimmer to full on when switch double-tapped up" do
+  changed gFullOn.members, to: 1.3
+  run do |event|
+    dimmer_item = event.item.points(Semantics::Switch).first
+    dimmer_item.ensure << 100
+  end
+end
+ + +

Turn off all the lights in a room

+

+ +
rule "turn off all lights in the room when switch double-tapped down" do
+  changed gRoomOff.members, to: 2.3
+  run do |event|
+    event
+      .item
+      .location
+      .equipments(Semantics::Lightbulb)
+      .members
+      .points(Semantics::Switch)
+      .ensure.off
+  end
+end
+ + +

Finding a related item that doesn't fit in the semantic model

+

+ +
# We can use custom tags to identify certain items that don't quite fit in the semantic model.
+# The extensions to the Enumerable mentioned above can help in this scenario.
+
+# In the following example, the TV `Equipment` has three `Points`. However, we are using custom tags
+# `Application` and `Channel` to identify the corresponding points, since the semantic model
+# doesn't have a specific property for them.
+
+# Here, we use Enumerable#tagged
+# to find the point with the custom tag that we want.
+
+# Item model:
+Group   gTVPower
+Group   lLivingRoom                                 [ "LivingRoom" ]
+
+Group   eTV             "TV"       (lLivingRoom)    [ "Television" ]
+Switch  TV_Power        "Power"    (eTV, gTVPower)  [ "Switch", "Power" ]
+String  TV_Application  "App"      (eTV)            [ "Control", "Application" ]
+String  TV_Channel      "Channel"  (eTV)            [ "Control", "Channel" ]
+
+# Rule:
+rule 'Switch TV to Netflix on startup' do
+  changed gTVPower.members, to: ON
+  run do |event|
+    application = event.item.points.tagged('Application').first
+    application << 'netflix'
+  end
+end
+ + +

Find all semantic entities regardless of hierarchy

+

+ +
# All locations
+items.locations
+
+# All rooms
+items.locations(Semantics::Room)
+
+# All equipments
+items.equipments
+
+# All lightbulbs
+items.equipments(Semantics::Lightbulb)
+
+# All blinds
+items.equipments(Semantics::Blinds)
+
+# Turn off all "Power control"
+items.points(Semantics::Control, Semantics::Power).off
+
+# All items tagged "SmartLightControl"
+items.tagged("SmartLightControl")
+ +
+ + +

See Also:

+ + +

Defined Under Namespace

+

+ + + Modules: SemanticTag, TagClassMethods + + + + Classes: Provider + + +

+ + +

+ Constant Summary + collapse +

+ +
+ +
Tag = +
+
+
Deprecated.

Since openHAB 4.0, SemanticTag is the interface that all tags implement. +Tags are simple instances, instead of another interface in a hierarchical structure.

+
+

This is a marker interface for all semantic tag classes.

+ + +
+
+
+ + +
+
+
org.openhab.core.semantics.Tag
+ +
Location = +
+
+

This is the parent tag for all tags that represent a Location.

+ + +
+
+
+ + +
+
+
SemanticTag
+ +
Equipment = +
+
+

This is the parent tag for all tags that represent an Equipment.

+ + +
+
+
+ + +
+
+
SemanticTag
+ +
Point = +
+
+

This is the parent tag for all tags that represent a Point.

+ + +
+
+
+ + +
+
+
SemanticTag
+ +
Property = +
+
+

This is the parent tag for all property tags.

+ + +
+
+
+ + +
+
+
SemanticTag
+ +
+ + + + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Class Method Summary + collapse +

+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #equipmentItem? (readonly) + + + + + +

+
+

Gets the related Equipment Item of this Item.

+

Checks ancestor groups one level at a time, returning the first Equipment Item found.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Item, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+506
+507
+508
+
+
# File 'lib/openhab/core/items/semantics.rb', line 506
+
+def equipment
+  Actions::Semantics.get_equipment(self)&.then(&Proxy.method(:new))
+end
+
+
+ + + +
+

+ + #equipment_typeSemanticTag? (readonly) + + + + + +

+
+

Returns the sub-tag of Equipment related to this Item.

+

In other words, the #semantic_type of this Item's Equipment.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+519
+520
+521
+
+
# File 'lib/openhab/core/items/semantics.rb', line 519
+
+def equipment_type
+  translate_tag(Actions::Semantics.get_equipment_type(self))
+end
+
+
+ + + +
+

+ + #locationItem? (readonly) + + + + + +

+
+

Gets the related Location Item of this Item.

+

Checks ancestor groups one level at a time, returning the first +Location Item found.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Item, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+480
+481
+482
+
+
# File 'lib/openhab/core/items/semantics.rb', line 480
+
+def location
+  Actions::Semantics.get_location(self)&.then(&Proxy.method(:new))
+end
+
+
+ + + +
+

+ + #location_typeSemanticTag? (readonly) + + + + + +

+
+

Returns the sub-tag of Location related to this Item.

+

In other words, the #semantic_type of this Item's Location.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+493
+494
+495
+
+
# File 'lib/openhab/core/items/semantics.rb', line 493
+
+def location_type
+  translate_tag(Actions::Semantics.get_location_type(self))
+end
+
+
+ + + +
+

+ + #point_typeSemanticTag? (readonly) + + + + + +

+
+

Returns the sub-tag of Point this Item is tagged with.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+530
+531
+532
+
+
# File 'lib/openhab/core/items/semantics.rb', line 530
+
+def point_type
+  translate_tag(Actions::Semantics.get_point_type(self))
+end
+
+
+ + + +
+

+ + #property_typeSemanticTag? (readonly) + + + + + +

+
+

Returns the sub-tag of Property this Item is tagged with.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+541
+542
+543
+
+
# File 'lib/openhab/core/items/semantics.rb', line 541
+
+def property_type
+  translate_tag(Actions::Semantics.get_property_type(self))
+end
+
+
+ + + +
+

+ + #semantic_typeSemanticTag? (readonly) + + + + + +

+
+

Returns the SemanticTag this Item is tagged with.

+

It will only return the first applicable Tag, preferring +a sub-tag of Location, Equipment, or Point first, +and if none of those are found, looks for a Property.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+555
+556
+557
+
+
# File 'lib/openhab/core/items/semantics.rb', line 555
+
+def semantic_type
+  translate_tag(Actions::Semantics.get_semantic_type(self))
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + + .add(**tags) ⇒ Array<SemanticTag> + + .add(label: nil, synonyms: "", description: "", **tags) ⇒ Array<SemanticTag> + + + + + + +

+
+

Adds custom semantic tags.

+ + +
+
+
+ +

Overloads:

+
    + + +
  • + .add(**tags) ⇒ Array<SemanticTag> +
    +
    +

    Quickly add one or more semantic tags using the default label, empty synonyms and descriptions.

    + + +
    +
    +
    + +
    +

    Examples:

    + + +

    Add one semantic tag Balcony whose parent is Semantics::Outdoor (Location)

    +

    + +
    Semantics.add(Balcony: Semantics::Outdoor)
    + + +

    Add multiple semantic tags

    +

    + +
    Semantics.add(Balcony: Semantics::Outdoor,
    +              SecretRoom: Semantics::Room,
    +              Motion: Semantics::Property)
    + +
    +

    Parameters:

    +
      + +
    • + + **tags + + + (kwargs) + + + + — +

      Pairs of tag => parent where tag is either a Symbol or a String +for the tag to be added, and parent is either a SemanticTag, a Symbol or a String of an +existing tag.

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Array<SemanticTag>) + + + + — +

      An array of tags successfully added.

      +
      + +
    • + +
    + +
    +
  • + + +
  • + .add(label: nil, synonyms: "", description: "", **tags) ⇒ Array<SemanticTag> +
    +
    +

    Add a custom semantic tag with extra details.

    + + +
    +
    +
    + +
    +

    Examples:

    + + +
    Semantics.add(SecretRoom: Semantics::Room, label: "My Secret Room",
    +  synonyms: "HidingPlace", description: "A room that requires a special trick to enter")
    + +
    +

    Parameters:

    +
      + +
    • + + label + + + (String, nil) + + + (defaults to: nil) + + + — +

      Optional label. When nil, infer the label from the tag name, +converting CamelCase to Camel Case

      +
      + +
    • + +
    • + + synonyms + + + (String, Symbol, Array<String,Symbol>) + + + (defaults to: "") + + + — +

      Additional synonyms to refer to this tag.

      +
      + +
    • + +
    • + + description + + + (String) + + + (defaults to: "") + + + — +

      A longer description of the tag.

      +
      + +
    • + +
    • + + **tags + + + (kwargs) + + + + — +

      Exactly one pair of tag => parent where tag is either a Symbol or a +String for the tag to be added, and parent is either a SemanticTag, a Symbol or a +String of an existing tag.

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Array<SemanticTag>) + + + + — +

      An array of tags successfully added.

      +
      + +
    • + +
    + +
    +
  • + +
+ +

Returns:

+
    + +
  • + + + (Array<SemanticTag>) + + + + — +

    An array of tags successfully added.

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.0

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+
+
# File 'lib/openhab/core/items/semantics.rb', line 302
+
+def add(label: nil, synonyms: "", description: "", **tags)
+  raise ArgumentError, "Tags must be specified" if tags.empty?
+  if (tags.length > 1) && !(label.nil? && synonyms.empty? && description.empty?)
+    raise ArgumentError, "Additional options can only be specified when creating one tag"
+  end
+
+  synonyms = Array.wrap(synonyms).map { |s| s.to_s.strip }
+
+  tags.map do |name, parent|
+    if (existing_tag = lookup(name))
+      logger.warn("Tag already exists: #{existing_tag.inspect}")
+      next
+    end
+
+    unless parent.is_a?(SemanticTag)
+      parent_tag = lookup(parent)
+      raise ArgumentError, "Unknown parent: #{parent}" unless parent_tag
+
+      parent = parent_tag
+    end
+
+    new_tag = org.openhab.core.semantics.SemanticTagImpl.new("#{parent.uid}_#{name}",
+                                                             label,
+                                                             description,
+                                                             synonyms)
+    Provider.instance.add(new_tag)
+    lookup(name)
+  end.compact
+end
+
+
+ +
+

+ + .lookup(id, locale = java.util.Locale.default) ⇒ SemanticTag, ... + + + + + +

+
+

Finds a semantic tag using its name, label, or synonyms.

+ + +
+
+
+

Parameters:

+
    + +
  • + + id + + + (String, Symbol) + + + + — +

    The tag name, label, or synonym to look up

    +
    + +
  • + +
  • + + locale + + + (java.util.Locale) + + + (defaults to: java.util.Locale.default) + + + — +

    The locale of the given label or synonym

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (SemanticTag, Module, nil) + + + + — +

    The semantic tag class if found, or nil if not found. +In openHAB 4.0, a SemanticTag instance will be returned. In openHAB 3.4, it will be +a Module.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+
+
# File 'lib/openhab/core/items/semantics.rb', line 224
+
+def lookup(id, locale = java.util.Locale.default)
+  id = id.to_s
+
+  # @deprecated OH3.4 - the Property tag had an ID of "MeasurementProperty" in OH3.4.
+  # This was corrected in OH4.
+  id = "MeasurementProperty" if id == "Property" && Core.version < Core::V4_0
+
+  # @deprecated OH3.4 missing registry
+  if Provider.registry
+    tag_class = service.get_by_label_or_synonym(id, locale).first ||
+                Provider.registry.get_tag_class_by_id(id)
+    return unless tag_class
+
+    Provider.registry.get(Provider.registry.class.build_id(tag_class))
+  else
+    tag = org.openhab.core.semantics.SemanticTags.get_by_label_or_synonym(id, locale).first ||
+          org.openhab.core.semantics.SemanticTags.get_by_id(id)
+    return unless tag
+
+    tag = tag.ruby_class
+    tag.singleton_class.include(TagClassMethods)
+    tag
+  end
+end
+
+
+ +
+

+ + .remove(*tags, recursive: false) ⇒ Array<SemanticTag> + + + + + +

+
+

Removes custom semantic tags.

+ + +
+
+
+

Parameters:

+
    + +
  • + + tags + + + (SemanticTag, String, Symbol) + + + + — +

    Custom Semantic Tags to remove. +The built in Semantic Tags cannot be removed.

    +
    + +
  • + +
  • + + recursive + + + (true, false) + + + (defaults to: false) + + + — +

    Remove all children of the given tags.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Array<SemanticTag>) + + + + — +

    An array of tags successfully removed.

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + + — +

    if any of the tags have children

    +
    + +
  • + +
  • + + + (FrozenError) + + + + — +

    if any of the tags are not custom tags

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.0

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+
+
# File 'lib/openhab/core/items/semantics.rb', line 345
+
+def remove(*tags, recursive: false)
+  tags.flat_map do |tag|
+    tag = lookup(tag) unless tag.is_a?(SemanticTag)
+    next unless tag
+
+    provider = Provider.registry.provider_for(tag)
+    unless provider.is_a?(ManagedProvider)
+      raise FrozenError, "Cannot remove item #{tag} from non-managed provider #{provider.inspect}"
+    end
+
+    children = []
+    Provider.registry.providers.grep(ManagedProvider).each do |managed_provider|
+      managed_provider.all.each do |existing_tag|
+        next unless existing_tag.parent_uid == tag.uid
+        raise ArgumentError, "Cannot remove #{tag} because it has children" unless recursive
+
+        children += remove(existing_tag, recursive: recursive)
+      end
+    end
+
+    remove_const(tag.name) if provider.remove(tag.uid) && const_defined?(tag.name)
+    [tag] + children
+  end.compact
+end
+
+
+ +
+

+ + .tagsArray<SemanticTag> + + + + + +

+
+

Returns all available Semantic tags

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array<SemanticTag>) + + + + — +

    an array containing all the Semantic tags

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+
+
# File 'lib/openhab/core/items/semantics.rb', line 200
+
+def tags
+  # @deprecated OH3.4 missing registry
+  if Provider.registry
+    Provider.registry.all.to_a
+  else
+    java.util.stream.Stream.of(
+      org.openhab.core.semantics.model.point.Points.stream,
+      org.openhab.core.semantics.model.property.Properties.stream,
+      org.openhab.core.semantics.model.equipment.Equipments.stream,
+      org.openhab.core.semantics.model.location.Locations.stream
+    ).flat_map(&:itself).map(&:ruby_class).iterator.to_a
+  end
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #equipment?true, false + + + + + +

+
+

Checks if this Item is an Equipment

+

This is implemented as checking if the item's #semantic_type +is an Equipment. I.e. an Item has a single #semantic_type.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+446
+447
+448
+
+
# File 'lib/openhab/core/items/semantics.rb', line 446
+
+def equipment?
+  Actions::Semantics.equipment?(self)
+end
+
+
+ +
+

+ + #location?true, false + + + + + +

+
+

Checks if this Item is a Location

+

This is implemented as checking if the item's #semantic_type +is a Location. I.e. an Item has a single #semantic_type.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+434
+435
+436
+
+
# File 'lib/openhab/core/items/semantics.rb', line 434
+
+def location?
+  Actions::Semantics.location?(self)
+end
+
+
+ +
+

+ + #point?true, false + + + + + +

+
+

Checks if this Item is a Point

+

This is implemented as checking if the item's #semantic_type +is a Point. I.e. an Item has a single #semantic_type.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+457
+458
+459
+
+
# File 'lib/openhab/core/items/semantics.rb', line 457
+
+def point?
+  Actions::Semantics.point?(self)
+end
+
+
+ +
+

+ + #points(*point_or_property_types) ⇒ Array<Item> + + + + + +

+
+

Return the related Point Items.

+

Searches this Equipment Item for Points that are tagged appropriately.

+

If called on a Point Item, it will automatically search for sibling Points +(and remove itself if found).

+ + +
+
+
+ +
+

Examples:

+ + +

Get all points for a TV

+

+ +
eGreatTV.points
+ + +

Search an Equipment item for its switch

+

+ +
eGuestFan.points(Semantics::Switch) # => [GuestFan_Dimmer]
+ + +

Search a Thermostat item for its current temperature item

+

+ +
eFamilyThermostat.points(Semantics::Status, Semantics::Temperature)
+# => [FamilyThermostat_AmbTemp]
+ + +

Search a Thermostat item for is setpoints

+

+ +
eFamilyThermostat.points(Semantics::Control, Semantics::Temperature)
+# => [FamilyThermostat_HeatingSetpoint, FamilyThermostat_CoolingSetpoint]
+ + +

Given a A/V receiver's input item, search for its power item

+

+ +
FamilyReceiver_Input.points(Semantics::Switch) # => [FamilyReceiver_Switch]
+ +
+

Parameters:

+
    + +
  • + + point_or_property_types + + + (SemanticTag) + + + + — +

    Pass 1 or 2 classes that are sub-classes of Point or Property. +Note that when comparing against semantic tags, it does a sub-class check. +So if you search for [Control], you'll get items tagged with [Switch].

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+586
+587
+588
+589
+590
+591
+592
+593
+
+
# File 'lib/openhab/core/items/semantics.rb', line 586
+
+def points(*point_or_property_types)
+  return members.points(*point_or_property_types) if equipment? || location?
+
+  # automatically search the parent equipment (or location?!) for sibling points
+  result = (equipment || location)&.points(*point_or_property_types) || []
+  result.delete(self)
+  result
+end
+
+
+ +
+

+ + #semantic?true, false + + + + + +

+
+

Checks if this Item has any semantic tags

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+466
+467
+468
+
+
# File 'lib/openhab/core/items/semantics.rb', line 466
+
+def semantic?
+  !!semantic_type
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/Semantics/Provider.html b/5.33/OpenHAB/Core/Items/Semantics/Provider.html new file mode 100644 index 0000000000..1b8f613703 --- /dev/null +++ b/5.33/OpenHAB/Core/Items/Semantics/Provider.html @@ -0,0 +1,3774 @@ + + + + + + + Class: OpenHAB::Core::Items::Semantics::Provider + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::Semantics::Provider + + + +

+
+ +
+
Inherits:
+
+ Provider + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/semantics/provider.rb
+
+ +
+ +

Overview

+
+

Provides SemanticTags created in Ruby to openHAB

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods inherited from Provider

+

#[], #all, current, #inspect

+ + + + + + + + + + + + + + + +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update, #update!

+ + + + + + + + + + + + + + +
+

Class Method Details

+ + +
+

+ + .registryorg.openhab.core.semantics.SemanticTagRegistry? + + + + + +

+
+

The SemanticTag registry

+ + +
+
+
+ +

Returns:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.0

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+24
+25
+26
+27
+28
+29
+
+
# File 'lib/openhab/core/items/semantics/provider.rb', line 24
+
+def registry
+  unless instance_variable_defined?(:@registry)
+    @registry = OSGi.service("org.openhab.core.semantics.SemanticTagRegistry")
+  end
+  @registry
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/Semantics/SemanticTag.html b/5.33/OpenHAB/Core/Items/Semantics/SemanticTag.html new file mode 100644 index 0000000000..43ad30e9ad --- /dev/null +++ b/5.33/OpenHAB/Core/Items/Semantics/SemanticTag.html @@ -0,0 +1,4392 @@ + + + + + + + Module: OpenHAB::Core::Items::Semantics::SemanticTag + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Items::Semantics::SemanticTag + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/semantics/semantic_tag.rb
+
+ +
+ +

Overview

+
+ + +
+
+
+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.0

    +
    + +
  • + +
+ +
+ + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #description ⇒ String + + + + + + + + + readonly + + + + + + + + + +

    The tag's full description.

    +
    + +
  • + + +
  • + + + #label ⇒ String + + + + + + + + + readonly + + + + + + + + + +

    The tag's human readable label.

    +
    + +
  • + + +
  • + + + #name ⇒ String + + + + + + + + + readonly + + + + + + + + + +

    The tag's simple name.

    +
    + +
  • + + +
  • + + + #parent_uid ⇒ String + + + + + + + + + readonly + + + + + + + + + +

    The UID of the tag's parent.

    +
    + +
  • + + +
  • + + + #synonyms ⇒ java.util.List<String> + + + + + + + + + readonly + + + + + + + + + +

    Allowed synonyms for the tag.

    +
    + +
  • + + +
  • + + + #uid ⇒ String + + + + + + + + + readonly + + + + + + + + + +

    The tag's full UID, including ancestors.

    +
    + +
  • + + +
+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #descriptionString (readonly) + + + + + +

+
+

The tag's full description.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/semantic_tag.rb', line 38
+
+
+
+
+ + + +
+

+ + #labelString (readonly) + + + + + +

+
+

The tag's human readable label.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/semantic_tag.rb', line 32
+
+
+
+
+ + + +
+

+ + #nameString (readonly) + + + + + +

+
+

The tag's simple name.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/semantic_tag.rb', line 26
+
+
+
+
+ + + +
+

+ + #parent_uidString (readonly) + + + + + +

+
+

The UID of the tag's parent.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/semantic_tag.rb', line 20
+
+
+
+
+ + + +
+

+ + #synonymsjava.util.List<String> (readonly) + + + + + +

+
+

Allowed synonyms for the tag.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/semantic_tag.rb', line 44
+
+
+
+
+ + + +
+

+ + #uidString (readonly) + + + + + +

+
+

The tag's full UID, including ancestors.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/semantic_tag.rb', line 14
+
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.0

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+88
+89
+90
+91
+92
+93
+94
+
+
# File 'lib/openhab/core/items/semantics/semantic_tag.rb', line 88
+
+def inspect
+  parent = "(#{parent_uid})" unless parent_uid.empty?
+  "#<OpenHAB::Core::Items::Semantics::#{name}#{parent} " \
+    "label=#{label.inspect} " \
+    "description=#{description.inspect} " \
+    "synonyms=#{synonyms.to_a.inspect}>"
+end
+
+
+ +
+

+ + #localized(locale) ⇒ SemanticTag + + + + + +

+
+

Returns a new SemanticTag localized to the specified locale.

+ + +
+
+
+

Parameters:

+
    + +
  • + + locale + + + (java.util.Locale) + + + + — +

    The locale to localize this tag to

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/semantics/semantic_tag.rb', line 50
+
+
+
+
+ +
+

+ + #to_sString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.0

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+97
+98
+99
+
+
# File 'lib/openhab/core/items/semantics/semantic_tag.rb', line 97
+
+def to_s
+  name
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/Semantics/TagClassMethods.html b/5.33/OpenHAB/Core/Items/Semantics/TagClassMethods.html new file mode 100644 index 0000000000..779ee0cbef --- /dev/null +++ b/5.33/OpenHAB/Core/Items/Semantics/TagClassMethods.html @@ -0,0 +1,4017 @@ + + + + + + + Module: OpenHAB::Core::Items::Semantics::TagClassMethods + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Items::Semantics::TagClassMethods + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/semantics/tag_class_methods.rb
+
+ +
+ +

Overview

+
+

Adds tag attributes to the semantic tag class

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #description(locale = nil) ⇒ String + + + + + +

+
+

Returns the tag's description

+ + +
+
+
+

Parameters:

+
    + +
  • + + locale + + + (java.util.Locale) + + + (defaults to: nil) + + + — +

    The locale that the description should be in, if available. +When nil, the system's default locale is used.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    The tag's description

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+62
+63
+64
+65
+66
+67
+68
+
+
# File 'lib/openhab/core/items/semantics/tag_class_methods.rb', line 62
+
+def description(locale = nil)
+  unless SemanticTags.respond_to?(:get_description)
+    return java_class.get_annotation(org.openhab.core.semantics.TagInfo.java_class).description
+  end
+
+  SemanticTags.get_description(java_class, locale || java.util.Locale.default)
+end
+
+
+ +
+

+ + #label(locale = nil) ⇒ String + + + + + +

+
+

Returns the tag's label

+ + +
+
+
+

Parameters:

+
    + +
  • + + locale + + + (java.util.Locale) + + + (defaults to: nil) + + + — +

    The locale that the label should be in, if available. +When nil, the system's default locale is used.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    The tag's label

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+33
+34
+35
+
+
# File 'lib/openhab/core/items/semantics/tag_class_methods.rb', line 33
+
+def label(locale = nil)
+  SemanticTags.get_label(java_class, locale || java.util.Locale.default)
+end
+
+
+ +
+

+ + #synonyms(locale = nil) ⇒ Array<String> + + + + + +

+
+

Returns the tag's synonyms

+ + +
+
+
+

Parameters:

+
    + +
  • + + locale + + + (java.util.Locale) + + + (defaults to: nil) + + + — +

    The locale that the label should be in, if available. +When nil, the system's default locale is used.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Array<String>) + + + + — +

    The list of synonyms in the requested locale.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+45
+46
+47
+48
+49
+50
+51
+52
+
+
# File 'lib/openhab/core/items/semantics/tag_class_methods.rb', line 45
+
+def synonyms(locale = nil)
+  unless SemanticTags.respond_to?(:get_synonyms)
+    return java_class.get_annotation(org.openhab.core.semantics.TagInfo.java_class).synonyms
+                     .split(",").map(&:strip)
+  end
+
+  SemanticTags.get_synonyms(java_class, locale || java.util.Locale.default).to_a
+end
+
+
+ +
+

+ + #to_sString + + + + + +

+
+

Returns the tag's string representation

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+21
+22
+23
+
+
# File 'lib/openhab/core/items/semantics/tag_class_methods.rb', line 21
+
+def to_s
+  java_class.simple_name
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/StateStorage.html b/5.33/OpenHAB/Core/Items/StateStorage.html new file mode 100644 index 0000000000..db7a4e9dee --- /dev/null +++ b/5.33/OpenHAB/Core/Items/StateStorage.html @@ -0,0 +1,3842 @@ + + + + + + + Class: OpenHAB::Core::Items::StateStorage + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::StateStorage + + + +

+
+ +
+
Inherits:
+
+ SimpleDelegator + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/state_storage.rb
+
+ +
+ +

Overview

+
+

Delegates state storage to a Hash providing methods to operate with states

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + +
    + +
  • + + + #changed? ⇒ true, false + + + + + + + + + + + + + +

    Detect if any items have changed states since being stored.

    +
    + +
  • + + +
  • + + + #restore ⇒ void + + + + + + + + + + + + + +

    Restore the stored states of all items.

    +
    + +
  • + + +
  • + + + #restore_changes ⇒ void + + + + + + + + + + + + + +

    Restore states for items that have changed.

    +
    + +
  • + + +
+ + + + + + +
+

Instance Method Details

+ + +
+

+ + #changed?true, false + + + + + +

+
+

Detect if any items have changed states since being stored

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    True if any items have changed states, false otherwise

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+47
+48
+49
+
+
# File 'lib/openhab/core/items/state_storage.rb', line 47
+
+def changed?
+  any? { |item, value| item.state != value }
+end
+
+
+ +
+

+ + #restorevoid + + + + + +

+
+

This method returns an undefined value.

Restore the stored states of all items

+ + +
+
+
+ + +
+ + + + +
+
+
+
+29
+30
+31
+
+
# File 'lib/openhab/core/items/state_storage.rb', line 29
+
+def restore
+  $events.restore_states(to_h)
+end
+
+
+ +
+

+ + #restore_changesvoid + + + + + +

+
+

This method returns an undefined value.

Restore states for items that have changed

+ + +
+
+
+ + +
+ + + + +
+
+
+
+38
+39
+40
+
+
# File 'lib/openhab/core/items/state_storage.rb', line 38
+
+def restore_changes
+  $events.restore_states(select { |item, value| item.state != value })
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/StringItem.html b/5.33/OpenHAB/Core/Items/StringItem.html new file mode 100644 index 0000000000..33bb976d3a --- /dev/null +++ b/5.33/OpenHAB/Core/Items/StringItem.html @@ -0,0 +1,3816 @@ + + + + + + + Class: OpenHAB::Core::Items::StringItem + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::StringItem + + + +

+
+ +
+
Inherits:
+
+ GenericItem + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/string_item.rb
+
+ +
+ +

Overview

+
+

A StringItem can be used for any kind of string to either send or +receive from a device.

+ + +
+
+
+ +
+

Examples:

+ + +
# StringOne has a current state of "Hello"
+StringOne << StringOne + " World!"
+# StringOne will eventually have a state of 'Hello World!'
+ +
+ + +
+ + +

Constant Summary

+ +

Constants included + from Semantics

+

OpenHAB::Core::Items::Semantics::Equipment, OpenHAB::Core::Items::Semantics::Location, OpenHAB::Core::Items::Semantics::Point, OpenHAB::Core::Items::Semantics::Property, OpenHAB::Core::Items::Semantics::Tag

+ + + +

Constants included + from Persistence

+

Persistence::HistoricState

+ + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from GenericItem

+

#category, #formatted_state, #label, #name, #raw_state, #tags

+ + + +

Attributes included from Semantics

+

#equipment, #equipment_type, #location, #location_type, #point_type, #property_type, #semantic_type

+ + + +

Attributes included from Item

+

#accepted_command_types, #accepted_data_types, #all_groups, #channel, #channel_uid, #channel_uids, #channels, #groups, #links, #metadata, #name, #provider, #thing, #things

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from GenericItem

+

#command, #modify, #null?, #refresh, #state?, #time_series=, #undef?, #update

+ + + + + + + + + +

Methods included from Semantics

+

add, #equipment?, #location?, lookup, #point?, #points, remove, #semantic?, tags

+ + + + + + + + + +

Methods included from Item

+

#call_item?, #color_item?, #contact_item?, #date_time_item?, #dimmer_item?, #group_item?, #image_item?, #inspect, #link, #location_item?, #member_of?, #number_item?, #player_item?, #rollershutter_item?, #string_item?, #switch_item?, #tagged?, #to_s, #unlink

+ + + + + + + + + +

Methods included from DSL::Items::TimedCommand

+

#command

+ + + + + + + + + +

Methods included from Persistence

+

#all_states_between, #all_states_since, #all_states_until, #average_between, #average_since, #average_until, #changed_between?, #changed_since?, #changed_until?, #count_between, #count_since, #count_state_changes_between, #count_state_changes_since, #count_state_changes_until, #count_until, #delta_between, #delta_since, #delta_until, #deviation_between, #deviation_since, #deviation_until, #evolution_rate, #evolution_rate_between, #evolution_rate_since, #evolution_rate_until, #historic_state, #last_change, #last_update, #maximum_between, #maximum_since, #maximum_until, #median_between, #median_since, #median_until, #minimum_between, #minimum_since, #minimum_until, #next_change, #next_state, #next_update, #persist, #persisted_state, #previous_state, #remove_all_states_between, #remove_all_states_since, #remove_all_states_until, #sum_between, #sum_since, #sum_until, #updated_between?, #updated_since?, #updated_until?, #variance_between, #variance_since, #variance_until

+ + + + + + + + + + + + + + + +

Methods included from DSL::Items::Ensure::Ensurable

+

#ensure

+ +
+

Instance Attribute Details

+ + + +
+

+ + #stateStringType? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+22
+23
+
+
# File 'lib/openhab/core/items/string_item.rb', line 22
+
+class StringItem < GenericItem
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Items/SwitchItem.html b/5.33/OpenHAB/Core/Items/SwitchItem.html new file mode 100644 index 0000000000..5c0af56b6f --- /dev/null +++ b/5.33/OpenHAB/Core/Items/SwitchItem.html @@ -0,0 +1,4478 @@ + + + + + + + Class: OpenHAB::Core::Items::SwitchItem + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Items::SwitchItem + + + +

+
+ +
+
Inherits:
+
+ GenericItem + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/items/switch_item.rb
+
+ +
+ +

Overview

+
+

A SwitchItem represents a normal switch that can be ON or OFF. +Useful for normal lights, presence detection etc.

+ + +
+
+
+ +
+

Examples:

+ + +

Turn on all switches in a Group:Switch called Switches

+

+ +
Switches.on
+ + +

Turn on all switches in a group called Switches that are off

+

+ +
Switches.select(&:off?).each(&:on)
+ + +

Switches accept booelan commands (true/false)

+

+ +
# Turn on switch
+SwitchItem << true
+
+# Turn off switch
+SwitchItem << false
+
+# Turn off switch if any in another group is on
+SwitchItem << Switches.any?(&:on?)
+ + +

Invert all Switches

+

+ +
items.grep(SwitchItem)
+     .each(&:toggle)
+ +
+ + +
+

Direct Known Subclasses

+

DimmerItem

+
+ + + +

Constant Summary

+ +

Constants included + from Semantics

+

OpenHAB::Core::Items::Semantics::Equipment, OpenHAB::Core::Items::Semantics::Location, OpenHAB::Core::Items::Semantics::Point, OpenHAB::Core::Items::Semantics::Property, OpenHAB::Core::Items::Semantics::Tag

+ + + +

Constants included + from Persistence

+

Persistence::HistoricState

+ + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from GenericItem

+

#category, #formatted_state, #label, #name, #raw_state, #tags

+ + + +

Attributes included from Semantics

+

#equipment, #equipment_type, #location, #location_type, #point_type, #property_type, #semantic_type

+ + + +

Attributes included from Item

+

#accepted_command_types, #accepted_data_types, #all_groups, #channel, #channel_uid, #channel_uids, #channels, #groups, #links, #metadata, #name, #provider, #thing, #things

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods inherited from GenericItem

+

#command, #modify, #null?, #refresh, #state?, #time_series=, #undef?, #update

+ + + + + + + + + +

Methods included from Semantics

+

add, #equipment?, #location?, lookup, #point?, #points, remove, #semantic?, tags

+ + + + + + + + + +

Methods included from Item

+

#call_item?, #color_item?, #contact_item?, #date_time_item?, #dimmer_item?, #group_item?, #image_item?, #inspect, #link, #location_item?, #member_of?, #number_item?, #player_item?, #rollershutter_item?, #string_item?, #switch_item?, #tagged?, #to_s, #unlink

+ + + + + + + + + +

Methods included from DSL::Items::TimedCommand

+

#command

+ + + + + + + + + +

Methods included from Persistence

+

#all_states_between, #all_states_since, #all_states_until, #average_between, #average_since, #average_until, #changed_between?, #changed_since?, #changed_until?, #count_between, #count_since, #count_state_changes_between, #count_state_changes_since, #count_state_changes_until, #count_until, #delta_between, #delta_since, #delta_until, #deviation_between, #deviation_since, #deviation_until, #evolution_rate, #evolution_rate_between, #evolution_rate_since, #evolution_rate_until, #historic_state, #last_change, #last_update, #maximum_between, #maximum_since, #maximum_until, #median_between, #median_since, #median_until, #minimum_between, #minimum_since, #minimum_until, #next_change, #next_state, #next_update, #persist, #persisted_state, #previous_state, #remove_all_states_between, #remove_all_states_since, #remove_all_states_until, #sum_between, #sum_since, #sum_until, #updated_between?, #updated_since?, #updated_until?, #variance_between, #variance_since, #variance_until

+ + + + + + + + + + + + + + + +

Methods included from DSL::Items::Ensure::Ensurable

+

#ensure

+ +
+

Instance Attribute Details

+ + + +
+

+ + #stateOnOffType? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+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
+75
+76
+77
+78
+79
+80
+81
+
+
# File 'lib/openhab/core/items/switch_item.rb', line 38
+
+class SwitchItem < GenericItem
+  # Convert boolean commands to ON/OFF
+  # @!visibility private
+  def format_type(command)
+    return Types::OnOffType.from(command) if [true, false].include?(command)
+
+    super
+  end
+
+  #
+  # Send a command to invert the state of the switch
+  #
+  # @return [self]
+  #
+  def toggle(source: nil)
+    return on!(source: source) unless state?
+
+    command!(!state, source: source)
+  end
+
+  # @!method on?
+  #   Check if the item state == {ON}
+  #   @return [true,false]
+
+  # @!method off?
+  #   Check if the item state == {OFF}
+  #   @return [true,false]
+
+  # @!method on
+  #   Send the {ON} command to the item
+  #   @return [SwitchItem] `self`
+
+  # @!method on!
+  #   Send the {ON} command to the item, even when {OpenHAB::DSL.ensure_states! ensure_states!} is in effect.
+  #   @return [SwitchItem] `self`
+
+  # @!method off
+  #   Send the {OFF} command to the item
+  #   @return [SwitchItem] `self`
+
+  # @!method off!
+  #   Send the {OFF} command to the item, even when {OpenHAB::DSL.ensure_states! ensure_states!} is in effect.
+  #   @return [SwitchItem] `self`
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #offSwitchItem + + + + + +

+
+

Send the OFF command to the item

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (SwitchItem) + + + + — +

    self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/switch_item.rb', line 74
+
+
+
+
+ +
+

+ + #off!SwitchItem + + + + + +

+
+

Send the OFF command to the item, even when ensure_states! is in effect.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (SwitchItem) + + + + — +

    self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/switch_item.rb', line 78
+
+
+
+
+ +
+

+ + #off?true, false + + + + + +

+
+

Check if the item state == OFF

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/switch_item.rb', line 62
+
+
+
+
+ +
+

+ + #onSwitchItem + + + + + +

+
+

Send the ON command to the item

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (SwitchItem) + + + + — +

    self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/switch_item.rb', line 66
+
+
+
+
+ +
+

+ + #on!SwitchItem + + + + + +

+
+

Send the ON command to the item, even when ensure_states! is in effect.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (SwitchItem) + + + + — +

    self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/switch_item.rb', line 70
+
+
+
+
+ +
+

+ + #on?true, false + + + + + +

+
+

Check if the item state == ON

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/items/switch_item.rb', line 58
+
+
+
+
+ +
+

+ + #toggle(source: nil) ⇒ self + + + + + +

+
+

Send a command to invert the state of the switch

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+52
+53
+54
+55
+56
+
+
# File 'lib/openhab/core/items/switch_item.rb', line 52
+
+def toggle(source: nil)
+  return on!(source: source) unless state?
+
+  command!(!state, source: source)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/LazyArray.html b/5.33/OpenHAB/Core/LazyArray.html new file mode 100644 index 0000000000..be1c242057 --- /dev/null +++ b/5.33/OpenHAB/Core/LazyArray.html @@ -0,0 +1,3863 @@ + + + + + + + Module: OpenHAB::Core::LazyArray + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::LazyArray + + + +

+
+ + + + + + +
+
Includes:
+
Enumerable
+
+ + + + +
+
Included in:
+
Items::GroupItem::Members, Items::Registry, Rules::Registry, Rules::TaggedArray, Things::Registry, Types::TimeSeries
+
+ + + +
+
Defined in:
+
lib/openhab/core/lazy_array.rb
+
+ +
+ +

Overview

+
+

Common base class for array-like collections that have lookup +methods to avoid instantiating the elements if you only use +the lookup method

+

your class should implement to_a

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update, #update!

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + +

+ +
+

+ + #method_missing(method, *args, &block) ⇒ Object + + + + + +

+
+

Delegate any other methods to the actual array, exclude mutating methods

+ + +
+
+
+ + +
+ + + + +
+
+
+
+38
+39
+40
+41
+42
+
+
# File 'lib/openhab/core/lazy_array.rb', line 38
+
+def method_missing(method, *args, &block)
+  return to_a.send(method, *args, &block) if method[-1] != "!" && Array.instance_methods.include?(method)
+
+  super
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #each(&block) ⇒ Object + + + + + +

+
+

Calls the given block once for each object, passing that object as a +parameter. Returns self.

+

If no block is given, an Enumerator is returned.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+24
+25
+26
+27
+
+
# File 'lib/openhab/core/lazy_array.rb', line 24
+
+def each(&block)
+  to_a.each(&block)
+  self
+end
+
+
+ +
+

+ + #to_aryArray + + + + + +

+
+

Implicitly convertible to array

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array) + + + +
  • + +
+ +
+ + + + +
+
+
+
+33
+34
+35
+
+
# File 'lib/openhab/core/lazy_array.rb', line 33
+
+def to_ary
+  to_a
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Provider.html b/5.33/OpenHAB/Core/Provider.html new file mode 100644 index 0000000000..f0befb5de5 --- /dev/null +++ b/5.33/OpenHAB/Core/Provider.html @@ -0,0 +1,4293 @@ + + + + + + + Class: OpenHAB::Core::Provider + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Provider + Abstract + + +

+
+ +
+
Inherits:
+
+ org.openhab.core.common.registry.AbstractProvider + + + show all + +
+
+ + + + + + +
+
Includes:
+
Enumerable
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/provider.rb
+
+ +
+ +

Overview

+
+
+ This class is abstract. +
+
+ + +
+
+
+ + +
+ + + + +

Class Attribute Summary collapse

+ + + + + + +

+ Class Method Summary + collapse +

+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update!

+ + + + + + + + + + + + + +
+

Class Attribute Details

+ + + +
+

+ + .registryorg.openhab.core.common.registry.Registry (readonly) + + + + + +

+
+
+ This method is abstract. +
+
+

The registry that this provider provides elements for.

+ + +
+
+
+ +

Returns:

+ +

Raises:

+
    + +
  • + + + (NotImplementedError) + + + +
  • + +
+ +
+ + + + +
+
+
+
+104
+105
+106
+
+
# File 'lib/openhab/core/provider.rb', line 104
+
+def registry
+  raise NotImplementedError
+end
+
+
+ + + +
+

+ + .typeSymbol (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + +
  • + +
+ +
+ + + + +
+
+
+
+141
+142
+143
+
+
# File 'lib/openhab/core/provider.rb', line 141
+
+def type
+  name.split("::")[-2].downcase.to_sym
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .current(preferred_provider = nil, element = nil) ⇒ org.openhab.core.common.registry.Provider + + + + + +

+
+

Determines the current provider that should be used to create elements belonging to this registry.

+ + +
+
+
+

Parameters:

+
    + +
  • + + preferred_provider + + + (org.openhab.core.common.registry.Provider, Proc, :persistent, :transient, nil) + + + (defaults to: nil) + + + — +

    An optional preferred provider to use. Can be one of several types:

    +
      +
    • An explicit instance of ManagedProvider
    • +
    • A Proc, which can calculate the preferred provider based on whatever conditions it wants, +and then is further processed as this parameter.
    • +
    • :persistent, meaning the default ManagedProvider +for this registry. Managed providers persist their objects to JSON, and will survive after the +Ruby script is unloaded. This is where objects you configure with MainUI are stored. You should +use this provider when you're creating something in response to a one-time event.
    • +
    • :transient, meaning a ManagedProvider that +will remove all of its contents when the Ruby script is unloaded. You should use this if you're +generating objects dynamically, either based on some sort of other configuration, or simply +hard coded and you're using Ruby as a more expressive way to define things than a .items or +.things file. If you don't use this provider for something such as metadata, then you +may have issues such as metadata still showing up even though you're no longer creating items +with it anymore.
    • +
    • nil, meaning to fall back to the current thread setting. See DSL.provider. +If there is no thread setting (or the thread setting was Proc that returned nil), +it defaults to :transient.
    • +
    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+
+
# File 'lib/openhab/core/provider.rb', line 75
+
+def current(preferred_provider = nil, element = nil)
+  preferred_provider ||= Thread.current[:openhab_providers]&.[](type)
+  if preferred_provider.is_a?(Proc)
+    preferred_provider = if preferred_provider.arity.zero? || element.nil?
+                           preferred_provider.call
+                         else
+                           preferred_provider.call(element)
+                         end
+  end
+
+  case preferred_provider
+  when nil, :transient
+    instance
+  when :persistent
+    registry.managed_provider.get
+  when org.openhab.core.common.registry.ManagedProvider
+    preferred_provider
+  else
+    raise ArgumentError, "#{preferred_provider.inspect} is not a ManagedProvider"
+  end
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #[](key) ⇒ Object + + + + Also known as: + get + + + + +

+
+

Get an element from this provider

+ + +
+
+
+

Parameters:

+
    + +
  • + + key + + + (Object) + + + + — +

    The proper key type for the elements in this provider.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Object) + + + +
  • + +
+ +
+ + + + +
+
+
+
+173
+174
+175
+
+
# File 'lib/openhab/core/provider.rb', line 173
+
+def [](key)
+  @elements[key]
+end
+
+
+ +
+

+ + #allArray<Object> + + + + Also known as: + getAll + + + + +

+
+

Get all elements in this provider

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array<Object>) + + + +
  • + +
+ +
+ + + + +
+
+
+
+183
+184
+185
+
+
# File 'lib/openhab/core/provider.rb', line 183
+
+def all
+  @elements.values
+end
+
+
+ +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+152
+153
+154
+
+
# File 'lib/openhab/core/provider.rb', line 152
+
+def inspect
+  "#<#{self.class.name}:#{object_id}>"
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Proxy/EventSubscriber.html b/5.33/OpenHAB/Core/Proxy/EventSubscriber.html new file mode 100644 index 0000000000..3349b1c29d --- /dev/null +++ b/5.33/OpenHAB/Core/Proxy/EventSubscriber.html @@ -0,0 +1,4081 @@ + + + + + + + Class: OpenHAB::Core::Proxy::EventSubscriber + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Proxy::EventSubscriber + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/proxy.rb
+
+ +
+ +

Overview

+
+

Registers and listens to openHAB bus events for objects getting +added/updated/removed, and updates references from proxy objects +to real objects.

+

Proxies are tracked (via a WeakRef), and their underlying object is +if it has changed.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + +
+

Constructor Details

+ +
+

+ + #initializeEventSubscriber + + + + + +

+
+

Returns a new instance of EventSubscriber.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+
+
# File 'lib/openhab/core/proxy.rb', line 39
+
+def initialize
+  @proxies = java.util.concurrent.ConcurrentHashMap.new
+  @parent_module = Object.const_get(self.class.name.split("::")[0..-3].join("::"), false)
+  @object_type = @parent_module.name.split("::").last.downcase[0..-2].to_sym
+
+  @event_types = @parent_module::Proxy::EVENTS
+  @uid_method = @parent_module::Proxy::UID_METHOD
+  @registry = @parent_module::Provider.registry
+  @registration = OSGi.register_service(self, "event.topics": "openhab/*")
+  ScriptHandling.script_unloaded { @registration.unregister }
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #subscribed_event_typesSet<String> (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Set<String>) + + + +
  • + +
+ +
+ + + + +
+
+
+
+55
+56
+57
+
+
# File 'lib/openhab/core/proxy.rb', line 55
+
+def subscribed_event_types
+  @event_types.to_set
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #event_filterorg.openhab.core.events.EventFilter? + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+60
+61
+62
+
+
# File 'lib/openhab/core/proxy.rb', line 60
+
+def event_filter
+  nil
+end
+
+
+ +
+

+ + #fetch(object) ⇒ Object + + + + + +

+
+

Get or create a Proxy for the given raw openHAB object.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+
+
# File 'lib/openhab/core/proxy.rb', line 84
+
+def fetch(object)
+  result = nil
+
+  @proxies.compute(object.__send__(@uid_method)) do |_k, proxy_ref|
+    result = resolve_ref(proxy_ref)
+    proxy_ref = nil unless result
+    result ||= yield
+
+    proxy_ref || WeakRef.new(result)
+  end
+
+  result
+end
+
+
+ +
+

+ + #receive(event) ⇒ void + + + + + +

+
+

This method returns an undefined value.

+ +
+
+
+

Parameters:

+ + + +
+ + + + +
+
+
+
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+
+
# File 'lib/openhab/core/proxy.rb', line 68
+
+def receive(event)
+  uid = event.__send__(@object_type).__send__(@uid_method)
+  object = @registry.get(uid) unless event.class.simple_name == @event_types.last
+
+  @proxies.compute_if_present(uid) do |_, proxy_ref|
+    proxy = resolve_ref(proxy_ref)
+    next nil unless proxy
+
+    proxy.__setobj__(object)
+    proxy_ref
+  end
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Registry.html b/5.33/OpenHAB/Core/Registry.html new file mode 100644 index 0000000000..4fbc84124e --- /dev/null +++ b/5.33/OpenHAB/Core/Registry.html @@ -0,0 +1,3853 @@ + + + + + + + Class: OpenHAB::Core::Registry + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Registry + Abstract + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/registry.rb
+
+ +
+ +

Overview

+
+
+ This class is abstract. +
+
+

The base class for all registries in openHAB.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #providersEnumerable<org.openhab.core.common.registry.Provider> (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+43
+44
+45
+
+
# File 'lib/openhab/core/registry.rb', line 43
+
+def providers
+  providerToElements.keys
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #provider_for(key) ⇒ org.openhab.core.common.registry.Provider + + + + + +

+
+

Determines which provider an element is associated with.

+ + +
+
+
+

Parameters:

+
    + +
  • + + key + + + (Object) + + + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+
+
# File 'lib/openhab/core/registry.rb', line 20
+
+def provider_for(key)
+  elementReadLock.lock
+  if key.is_a?(org.openhab.core.common.registry.Identifiable)
+    return unless (provider = elementToProvider[key])
+
+    # The HashMap lookup above uses java's hashCode() which has been overridden
+    # by GenericItem and ThingImpl to return object's uid, e.g. item's name, thing uid
+    # so it will return a provider even for an unmanaged object having the same uid
+    # as an existing managed object.
+
+    # So take an extra step to verify that the provider really holds the given instance.
+    # by using equal? to compare the object's identity.
+    # Only ManagedProviders have a #get method to look up the object by uid.
+    provider if !provider.is_a?(ManagedProvider) || provider.get(key.uid).equal?(key)
+  elsif (element = identifierToElement[key])
+    elementToProvider[element]
+  end
+ensure
+  elementReadLock.unlock
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Rules.html b/5.33/OpenHAB/Core/Rules.html new file mode 100644 index 0000000000..49bf94c112 --- /dev/null +++ b/5.33/OpenHAB/Core/Rules.html @@ -0,0 +1,3740 @@ + + + + + + + Module: OpenHAB::Core::Rules + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Rules + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/rules.rb,
+ lib/openhab/core/rules/rule.rb,
lib/openhab/core/rules/module.rb,
lib/openhab/core/rules/provider.rb,
lib/openhab/core/rules/registry.rb,
lib/openhab/core/rules/tagged_array.rb
+
+
+ +
+ +

Overview

+
+

Contains the core Rule as well as related infrastructure.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: Rule + + + + Classes: Provider, Registry, TaggedArray + + +

+ + +

+ Constant Summary + collapse +

+ +
+ +
RuleStatus = + +
+
org.openhab.core.automation.RuleStatus
+ +
RuleStatusInfo = + +
+
org.openhab.core.automation.RuleStatusInfo
+ +
RuleStatusDetail = + +
+
org.openhab.core.automation.RuleStatusDetail
+ +
Visibility = + +
+
org.openhab.core.automation.Visibility
+ +
+ + + + + +

Class Attribute Summary collapse

+ + + + + + + +
+

Class Attribute Details

+ + + +
+

+ + .managerorg.openhab.core.automation.RuleManager (readonly) + + + + + +

+
+

Returns The openHAB rule manager/engine.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+19
+20
+21
+
+
# File 'lib/openhab/core/rules.rb', line 19
+
+def manager
+  @manager ||= OSGi.service("org.openhab.core.automation.RuleManager")
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Rules/Provider.html b/5.33/OpenHAB/Core/Rules/Provider.html new file mode 100644 index 0000000000..2d41896d5b --- /dev/null +++ b/5.33/OpenHAB/Core/Rules/Provider.html @@ -0,0 +1,3759 @@ + + + + + + + Class: OpenHAB::Core::Rules::Provider + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Rules::Provider + + + +

+
+ +
+
Inherits:
+
+ Provider + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/rules/provider.rb
+
+ +
+ +

Overview

+
+

Provides rules created in Ruby to openHAB

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods inherited from Provider

+

#[], #all, current, #inspect

+ + + + + + + + + + + + + + + +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update, #update!

+ + + + + + + + + + + + + + +
+

Class Method Details

+ + +
+

+ + .registryorg.openhab.core.automation.RuleRegistry + + + + + +

+
+

The Rule registry

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+18
+19
+20
+
+
# File 'lib/openhab/core/rules/provider.rb', line 18
+
+def registry
+  $rules
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Rules/Registry.html b/5.33/OpenHAB/Core/Rules/Registry.html new file mode 100644 index 0000000000..1b23787c6b --- /dev/null +++ b/5.33/OpenHAB/Core/Rules/Registry.html @@ -0,0 +1,4273 @@ + + + + + + + Class: OpenHAB::Core::Rules::Registry + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Rules::Registry + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
LazyArray
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/rules/registry.rb
+
+ +
+ +

Overview

+
+

Provides access to all openHAB rules, and acts like an array.

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from LazyArray

+

#each, #method_missing, #to_ary

+ + + + + + + + + +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update, #update!

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::LazyArray + +

+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #[](uid) ⇒ Rule? + + + + Also known as: + include?, key?, has_key? + + + + +

+
+

Gets a specific Rule

+ + +
+
+
+

Parameters:

+
    + +
  • + + uid + + + (String) + + + + — +

    Rule UID

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Rule, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+21
+22
+23
+
+
# File 'lib/openhab/core/rules/registry.rb', line 21
+
+def [](uid)
+  $rules.get(uid)
+end
+
+
+ +
+

+ + #build(preferred_provider = nil) { ... } ⇒ Object + + + + + +

+
+

Enter the Rule Builder DSL.

+ + +
+
+
+

Parameters:

+
    + +
  • + + preferred_provider + + + (org.openhab.core.common.registry.Provider, Proc, :persistent, :transient, nil) + + + (defaults to: nil) + + + — +

    An optional preferred provider to use. Can be one of several types:

    +
      +
    • An explicit instance of ManagedProvider
    • +
    • A Proc, which can calculate the preferred provider based on whatever conditions it wants, +and then is further processed as this parameter.
    • +
    • :persistent, meaning the default ManagedProvider +for this registry. Managed providers persist their objects to JSON, and will survive after the +Ruby script is unloaded. This is where objects you configure with MainUI are stored. You should +use this provider when you're creating something in response to a one-time event.
    • +
    • :transient, meaning a ManagedProvider that +will remove all of its contents when the Ruby script is unloaded. You should use this if you're +generating objects dynamically, either based on some sort of other configuration, or simply +hard coded and you're using Ruby as a more expressive way to define things than a .items or +.things file. If you don't use this provider for something such as metadata, then you +may have issues such as metadata still showing up even though you're no longer creating items +with it anymore.
    • +
    • nil, meaning to fall back to the current thread setting. See DSL.provider. +If there is no thread setting (or the thread setting was Proc that returned nil), +it defaults to :transient.
    • +
    +
    + +
  • + +
+ +

Yields:

+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +

    The result of the block.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+44
+45
+46
+
+
# File 'lib/openhab/core/rules/registry.rb', line 44
+
+def build(preferred_provider = nil, &block)
+  DSL::Rules::Builder.new(preferred_provider).instance_eval_with_dummy_items(&block)
+end
+
+
+ +
+

+ + #remove(rule_uid) ⇒ Rule? + + + + + +

+
+

Remove a Rule.

+

The rule must be a managed thing (typically created by Ruby or in the UI).

+ + +
+
+
+ +
+

Examples:

+ + +
my_rule = rule do
+  every :day
+  run { nil }
+end
+
+rules.remove(my_rule)
+ +
+

Parameters:

+
    + +
  • + + rule_uid + + + (String, Rule) + + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Rule, nil) + + + + — +

    The removed rule, if found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+
+
# File 'lib/openhab/core/rules/registry.rb', line 64
+
+def remove(rule_uid)
+  rule_uid = rule_uid.uid if rule_uid.is_a?(Rule)
+  return nil unless (provider = Provider.registry.provider_for(rule_uid))
+
+  unless provider.is_a?(org.openhab.core.common.registry.ManagedProvider)
+    raise "Cannot remove rule #{rule_uid} from non-managed provider #{provider.inspect}"
+  end
+
+  provider.remove(rule_uid)
+end
+
+
+ +
+

+ + #scenesTaggedArray + + + + + +

+
+

Returns all Scenes (rules tagged with "Scene")

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (TaggedArray) + + + + — +

    A list of all the scenes

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+80
+81
+82
+
+
# File 'lib/openhab/core/rules/registry.rb', line 80
+
+def scenes
+  @scenes ||= TaggedArray.new("Scene")
+end
+
+
+ +
+

+ + #scriptsTaggedArray + + + + + +

+
+

Returns all Scripts (rules tagged with "Script")

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (TaggedArray) + + + + — +

    A list of all the scripts

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+89
+90
+91
+
+
# File 'lib/openhab/core/rules/registry.rb', line 89
+
+def scripts
+  @scripts ||= TaggedArray.new("Script")
+end
+
+
+ +
+

+ + #to_aArray<Rule> + + + + + +

+
+

Explicit conversion to array

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+34
+35
+36
+
+
# File 'lib/openhab/core/rules/registry.rb', line 34
+
+def to_a
+  $rules.all.to_a
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Rules/Rule.html b/5.33/OpenHAB/Core/Rules/Rule.html new file mode 100644 index 0000000000..e081a1b1de --- /dev/null +++ b/5.33/OpenHAB/Core/Rules/Rule.html @@ -0,0 +1,5300 @@ + + + + + + + Module: OpenHAB::Core::Rules::Rule + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Rules::Rule + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/rules/rule.rb
+
+ +
+ +

Overview

+
+

A Rule is a chunk of code that can execute when certain conditions are +met, enabling the core dynamic functionality of openHAB.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #descriptionString? (readonly) + + + + + +

+
+

Returns The rule's description.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + + — +

    The rule's description

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/rules/rule.rb', line 17
+
+
+
+
+ + + +
+

+ + #nameString? (readonly) + + + + + +

+
+

Returns The rule's human-readable name.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + + — +

    The rule's human-readable name

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/rules/rule.rb', line 14
+
+
+
+
+ + + +
+

+ + #statusRuleStatus? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+142
+143
+144
+
+
# File 'lib/openhab/core/rules/rule.rb', line 142
+
+def status
+  Rules.manager&.get_status(uid)
+end
+
+
+ + + +
+

+ + #status_infoRuleStatusInfo? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+150
+151
+152
+
+
# File 'lib/openhab/core/rules/rule.rb', line 150
+
+def status_info
+  Rules.manager&.get_status_info(uid)
+end
+
+
+ + + +
+

+ + #tagsArray<Tag> (readonly) + + + + + +

+
+

Returns The rule's list of tags.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array<Tag>) + + + + — +

    The rule's list of tags

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/rules/rule.rb', line 20
+
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #disablevoid + + + + + +

+
+

This method returns an undefined value.

Disable the Rule

+ + +
+
+
+ + +
+ + + + +
+
+
+
+100
+101
+102
+
+
# File 'lib/openhab/core/rules/rule.rb', line 100
+
+def disable
+  enable(enabled: false)
+end
+
+
+ +
+

+ + #disabled?true, false + + + + + +

+
+

Check if the rule's status detail == DISABLED

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+109
+110
+111
+112
+
+
# File 'lib/openhab/core/rules/rule.rb', line 109
+
+def disabled?
+  info = status_info
+  info.nil? || info.status_detail == RuleStatusDetail::DISABLED
+end
+
+
+ +
+

+ + #enable(enabled: true) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Enable the Rule

+ + +
+
+
+

Parameters:

+
    + +
  • + + enabled + + + (true, false) + + + (defaults to: true) + + +
  • + +
+ + +
+ + + + +
+
+
+
+91
+92
+93
+
+
# File 'lib/openhab/core/rules/rule.rb', line 91
+
+def enable(enabled: true)
+  Rules.manager.set_enabled(uid, enabled)
+end
+
+
+ +
+

+ + #enabled?true, false + + + + + +

+
+

Check if the rule's status detail != DISABLED

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+119
+120
+121
+
+
# File 'lib/openhab/core/rules/rule.rb', line 119
+
+def enabled?
+  !disabled?
+end
+
+
+ +
+

+ + #expert?true, false + + + + + +

+
+

Check if visibility == EXPERT

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/rules/rule.rb', line 35
+
+
+
+
+ +
+

+ + #hidden?true, false + + + + + +

+
+

Check if visibility == HIDDEN

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/rules/rule.rb', line 29
+
+
+
+
+ +
+

+ + #idle?true, false + + + + + +

+
+

Check if rule status == IDLE

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+57
+58
+59
+60
+61
+62
+63
+
+
# File 'lib/openhab/core/rules/rule.rb', line 57
+
+Visibility.constants.each do |visibility|
+  class_eval <<~RUBY, __FILE__, __LINE__ + 1
+    def #{visibility.to_s.downcase}?           # def visibile?
+      visibility == Visibility::#{visibility}  #   visibility == Visibility::VISIBLE
+    end                                        # end
+  RUBY
+end
+
+
+ +
+

+ + #initializing?true, false + + + + + +

+
+

Check if rule status == INITIALIZING

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+57
+58
+59
+60
+61
+62
+63
+
+
# File 'lib/openhab/core/rules/rule.rb', line 57
+
+Visibility.constants.each do |visibility|
+  class_eval <<~RUBY, __FILE__, __LINE__ + 1
+    def #{visibility.to_s.downcase}?           # def visibile?
+      visibility == Visibility::#{visibility}  #   visibility == Visibility::VISIBLE
+    end                                        # end
+  RUBY
+end
+
+
+ +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+
+
# File 'lib/openhab/core/rules/rule.rb', line 155
+
+def inspect
+  r = "#<OpenHAB::Core::Rules::Rule #{uid}"
+  r += " #{name.inspect}" if name
+  r += " #{visibility}" unless visible?
+  r += " #{status || "<detached>"}"
+  r += " (#{status_info.status_detail})" if status_info && status_info.status_detail != RuleStatusDetail::NONE
+  r += " description=#{description.inspect}" if description
+  r += " tags=#{tags.to_a.inspect}" unless tags.empty?
+  r += " configuration=#{configuration.properties.to_h}" if configuration && !configuration.properties.empty?
+  "#{r}>"
+end
+
+
+ +
+

+ + #running?true, false + + + + + +

+
+

Check if rule status == RUNNING

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+57
+58
+59
+60
+61
+62
+63
+
+
# File 'lib/openhab/core/rules/rule.rb', line 57
+
+Visibility.constants.each do |visibility|
+  class_eval <<~RUBY, __FILE__, __LINE__ + 1
+    def #{visibility.to_s.downcase}?           # def visibile?
+      visibility == Visibility::#{visibility}  #   visibility == Visibility::VISIBLE
+    end                                        # end
+  RUBY
+end
+
+
+ +
+

+ + #tagged?(*tags) ⇒ Boolean + + + + + +

+
+

Checks if this rule has at least one of the given tags.

+

(see Items::Item#tagged)

+ + +
+
+
+ +
+

Examples:

+ + +

Find rules tagged with "Halloween"

+

+ +
rules.tagged?("Halloweed")
+ +
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+131
+132
+133
+134
+135
+136
+
+
# File 'lib/openhab/core/rules/rule.rb', line 131
+
+def tagged?(*tags)
+  tags.map! do |tag|
+    tag.is_a?(::Module) ? tag.simple_name : tag # ::Module to distinguish against Rule::Module!
+  end
+  !(self.tags.to_a & tags).empty?
+end
+
+
+ +
+

+ + #to_sString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+168
+169
+170
+
+
# File 'lib/openhab/core/rules/rule.rb', line 168
+
+def to_s
+  uid
+end
+
+
+ +
+

+ + #trigger(event = nil, consider_conditions: false, **context) ⇒ Hash + + + + Also known as: + run + + + + +

+
+

Manually trigger the rule

+ + +
+
+
+

Parameters:

+
    + +
  • + + event + + + (Object, nil) + + + (defaults to: nil) + + + — +

    The event to pass to the rule's execution blocks.

    +
    + +
  • + +
  • + + consider_conditions + + + (Boolean) + + + (defaults to: false) + + + — +

    Whether to check the conditions of the called rules.

    +
    + +
  • + +
  • + + context + + + (kwargs) + + + + — +

    The context to pass to the conditions and the actions of the rule.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Hash) + + + + — +

    A copy of the rule context, including possible return values.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+
+
# File 'lib/openhab/core/rules/rule.rb', line 180
+
+def trigger(event = nil, consider_conditions: false, **context)
+  begin
+    event ||= org.openhab.core.automation.events.AutomationEventFactory
+                 .createExecutionEvent(uid, nil, "manual")
+  rescue NameError
+    # @deprecated OH3.4 doesn't have AutomationEventFactory
+  end
+  context.transform_keys!(&:to_s)
+  # Unwrap any proxies and pass raw objects (items, things)
+  context.transform_values! { |value| value.is_a?(Delegator) ? value.__getobj__ : value }
+  context["event"] = event if event # @deprecated OH3.4 - remove if guard. In OH4 `event` will never be nil
+  Rules.manager.run_now(uid, consider_conditions, context)
+end
+
+
+ +
+

+ + #uninitialized?true, false + + + + + +

+
+

Check if rule status == UNINITIALIZED

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+80
+81
+82
+83
+
+
# File 'lib/openhab/core/rules/rule.rb', line 80
+
+def uninitialized?
+  s = status
+  s.nil? || s == RuleStatus::UNINITIALIZED
+end
+
+
+ +
+

+ + #visible?true, false + + + + + +

+
+

Check if visibility == VISIBLE

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/rules/rule.rb', line 23
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Rules/TaggedArray.html b/5.33/OpenHAB/Core/Rules/TaggedArray.html new file mode 100644 index 0000000000..01cecdffbe --- /dev/null +++ b/5.33/OpenHAB/Core/Rules/TaggedArray.html @@ -0,0 +1,3918 @@ + + + + + + + Class: OpenHAB::Core::Rules::TaggedArray + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Rules::TaggedArray + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
LazyArray
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/rules/tagged_array.rb
+
+ +
+ +

Overview

+
+

Provides access to a set of openHAB rules, and acts like an array.

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods included from LazyArray

+

#each, #method_missing, #to_ary

+ + + + + + + + + +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update, #update!

+
+

Constructor Details

+ +
+

+ + #initialize(tag) ⇒ TaggedArray + + + + + +

+
+

Returns a new instance of TaggedArray.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+14
+15
+16
+
+
# File 'lib/openhab/core/rules/tagged_array.rb', line 14
+
+def initialize(tag)
+  @tag = tag
+end
+
+
+ +
+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::LazyArray + +

+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #[](uid) ⇒ Rule? + + + + Also known as: + include?, key?, has_key? + + + + +

+
+

Gets a specific Rule

+ + +
+
+
+

Parameters:

+
    + +
  • + + uid + + + (String) + + + + — +

    Rule UID

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Rule, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+24
+25
+26
+27
+
+
# File 'lib/openhab/core/rules/tagged_array.rb', line 24
+
+def [](uid)
+  rule = $rules.get(uid)
+  rule.tagged?(@tag) ? rule : nil
+end
+
+
+ +
+

+ + #to_aArray<Rule> + + + + + +

+
+

Explicit conversion to array

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+38
+39
+40
+
+
# File 'lib/openhab/core/rules/tagged_array.rb', line 38
+
+def to_a
+  $rules.all.to_a.tagged(@tag)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/ScriptHandling.html b/5.33/OpenHAB/Core/ScriptHandling.html new file mode 100644 index 0000000000..d9f3a4487f --- /dev/null +++ b/5.33/OpenHAB/Core/ScriptHandling.html @@ -0,0 +1,3803 @@ + + + + + + + Module: OpenHAB::Core::ScriptHandling + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::ScriptHandling + + + +

+
+ + + + + + + + + +
+
Included in:
+
DSL
+
+ + + +
+
Defined in:
+
lib/openhab/core/script_handling.rb
+
+ +
+ +

Overview

+
+

Provide callback mechanisms for script handling

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + + + + +
+

Class Method Details

+ + +
+

+ + .script_loaded(&block) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Add a block of code to be executed once the rule script has finished loading.

+

This can occur on openHAB start up, when the script is first created, or updated.

+

Multiple hooks can be added by calling #script_loaded multiple times. +They can be used to perform final initializations.

+ + +
+
+
+ +
+

Examples:

+ + +
script_loaded do
+  logger.info 'Hi, this script has just finished loading'
+end
+ + +
script_loaded do
+  logger.info 'I will be called after the script finished loading too'
+end
+ +
+ + +
+ + + + +
+
+
+
+31
+32
+33
+
+
# File 'lib/openhab/core/script_handling.rb', line 31
+
+def script_loaded(&block)
+  ScriptHandlingCallbacks.script_loaded_hooks << block
+end
+
+
+ +
+

+ + .script_unloaded(priority: nil, &block) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Add a block of code to be executed when the script is unloaded.

+

This can occur when openHAB shuts down, or when the script is being reloaded.

+

Multiple hooks can be added by calling #script_unloaded multiple times. +They can be used to perform final cleanup.

+ + +
+
+
+ +
+

Examples:

+ + +
script_unloaded do
+  logger.info 'Hi, this script has been unloaded'
+end
+ +
+

Parameters:

+
    + +
  • + + priority + + + (Integer, nil) + + + (defaults to: nil) + + + — +

    The order at which the the given hook will be executed. +The higher the number, the lower the priority. Higher priority hooks will be executed +first, before the lower priority hooks. When nil, the default priority of zero will +be used.

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+54
+55
+56
+
+
# File 'lib/openhab/core/script_handling.rb', line 54
+
+def script_unloaded(priority: nil, &block)
+  ScriptHandlingCallbacks.script_unloaded_hooks[priority || 0] << block
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Sitemaps.html b/5.33/OpenHAB/Core/Sitemaps.html new file mode 100644 index 0000000000..728f48ab94 --- /dev/null +++ b/5.33/OpenHAB/Core/Sitemaps.html @@ -0,0 +1,3608 @@ + + + + + + + Module: OpenHAB::Core::Sitemaps + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Sitemaps + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/sitemaps/provider.rb
+
+ +
+ +

Overview

+
+

Contains sitemap related classes.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + + + Classes: Provider + + +

+ + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Sitemaps/Provider.html b/5.33/OpenHAB/Core/Sitemaps/Provider.html new file mode 100644 index 0000000000..0d5fc228de --- /dev/null +++ b/5.33/OpenHAB/Core/Sitemaps/Provider.html @@ -0,0 +1,4069 @@ + + + + + + + Class: OpenHAB::Core::Sitemaps::Provider + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Sitemaps::Provider + + + +

+
+ +
+
Inherits:
+
+ Provider + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/sitemaps/provider.rb
+
+ +
+ +

Overview

+
+

Provides sitemaps created in Ruby to openHAB

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods inherited from Provider

+

#[], #all, current, #inspect

+ + + + + + + + + + + + + + + +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update!

+ + + + + + + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #build(update: true) { ... } ⇒ void + + + + + +

+
+

This method returns an undefined value.

Enter the Sitemap Builder DSL.

+ + +
+
+
+ +
+

Examples:

+ + +
sitemaps.build do
+  sitemap "default", label: "My Residence" do
+    frame label: "Control" do
+      text label: "Climate", icon: "if:mdi:home-thermometer-outline" do
+        frame label: "Main Floor" do
+          # colors are set with a hash, with key being condition, and value being the color
+          # The :default key is used when no other condition matches
+          text item: MainFloor_AmbTemp,
+            label_color: "purple", # A simple string can be used when no conditions are needed
+            value_color: { ">=90" => "red", "<=70" => "blue", :default => "black" }
+
+          # If item name is not provided in the condition, it will default to the widget's Item
+          # The operator will default to == if not specified
+          switch item: MainFloorThermostat_TargetMode, label: "Mode",
+            mappings: %w[off auto cool heat],
+            value_color: { "cool" => "blue", "heat" => "red", :default => "black" }
+
+          # an array of conditions are AND'd together
+          setpoint item: MainFloorThermostat_SetPoint, label: "Set Point",
+            value_color: {
+              ["MainFloorThermostat_TargetMode!=off", ">80"] => "red", # red if mode!=off AND setpoint > 80
+              ["MainFloorThermostat_TargetMode!=off", ">74"] => "yellow",
+              ["MainFloorThermostat_TargetMode!=off", ">70"] => "green",
+              "MainFloorThermostat_TargetMode!=off" => "blue",
+              :default => "gray"
+            }
+        end
+        frame label: "Basement" do
+          text item: Basement_AmbTemp
+          switch item: BasementThermostat_TargetMode, label: "Mode",
+            mappings: { OFF: "off", COOL: "cool", HEAT: "heat" }
+
+          # Conditions within a nested array are AND'd together (requires openHAB 4.1)
+          setpoint item: BasementThermostat_SetPoint, label: "Set Point",
+            visibility: [["BasementThermostat_TargetMode!=off", "Vacation_Switch==OFF"]]
+
+          # Additional elements are OR'd
+          # The following visibility conditions are evaluated as:
+          # (BasementThermostat_TargetMode!=off AND Vacation_Switch==OFF) OR Verbose_Mode==ON
+          setpoint item: BasementThermostat_SetPoint, label: "Set Point",
+            visibility: [
+              ["BasementThermostat_TargetMode!=off", "Vacation_Switch==OFF"],
+              "Verbose_Mode==ON"
+            ]
+        end
+      end
+    end
+  end
+end
+ + +
def add_tv(builder, tv)
+  builder.frame label: tv.location.label do
+    builder.switch item: tv.points(Semantics::Switch), label: "Power"
+  end
+end
+
+sitemaps.build do |builder|
+  builder.sitemap "tvs", label: "TVs" do
+    items.equipments(Semantics::TV).each do |tv|
+      add_tv(builder, tv)
+    end
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + update + + + (true, false) + + + (defaults to: true) + + + — +

    When true, existing sitemaps with the same name will be updated.

    +
    + +
  • + +
+ +

Yields:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+
+
# File 'lib/openhab/core/sitemaps/provider.rb', line 131
+
+def build(update: true, &block)
+  builder_proxy = SimpleDelegator.new(nil) if block.arity == 1
+  builder = DSL::Sitemaps::Builder.new(self, builder_proxy, update: update)
+  if block.arity == 1
+    builder_proxy.__setobj__(builder)
+    DSL::ThreadLocal.thread_local(openhab_create_dummy_items: true) do
+      yield builder_proxy
+    end
+  else
+    builder.instance_eval(&block)
+  end
+end
+
+
+ +
+

+ + #remove(sitemap) ⇒ Boolean + + + + + +

+
+

Remove a sitemap.

+ + +
+
+
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    If a sitemap was removed

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+165
+166
+167
+168
+
+
# File 'lib/openhab/core/sitemaps/provider.rb', line 165
+
+def remove(sitemap)
+  sitemap = sitemap.uid if sitemap.respond_to?(:uid)
+  super
+end
+
+
+ +
+

+ + #update(sitemap) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Notify listeners about updated sitemap

+ + +
+
+
+

Parameters:

+ + + +
+ + + + +
+
+
+
+150
+151
+152
+153
+154
+155
+156
+157
+
+
# File 'lib/openhab/core/sitemaps/provider.rb', line 150
+
+def update(sitemap)
+  if sitemap.respond_to?(:to_str)
+    sitemap = get(sitemap).tap do |obj|
+      raise ArgumentError, "Sitemap #{sitemap} not found" unless obj
+    end
+  end
+  super
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things.html b/5.33/OpenHAB/Core/Things.html new file mode 100644 index 0000000000..dff3595863 --- /dev/null +++ b/5.33/OpenHAB/Core/Things.html @@ -0,0 +1,3630 @@ + + + + + + + Module: OpenHAB::Core::Things + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Things + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/things.rb,
+ lib/openhab/core/things/uid.rb,
lib/openhab/core/things/proxy.rb,
lib/openhab/core/things/thing.rb,
lib/openhab/core/things/channel.rb,
lib/openhab/core/things/provider.rb,
lib/openhab/core/things/registry.rb,
lib/openhab/core/things/thing_uid.rb,
lib/openhab/core/things/thing_type.rb,
lib/openhab/core/things/channel_uid.rb,
lib/openhab/core/things/channel_type.rb,
lib/openhab/core/things/links/provider.rb,
lib/openhab/core/things/thing_type_uid.rb,
lib/openhab/core/things/channel_type_uid.rb,
lib/openhab/core/things/profile_callback.rb,
lib/openhab/core/things/channel_group_uid.rb,
lib/openhab/core/things/item_channel_link.rb,
lib/openhab/core/things/channel_definition.rb,
lib/openhab/core/things/channel_group_type.rb,
lib/openhab/core/things/channel_group_type_uid.rb,
lib/openhab/core/things/channel_group_definition.rb,
lib/openhab/core/things/abstract_description_type.rb
+
+
+ +
+ +

Overview

+
+

Contains the core Thing that bindings use to represent connected devices, +as well as related infrastructure.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: Links, ProfileCallback, Thing + + + + Classes: AbstractDescriptionType, Channel, ChannelDefinition, ChannelGroupDefinition, ChannelGroupType, ChannelGroupTypeUID, ChannelGroupUID, ChannelType, ChannelTypeUID, ChannelUID, ItemChannelLink, Provider, Registry, ThingType, ThingTypeUID, ThingUID, UID + + +

+ + +

+ Constant Summary + collapse +

+ +
+ +
ThingStatus = + +
+
org.openhab.core.thing.ThingStatus
+ +
+ + + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/AbstractDescriptionType.html b/5.33/OpenHAB/Core/Things/AbstractDescriptionType.html new file mode 100644 index 0000000000..83f6992f95 --- /dev/null +++ b/5.33/OpenHAB/Core/Things/AbstractDescriptionType.html @@ -0,0 +1,3786 @@ + + + + + + + Class: OpenHAB::Core::Things::AbstractDescriptionType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Things::AbstractDescriptionType + + + +

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

Overview

+
+

Base class for ThingType, ChannelType, and ChannelGroupType

+ + +
+
+
+ + +
+

Direct Known Subclasses

+

ChannelGroupType, ChannelType, ThingType

+
+ + + + +

Instance Attribute Summary collapse

+ + + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #descriptionString? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+17
+18
+
+
# File 'lib/openhab/core/things/abstract_description_type.rb', line 17
+
+class AbstractDescriptionType # rubocop:disable Lint/EmptyClass
+end
+
+
+ + + +
+

+ + #labelString (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+17
+18
+
+
# File 'lib/openhab/core/things/abstract_description_type.rb', line 17
+
+class AbstractDescriptionType # rubocop:disable Lint/EmptyClass
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/Channel.html b/5.33/OpenHAB/Core/Things/Channel.html new file mode 100644 index 0000000000..511dd42425 --- /dev/null +++ b/5.33/OpenHAB/Core/Things/Channel.html @@ -0,0 +1,6729 @@ + + + + + + + Class: OpenHAB::Core::Things::Channel + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Things::Channel + + + +

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

Overview

+
+

Channel is a part of a Thing that represents a functionality of it. +Therefore Items can be linked a to a channel.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #channel_typeChannelType (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+51
+52
+53
+
+
# File 'lib/openhab/core/things/channel.rb', line 51
+
+def channel_type
+  ChannelType.registry.get_channel_type(channel_type_uid)
+end
+
+
+ + + +
+

+ + #channel_type_uidChannelTypeUID (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+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
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+
+
# File 'lib/openhab/core/things/channel.rb', line 29
+
+class Channel
+  extend Forwardable
+
+  delegate %i[item items thing] => :uid
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::Channel #{uid}"
+    r += " #{label.inspect}" if label
+    r += " description=#{description.inspect}" if description
+    r += " kind=#{kind.inspect}"
+    r += " channel_type_uid=#{channel_type_uid.inspect}" if channel_type_uid
+    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    r += " default_tags=#{default_tags.to_a}" unless default_tags.empty?
+    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
+    r += " accepted_item_type=#{accepted_item_type}" if accepted_item_type
+    "#{r}>"
+  end
+
+  # @!attribute [r] channel_type
+  # @return [ChannelType]
+  def channel_type
+    ChannelType.registry.get_channel_type(channel_type_uid)
+  end
+
+  # @return [String]
+  def to_s
+    uid.to_s
+  end
+
+  # @!attribute item_name [r]
+  # Return the name of the item this channel is linked to. If a channel is linked to more than one item,
+  # this method only returns the first item.
+  #
+  # @return [String, nil]
+  def item_name
+    item_names.first
+  end
+
+  # @!attribute item_names [r]
+  # Return the names of all of the items this channel is linked to.
+  #
+  # @return [Array<String>]
+  def item_names
+    Things::Links::Provider.registry.get_linked_item_names(uid)
+  end
+
+  # @!attribute item [r]
+  # Return the item this channel is linked to. If a channel is linked to more than one item,
+  # this method only returns the first item.
+  #
+  # @return [Items::Item, nil]
+  def item
+    items.first
+  end
+
+  # @!attribute items [r]
+  # Return all of the items this channel is linked to.
+  #
+  # @return [Array<Items::Item>]
+  def items
+    Things::Links::Provider.registry.get_linked_items(uid).map { |item| Items::Proxy.new(item) }
+  end
+
+  #
+  # @!attribute links [r]
+  # Returns all of the channel's links (items and link configurations).
+  #
+  # @return [Items::ItemChannelLinks] An array of ItemChannelLink or an empty array
+  #
+  # @example Get the configuration of the first link
+  #   things["mqtt:topic:livingroom-light"].channel["power"].links.first.configuration
+  #
+  # @example Remove all managed links
+  #   things["mqtt:topic:livingroom-light"].channel["power"].links.clear
+  #
+  # @see link
+  # @see unlink
+  #
+  def links
+    Items::ItemChannelLinks.new(uid, Things::Links::Provider.registry.get_links(uid))
+  end
+
+  #
+  # @return [ItemChannelLink, nil]
+  #
+  # @overload link
+  #   Returns the channel's link. If an channel is linked to more than one item,
+  #   this method only returns the first link.
+  #
+  #   @return [Things::ItemChannelLink, nil]
+  #
+  # @overload link(item, config = {})
+  #
+  #   Links the channel to an item.
+  #
+  #   @param [String, Items::Item] item The item to link to.
+  #   @param [Hash] config The configuration for the link.
+  #
+  #   @return [Things::ItemChannelLink] The created link.
+  #
+  #   @example Link a channel to an item
+  #     things["mqtt:topic:livingroom-light"].channels["power"].link(LivingRoom_Light_Power)
+  #
+  #   @example Specify a link configuration
+  #     things["mqtt:topic:outdoor-thermometer"].channels["temperature"].link(
+  #       High_Temperature_Alert,
+  #       profile: "system:hysteresis",
+  #       lower: "29 °C",
+  #       upper: "30 °C")
+  #
+  #   @see links
+  #   @see unlink
+  #
+  def link(item = nil, config = nil)
+    return Things::Links::Provider.registry.get_links(uid).first if item.nil? && config.nil?
+
+    config ||= {}
+    Core::Things::Links::Provider.create_link(item, self, config).tap do |new_link|
+      provider = Core::Things::Links::Provider.current
+      if !(current_link = provider.get(new_link.uid))
+        provider.add(new_link)
+      elsif current_link.configuration != config
+        provider.update(new_link)
+      end
+    end
+  end
+
+  #
+  # Removes a link to an item from managed link providers.
+  #
+  # @param [String, Items::Item] item The item to remove the link to.
+  #
+  # @return [Things::ItemChannelLink, nil] The removed link, if found.
+  # @raise [FrozenError] if the link is not managed by a managed link provider.
+  #
+  # @see link
+  # @see links
+  #
+  def unlink(item)
+    link_to_delete = Things::Links::Provider.create_link(item, self, {})
+    provider = Things::Links::Provider.registry.provider_for(link_to_delete.uid)
+    unless provider.is_a?(ManagedProvider)
+      raise FrozenError,
+            "Cannot remove the link #{link_to_delete.uid} from non-managed provider #{provider.inspect}"
+    end
+
+    provider.remove(link_to_delete.uid)
+  end
+
+  # @deprecated OH3.4 this whole section is not needed in OH4+. Also see Thing#config_eql?
+  if Core.version < Core::V4_0
+    # @!visibility private
+    module ChannelComparable
+      # @!visibility private
+      # This is only needed in OH3 because it is implemented in OH4 core
+      def ==(other)
+        return true if equal?(other)
+        return false unless other.is_a?(Channel)
+
+        %i[class
+           uid
+           label
+           description
+           kind
+           channel_type_uid
+           configuration
+           properties
+           default_tags
+           auto_update_policy
+           accepted_item_type].all? do |attr|
+          send(attr) == other.send(attr)
+        end
+      end
+    end
+    org.openhab.core.thing.binding.builder.ChannelBuilder.const_get(:ChannelImpl).prepend(ChannelComparable)
+  end
+end
+
+
+ + + +
+

+ + #itemItems::Item? (readonly) + + + + + +

+
+

Return the item this channel is linked to. If a channel is linked to more than one item, +this method only returns the first item.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+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
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+
+
# File 'lib/openhab/core/things/channel.rb', line 29
+
+class Channel
+  extend Forwardable
+
+  delegate %i[item items thing] => :uid
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::Channel #{uid}"
+    r += " #{label.inspect}" if label
+    r += " description=#{description.inspect}" if description
+    r += " kind=#{kind.inspect}"
+    r += " channel_type_uid=#{channel_type_uid.inspect}" if channel_type_uid
+    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    r += " default_tags=#{default_tags.to_a}" unless default_tags.empty?
+    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
+    r += " accepted_item_type=#{accepted_item_type}" if accepted_item_type
+    "#{r}>"
+  end
+
+  # @!attribute [r] channel_type
+  # @return [ChannelType]
+  def channel_type
+    ChannelType.registry.get_channel_type(channel_type_uid)
+  end
+
+  # @return [String]
+  def to_s
+    uid.to_s
+  end
+
+  # @!attribute item_name [r]
+  # Return the name of the item this channel is linked to. If a channel is linked to more than one item,
+  # this method only returns the first item.
+  #
+  # @return [String, nil]
+  def item_name
+    item_names.first
+  end
+
+  # @!attribute item_names [r]
+  # Return the names of all of the items this channel is linked to.
+  #
+  # @return [Array<String>]
+  def item_names
+    Things::Links::Provider.registry.get_linked_item_names(uid)
+  end
+
+  # @!attribute item [r]
+  # Return the item this channel is linked to. If a channel is linked to more than one item,
+  # this method only returns the first item.
+  #
+  # @return [Items::Item, nil]
+  def item
+    items.first
+  end
+
+  # @!attribute items [r]
+  # Return all of the items this channel is linked to.
+  #
+  # @return [Array<Items::Item>]
+  def items
+    Things::Links::Provider.registry.get_linked_items(uid).map { |item| Items::Proxy.new(item) }
+  end
+
+  #
+  # @!attribute links [r]
+  # Returns all of the channel's links (items and link configurations).
+  #
+  # @return [Items::ItemChannelLinks] An array of ItemChannelLink or an empty array
+  #
+  # @example Get the configuration of the first link
+  #   things["mqtt:topic:livingroom-light"].channel["power"].links.first.configuration
+  #
+  # @example Remove all managed links
+  #   things["mqtt:topic:livingroom-light"].channel["power"].links.clear
+  #
+  # @see link
+  # @see unlink
+  #
+  def links
+    Items::ItemChannelLinks.new(uid, Things::Links::Provider.registry.get_links(uid))
+  end
+
+  #
+  # @return [ItemChannelLink, nil]
+  #
+  # @overload link
+  #   Returns the channel's link. If an channel is linked to more than one item,
+  #   this method only returns the first link.
+  #
+  #   @return [Things::ItemChannelLink, nil]
+  #
+  # @overload link(item, config = {})
+  #
+  #   Links the channel to an item.
+  #
+  #   @param [String, Items::Item] item The item to link to.
+  #   @param [Hash] config The configuration for the link.
+  #
+  #   @return [Things::ItemChannelLink] The created link.
+  #
+  #   @example Link a channel to an item
+  #     things["mqtt:topic:livingroom-light"].channels["power"].link(LivingRoom_Light_Power)
+  #
+  #   @example Specify a link configuration
+  #     things["mqtt:topic:outdoor-thermometer"].channels["temperature"].link(
+  #       High_Temperature_Alert,
+  #       profile: "system:hysteresis",
+  #       lower: "29 °C",
+  #       upper: "30 °C")
+  #
+  #   @see links
+  #   @see unlink
+  #
+  def link(item = nil, config = nil)
+    return Things::Links::Provider.registry.get_links(uid).first if item.nil? && config.nil?
+
+    config ||= {}
+    Core::Things::Links::Provider.create_link(item, self, config).tap do |new_link|
+      provider = Core::Things::Links::Provider.current
+      if !(current_link = provider.get(new_link.uid))
+        provider.add(new_link)
+      elsif current_link.configuration != config
+        provider.update(new_link)
+      end
+    end
+  end
+
+  #
+  # Removes a link to an item from managed link providers.
+  #
+  # @param [String, Items::Item] item The item to remove the link to.
+  #
+  # @return [Things::ItemChannelLink, nil] The removed link, if found.
+  # @raise [FrozenError] if the link is not managed by a managed link provider.
+  #
+  # @see link
+  # @see links
+  #
+  def unlink(item)
+    link_to_delete = Things::Links::Provider.create_link(item, self, {})
+    provider = Things::Links::Provider.registry.provider_for(link_to_delete.uid)
+    unless provider.is_a?(ManagedProvider)
+      raise FrozenError,
+            "Cannot remove the link #{link_to_delete.uid} from non-managed provider #{provider.inspect}"
+    end
+
+    provider.remove(link_to_delete.uid)
+  end
+
+  # @deprecated OH3.4 this whole section is not needed in OH4+. Also see Thing#config_eql?
+  if Core.version < Core::V4_0
+    # @!visibility private
+    module ChannelComparable
+      # @!visibility private
+      # This is only needed in OH3 because it is implemented in OH4 core
+      def ==(other)
+        return true if equal?(other)
+        return false unless other.is_a?(Channel)
+
+        %i[class
+           uid
+           label
+           description
+           kind
+           channel_type_uid
+           configuration
+           properties
+           default_tags
+           auto_update_policy
+           accepted_item_type].all? do |attr|
+          send(attr) == other.send(attr)
+        end
+      end
+    end
+    org.openhab.core.thing.binding.builder.ChannelBuilder.const_get(:ChannelImpl).prepend(ChannelComparable)
+  end
+end
+
+
+ + + +
+

+ + #item_nameString? (readonly) + + + + + +

+
+

Return the name of the item this channel is linked to. If a channel is linked to more than one item, +this method only returns the first item.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+65
+66
+67
+
+
# File 'lib/openhab/core/things/channel.rb', line 65
+
+def item_name
+  item_names.first
+end
+
+
+ + + +
+

+ + #item_namesArray<String> (readonly) + + + + + +

+
+

Return the names of all of the items this channel is linked to.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array<String>) + + + +
  • + +
+ +
+ + + + +
+
+
+
+73
+74
+75
+
+
# File 'lib/openhab/core/things/channel.rb', line 73
+
+def item_names
+  Things::Links::Provider.registry.get_linked_item_names(uid)
+end
+
+
+ + + +
+

+ + #itemsArray<Items::Item> (readonly) + + + + + +

+
+

Return all of the items this channel is linked to.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+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
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+
+
# File 'lib/openhab/core/things/channel.rb', line 29
+
+class Channel
+  extend Forwardable
+
+  delegate %i[item items thing] => :uid
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::Channel #{uid}"
+    r += " #{label.inspect}" if label
+    r += " description=#{description.inspect}" if description
+    r += " kind=#{kind.inspect}"
+    r += " channel_type_uid=#{channel_type_uid.inspect}" if channel_type_uid
+    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    r += " default_tags=#{default_tags.to_a}" unless default_tags.empty?
+    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
+    r += " accepted_item_type=#{accepted_item_type}" if accepted_item_type
+    "#{r}>"
+  end
+
+  # @!attribute [r] channel_type
+  # @return [ChannelType]
+  def channel_type
+    ChannelType.registry.get_channel_type(channel_type_uid)
+  end
+
+  # @return [String]
+  def to_s
+    uid.to_s
+  end
+
+  # @!attribute item_name [r]
+  # Return the name of the item this channel is linked to. If a channel is linked to more than one item,
+  # this method only returns the first item.
+  #
+  # @return [String, nil]
+  def item_name
+    item_names.first
+  end
+
+  # @!attribute item_names [r]
+  # Return the names of all of the items this channel is linked to.
+  #
+  # @return [Array<String>]
+  def item_names
+    Things::Links::Provider.registry.get_linked_item_names(uid)
+  end
+
+  # @!attribute item [r]
+  # Return the item this channel is linked to. If a channel is linked to more than one item,
+  # this method only returns the first item.
+  #
+  # @return [Items::Item, nil]
+  def item
+    items.first
+  end
+
+  # @!attribute items [r]
+  # Return all of the items this channel is linked to.
+  #
+  # @return [Array<Items::Item>]
+  def items
+    Things::Links::Provider.registry.get_linked_items(uid).map { |item| Items::Proxy.new(item) }
+  end
+
+  #
+  # @!attribute links [r]
+  # Returns all of the channel's links (items and link configurations).
+  #
+  # @return [Items::ItemChannelLinks] An array of ItemChannelLink or an empty array
+  #
+  # @example Get the configuration of the first link
+  #   things["mqtt:topic:livingroom-light"].channel["power"].links.first.configuration
+  #
+  # @example Remove all managed links
+  #   things["mqtt:topic:livingroom-light"].channel["power"].links.clear
+  #
+  # @see link
+  # @see unlink
+  #
+  def links
+    Items::ItemChannelLinks.new(uid, Things::Links::Provider.registry.get_links(uid))
+  end
+
+  #
+  # @return [ItemChannelLink, nil]
+  #
+  # @overload link
+  #   Returns the channel's link. If an channel is linked to more than one item,
+  #   this method only returns the first link.
+  #
+  #   @return [Things::ItemChannelLink, nil]
+  #
+  # @overload link(item, config = {})
+  #
+  #   Links the channel to an item.
+  #
+  #   @param [String, Items::Item] item The item to link to.
+  #   @param [Hash] config The configuration for the link.
+  #
+  #   @return [Things::ItemChannelLink] The created link.
+  #
+  #   @example Link a channel to an item
+  #     things["mqtt:topic:livingroom-light"].channels["power"].link(LivingRoom_Light_Power)
+  #
+  #   @example Specify a link configuration
+  #     things["mqtt:topic:outdoor-thermometer"].channels["temperature"].link(
+  #       High_Temperature_Alert,
+  #       profile: "system:hysteresis",
+  #       lower: "29 °C",
+  #       upper: "30 °C")
+  #
+  #   @see links
+  #   @see unlink
+  #
+  def link(item = nil, config = nil)
+    return Things::Links::Provider.registry.get_links(uid).first if item.nil? && config.nil?
+
+    config ||= {}
+    Core::Things::Links::Provider.create_link(item, self, config).tap do |new_link|
+      provider = Core::Things::Links::Provider.current
+      if !(current_link = provider.get(new_link.uid))
+        provider.add(new_link)
+      elsif current_link.configuration != config
+        provider.update(new_link)
+      end
+    end
+  end
+
+  #
+  # Removes a link to an item from managed link providers.
+  #
+  # @param [String, Items::Item] item The item to remove the link to.
+  #
+  # @return [Things::ItemChannelLink, nil] The removed link, if found.
+  # @raise [FrozenError] if the link is not managed by a managed link provider.
+  #
+  # @see link
+  # @see links
+  #
+  def unlink(item)
+    link_to_delete = Things::Links::Provider.create_link(item, self, {})
+    provider = Things::Links::Provider.registry.provider_for(link_to_delete.uid)
+    unless provider.is_a?(ManagedProvider)
+      raise FrozenError,
+            "Cannot remove the link #{link_to_delete.uid} from non-managed provider #{provider.inspect}"
+    end
+
+    provider.remove(link_to_delete.uid)
+  end
+
+  # @deprecated OH3.4 this whole section is not needed in OH4+. Also see Thing#config_eql?
+  if Core.version < Core::V4_0
+    # @!visibility private
+    module ChannelComparable
+      # @!visibility private
+      # This is only needed in OH3 because it is implemented in OH4 core
+      def ==(other)
+        return true if equal?(other)
+        return false unless other.is_a?(Channel)
+
+        %i[class
+           uid
+           label
+           description
+           kind
+           channel_type_uid
+           configuration
+           properties
+           default_tags
+           auto_update_policy
+           accepted_item_type].all? do |attr|
+          send(attr) == other.send(attr)
+        end
+      end
+    end
+    org.openhab.core.thing.binding.builder.ChannelBuilder.const_get(:ChannelImpl).prepend(ChannelComparable)
+  end
+end
+
+
+ + + +
+
+
+

Returns all of the channel's links (items and link configurations).

+ + +
+
+
+ +
+

Examples:

+ + +

Get the configuration of the first link

+

+ +
things["mqtt:topic:livingroom-light"].channel["power"].links.first.configuration
+ + +

Remove all managed links

+

+ +
things["mqtt:topic:livingroom-light"].channel["power"].links.clear
+ +
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+109
+110
+111
+
+
# File 'lib/openhab/core/things/channel.rb', line 109
+
+def links
+  Items::ItemChannelLinks.new(uid, Things::Links::Provider.registry.get_links(uid))
+end
+
+
+ + + +
+

+ + #thingThing? (readonly) + + + + + +

+
+

Return the thing this channel is associated with.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Thing, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+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
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+
+
# File 'lib/openhab/core/things/channel.rb', line 29
+
+class Channel
+  extend Forwardable
+
+  delegate %i[item items thing] => :uid
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::Channel #{uid}"
+    r += " #{label.inspect}" if label
+    r += " description=#{description.inspect}" if description
+    r += " kind=#{kind.inspect}"
+    r += " channel_type_uid=#{channel_type_uid.inspect}" if channel_type_uid
+    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    r += " default_tags=#{default_tags.to_a}" unless default_tags.empty?
+    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
+    r += " accepted_item_type=#{accepted_item_type}" if accepted_item_type
+    "#{r}>"
+  end
+
+  # @!attribute [r] channel_type
+  # @return [ChannelType]
+  def channel_type
+    ChannelType.registry.get_channel_type(channel_type_uid)
+  end
+
+  # @return [String]
+  def to_s
+    uid.to_s
+  end
+
+  # @!attribute item_name [r]
+  # Return the name of the item this channel is linked to. If a channel is linked to more than one item,
+  # this method only returns the first item.
+  #
+  # @return [String, nil]
+  def item_name
+    item_names.first
+  end
+
+  # @!attribute item_names [r]
+  # Return the names of all of the items this channel is linked to.
+  #
+  # @return [Array<String>]
+  def item_names
+    Things::Links::Provider.registry.get_linked_item_names(uid)
+  end
+
+  # @!attribute item [r]
+  # Return the item this channel is linked to. If a channel is linked to more than one item,
+  # this method only returns the first item.
+  #
+  # @return [Items::Item, nil]
+  def item
+    items.first
+  end
+
+  # @!attribute items [r]
+  # Return all of the items this channel is linked to.
+  #
+  # @return [Array<Items::Item>]
+  def items
+    Things::Links::Provider.registry.get_linked_items(uid).map { |item| Items::Proxy.new(item) }
+  end
+
+  #
+  # @!attribute links [r]
+  # Returns all of the channel's links (items and link configurations).
+  #
+  # @return [Items::ItemChannelLinks] An array of ItemChannelLink or an empty array
+  #
+  # @example Get the configuration of the first link
+  #   things["mqtt:topic:livingroom-light"].channel["power"].links.first.configuration
+  #
+  # @example Remove all managed links
+  #   things["mqtt:topic:livingroom-light"].channel["power"].links.clear
+  #
+  # @see link
+  # @see unlink
+  #
+  def links
+    Items::ItemChannelLinks.new(uid, Things::Links::Provider.registry.get_links(uid))
+  end
+
+  #
+  # @return [ItemChannelLink, nil]
+  #
+  # @overload link
+  #   Returns the channel's link. If an channel is linked to more than one item,
+  #   this method only returns the first link.
+  #
+  #   @return [Things::ItemChannelLink, nil]
+  #
+  # @overload link(item, config = {})
+  #
+  #   Links the channel to an item.
+  #
+  #   @param [String, Items::Item] item The item to link to.
+  #   @param [Hash] config The configuration for the link.
+  #
+  #   @return [Things::ItemChannelLink] The created link.
+  #
+  #   @example Link a channel to an item
+  #     things["mqtt:topic:livingroom-light"].channels["power"].link(LivingRoom_Light_Power)
+  #
+  #   @example Specify a link configuration
+  #     things["mqtt:topic:outdoor-thermometer"].channels["temperature"].link(
+  #       High_Temperature_Alert,
+  #       profile: "system:hysteresis",
+  #       lower: "29 °C",
+  #       upper: "30 °C")
+  #
+  #   @see links
+  #   @see unlink
+  #
+  def link(item = nil, config = nil)
+    return Things::Links::Provider.registry.get_links(uid).first if item.nil? && config.nil?
+
+    config ||= {}
+    Core::Things::Links::Provider.create_link(item, self, config).tap do |new_link|
+      provider = Core::Things::Links::Provider.current
+      if !(current_link = provider.get(new_link.uid))
+        provider.add(new_link)
+      elsif current_link.configuration != config
+        provider.update(new_link)
+      end
+    end
+  end
+
+  #
+  # Removes a link to an item from managed link providers.
+  #
+  # @param [String, Items::Item] item The item to remove the link to.
+  #
+  # @return [Things::ItemChannelLink, nil] The removed link, if found.
+  # @raise [FrozenError] if the link is not managed by a managed link provider.
+  #
+  # @see link
+  # @see links
+  #
+  def unlink(item)
+    link_to_delete = Things::Links::Provider.create_link(item, self, {})
+    provider = Things::Links::Provider.registry.provider_for(link_to_delete.uid)
+    unless provider.is_a?(ManagedProvider)
+      raise FrozenError,
+            "Cannot remove the link #{link_to_delete.uid} from non-managed provider #{provider.inspect}"
+    end
+
+    provider.remove(link_to_delete.uid)
+  end
+
+  # @deprecated OH3.4 this whole section is not needed in OH4+. Also see Thing#config_eql?
+  if Core.version < Core::V4_0
+    # @!visibility private
+    module ChannelComparable
+      # @!visibility private
+      # This is only needed in OH3 because it is implemented in OH4 core
+      def ==(other)
+        return true if equal?(other)
+        return false unless other.is_a?(Channel)
+
+        %i[class
+           uid
+           label
+           description
+           kind
+           channel_type_uid
+           configuration
+           properties
+           default_tags
+           auto_update_policy
+           accepted_item_type].all? do |attr|
+          send(attr) == other.send(attr)
+        end
+      end
+    end
+    org.openhab.core.thing.binding.builder.ChannelBuilder.const_get(:ChannelImpl).prepend(ChannelComparable)
+  end
+end
+
+
+ + + +
+

+ + #uidChannelUID (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+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
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+
+
# File 'lib/openhab/core/things/channel.rb', line 29
+
+class Channel
+  extend Forwardable
+
+  delegate %i[item items thing] => :uid
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::Channel #{uid}"
+    r += " #{label.inspect}" if label
+    r += " description=#{description.inspect}" if description
+    r += " kind=#{kind.inspect}"
+    r += " channel_type_uid=#{channel_type_uid.inspect}" if channel_type_uid
+    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    r += " default_tags=#{default_tags.to_a}" unless default_tags.empty?
+    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
+    r += " accepted_item_type=#{accepted_item_type}" if accepted_item_type
+    "#{r}>"
+  end
+
+  # @!attribute [r] channel_type
+  # @return [ChannelType]
+  def channel_type
+    ChannelType.registry.get_channel_type(channel_type_uid)
+  end
+
+  # @return [String]
+  def to_s
+    uid.to_s
+  end
+
+  # @!attribute item_name [r]
+  # Return the name of the item this channel is linked to. If a channel is linked to more than one item,
+  # this method only returns the first item.
+  #
+  # @return [String, nil]
+  def item_name
+    item_names.first
+  end
+
+  # @!attribute item_names [r]
+  # Return the names of all of the items this channel is linked to.
+  #
+  # @return [Array<String>]
+  def item_names
+    Things::Links::Provider.registry.get_linked_item_names(uid)
+  end
+
+  # @!attribute item [r]
+  # Return the item this channel is linked to. If a channel is linked to more than one item,
+  # this method only returns the first item.
+  #
+  # @return [Items::Item, nil]
+  def item
+    items.first
+  end
+
+  # @!attribute items [r]
+  # Return all of the items this channel is linked to.
+  #
+  # @return [Array<Items::Item>]
+  def items
+    Things::Links::Provider.registry.get_linked_items(uid).map { |item| Items::Proxy.new(item) }
+  end
+
+  #
+  # @!attribute links [r]
+  # Returns all of the channel's links (items and link configurations).
+  #
+  # @return [Items::ItemChannelLinks] An array of ItemChannelLink or an empty array
+  #
+  # @example Get the configuration of the first link
+  #   things["mqtt:topic:livingroom-light"].channel["power"].links.first.configuration
+  #
+  # @example Remove all managed links
+  #   things["mqtt:topic:livingroom-light"].channel["power"].links.clear
+  #
+  # @see link
+  # @see unlink
+  #
+  def links
+    Items::ItemChannelLinks.new(uid, Things::Links::Provider.registry.get_links(uid))
+  end
+
+  #
+  # @return [ItemChannelLink, nil]
+  #
+  # @overload link
+  #   Returns the channel's link. If an channel is linked to more than one item,
+  #   this method only returns the first link.
+  #
+  #   @return [Things::ItemChannelLink, nil]
+  #
+  # @overload link(item, config = {})
+  #
+  #   Links the channel to an item.
+  #
+  #   @param [String, Items::Item] item The item to link to.
+  #   @param [Hash] config The configuration for the link.
+  #
+  #   @return [Things::ItemChannelLink] The created link.
+  #
+  #   @example Link a channel to an item
+  #     things["mqtt:topic:livingroom-light"].channels["power"].link(LivingRoom_Light_Power)
+  #
+  #   @example Specify a link configuration
+  #     things["mqtt:topic:outdoor-thermometer"].channels["temperature"].link(
+  #       High_Temperature_Alert,
+  #       profile: "system:hysteresis",
+  #       lower: "29 °C",
+  #       upper: "30 °C")
+  #
+  #   @see links
+  #   @see unlink
+  #
+  def link(item = nil, config = nil)
+    return Things::Links::Provider.registry.get_links(uid).first if item.nil? && config.nil?
+
+    config ||= {}
+    Core::Things::Links::Provider.create_link(item, self, config).tap do |new_link|
+      provider = Core::Things::Links::Provider.current
+      if !(current_link = provider.get(new_link.uid))
+        provider.add(new_link)
+      elsif current_link.configuration != config
+        provider.update(new_link)
+      end
+    end
+  end
+
+  #
+  # Removes a link to an item from managed link providers.
+  #
+  # @param [String, Items::Item] item The item to remove the link to.
+  #
+  # @return [Things::ItemChannelLink, nil] The removed link, if found.
+  # @raise [FrozenError] if the link is not managed by a managed link provider.
+  #
+  # @see link
+  # @see links
+  #
+  def unlink(item)
+    link_to_delete = Things::Links::Provider.create_link(item, self, {})
+    provider = Things::Links::Provider.registry.provider_for(link_to_delete.uid)
+    unless provider.is_a?(ManagedProvider)
+      raise FrozenError,
+            "Cannot remove the link #{link_to_delete.uid} from non-managed provider #{provider.inspect}"
+    end
+
+    provider.remove(link_to_delete.uid)
+  end
+
+  # @deprecated OH3.4 this whole section is not needed in OH4+. Also see Thing#config_eql?
+  if Core.version < Core::V4_0
+    # @!visibility private
+    module ChannelComparable
+      # @!visibility private
+      # This is only needed in OH3 because it is implemented in OH4 core
+      def ==(other)
+        return true if equal?(other)
+        return false unless other.is_a?(Channel)
+
+        %i[class
+           uid
+           label
+           description
+           kind
+           channel_type_uid
+           configuration
+           properties
+           default_tags
+           auto_update_policy
+           accepted_item_type].all? do |attr|
+          send(attr) == other.send(attr)
+        end
+      end
+    end
+    org.openhab.core.thing.binding.builder.ChannelBuilder.const_get(:ChannelImpl).prepend(ChannelComparable)
+  end
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+
+
# File 'lib/openhab/core/things/channel.rb', line 35
+
+def inspect
+  r = "#<OpenHAB::Core::Things::Channel #{uid}"
+  r += " #{label.inspect}" if label
+  r += " description=#{description.inspect}" if description
+  r += " kind=#{kind.inspect}"
+  r += " channel_type_uid=#{channel_type_uid.inspect}" if channel_type_uid
+  r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
+  r += " properties=#{properties.to_h}" unless properties.empty?
+  r += " default_tags=#{default_tags.to_a}" unless default_tags.empty?
+  r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
+  r += " accepted_item_type=#{accepted_item_type}" if accepted_item_type
+  "#{r}>"
+end
+
+
+ +
+
+
+ + +
+
+
+ +

Overloads:

+
    + + +
  • + #linkThings::ItemChannelLink? +
    +
    +

    Returns the channel's link. If an channel is linked to more than one item, +this method only returns the first link.

    + + +
    +
    +
    + +

    Returns:

    + + +
    +
  • + + +
  • + #link(item, config = {}) ⇒ Things::ItemChannelLink +
    +
    +

    Links the channel to an item.

    + + +
    +
    +
    + +
    +

    Examples:

    + + +

    Link a channel to an item

    +

    + +
    things["mqtt:topic:livingroom-light"].channels["power"].link(LivingRoom_Light_Power)
    + + +

    Specify a link configuration

    +

    + +
    things["mqtt:topic:outdoor-thermometer"].channels["temperature"].link(
    +  High_Temperature_Alert,
    +  profile: "system:hysteresis",
    +  lower: "29 °C",
    +  upper: "30 °C")
    + +
    +

    Parameters:

    +
      + +
    • + + item + + + (String, Items::Item) + + + + — +

      The item to link to.

      +
      + +
    • + +
    • + + config + + + (Hash) + + + (defaults to: {}) + + + — +

      The configuration for the link.

      +
      + +
    • + +
    + +

    Returns:

    + + +

    See Also:

    + + +
    +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+
+
# File 'lib/openhab/core/things/channel.rb', line 144
+
+def link(item = nil, config = nil)
+  return Things::Links::Provider.registry.get_links(uid).first if item.nil? && config.nil?
+
+  config ||= {}
+  Core::Things::Links::Provider.create_link(item, self, config).tap do |new_link|
+    provider = Core::Things::Links::Provider.current
+    if !(current_link = provider.get(new_link.uid))
+      provider.add(new_link)
+    elsif current_link.configuration != config
+      provider.update(new_link)
+    end
+  end
+end
+
+
+ +
+

+ + #to_sString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+56
+57
+58
+
+
# File 'lib/openhab/core/things/channel.rb', line 56
+
+def to_s
+  uid.to_s
+end
+
+
+ +
+
+
+

Removes a link to an item from managed link providers.

+ + +
+
+
+

Parameters:

+
    + +
  • + + item + + + (String, Items::Item) + + + + — +

    The item to remove the link to.

    +
    + +
  • + +
+ +

Returns:

+ +

Raises:

+
    + +
  • + + + (FrozenError) + + + + — +

    if the link is not managed by a managed link provider.

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+
+
# File 'lib/openhab/core/things/channel.rb', line 169
+
+def unlink(item)
+  link_to_delete = Things::Links::Provider.create_link(item, self, {})
+  provider = Things::Links::Provider.registry.provider_for(link_to_delete.uid)
+  unless provider.is_a?(ManagedProvider)
+    raise FrozenError,
+          "Cannot remove the link #{link_to_delete.uid} from non-managed provider #{provider.inspect}"
+  end
+
+  provider.remove(link_to_delete.uid)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/ChannelDefinition.html b/5.33/OpenHAB/Core/Things/ChannelDefinition.html new file mode 100644 index 0000000000..4cfcea38ce --- /dev/null +++ b/5.33/OpenHAB/Core/Things/ChannelDefinition.html @@ -0,0 +1,4666 @@ + + + + + + + Class: OpenHAB::Core::Things::ChannelDefinition + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Things::ChannelDefinition + + + +

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

Overview

+
+

ChannelDefinition is a part of a ChannelGroupType that represents a functionality of it. +Therefore Items can be linked a to a channel.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #auto_update_policy:veto, ... (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (:veto, :default, :recommend, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+39
+40
+41
+
+
# File 'lib/openhab/core/things/channel_definition.rb', line 39
+
+def auto_update_policy
+  get_auto_update_policy&.to_s&.downcase&.to_sym
+end
+
+
+ + + +
+

+ + #channel_typeChannelType (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+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
+
+
# File 'lib/openhab/core/things/channel_definition.rb', line 32
+
+class ChannelDefinition
+  extend Forwardable
+
+  delegate channel_type: :channel_type_uid
+
+  # @!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::ChannelDefinition #{id}"
+    r += " channel_type_uid=#{channel_type_uid.inspect}" if channel_type_uid
+    r += " #{label.inspect}" if label
+    r += " description=#{description.inspect}" if description
+    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    id.to_s
+  end
+end
+
+
+ + + +
+

+ + #channel_type_uidChannelTypeUID (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+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
+
+
# File 'lib/openhab/core/things/channel_definition.rb', line 32
+
+class ChannelDefinition
+  extend Forwardable
+
+  delegate channel_type: :channel_type_uid
+
+  # @!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::ChannelDefinition #{id}"
+    r += " channel_type_uid=#{channel_type_uid.inspect}" if channel_type_uid
+    r += " #{label.inspect}" if label
+    r += " description=#{description.inspect}" if description
+    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    id.to_s
+  end
+end
+
+
+ + + +
+

+ + #descriptionString? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+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
+
+
# File 'lib/openhab/core/things/channel_definition.rb', line 32
+
+class ChannelDefinition
+  extend Forwardable
+
+  delegate channel_type: :channel_type_uid
+
+  # @!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::ChannelDefinition #{id}"
+    r += " channel_type_uid=#{channel_type_uid.inspect}" if channel_type_uid
+    r += " #{label.inspect}" if label
+    r += " description=#{description.inspect}" if description
+    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    id.to_s
+  end
+end
+
+
+ + + +
+

+ + #idString (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+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
+
+
# File 'lib/openhab/core/things/channel_definition.rb', line 32
+
+class ChannelDefinition
+  extend Forwardable
+
+  delegate channel_type: :channel_type_uid
+
+  # @!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::ChannelDefinition #{id}"
+    r += " channel_type_uid=#{channel_type_uid.inspect}" if channel_type_uid
+    r += " #{label.inspect}" if label
+    r += " description=#{description.inspect}" if description
+    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    id.to_s
+  end
+end
+
+
+ + + +
+

+ + #labelString? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+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
+
+
# File 'lib/openhab/core/things/channel_definition.rb', line 32
+
+class ChannelDefinition
+  extend Forwardable
+
+  delegate channel_type: :channel_type_uid
+
+  # @!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::ChannelDefinition #{id}"
+    r += " channel_type_uid=#{channel_type_uid.inspect}" if channel_type_uid
+    r += " #{label.inspect}" if label
+    r += " description=#{description.inspect}" if description
+    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    id.to_s
+  end
+end
+
+
+ + + +
+

+ + #propertiesHash<String, String> (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash<String, String>) + + + +
  • + +
+ +
+ + + + +
+
+
+
+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
+
+
# File 'lib/openhab/core/things/channel_definition.rb', line 32
+
+class ChannelDefinition
+  extend Forwardable
+
+  delegate channel_type: :channel_type_uid
+
+  # @!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::ChannelDefinition #{id}"
+    r += " channel_type_uid=#{channel_type_uid.inspect}" if channel_type_uid
+    r += " #{label.inspect}" if label
+    r += " description=#{description.inspect}" if description
+    r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    id.to_s
+  end
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+44
+45
+46
+47
+48
+49
+50
+51
+52
+
+
# File 'lib/openhab/core/things/channel_definition.rb', line 44
+
+def inspect
+  r = "#<OpenHAB::Core::Things::ChannelDefinition #{id}"
+  r += " channel_type_uid=#{channel_type_uid.inspect}" if channel_type_uid
+  r += " #{label.inspect}" if label
+  r += " description=#{description.inspect}" if description
+  r += " auto_update_policy=#{auto_update_policy}" if auto_update_policy
+  r += " properties=#{properties.to_h}" unless properties.empty?
+  "#{r}>"
+end
+
+
+ +
+

+ + #to_sString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+55
+56
+57
+
+
# File 'lib/openhab/core/things/channel_definition.rb', line 55
+
+def to_s
+  id.to_s
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/ChannelGroupDefinition.html b/5.33/OpenHAB/Core/Things/ChannelGroupDefinition.html new file mode 100644 index 0000000000..d13da0f006 --- /dev/null +++ b/5.33/OpenHAB/Core/Things/ChannelGroupDefinition.html @@ -0,0 +1,4390 @@ + + + + + + + Class: OpenHAB::Core::Things::ChannelGroupDefinition + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Things::ChannelGroupDefinition + + + +

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

Overview

+
+

ChannelGroupDefinition is a part of a ThingType that represents a set of channels

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #channel_group_typeChannelGroupType (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+
+
# File 'lib/openhab/core/things/channel_group_definition.rb', line 28
+
+class ChannelGroupDefinition
+  extend Forwardable
+
+  alias_method :channel_group_type_uid, :type_uid
+
+  delegate channel_group_type: :channel_group_type_uid
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::ChannelGroupDefinition #{id}"
+    r += " channel_group_type_uid=#{channel_group_type_uid.inspect}"
+    r += " #{label.inspect}" if label
+    r += " description=#{description.inspect}" if description
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    id.to_s
+  end
+end
+
+
+ + + +
+

+ + #channel_group_type_uidChannelGroupTypeUID (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+
+
# File 'lib/openhab/core/things/channel_group_definition.rb', line 28
+
+class ChannelGroupDefinition
+  extend Forwardable
+
+  alias_method :channel_group_type_uid, :type_uid
+
+  delegate channel_group_type: :channel_group_type_uid
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::ChannelGroupDefinition #{id}"
+    r += " channel_group_type_uid=#{channel_group_type_uid.inspect}"
+    r += " #{label.inspect}" if label
+    r += " description=#{description.inspect}" if description
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    id.to_s
+  end
+end
+
+
+ + + +
+

+ + #descriptionString? (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
+
+
# File 'lib/openhab/core/things/channel_group_definition.rb', line 28
+
+class ChannelGroupDefinition
+  extend Forwardable
+
+  alias_method :channel_group_type_uid, :type_uid
+
+  delegate channel_group_type: :channel_group_type_uid
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::ChannelGroupDefinition #{id}"
+    r += " channel_group_type_uid=#{channel_group_type_uid.inspect}"
+    r += " #{label.inspect}" if label
+    r += " description=#{description.inspect}" if description
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    id.to_s
+  end
+end
+
+
+ + + +
+

+ + #idString (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+
+
# File 'lib/openhab/core/things/channel_group_definition.rb', line 28
+
+class ChannelGroupDefinition
+  extend Forwardable
+
+  alias_method :channel_group_type_uid, :type_uid
+
+  delegate channel_group_type: :channel_group_type_uid
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::ChannelGroupDefinition #{id}"
+    r += " channel_group_type_uid=#{channel_group_type_uid.inspect}"
+    r += " #{label.inspect}" if label
+    r += " description=#{description.inspect}" if description
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    id.to_s
+  end
+end
+
+
+ + + +
+

+ + #labelString? (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
+
+
# File 'lib/openhab/core/things/channel_group_definition.rb', line 28
+
+class ChannelGroupDefinition
+  extend Forwardable
+
+  alias_method :channel_group_type_uid, :type_uid
+
+  delegate channel_group_type: :channel_group_type_uid
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::ChannelGroupDefinition #{id}"
+    r += " channel_group_type_uid=#{channel_group_type_uid.inspect}"
+    r += " #{label.inspect}" if label
+    r += " description=#{description.inspect}" if description
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    id.to_s
+  end
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+36
+37
+38
+39
+40
+41
+42
+
+
# File 'lib/openhab/core/things/channel_group_definition.rb', line 36
+
+def inspect
+  r = "#<OpenHAB::Core::Things::ChannelGroupDefinition #{id}"
+  r += " channel_group_type_uid=#{channel_group_type_uid.inspect}"
+  r += " #{label.inspect}" if label
+  r += " description=#{description.inspect}" if description
+  "#{r}>"
+end
+
+
+ +
+

+ + #to_sString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+45
+46
+47
+
+
# File 'lib/openhab/core/things/channel_group_definition.rb', line 45
+
+def to_s
+  id.to_s
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/ChannelGroupType.html b/5.33/OpenHAB/Core/Things/ChannelGroupType.html new file mode 100644 index 0000000000..1b894353a4 --- /dev/null +++ b/5.33/OpenHAB/Core/Things/ChannelGroupType.html @@ -0,0 +1,4159 @@ + + + + + + + Class: OpenHAB::Core::Things::ChannelGroupType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Things::ChannelGroupType + + + +

+
+ +
+
Inherits:
+
+ AbstractDescriptionType + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/things/channel_group_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

+ + + +
+

+ + #categoryString? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+
+
# File 'lib/openhab/core/things/channel_group_type.rb', line 23
+
+class ChannelGroupType < AbstractDescriptionType
+  class << self
+    # @!visibility private
+    def registry
+      @registry ||= OSGi.service("org.openhab.core.thing.type.ChannelGroupTypeRegistry")
+    end
+  end
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::ChannelGroupType #{uid}"
+    r += " category=#{category.inspect}" if category
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    uid.to_s
+  end
+end
+
+
+ + + +
+

+ + #channel_definitionsArray<ChannelDefinition> (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+
+
# File 'lib/openhab/core/things/channel_group_type.rb', line 23
+
+class ChannelGroupType < AbstractDescriptionType
+  class << self
+    # @!visibility private
+    def registry
+      @registry ||= OSGi.service("org.openhab.core.thing.type.ChannelGroupTypeRegistry")
+    end
+  end
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::ChannelGroupType #{uid}"
+    r += " category=#{category.inspect}" if category
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    uid.to_s
+  end
+end
+
+
+ + + +
+

+ + #uidChannelGroupTypeUID (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+
+
# File 'lib/openhab/core/things/channel_group_type.rb', line 23
+
+class ChannelGroupType < AbstractDescriptionType
+  class << self
+    # @!visibility private
+    def registry
+      @registry ||= OSGi.service("org.openhab.core.thing.type.ChannelGroupTypeRegistry")
+    end
+  end
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::ChannelGroupType #{uid}"
+    r += " category=#{category.inspect}" if category
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    uid.to_s
+  end
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+32
+33
+34
+35
+36
+
+
# File 'lib/openhab/core/things/channel_group_type.rb', line 32
+
+def inspect
+  r = "#<OpenHAB::Core::Things::ChannelGroupType #{uid}"
+  r += " category=#{category.inspect}" if category
+  "#{r}>"
+end
+
+
+ +
+

+ + #to_sString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+39
+40
+41
+
+
# File 'lib/openhab/core/things/channel_group_type.rb', line 39
+
+def to_s
+  uid.to_s
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/ChannelGroupTypeUID.html b/5.33/OpenHAB/Core/Things/ChannelGroupTypeUID.html new file mode 100644 index 0000000000..4898c73a49 --- /dev/null +++ b/5.33/OpenHAB/Core/Things/ChannelGroupTypeUID.html @@ -0,0 +1,4028 @@ + + + + + + + Class: OpenHAB::Core::Things::ChannelGroupTypeUID + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Things::ChannelGroupTypeUID + + + +

+
+ +
+
Inherits:
+
+ UID + +
    +
  • Object
  • + + + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/things/channel_group_type_uid.rb
+
+ +
+ +

Overview

+
+

ChannelGroupTypeUID represents a unique identifier for a ChannelGroupType.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from UID

+

#binding_id

+ + + + + + + + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractUID

+

#==, #inspect, #to_str

+ +
+

Instance Attribute Details

+ + + +
+

+ + #categoryString? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+
+
# File 'lib/openhab/core/things/channel_group_type_uid.rb', line 24
+
+class ChannelGroupTypeUID < UID
+  extend Forwardable
+
+  delegate %i[category channel_definitions] => :channel_group_type
+
+  # @!attribute [r] channel_group_type
+  # @return [ChannelGroupType]
+  def channel_group_type
+    ChannelGroupType.registry.get_channel_group_type(self)
+  end
+end
+
+
+ + + +
+

+ + #channel_definitionsArray<ChannelDefinition> (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+
+
# File 'lib/openhab/core/things/channel_group_type_uid.rb', line 24
+
+class ChannelGroupTypeUID < UID
+  extend Forwardable
+
+  delegate %i[category channel_definitions] => :channel_group_type
+
+  # @!attribute [r] channel_group_type
+  # @return [ChannelGroupType]
+  def channel_group_type
+    ChannelGroupType.registry.get_channel_group_type(self)
+  end
+end
+
+
+ + + +
+

+ + #channel_group_typeChannelGroupType (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+31
+32
+33
+
+
# File 'lib/openhab/core/things/channel_group_type_uid.rb', line 31
+
+def channel_group_type
+  ChannelGroupType.registry.get_channel_group_type(self)
+end
+
+
+ + + +
+

+ + #idString (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+
+
# File 'lib/openhab/core/things/channel_group_type_uid.rb', line 24
+
+class ChannelGroupTypeUID < UID
+  extend Forwardable
+
+  delegate %i[category channel_definitions] => :channel_group_type
+
+  # @!attribute [r] channel_group_type
+  # @return [ChannelGroupType]
+  def channel_group_type
+    ChannelGroupType.registry.get_channel_group_type(self)
+  end
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/ChannelGroupUID.html b/5.33/OpenHAB/Core/Things/ChannelGroupUID.html new file mode 100644 index 0000000000..1219565c74 --- /dev/null +++ b/5.33/OpenHAB/Core/Things/ChannelGroupUID.html @@ -0,0 +1,3808 @@ + + + + + + + Class: OpenHAB::Core::Things::ChannelGroupUID + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Things::ChannelGroupUID + + + +

+
+ +
+
Inherits:
+
+ UID + +
    +
  • Object
  • + + + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/things/channel_group_uid.rb
+
+ +
+ +

Overview

+
+

ChannelGroupUID represents a unique identifier for a group of channels.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from UID

+

#binding_id, #category

+ + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractUID

+

#==, #inspect, #to_str

+ +
+

Instance Attribute Details

+ + + +
+

+ + #idString (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+21
+22
+
+
# File 'lib/openhab/core/things/channel_group_uid.rb', line 21
+
+class ChannelGroupUID < UID
+end
+
+
+ + + +
+

+ + #thing_uidThingUID (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+21
+22
+
+
# File 'lib/openhab/core/things/channel_group_uid.rb', line 21
+
+class ChannelGroupUID < UID
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/ChannelType.html b/5.33/OpenHAB/Core/Things/ChannelType.html new file mode 100644 index 0000000000..a21c17e3cc --- /dev/null +++ b/5.33/OpenHAB/Core/Things/ChannelType.html @@ -0,0 +1,4715 @@ + + + + + + + Class: OpenHAB::Core::Things::ChannelType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

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

+ + + +
+

+ + #advanced?true, false (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+44
+
+
# File 'lib/openhab/core/things/channel_type.rb', line 44
+
+alias_method :advanced?, :advanced
+
+
+ + + +
+

+ + #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
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/ChannelTypeUID.html b/5.33/OpenHAB/Core/Things/ChannelTypeUID.html new file mode 100644 index 0000000000..567c889309 --- /dev/null +++ b/5.33/OpenHAB/Core/Things/ChannelTypeUID.html @@ -0,0 +1,4425 @@ + + + + + + + Class: OpenHAB::Core::Things::ChannelTypeUID + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Things::ChannelTypeUID + + + +

+
+ +
+
Inherits:
+
+ UID + +
    +
  • Object
  • + + + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/things/channel_type_uid.rb
+
+ +
+ +

Overview

+
+

ChannelTypeUID represents a unique identifier for a ChannelType.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from UID

+

#binding_id

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Methods inherited from AbstractUID

+

#==, #inspect, #to_str

+ +
+

Instance Attribute Details

+ + + +
+

+ + #auto_update_policy:veto, ... (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (:veto, :default, :recommend, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+
+
# File 'lib/openhab/core/things/channel_type_uid.rb', line 30
+
+class ChannelTypeUID < UID
+  extend Forwardable
+
+  # @!method advanced?
+  #   @return [true, false]
+
+  delegate %i[item_type
+              tags
+              category
+              auto_update_policy
+              command_description
+              event_description
+              state_description
+              advanced?] => :channel_type
+
+  # @!attribute [r] channel_type
+  # @return [ChannelType]
+  def channel_type
+    ChannelType.registry.get_channel_type(self)
+  end
+end
+
+
+ + + +
+

+ + #categoryString? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+
+
# File 'lib/openhab/core/things/channel_type_uid.rb', line 30
+
+class ChannelTypeUID < UID
+  extend Forwardable
+
+  # @!method advanced?
+  #   @return [true, false]
+
+  delegate %i[item_type
+              tags
+              category
+              auto_update_policy
+              command_description
+              event_description
+              state_description
+              advanced?] => :channel_type
+
+  # @!attribute [r] channel_type
+  # @return [ChannelType]
+  def channel_type
+    ChannelType.registry.get_channel_type(self)
+  end
+end
+
+
+ + + +
+

+ + #channel_typeChannelType (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+47
+48
+49
+
+
# File 'lib/openhab/core/things/channel_type_uid.rb', line 47
+
+def channel_type
+  ChannelType.registry.get_channel_type(self)
+end
+
+
+ + + +
+

+ + #idString (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+
+
# File 'lib/openhab/core/things/channel_type_uid.rb', line 30
+
+class ChannelTypeUID < UID
+  extend Forwardable
+
+  # @!method advanced?
+  #   @return [true, false]
+
+  delegate %i[item_type
+              tags
+              category
+              auto_update_policy
+              command_description
+              event_description
+              state_description
+              advanced?] => :channel_type
+
+  # @!attribute [r] channel_type
+  # @return [ChannelType]
+  def channel_type
+    ChannelType.registry.get_channel_type(self)
+  end
+end
+
+
+ + + +
+

+ + #item_typeString (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+
+
# File 'lib/openhab/core/things/channel_type_uid.rb', line 30
+
+class ChannelTypeUID < UID
+  extend Forwardable
+
+  # @!method advanced?
+  #   @return [true, false]
+
+  delegate %i[item_type
+              tags
+              category
+              auto_update_policy
+              command_description
+              event_description
+              state_description
+              advanced?] => :channel_type
+
+  # @!attribute [r] channel_type
+  # @return [ChannelType]
+  def channel_type
+    ChannelType.registry.get_channel_type(self)
+  end
+end
+
+
+ + + +
+

+ + #tagsSet<String> (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Set<String>) + + + +
  • + +
+ +
+ + + + +
+
+
+
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+
+
# File 'lib/openhab/core/things/channel_type_uid.rb', line 30
+
+class ChannelTypeUID < UID
+  extend Forwardable
+
+  # @!method advanced?
+  #   @return [true, false]
+
+  delegate %i[item_type
+              tags
+              category
+              auto_update_policy
+              command_description
+              event_description
+              state_description
+              advanced?] => :channel_type
+
+  # @!attribute [r] channel_type
+  # @return [ChannelType]
+  def channel_type
+    ChannelType.registry.get_channel_type(self)
+  end
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #advanced?true, false + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+36
+37
+38
+39
+40
+41
+42
+43
+
+
# File 'lib/openhab/core/things/channel_type_uid.rb', line 36
+
+delegate %i[item_type
+tags
+category
+auto_update_policy
+command_description
+event_description
+state_description
+advanced?] => :channel_type
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/ChannelUID.html b/5.33/OpenHAB/Core/Things/ChannelUID.html new file mode 100644 index 0000000000..ddd7d1748e --- /dev/null +++ b/5.33/OpenHAB/Core/Things/ChannelUID.html @@ -0,0 +1,4760 @@ + + + + + + + Class: OpenHAB::Core::Things::ChannelUID + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

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

+
+ +
+
Inherits:
+
+ UID + +
    +
  • Object
  • + + + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
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

+

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

+
    + +
  • + + + (Channel, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+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:

+
    + +
  • + + + (Item, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+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:

+
    + +
  • + + + (Thing, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+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
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/ItemChannelLink.html b/5.33/OpenHAB/Core/Things/ItemChannelLink.html new file mode 100644 index 0000000000..f409d170ab --- /dev/null +++ b/5.33/OpenHAB/Core/Things/ItemChannelLink.html @@ -0,0 +1,4145 @@ + + + + + + + Class: OpenHAB::Core::Things::ItemChannelLink + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

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
+
+
+ + + +
+

+ + #channel_uidChannelUID (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
+
+
+ + + +
+

+ + #itemItem (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Item) + + + +
  • + +
+ +
+ + + + +
+
+
+
+25
+26
+27
+
+
# File 'lib/openhab/core/things/item_channel_link.rb', line 25
+
+def item
+  DSL.items[item_name]
+end
+
+
+ + + +
+

+ + #thingThing (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Thing) + + + +
  • + +
+ +
+ + + + +
+
+
+
+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
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/Links.html b/5.33/OpenHAB/Core/Things/Links.html new file mode 100644 index 0000000000..a62ae11027 --- /dev/null +++ b/5.33/OpenHAB/Core/Things/Links.html @@ -0,0 +1,3608 @@ + + + + + + + Module: OpenHAB::Core::Things::Links + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Things::Links + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/things/links/provider.rb
+
+ +
+ +

Overview

+
+

Contains the link between a Thing's Channels and Items.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + + + Classes: Provider + + +

+ + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/Links/Provider.html b/5.33/OpenHAB/Core/Things/Links/Provider.html new file mode 100644 index 0000000000..8488c8cbca --- /dev/null +++ b/5.33/OpenHAB/Core/Things/Links/Provider.html @@ -0,0 +1,4010 @@ + + + + + + + Class: OpenHAB::Core::Things::Links::Provider + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Things::Links::Provider + + + +

+
+ +
+
Inherits:
+
+ Provider + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/things/links/provider.rb
+
+ +
+ +

Overview

+
+

Provides items linked to channels in Ruby to openHAB.

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods inherited from Provider

+

#[], #all, current, #inspect

+ + + + + + + + + + + + + + + +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update, #update!

+ + + + + + + + + + + + + + +
+

Class Method Details

+ + +
+

+ + .registryorg.openhab.core.thing.link.ItemChannelLinkRegistry + + + + + +

+
+

The ItemChannelLink registry

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+22
+23
+24
+
+
# File 'lib/openhab/core/things/links/provider.rb', line 22
+
+def registry
+  @registry ||= OSGi.service("org.openhab.core.thing.link.ItemChannelLinkRegistry")
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+
+
+

Removes all links to a given item.

+ + +
+
+
+

Parameters:

+
    + +
  • + + item_name + + + (String) + + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    how many links were removed

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+
+
# File 'lib/openhab/core/things/links/provider.rb', line 42
+
+def remove_links_for_item(item_name)
+  count = 0
+  @elements.delete_if do |_k, v|
+    next unless v.item_name == item_name
+
+    count += 1
+    notify_listeners_about_removed_element(v)
+    true
+  end
+  count
+end
+
+
+ +
+
+
+

Removes all links to a given thing.

+ + +
+
+
+

Parameters:

+
    + +
  • + + thing_uid + + + (ThingUID) + + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    how many links were removed

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+
+
# File 'lib/openhab/core/things/links/provider.rb', line 61
+
+def remove_links_for_thing(thing_uid)
+  count = 0
+  @elements.delete_if do |_k, v|
+    next unless v.linked_uid.thing_uid == thing_uid
+
+    count += 1
+    notify_listeners_about_removed_element(v)
+    true
+  end
+  count
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/ProfileCallback.html b/5.33/OpenHAB/Core/Things/ProfileCallback.html new file mode 100644 index 0000000000..fe8a9e53b5 --- /dev/null +++ b/5.33/OpenHAB/Core/Things/ProfileCallback.html @@ -0,0 +1,3954 @@ + + + + + + + Module: OpenHAB::Core::Things::ProfileCallback + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Things::ProfileCallback + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/things/profile_callback.rb
+
+ +
+ +

Overview

+
+

Contains methods for profile's callback to forward commands between items +and channels.

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #handle_command(command) ⇒ Object + + + + + +

+
+

Forward the given command to the respective thing handler.

+ + +
+
+
+

Parameters:

+
    + +
  • + + command + + + (Command) + + + +
  • + +
+ + +
+ + + + +
+
+
+
+16
+17
+18
+19
+20
+21
+22
+
+
# File 'lib/openhab/core/things/profile_callback.rb', line 16
+
+def handle_command(command)
+  unless instance_variable_defined?(:@dummy_channel_item)
+    @dummy_channel_item = DSL::Items::ItemBuilder.item_factory.create_item(link.channel.accepted_item_type, "")
+  end
+  command = @dummy_channel_item.format_command(command) if @dummy_channel_item
+  super(command)
+end
+
+
+ +
+

+ + #send_command(command) ⇒ Object + + + + + +

+
+

Send a command to the framework.

+ + +
+
+
+

Parameters:

+
    + +
  • + + command + + + (Command) + + + +
  • + +
+ + +
+ + + + +
+
+
+
+29
+30
+31
+32
+
+
# File 'lib/openhab/core/things/profile_callback.rb', line 29
+
+def send_command(command)
+  command = link.item.format_command(command)
+  super(command)
+end
+
+
+ +
+

+ + #send_time_series(time_series) ⇒ Object + + + + + +

+
+

Send a time series to the framework.

+ + +
+
+
+

Parameters:

+
    + +
  • + + time_series + + + (TimeSeries) + + + +
  • + +
+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.1

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/things/profile_callback.rb', line 44
+
+
+
+
+ +
+

+ + #send_update(state) ⇒ Object + + + + + +

+
+

Send a state update to the framework.

+ + +
+
+
+

Parameters:

+
    + +
  • + + state + + + (State) + + + +
  • + +
+ + +
+ + + + +
+
+
+
+39
+40
+41
+42
+
+
# File 'lib/openhab/core/things/profile_callback.rb', line 39
+
+def send_update(state)
+  state = link.item.format_update(state)
+  super(state)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/Provider.html b/5.33/OpenHAB/Core/Things/Provider.html new file mode 100644 index 0000000000..022ecaf2a9 --- /dev/null +++ b/5.33/OpenHAB/Core/Things/Provider.html @@ -0,0 +1,3839 @@ + + + + + + + Class: OpenHAB::Core::Things::Provider + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Things::Provider + + + +

+
+ +
+
Inherits:
+
+ Provider + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/things/provider.rb
+
+ +
+ +

Overview

+
+

Provides Things created in Ruby to openHAB

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods inherited from Provider

+

#[], #all, current, #inspect

+ + + + + + + + + + + + + + + +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update, #update!

+ + + + + + + + + + + + +
+

Constructor Details

+ +
+

+ + #initializeProvider + + + + + +

+
+

Returns a new instance of Provider.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/openhab/core/things/provider.rb', line 23
+
+def initialize
+  super(unload_priority: 60)
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .registryorg.openhab.core.thing.ThingRegistry + + + + + +

+
+

The Thing registry

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+18
+19
+20
+
+
# File 'lib/openhab/core/things/provider.rb', line 18
+
+def registry
+  $things
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/Registry.html b/5.33/OpenHAB/Core/Things/Registry.html new file mode 100644 index 0000000000..27f5697c6e --- /dev/null +++ b/5.33/OpenHAB/Core/Things/Registry.html @@ -0,0 +1,4158 @@ + + + + + + + Class: OpenHAB::Core::Things::Registry + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Things::Registry + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
LazyArray
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/things/registry.rb
+
+ +
+ +

Overview

+
+

Provides access to all openHAB things, and acts like an array.

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from LazyArray

+

#each, #method_missing, #to_ary

+ + + + + + + + + +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update, #update!

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::LazyArray + +

+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #[](uid) ⇒ Thing? + + + + Also known as: + include?, key?, has_key? + + + + +

+
+

Gets a specific Thing

+ + +
+
+
+

Parameters:

+
    + +
  • + + uid + + + (String, ThingUID) + + + + — +

    Thing UID in the format binding_id:type_id:thing_id +or via the ThingUID

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Thing, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+22
+23
+24
+
+
# File 'lib/openhab/core/things/registry.rb', line 22
+
+def [](uid)
+  EntityLookup.lookup_thing(uid)
+end
+
+
+ +
+

+ + #build(preferred_provider = nil, update: true) { ... } ⇒ Object + + + + + +

+
+

Enter the Thing Builder DSL.

+ + +
+
+
+

Parameters:

+
    + +
  • + + update + + + (true, false) + + + (defaults to: true) + + + — +

    When true, existing things with the same name will be redefined if they're different. +When false, an error will be raised if a thing with the same uid already exists.

    +
    + +
  • + +
  • + + preferred_provider + + + (org.openhab.core.common.registry.Provider, Proc, :persistent, :transient, nil) + + + (defaults to: nil) + + + — +

    An optional preferred provider to use. Can be one of several types:

    +
      +
    • An explicit instance of ManagedProvider
    • +
    • A Proc, which can calculate the preferred provider based on whatever conditions it wants, +and then is further processed as this parameter.
    • +
    • :persistent, meaning the default ManagedProvider +for this registry. Managed providers persist their objects to JSON, and will survive after the +Ruby script is unloaded. This is where objects you configure with MainUI are stored. You should +use this provider when you're creating something in response to a one-time event.
    • +
    • :transient, meaning a ManagedProvider that +will remove all of its contents when the Ruby script is unloaded. You should use this if you're +generating objects dynamically, either based on some sort of other configuration, or simply +hard coded and you're using Ruby as a more expressive way to define things than a .items or +.things file. If you don't use this provider for something such as metadata, then you +may have issues such as metadata still showing up even though you're no longer creating items +with it anymore.
    • +
    • nil, meaning to fall back to the current thread setting. See DSL.provider. +If there is no thread setting (or the thread setting was Proc that returned nil), +it defaults to :transient.
    • +
    +
    + +
  • + +
+ +

Yields:

+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +

    The result of the block.

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + + — +

    if a thing with the same uid already exists and update is false.

    +
    + +
  • + +
  • + + + (FrozenError) + + + + — +

    if update is true but the existing thing with the same uid +wasn't created by the current provider.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+51
+52
+53
+
+
# File 'lib/openhab/core/things/registry.rb', line 51
+
+def build(preferred_provider = nil, update: true, &block)
+  DSL::Things::Builder.new(preferred_provider, update: update).instance_eval(&block)
+end
+
+
+ +
+

+ + #remove(thing_uid) ⇒ Thing? + + + + + +

+
+

Remove a Thing.

+

The thing must be a managed thing (typically created by Ruby or in the UI).

+ + +
+
+
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (Thing, nil) + + + + — +

    The removed item, if found.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+
+
# File 'lib/openhab/core/things/registry.rb', line 62
+
+def remove(thing_uid)
+  thing_uid = thing.uid if thing_uid.is_a?(Thing)
+  thing_uid = ThingUID.new(thing_uid) if thing_uid.is_a?(String)
+  provider = Provider.registry.provider_for(thing_uid)
+  unless provider.is_a?(org.openhab.core.common.registry.ManagedProvider)
+    raise "Cannot remove thing #{thing_uid} from non-managed provider #{provider.inspect}"
+  end
+
+  Links::Provider.registry.providers.grep(ManagedProvider).each do |managed_provider|
+    managed_provider.remove_links_for_thing(thing_uid)
+  end
+
+  provider.remove(thing_uid)
+end
+
+
+ +
+

+ + #to_aArray<Thing> + + + + + +

+
+

Explicit conversion to array

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+35
+36
+37
+
+
# File 'lib/openhab/core/things/registry.rb', line 35
+
+def to_a
+  $things.all.map { |thing| Proxy.new(thing) }
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/Thing.html b/5.33/OpenHAB/Core/Things/Thing.html new file mode 100644 index 0000000000..b96b748927 --- /dev/null +++ b/5.33/OpenHAB/Core/Things/Thing.html @@ -0,0 +1,9248 @@ + + + + + + + Module: OpenHAB::Core::Things::Thing + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Things::Thing + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/things/thing.rb
+
+ +
+ +

Overview

+
+

A Thing is a representation of a connected part (e.g. physical device +or cloud service) from the real world. It contains a list of +Channels, which can be bound to Items.

+ + +
+
+
+ +
+

Examples:

+ + +
thing = things["chromecast:audiogroup:dd9f8622-eee-4eaf-b33f-cdcdcdeee001121"]
+logger.info("Audiogroup Status: #{thing&.status}")
+logger.info("Audiogroup Online? #{thing&.online?}")
+logger.info("Channel ids: #{thing.channels.map(&:uid)}")
+logger.info("Items linked to volume channel: #{thing.channels['volume']&.items&.map(&:name)&.join(', ')}")
+logger.info("Item linked to volume channel: #{thing.channels['volume']&.item&.name}")
+ + +

Thing actions can be called directly through a Thing object

+

+ +
things["mqtt:broker:mosquitto"].publish_mqtt("zigbee2mqttt/bridge/config/permit_join", "true")
+things["mail:smtp:local"].send_mail("me@example.com", "Subject", "Email body")
+ + +

Thing can be accessed directly through entity lookup

+

+ +
# replace ':' with '_' in thing uid
+mqtt_broker_mosquitto.online? # is mqtt:broker:mosquitto thing online?
+ +
+ + +

See Also:

+ + +

Defined Under Namespace

+

+ + + + + Classes: ChannelsArray + + +

+ + + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + +
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + +

+ +
+

+ + #method_missing(method, *args, &block) ⇒ Object + + + + + +

+
+

Delegate missing methods to the thing's default actions scope.

+ + +
+
+
+ +
+

Examples:

+ + +
things['mail:smtp:local'].send_email('me@example.com', 'subject', 'message')
+ +
+ + +
+ + + + +
+
+
+
+251
+252
+253
+254
+255
+
+
# File 'lib/openhab/core/things/thing.rb', line 251
+
+def method_missing(method, *args, &block)
+  return actions.public_send(method, *args, &block) if actions.respond_to?(method)
+
+  super
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #bridgeThing? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Thing, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+178
+179
+180
+
+
# File 'lib/openhab/core/things/thing.rb', line 178
+
+def bridge
+  bridge_uid && EntityLookup.lookup_thing(bridge_uid)
+end
+
+
+ + + +
+

+ + #bridge_uidThingUID? (readonly) + + + + + +

+
+

Return the Bridge UID when available.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+
+
# File 'lib/openhab/core/things/thing.rb', line 74
+
+module Thing
+  # Array wrapper class to allow searching a list of channels
+  # by channel id
+  class ChannelsArray < Array
+    def initialize(thing, array)
+      super(array)
+      @thing = thing
+    end
+
+    # Allows indexing by both integer as an array or channel id acting like a hash.
+    # @param [Integer, String, ChannelUID] index
+    #   Numeric index, string channel id, or a {ChannelUID} to search for.
+    # @return [Channel, nil]
+    def [](index)
+      return @thing.get_channel(index) if index.is_a?(ChannelUID)
+      return @thing.get_channel(index.to_str) if index.respond_to?(:to_str)
+
+      super
+    end
+  end
+
+  class << self
+    # @!visibility private
+    #
+    # Override to support Proxy
+    #
+    def ===(other)
+      other.is_a?(self)
+    end
+  end
+
+  #
+  # @!method uninitialized?
+  #   Check if thing status == UNINITIALIZED
+  #   @return [true,false]
+  #
+
+  #
+  # @!method initialized?
+  #   Check if thing status == INITIALIZED
+  #   @return [true,false]
+  #
+
+  #
+  # @!method unknown?
+  #   Check if thing status == UNKNOWN
+  #   @return [true,false]
+  #
+
+  #
+  # @!method online?
+  #   Check if thing status == ONLINE
+  #   @return [true,false]
+  #
+
+  #
+  # @!method offline?
+  #   Check if thing status == OFFLINE
+  #   @return [true,false]
+  #
+
+  #
+  # @!method removing?
+  #   Check if thing status == REMOVING
+  #   @return [true,false]
+  #
+
+  #
+  # @!method removed?
+  #   Check if thing status == REMOVED
+  #   @return [true,false]
+  #
+
+  ThingStatus.constants.each do |thingstatus|
+    define_method(:"#{thingstatus.to_s.downcase}?") { status == ThingStatus.value_of(thingstatus) }
+  end
+
+  #
+  # Enable the Thing
+  #
+  # @param [true, false] enabled
+  # @return [void]
+  #
+  def enable(enabled: true)
+    Things.manager.set_enabled(uid, enabled)
+  end
+
+  #
+  # Disable the Thing
+  #
+  # @return [void]
+  #
+  def disable
+    enable(enabled: false)
+  end
+
+  # @!attribute [r] thing_type
+  # @return [ThingType]
+  def thing_type
+    ThingType.registry.get_thing_type(thing_type_uid)
+  end
+
+  # @!attribute [r] bridge
+  # @return [Thing, nil]
+  def bridge
+    bridge_uid && EntityLookup.lookup_thing(bridge_uid)
+  end
+
+  # @return [true,false] true if this Thing is a bridge
+  def bridge?
+    is_a?(org.openhab.core.thing.Bridge)
+  end
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::Thing #{uid}"
+    r += " #{label.inspect}" if label
+    r += " (#{location.inspect})" if location
+    r += " #{status}"
+    unless status_info.status_detail == org.openhab.core.thing.ThingStatusDetail::NONE
+      r += " (#{status_info.status_detail})"
+    end
+    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  #
+  # Return Thing's uid as a string
+  #
+  # @return [String]
+  #
+  def to_s
+    uid.to_s
+  end
+
+  # @return [org.openhab.core.common.registry.Provider, nil]
+  def provider
+    Provider.registry.provider_for(uid)
+  end
+
+  #
+  # Fetches the actions available for this thing.
+  #
+  # Default scope actions are available directly on the thing object, via
+  # {#method_missing}.
+  #
+  # @param [String, nil] scope The action scope. Default's to the thing's binding.
+  # @return [Object, nil]
+  #
+  # @example
+  #   things["max:thermostat:mybridge:thermostat"].actions("max-devices").delete_from_cube
+  #
+  # @example (see #method_missing)
+  #
+  def actions(scope = nil)
+    $actions.get(scope || uid.binding_id, uid.to_s)
+  end
+
+  #
+  # Compares all attributes of the thing with another thing.
+  #
+  # @param other [Thing] The thing to compare with
+  # @return [true,false] true if all attributes are equal, false otherwise
+  #
+  def config_eql?(other)
+    # @deprecated OH3.4 - in OH4, channels can be included in the array and do not need to be compared separately
+    channels.to_a == other.channels.to_a &&
+      %i[uid label bridge_uid location configuration].all? { |method| send(method) == other.send(method) }
+  end
+
+  #
+  # Delegate missing methods to the thing's default actions scope.
+  #
+  # @example
+  #   things['mail:smtp:local'].send_email('me@example.com', 'subject', 'message')
+  #
+  def method_missing(method, *args, &block)
+    return actions.public_send(method, *args, &block) if actions.respond_to?(method)
+
+    super
+  end
+
+  # @!visibility private
+  def respond_to_missing?(method_name, _include_private = false)
+    logger.trace { "Checking if Thing #{uid} supports #{method_name} action" }
+    return true if actions.respond_to?(method_name)
+
+    super
+  end
+end
+
+
+ + + +
+

+ + #channelsChannelsArray (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+
+
# File 'lib/openhab/core/things/thing.rb', line 74
+
+module Thing
+  # Array wrapper class to allow searching a list of channels
+  # by channel id
+  class ChannelsArray < Array
+    def initialize(thing, array)
+      super(array)
+      @thing = thing
+    end
+
+    # Allows indexing by both integer as an array or channel id acting like a hash.
+    # @param [Integer, String, ChannelUID] index
+    #   Numeric index, string channel id, or a {ChannelUID} to search for.
+    # @return [Channel, nil]
+    def [](index)
+      return @thing.get_channel(index) if index.is_a?(ChannelUID)
+      return @thing.get_channel(index.to_str) if index.respond_to?(:to_str)
+
+      super
+    end
+  end
+
+  class << self
+    # @!visibility private
+    #
+    # Override to support Proxy
+    #
+    def ===(other)
+      other.is_a?(self)
+    end
+  end
+
+  #
+  # @!method uninitialized?
+  #   Check if thing status == UNINITIALIZED
+  #   @return [true,false]
+  #
+
+  #
+  # @!method initialized?
+  #   Check if thing status == INITIALIZED
+  #   @return [true,false]
+  #
+
+  #
+  # @!method unknown?
+  #   Check if thing status == UNKNOWN
+  #   @return [true,false]
+  #
+
+  #
+  # @!method online?
+  #   Check if thing status == ONLINE
+  #   @return [true,false]
+  #
+
+  #
+  # @!method offline?
+  #   Check if thing status == OFFLINE
+  #   @return [true,false]
+  #
+
+  #
+  # @!method removing?
+  #   Check if thing status == REMOVING
+  #   @return [true,false]
+  #
+
+  #
+  # @!method removed?
+  #   Check if thing status == REMOVED
+  #   @return [true,false]
+  #
+
+  ThingStatus.constants.each do |thingstatus|
+    define_method(:"#{thingstatus.to_s.downcase}?") { status == ThingStatus.value_of(thingstatus) }
+  end
+
+  #
+  # Enable the Thing
+  #
+  # @param [true, false] enabled
+  # @return [void]
+  #
+  def enable(enabled: true)
+    Things.manager.set_enabled(uid, enabled)
+  end
+
+  #
+  # Disable the Thing
+  #
+  # @return [void]
+  #
+  def disable
+    enable(enabled: false)
+  end
+
+  # @!attribute [r] thing_type
+  # @return [ThingType]
+  def thing_type
+    ThingType.registry.get_thing_type(thing_type_uid)
+  end
+
+  # @!attribute [r] bridge
+  # @return [Thing, nil]
+  def bridge
+    bridge_uid && EntityLookup.lookup_thing(bridge_uid)
+  end
+
+  # @return [true,false] true if this Thing is a bridge
+  def bridge?
+    is_a?(org.openhab.core.thing.Bridge)
+  end
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::Thing #{uid}"
+    r += " #{label.inspect}" if label
+    r += " (#{location.inspect})" if location
+    r += " #{status}"
+    unless status_info.status_detail == org.openhab.core.thing.ThingStatusDetail::NONE
+      r += " (#{status_info.status_detail})"
+    end
+    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  #
+  # Return Thing's uid as a string
+  #
+  # @return [String]
+  #
+  def to_s
+    uid.to_s
+  end
+
+  # @return [org.openhab.core.common.registry.Provider, nil]
+  def provider
+    Provider.registry.provider_for(uid)
+  end
+
+  #
+  # Fetches the actions available for this thing.
+  #
+  # Default scope actions are available directly on the thing object, via
+  # {#method_missing}.
+  #
+  # @param [String, nil] scope The action scope. Default's to the thing's binding.
+  # @return [Object, nil]
+  #
+  # @example
+  #   things["max:thermostat:mybridge:thermostat"].actions("max-devices").delete_from_cube
+  #
+  # @example (see #method_missing)
+  #
+  def actions(scope = nil)
+    $actions.get(scope || uid.binding_id, uid.to_s)
+  end
+
+  #
+  # Compares all attributes of the thing with another thing.
+  #
+  # @param other [Thing] The thing to compare with
+  # @return [true,false] true if all attributes are equal, false otherwise
+  #
+  def config_eql?(other)
+    # @deprecated OH3.4 - in OH4, channels can be included in the array and do not need to be compared separately
+    channels.to_a == other.channels.to_a &&
+      %i[uid label bridge_uid location configuration].all? { |method| send(method) == other.send(method) }
+  end
+
+  #
+  # Delegate missing methods to the thing's default actions scope.
+  #
+  # @example
+  #   things['mail:smtp:local'].send_email('me@example.com', 'subject', 'message')
+  #
+  def method_missing(method, *args, &block)
+    return actions.public_send(method, *args, &block) if actions.respond_to?(method)
+
+    super
+  end
+
+  # @!visibility private
+  def respond_to_missing?(method_name, _include_private = false)
+    logger.trace { "Checking if Thing #{uid} supports #{method_name} action" }
+    return true if actions.respond_to?(method_name)
+
+    super
+  end
+end
+
+
+ + + +
+

+ + #configurationOpenHAB::Core::Configuration (readonly) + + + + + +

+
+

Return the thing's configuration.

+ + +
+
+
+ +
+

Examples:

+ + +
logger.info things["smtp:mail:local"].configuration["hostname"]
+logger.info things["ipcamera:dahua:frontporch"].configuration["ipAddress"]
+ +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+
+
# File 'lib/openhab/core/things/thing.rb', line 74
+
+module Thing
+  # Array wrapper class to allow searching a list of channels
+  # by channel id
+  class ChannelsArray < Array
+    def initialize(thing, array)
+      super(array)
+      @thing = thing
+    end
+
+    # Allows indexing by both integer as an array or channel id acting like a hash.
+    # @param [Integer, String, ChannelUID] index
+    #   Numeric index, string channel id, or a {ChannelUID} to search for.
+    # @return [Channel, nil]
+    def [](index)
+      return @thing.get_channel(index) if index.is_a?(ChannelUID)
+      return @thing.get_channel(index.to_str) if index.respond_to?(:to_str)
+
+      super
+    end
+  end
+
+  class << self
+    # @!visibility private
+    #
+    # Override to support Proxy
+    #
+    def ===(other)
+      other.is_a?(self)
+    end
+  end
+
+  #
+  # @!method uninitialized?
+  #   Check if thing status == UNINITIALIZED
+  #   @return [true,false]
+  #
+
+  #
+  # @!method initialized?
+  #   Check if thing status == INITIALIZED
+  #   @return [true,false]
+  #
+
+  #
+  # @!method unknown?
+  #   Check if thing status == UNKNOWN
+  #   @return [true,false]
+  #
+
+  #
+  # @!method online?
+  #   Check if thing status == ONLINE
+  #   @return [true,false]
+  #
+
+  #
+  # @!method offline?
+  #   Check if thing status == OFFLINE
+  #   @return [true,false]
+  #
+
+  #
+  # @!method removing?
+  #   Check if thing status == REMOVING
+  #   @return [true,false]
+  #
+
+  #
+  # @!method removed?
+  #   Check if thing status == REMOVED
+  #   @return [true,false]
+  #
+
+  ThingStatus.constants.each do |thingstatus|
+    define_method(:"#{thingstatus.to_s.downcase}?") { status == ThingStatus.value_of(thingstatus) }
+  end
+
+  #
+  # Enable the Thing
+  #
+  # @param [true, false] enabled
+  # @return [void]
+  #
+  def enable(enabled: true)
+    Things.manager.set_enabled(uid, enabled)
+  end
+
+  #
+  # Disable the Thing
+  #
+  # @return [void]
+  #
+  def disable
+    enable(enabled: false)
+  end
+
+  # @!attribute [r] thing_type
+  # @return [ThingType]
+  def thing_type
+    ThingType.registry.get_thing_type(thing_type_uid)
+  end
+
+  # @!attribute [r] bridge
+  # @return [Thing, nil]
+  def bridge
+    bridge_uid && EntityLookup.lookup_thing(bridge_uid)
+  end
+
+  # @return [true,false] true if this Thing is a bridge
+  def bridge?
+    is_a?(org.openhab.core.thing.Bridge)
+  end
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::Thing #{uid}"
+    r += " #{label.inspect}" if label
+    r += " (#{location.inspect})" if location
+    r += " #{status}"
+    unless status_info.status_detail == org.openhab.core.thing.ThingStatusDetail::NONE
+      r += " (#{status_info.status_detail})"
+    end
+    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  #
+  # Return Thing's uid as a string
+  #
+  # @return [String]
+  #
+  def to_s
+    uid.to_s
+  end
+
+  # @return [org.openhab.core.common.registry.Provider, nil]
+  def provider
+    Provider.registry.provider_for(uid)
+  end
+
+  #
+  # Fetches the actions available for this thing.
+  #
+  # Default scope actions are available directly on the thing object, via
+  # {#method_missing}.
+  #
+  # @param [String, nil] scope The action scope. Default's to the thing's binding.
+  # @return [Object, nil]
+  #
+  # @example
+  #   things["max:thermostat:mybridge:thermostat"].actions("max-devices").delete_from_cube
+  #
+  # @example (see #method_missing)
+  #
+  def actions(scope = nil)
+    $actions.get(scope || uid.binding_id, uid.to_s)
+  end
+
+  #
+  # Compares all attributes of the thing with another thing.
+  #
+  # @param other [Thing] The thing to compare with
+  # @return [true,false] true if all attributes are equal, false otherwise
+  #
+  def config_eql?(other)
+    # @deprecated OH3.4 - in OH4, channels can be included in the array and do not need to be compared separately
+    channels.to_a == other.channels.to_a &&
+      %i[uid label bridge_uid location configuration].all? { |method| send(method) == other.send(method) }
+  end
+
+  #
+  # Delegate missing methods to the thing's default actions scope.
+  #
+  # @example
+  #   things['mail:smtp:local'].send_email('me@example.com', 'subject', 'message')
+  #
+  def method_missing(method, *args, &block)
+    return actions.public_send(method, *args, &block) if actions.respond_to?(method)
+
+    super
+  end
+
+  # @!visibility private
+  def respond_to_missing?(method_name, _include_private = false)
+    logger.trace { "Checking if Thing #{uid} supports #{method_name} action" }
+    return true if actions.respond_to?(method_name)
+
+    super
+  end
+end
+
+
+ + + +
+

+ + #labelString + + + + + +

+
+

Return the thing label

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+
+
# File 'lib/openhab/core/things/thing.rb', line 74
+
+module Thing
+  # Array wrapper class to allow searching a list of channels
+  # by channel id
+  class ChannelsArray < Array
+    def initialize(thing, array)
+      super(array)
+      @thing = thing
+    end
+
+    # Allows indexing by both integer as an array or channel id acting like a hash.
+    # @param [Integer, String, ChannelUID] index
+    #   Numeric index, string channel id, or a {ChannelUID} to search for.
+    # @return [Channel, nil]
+    def [](index)
+      return @thing.get_channel(index) if index.is_a?(ChannelUID)
+      return @thing.get_channel(index.to_str) if index.respond_to?(:to_str)
+
+      super
+    end
+  end
+
+  class << self
+    # @!visibility private
+    #
+    # Override to support Proxy
+    #
+    def ===(other)
+      other.is_a?(self)
+    end
+  end
+
+  #
+  # @!method uninitialized?
+  #   Check if thing status == UNINITIALIZED
+  #   @return [true,false]
+  #
+
+  #
+  # @!method initialized?
+  #   Check if thing status == INITIALIZED
+  #   @return [true,false]
+  #
+
+  #
+  # @!method unknown?
+  #   Check if thing status == UNKNOWN
+  #   @return [true,false]
+  #
+
+  #
+  # @!method online?
+  #   Check if thing status == ONLINE
+  #   @return [true,false]
+  #
+
+  #
+  # @!method offline?
+  #   Check if thing status == OFFLINE
+  #   @return [true,false]
+  #
+
+  #
+  # @!method removing?
+  #   Check if thing status == REMOVING
+  #   @return [true,false]
+  #
+
+  #
+  # @!method removed?
+  #   Check if thing status == REMOVED
+  #   @return [true,false]
+  #
+
+  ThingStatus.constants.each do |thingstatus|
+    define_method(:"#{thingstatus.to_s.downcase}?") { status == ThingStatus.value_of(thingstatus) }
+  end
+
+  #
+  # Enable the Thing
+  #
+  # @param [true, false] enabled
+  # @return [void]
+  #
+  def enable(enabled: true)
+    Things.manager.set_enabled(uid, enabled)
+  end
+
+  #
+  # Disable the Thing
+  #
+  # @return [void]
+  #
+  def disable
+    enable(enabled: false)
+  end
+
+  # @!attribute [r] thing_type
+  # @return [ThingType]
+  def thing_type
+    ThingType.registry.get_thing_type(thing_type_uid)
+  end
+
+  # @!attribute [r] bridge
+  # @return [Thing, nil]
+  def bridge
+    bridge_uid && EntityLookup.lookup_thing(bridge_uid)
+  end
+
+  # @return [true,false] true if this Thing is a bridge
+  def bridge?
+    is_a?(org.openhab.core.thing.Bridge)
+  end
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::Thing #{uid}"
+    r += " #{label.inspect}" if label
+    r += " (#{location.inspect})" if location
+    r += " #{status}"
+    unless status_info.status_detail == org.openhab.core.thing.ThingStatusDetail::NONE
+      r += " (#{status_info.status_detail})"
+    end
+    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  #
+  # Return Thing's uid as a string
+  #
+  # @return [String]
+  #
+  def to_s
+    uid.to_s
+  end
+
+  # @return [org.openhab.core.common.registry.Provider, nil]
+  def provider
+    Provider.registry.provider_for(uid)
+  end
+
+  #
+  # Fetches the actions available for this thing.
+  #
+  # Default scope actions are available directly on the thing object, via
+  # {#method_missing}.
+  #
+  # @param [String, nil] scope The action scope. Default's to the thing's binding.
+  # @return [Object, nil]
+  #
+  # @example
+  #   things["max:thermostat:mybridge:thermostat"].actions("max-devices").delete_from_cube
+  #
+  # @example (see #method_missing)
+  #
+  def actions(scope = nil)
+    $actions.get(scope || uid.binding_id, uid.to_s)
+  end
+
+  #
+  # Compares all attributes of the thing with another thing.
+  #
+  # @param other [Thing] The thing to compare with
+  # @return [true,false] true if all attributes are equal, false otherwise
+  #
+  def config_eql?(other)
+    # @deprecated OH3.4 - in OH4, channels can be included in the array and do not need to be compared separately
+    channels.to_a == other.channels.to_a &&
+      %i[uid label bridge_uid location configuration].all? { |method| send(method) == other.send(method) }
+  end
+
+  #
+  # Delegate missing methods to the thing's default actions scope.
+  #
+  # @example
+  #   things['mail:smtp:local'].send_email('me@example.com', 'subject', 'message')
+  #
+  def method_missing(method, *args, &block)
+    return actions.public_send(method, *args, &block) if actions.respond_to?(method)
+
+    super
+  end
+
+  # @!visibility private
+  def respond_to_missing?(method_name, _include_private = false)
+    logger.trace { "Checking if Thing #{uid} supports #{method_name} action" }
+    return true if actions.respond_to?(method_name)
+
+    super
+  end
+end
+
+
+ + + +
+

+ + #locationString + + + + + +

+
+

Return the thing location

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+
+
# File 'lib/openhab/core/things/thing.rb', line 74
+
+module Thing
+  # Array wrapper class to allow searching a list of channels
+  # by channel id
+  class ChannelsArray < Array
+    def initialize(thing, array)
+      super(array)
+      @thing = thing
+    end
+
+    # Allows indexing by both integer as an array or channel id acting like a hash.
+    # @param [Integer, String, ChannelUID] index
+    #   Numeric index, string channel id, or a {ChannelUID} to search for.
+    # @return [Channel, nil]
+    def [](index)
+      return @thing.get_channel(index) if index.is_a?(ChannelUID)
+      return @thing.get_channel(index.to_str) if index.respond_to?(:to_str)
+
+      super
+    end
+  end
+
+  class << self
+    # @!visibility private
+    #
+    # Override to support Proxy
+    #
+    def ===(other)
+      other.is_a?(self)
+    end
+  end
+
+  #
+  # @!method uninitialized?
+  #   Check if thing status == UNINITIALIZED
+  #   @return [true,false]
+  #
+
+  #
+  # @!method initialized?
+  #   Check if thing status == INITIALIZED
+  #   @return [true,false]
+  #
+
+  #
+  # @!method unknown?
+  #   Check if thing status == UNKNOWN
+  #   @return [true,false]
+  #
+
+  #
+  # @!method online?
+  #   Check if thing status == ONLINE
+  #   @return [true,false]
+  #
+
+  #
+  # @!method offline?
+  #   Check if thing status == OFFLINE
+  #   @return [true,false]
+  #
+
+  #
+  # @!method removing?
+  #   Check if thing status == REMOVING
+  #   @return [true,false]
+  #
+
+  #
+  # @!method removed?
+  #   Check if thing status == REMOVED
+  #   @return [true,false]
+  #
+
+  ThingStatus.constants.each do |thingstatus|
+    define_method(:"#{thingstatus.to_s.downcase}?") { status == ThingStatus.value_of(thingstatus) }
+  end
+
+  #
+  # Enable the Thing
+  #
+  # @param [true, false] enabled
+  # @return [void]
+  #
+  def enable(enabled: true)
+    Things.manager.set_enabled(uid, enabled)
+  end
+
+  #
+  # Disable the Thing
+  #
+  # @return [void]
+  #
+  def disable
+    enable(enabled: false)
+  end
+
+  # @!attribute [r] thing_type
+  # @return [ThingType]
+  def thing_type
+    ThingType.registry.get_thing_type(thing_type_uid)
+  end
+
+  # @!attribute [r] bridge
+  # @return [Thing, nil]
+  def bridge
+    bridge_uid && EntityLookup.lookup_thing(bridge_uid)
+  end
+
+  # @return [true,false] true if this Thing is a bridge
+  def bridge?
+    is_a?(org.openhab.core.thing.Bridge)
+  end
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::Thing #{uid}"
+    r += " #{label.inspect}" if label
+    r += " (#{location.inspect})" if location
+    r += " #{status}"
+    unless status_info.status_detail == org.openhab.core.thing.ThingStatusDetail::NONE
+      r += " (#{status_info.status_detail})"
+    end
+    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  #
+  # Return Thing's uid as a string
+  #
+  # @return [String]
+  #
+  def to_s
+    uid.to_s
+  end
+
+  # @return [org.openhab.core.common.registry.Provider, nil]
+  def provider
+    Provider.registry.provider_for(uid)
+  end
+
+  #
+  # Fetches the actions available for this thing.
+  #
+  # Default scope actions are available directly on the thing object, via
+  # {#method_missing}.
+  #
+  # @param [String, nil] scope The action scope. Default's to the thing's binding.
+  # @return [Object, nil]
+  #
+  # @example
+  #   things["max:thermostat:mybridge:thermostat"].actions("max-devices").delete_from_cube
+  #
+  # @example (see #method_missing)
+  #
+  def actions(scope = nil)
+    $actions.get(scope || uid.binding_id, uid.to_s)
+  end
+
+  #
+  # Compares all attributes of the thing with another thing.
+  #
+  # @param other [Thing] The thing to compare with
+  # @return [true,false] true if all attributes are equal, false otherwise
+  #
+  def config_eql?(other)
+    # @deprecated OH3.4 - in OH4, channels can be included in the array and do not need to be compared separately
+    channels.to_a == other.channels.to_a &&
+      %i[uid label bridge_uid location configuration].all? { |method| send(method) == other.send(method) }
+  end
+
+  #
+  # Delegate missing methods to the thing's default actions scope.
+  #
+  # @example
+  #   things['mail:smtp:local'].send_email('me@example.com', 'subject', 'message')
+  #
+  def method_missing(method, *args, &block)
+    return actions.public_send(method, *args, &block) if actions.respond_to?(method)
+
+    super
+  end
+
+  # @!visibility private
+  def respond_to_missing?(method_name, _include_private = false)
+    logger.trace { "Checking if Thing #{uid} supports #{method_name} action" }
+    return true if actions.respond_to?(method_name)
+
+    super
+  end
+end
+
+
+ + + +
+

+ + #propertiesHash (readonly) + + + + + +

+
+

Return the properties when available.

+ + +
+
+
+ +
+

Examples:

+ + +
logger.info things["fronius:meter:mybridge:mymeter"].properties["modelId"]
+ +
+ +

Returns:

+
    + +
  • + + + (Hash) + + + +
  • + +
+ +
+ + + + +
+
+
+
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+
+
# File 'lib/openhab/core/things/thing.rb', line 74
+
+module Thing
+  # Array wrapper class to allow searching a list of channels
+  # by channel id
+  class ChannelsArray < Array
+    def initialize(thing, array)
+      super(array)
+      @thing = thing
+    end
+
+    # Allows indexing by both integer as an array or channel id acting like a hash.
+    # @param [Integer, String, ChannelUID] index
+    #   Numeric index, string channel id, or a {ChannelUID} to search for.
+    # @return [Channel, nil]
+    def [](index)
+      return @thing.get_channel(index) if index.is_a?(ChannelUID)
+      return @thing.get_channel(index.to_str) if index.respond_to?(:to_str)
+
+      super
+    end
+  end
+
+  class << self
+    # @!visibility private
+    #
+    # Override to support Proxy
+    #
+    def ===(other)
+      other.is_a?(self)
+    end
+  end
+
+  #
+  # @!method uninitialized?
+  #   Check if thing status == UNINITIALIZED
+  #   @return [true,false]
+  #
+
+  #
+  # @!method initialized?
+  #   Check if thing status == INITIALIZED
+  #   @return [true,false]
+  #
+
+  #
+  # @!method unknown?
+  #   Check if thing status == UNKNOWN
+  #   @return [true,false]
+  #
+
+  #
+  # @!method online?
+  #   Check if thing status == ONLINE
+  #   @return [true,false]
+  #
+
+  #
+  # @!method offline?
+  #   Check if thing status == OFFLINE
+  #   @return [true,false]
+  #
+
+  #
+  # @!method removing?
+  #   Check if thing status == REMOVING
+  #   @return [true,false]
+  #
+
+  #
+  # @!method removed?
+  #   Check if thing status == REMOVED
+  #   @return [true,false]
+  #
+
+  ThingStatus.constants.each do |thingstatus|
+    define_method(:"#{thingstatus.to_s.downcase}?") { status == ThingStatus.value_of(thingstatus) }
+  end
+
+  #
+  # Enable the Thing
+  #
+  # @param [true, false] enabled
+  # @return [void]
+  #
+  def enable(enabled: true)
+    Things.manager.set_enabled(uid, enabled)
+  end
+
+  #
+  # Disable the Thing
+  #
+  # @return [void]
+  #
+  def disable
+    enable(enabled: false)
+  end
+
+  # @!attribute [r] thing_type
+  # @return [ThingType]
+  def thing_type
+    ThingType.registry.get_thing_type(thing_type_uid)
+  end
+
+  # @!attribute [r] bridge
+  # @return [Thing, nil]
+  def bridge
+    bridge_uid && EntityLookup.lookup_thing(bridge_uid)
+  end
+
+  # @return [true,false] true if this Thing is a bridge
+  def bridge?
+    is_a?(org.openhab.core.thing.Bridge)
+  end
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::Thing #{uid}"
+    r += " #{label.inspect}" if label
+    r += " (#{location.inspect})" if location
+    r += " #{status}"
+    unless status_info.status_detail == org.openhab.core.thing.ThingStatusDetail::NONE
+      r += " (#{status_info.status_detail})"
+    end
+    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  #
+  # Return Thing's uid as a string
+  #
+  # @return [String]
+  #
+  def to_s
+    uid.to_s
+  end
+
+  # @return [org.openhab.core.common.registry.Provider, nil]
+  def provider
+    Provider.registry.provider_for(uid)
+  end
+
+  #
+  # Fetches the actions available for this thing.
+  #
+  # Default scope actions are available directly on the thing object, via
+  # {#method_missing}.
+  #
+  # @param [String, nil] scope The action scope. Default's to the thing's binding.
+  # @return [Object, nil]
+  #
+  # @example
+  #   things["max:thermostat:mybridge:thermostat"].actions("max-devices").delete_from_cube
+  #
+  # @example (see #method_missing)
+  #
+  def actions(scope = nil)
+    $actions.get(scope || uid.binding_id, uid.to_s)
+  end
+
+  #
+  # Compares all attributes of the thing with another thing.
+  #
+  # @param other [Thing] The thing to compare with
+  # @return [true,false] true if all attributes are equal, false otherwise
+  #
+  def config_eql?(other)
+    # @deprecated OH3.4 - in OH4, channels can be included in the array and do not need to be compared separately
+    channels.to_a == other.channels.to_a &&
+      %i[uid label bridge_uid location configuration].all? { |method| send(method) == other.send(method) }
+  end
+
+  #
+  # Delegate missing methods to the thing's default actions scope.
+  #
+  # @example
+  #   things['mail:smtp:local'].send_email('me@example.com', 'subject', 'message')
+  #
+  def method_missing(method, *args, &block)
+    return actions.public_send(method, *args, &block) if actions.respond_to?(method)
+
+    super
+  end
+
+  # @!visibility private
+  def respond_to_missing?(method_name, _include_private = false)
+    logger.trace { "Checking if Thing #{uid} supports #{method_name} action" }
+    return true if actions.respond_to?(method_name)
+
+    super
+  end
+end
+
+
+ + + +
+

+ + #statusorg.openhab.core.thing.ThingStatus (readonly) + + + + + +

+
+

Return the thing status

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+
+
# File 'lib/openhab/core/things/thing.rb', line 74
+
+module Thing
+  # Array wrapper class to allow searching a list of channels
+  # by channel id
+  class ChannelsArray < Array
+    def initialize(thing, array)
+      super(array)
+      @thing = thing
+    end
+
+    # Allows indexing by both integer as an array or channel id acting like a hash.
+    # @param [Integer, String, ChannelUID] index
+    #   Numeric index, string channel id, or a {ChannelUID} to search for.
+    # @return [Channel, nil]
+    def [](index)
+      return @thing.get_channel(index) if index.is_a?(ChannelUID)
+      return @thing.get_channel(index.to_str) if index.respond_to?(:to_str)
+
+      super
+    end
+  end
+
+  class << self
+    # @!visibility private
+    #
+    # Override to support Proxy
+    #
+    def ===(other)
+      other.is_a?(self)
+    end
+  end
+
+  #
+  # @!method uninitialized?
+  #   Check if thing status == UNINITIALIZED
+  #   @return [true,false]
+  #
+
+  #
+  # @!method initialized?
+  #   Check if thing status == INITIALIZED
+  #   @return [true,false]
+  #
+
+  #
+  # @!method unknown?
+  #   Check if thing status == UNKNOWN
+  #   @return [true,false]
+  #
+
+  #
+  # @!method online?
+  #   Check if thing status == ONLINE
+  #   @return [true,false]
+  #
+
+  #
+  # @!method offline?
+  #   Check if thing status == OFFLINE
+  #   @return [true,false]
+  #
+
+  #
+  # @!method removing?
+  #   Check if thing status == REMOVING
+  #   @return [true,false]
+  #
+
+  #
+  # @!method removed?
+  #   Check if thing status == REMOVED
+  #   @return [true,false]
+  #
+
+  ThingStatus.constants.each do |thingstatus|
+    define_method(:"#{thingstatus.to_s.downcase}?") { status == ThingStatus.value_of(thingstatus) }
+  end
+
+  #
+  # Enable the Thing
+  #
+  # @param [true, false] enabled
+  # @return [void]
+  #
+  def enable(enabled: true)
+    Things.manager.set_enabled(uid, enabled)
+  end
+
+  #
+  # Disable the Thing
+  #
+  # @return [void]
+  #
+  def disable
+    enable(enabled: false)
+  end
+
+  # @!attribute [r] thing_type
+  # @return [ThingType]
+  def thing_type
+    ThingType.registry.get_thing_type(thing_type_uid)
+  end
+
+  # @!attribute [r] bridge
+  # @return [Thing, nil]
+  def bridge
+    bridge_uid && EntityLookup.lookup_thing(bridge_uid)
+  end
+
+  # @return [true,false] true if this Thing is a bridge
+  def bridge?
+    is_a?(org.openhab.core.thing.Bridge)
+  end
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::Thing #{uid}"
+    r += " #{label.inspect}" if label
+    r += " (#{location.inspect})" if location
+    r += " #{status}"
+    unless status_info.status_detail == org.openhab.core.thing.ThingStatusDetail::NONE
+      r += " (#{status_info.status_detail})"
+    end
+    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  #
+  # Return Thing's uid as a string
+  #
+  # @return [String]
+  #
+  def to_s
+    uid.to_s
+  end
+
+  # @return [org.openhab.core.common.registry.Provider, nil]
+  def provider
+    Provider.registry.provider_for(uid)
+  end
+
+  #
+  # Fetches the actions available for this thing.
+  #
+  # Default scope actions are available directly on the thing object, via
+  # {#method_missing}.
+  #
+  # @param [String, nil] scope The action scope. Default's to the thing's binding.
+  # @return [Object, nil]
+  #
+  # @example
+  #   things["max:thermostat:mybridge:thermostat"].actions("max-devices").delete_from_cube
+  #
+  # @example (see #method_missing)
+  #
+  def actions(scope = nil)
+    $actions.get(scope || uid.binding_id, uid.to_s)
+  end
+
+  #
+  # Compares all attributes of the thing with another thing.
+  #
+  # @param other [Thing] The thing to compare with
+  # @return [true,false] true if all attributes are equal, false otherwise
+  #
+  def config_eql?(other)
+    # @deprecated OH3.4 - in OH4, channels can be included in the array and do not need to be compared separately
+    channels.to_a == other.channels.to_a &&
+      %i[uid label bridge_uid location configuration].all? { |method| send(method) == other.send(method) }
+  end
+
+  #
+  # Delegate missing methods to the thing's default actions scope.
+  #
+  # @example
+  #   things['mail:smtp:local'].send_email('me@example.com', 'subject', 'message')
+  #
+  def method_missing(method, *args, &block)
+    return actions.public_send(method, *args, &block) if actions.respond_to?(method)
+
+    super
+  end
+
+  # @!visibility private
+  def respond_to_missing?(method_name, _include_private = false)
+    logger.trace { "Checking if Thing #{uid} supports #{method_name} action" }
+    return true if actions.respond_to?(method_name)
+
+    super
+  end
+end
+
+
+ + + +
+

+ + #thing_typeThingType (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+172
+173
+174
+
+
# File 'lib/openhab/core/things/thing.rb', line 172
+
+def thing_type
+  ThingType.registry.get_thing_type(thing_type_uid)
+end
+
+
+ + + +
+

+ + #thing_type_uidThingTypeUID (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+
+
# File 'lib/openhab/core/things/thing.rb', line 74
+
+module Thing
+  # Array wrapper class to allow searching a list of channels
+  # by channel id
+  class ChannelsArray < Array
+    def initialize(thing, array)
+      super(array)
+      @thing = thing
+    end
+
+    # Allows indexing by both integer as an array or channel id acting like a hash.
+    # @param [Integer, String, ChannelUID] index
+    #   Numeric index, string channel id, or a {ChannelUID} to search for.
+    # @return [Channel, nil]
+    def [](index)
+      return @thing.get_channel(index) if index.is_a?(ChannelUID)
+      return @thing.get_channel(index.to_str) if index.respond_to?(:to_str)
+
+      super
+    end
+  end
+
+  class << self
+    # @!visibility private
+    #
+    # Override to support Proxy
+    #
+    def ===(other)
+      other.is_a?(self)
+    end
+  end
+
+  #
+  # @!method uninitialized?
+  #   Check if thing status == UNINITIALIZED
+  #   @return [true,false]
+  #
+
+  #
+  # @!method initialized?
+  #   Check if thing status == INITIALIZED
+  #   @return [true,false]
+  #
+
+  #
+  # @!method unknown?
+  #   Check if thing status == UNKNOWN
+  #   @return [true,false]
+  #
+
+  #
+  # @!method online?
+  #   Check if thing status == ONLINE
+  #   @return [true,false]
+  #
+
+  #
+  # @!method offline?
+  #   Check if thing status == OFFLINE
+  #   @return [true,false]
+  #
+
+  #
+  # @!method removing?
+  #   Check if thing status == REMOVING
+  #   @return [true,false]
+  #
+
+  #
+  # @!method removed?
+  #   Check if thing status == REMOVED
+  #   @return [true,false]
+  #
+
+  ThingStatus.constants.each do |thingstatus|
+    define_method(:"#{thingstatus.to_s.downcase}?") { status == ThingStatus.value_of(thingstatus) }
+  end
+
+  #
+  # Enable the Thing
+  #
+  # @param [true, false] enabled
+  # @return [void]
+  #
+  def enable(enabled: true)
+    Things.manager.set_enabled(uid, enabled)
+  end
+
+  #
+  # Disable the Thing
+  #
+  # @return [void]
+  #
+  def disable
+    enable(enabled: false)
+  end
+
+  # @!attribute [r] thing_type
+  # @return [ThingType]
+  def thing_type
+    ThingType.registry.get_thing_type(thing_type_uid)
+  end
+
+  # @!attribute [r] bridge
+  # @return [Thing, nil]
+  def bridge
+    bridge_uid && EntityLookup.lookup_thing(bridge_uid)
+  end
+
+  # @return [true,false] true if this Thing is a bridge
+  def bridge?
+    is_a?(org.openhab.core.thing.Bridge)
+  end
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::Thing #{uid}"
+    r += " #{label.inspect}" if label
+    r += " (#{location.inspect})" if location
+    r += " #{status}"
+    unless status_info.status_detail == org.openhab.core.thing.ThingStatusDetail::NONE
+      r += " (#{status_info.status_detail})"
+    end
+    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  #
+  # Return Thing's uid as a string
+  #
+  # @return [String]
+  #
+  def to_s
+    uid.to_s
+  end
+
+  # @return [org.openhab.core.common.registry.Provider, nil]
+  def provider
+    Provider.registry.provider_for(uid)
+  end
+
+  #
+  # Fetches the actions available for this thing.
+  #
+  # Default scope actions are available directly on the thing object, via
+  # {#method_missing}.
+  #
+  # @param [String, nil] scope The action scope. Default's to the thing's binding.
+  # @return [Object, nil]
+  #
+  # @example
+  #   things["max:thermostat:mybridge:thermostat"].actions("max-devices").delete_from_cube
+  #
+  # @example (see #method_missing)
+  #
+  def actions(scope = nil)
+    $actions.get(scope || uid.binding_id, uid.to_s)
+  end
+
+  #
+  # Compares all attributes of the thing with another thing.
+  #
+  # @param other [Thing] The thing to compare with
+  # @return [true,false] true if all attributes are equal, false otherwise
+  #
+  def config_eql?(other)
+    # @deprecated OH3.4 - in OH4, channels can be included in the array and do not need to be compared separately
+    channels.to_a == other.channels.to_a &&
+      %i[uid label bridge_uid location configuration].all? { |method| send(method) == other.send(method) }
+  end
+
+  #
+  # Delegate missing methods to the thing's default actions scope.
+  #
+  # @example
+  #   things['mail:smtp:local'].send_email('me@example.com', 'subject', 'message')
+  #
+  def method_missing(method, *args, &block)
+    return actions.public_send(method, *args, &block) if actions.respond_to?(method)
+
+    super
+  end
+
+  # @!visibility private
+  def respond_to_missing?(method_name, _include_private = false)
+    logger.trace { "Checking if Thing #{uid} supports #{method_name} action" }
+    return true if actions.respond_to?(method_name)
+
+    super
+  end
+end
+
+
+ + + +
+

+ + #uidThingUID (readonly) + + + + + +

+
+

Return the UID.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+
+
# File 'lib/openhab/core/things/thing.rb', line 74
+
+module Thing
+  # Array wrapper class to allow searching a list of channels
+  # by channel id
+  class ChannelsArray < Array
+    def initialize(thing, array)
+      super(array)
+      @thing = thing
+    end
+
+    # Allows indexing by both integer as an array or channel id acting like a hash.
+    # @param [Integer, String, ChannelUID] index
+    #   Numeric index, string channel id, or a {ChannelUID} to search for.
+    # @return [Channel, nil]
+    def [](index)
+      return @thing.get_channel(index) if index.is_a?(ChannelUID)
+      return @thing.get_channel(index.to_str) if index.respond_to?(:to_str)
+
+      super
+    end
+  end
+
+  class << self
+    # @!visibility private
+    #
+    # Override to support Proxy
+    #
+    def ===(other)
+      other.is_a?(self)
+    end
+  end
+
+  #
+  # @!method uninitialized?
+  #   Check if thing status == UNINITIALIZED
+  #   @return [true,false]
+  #
+
+  #
+  # @!method initialized?
+  #   Check if thing status == INITIALIZED
+  #   @return [true,false]
+  #
+
+  #
+  # @!method unknown?
+  #   Check if thing status == UNKNOWN
+  #   @return [true,false]
+  #
+
+  #
+  # @!method online?
+  #   Check if thing status == ONLINE
+  #   @return [true,false]
+  #
+
+  #
+  # @!method offline?
+  #   Check if thing status == OFFLINE
+  #   @return [true,false]
+  #
+
+  #
+  # @!method removing?
+  #   Check if thing status == REMOVING
+  #   @return [true,false]
+  #
+
+  #
+  # @!method removed?
+  #   Check if thing status == REMOVED
+  #   @return [true,false]
+  #
+
+  ThingStatus.constants.each do |thingstatus|
+    define_method(:"#{thingstatus.to_s.downcase}?") { status == ThingStatus.value_of(thingstatus) }
+  end
+
+  #
+  # Enable the Thing
+  #
+  # @param [true, false] enabled
+  # @return [void]
+  #
+  def enable(enabled: true)
+    Things.manager.set_enabled(uid, enabled)
+  end
+
+  #
+  # Disable the Thing
+  #
+  # @return [void]
+  #
+  def disable
+    enable(enabled: false)
+  end
+
+  # @!attribute [r] thing_type
+  # @return [ThingType]
+  def thing_type
+    ThingType.registry.get_thing_type(thing_type_uid)
+  end
+
+  # @!attribute [r] bridge
+  # @return [Thing, nil]
+  def bridge
+    bridge_uid && EntityLookup.lookup_thing(bridge_uid)
+  end
+
+  # @return [true,false] true if this Thing is a bridge
+  def bridge?
+    is_a?(org.openhab.core.thing.Bridge)
+  end
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::Thing #{uid}"
+    r += " #{label.inspect}" if label
+    r += " (#{location.inspect})" if location
+    r += " #{status}"
+    unless status_info.status_detail == org.openhab.core.thing.ThingStatusDetail::NONE
+      r += " (#{status_info.status_detail})"
+    end
+    r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  #
+  # Return Thing's uid as a string
+  #
+  # @return [String]
+  #
+  def to_s
+    uid.to_s
+  end
+
+  # @return [org.openhab.core.common.registry.Provider, nil]
+  def provider
+    Provider.registry.provider_for(uid)
+  end
+
+  #
+  # Fetches the actions available for this thing.
+  #
+  # Default scope actions are available directly on the thing object, via
+  # {#method_missing}.
+  #
+  # @param [String, nil] scope The action scope. Default's to the thing's binding.
+  # @return [Object, nil]
+  #
+  # @example
+  #   things["max:thermostat:mybridge:thermostat"].actions("max-devices").delete_from_cube
+  #
+  # @example (see #method_missing)
+  #
+  def actions(scope = nil)
+    $actions.get(scope || uid.binding_id, uid.to_s)
+  end
+
+  #
+  # Compares all attributes of the thing with another thing.
+  #
+  # @param other [Thing] The thing to compare with
+  # @return [true,false] true if all attributes are equal, false otherwise
+  #
+  def config_eql?(other)
+    # @deprecated OH3.4 - in OH4, channels can be included in the array and do not need to be compared separately
+    channels.to_a == other.channels.to_a &&
+      %i[uid label bridge_uid location configuration].all? { |method| send(method) == other.send(method) }
+  end
+
+  #
+  # Delegate missing methods to the thing's default actions scope.
+  #
+  # @example
+  #   things['mail:smtp:local'].send_email('me@example.com', 'subject', 'message')
+  #
+  def method_missing(method, *args, &block)
+    return actions.public_send(method, *args, &block) if actions.respond_to?(method)
+
+    super
+  end
+
+  # @!visibility private
+  def respond_to_missing?(method_name, _include_private = false)
+    logger.trace { "Checking if Thing #{uid} supports #{method_name} action" }
+    return true if actions.respond_to?(method_name)
+
+    super
+  end
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #actions(scope = nil) ⇒ Object? + + + + + +

+
+

Fetches the actions available for this thing.

+

Default scope actions are available directly on the thing object, via +#method_missing.

+ + +
+
+
+ +
+

Examples:

+ + +
things["max:thermostat:mybridge:thermostat"].actions("max-devices").delete_from_cube
+ + +
things['mail:smtp:local'].send_email('me@example.com', 'subject', 'message')
+ +
+

Parameters:

+
    + +
  • + + scope + + + (String, nil) + + + (defaults to: nil) + + + — +

    The action scope. Default's to the thing's binding.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Object, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+229
+230
+231
+
+
# File 'lib/openhab/core/things/thing.rb', line 229
+
+def actions(scope = nil)
+  $actions.get(scope || uid.binding_id, uid.to_s)
+end
+
+
+ +
+

+ + #bridge?true, false + + + + + +

+
+

Returns true if this Thing is a bridge.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    true if this Thing is a bridge

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+183
+184
+185
+
+
# File 'lib/openhab/core/things/thing.rb', line 183
+
+def bridge?
+  is_a?(org.openhab.core.thing.Bridge)
+end
+
+
+ +
+

+ + #config_eql?(other) ⇒ true, false + + + + + +

+
+

Compares all attributes of the thing with another thing.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Thing) + + + + — +

    The thing to compare with

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    true if all attributes are equal, false otherwise

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+239
+240
+241
+242
+243
+
+
# File 'lib/openhab/core/things/thing.rb', line 239
+
+def config_eql?(other)
+  # @deprecated OH3.4 - in OH4, channels can be included in the array and do not need to be compared separately
+  channels.to_a == other.channels.to_a &&
+    %i[uid label bridge_uid location configuration].all? { |method| send(method) == other.send(method) }
+end
+
+
+ +
+

+ + #disablevoid + + + + + +

+
+

This method returns an undefined value.

Disable the Thing

+ + +
+
+
+ + +
+ + + + +
+
+
+
+166
+167
+168
+
+
# File 'lib/openhab/core/things/thing.rb', line 166
+
+def disable
+  enable(enabled: false)
+end
+
+
+ +
+

+ + #enable(enabled: true) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Enable the Thing

+ + +
+
+
+

Parameters:

+
    + +
  • + + enabled + + + (true, false) + + + (defaults to: true) + + +
  • + +
+ + +
+ + + + +
+
+
+
+157
+158
+159
+
+
# File 'lib/openhab/core/things/thing.rb', line 157
+
+def enable(enabled: true)
+  Things.manager.set_enabled(uid, enabled)
+end
+
+
+ +
+

+ + #initialized?true, false + + + + + +

+
+

Check if thing status == INITIALIZED

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/things/thing.rb', line 111
+
+
+
+
+ +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+
+
# File 'lib/openhab/core/things/thing.rb', line 188
+
+def inspect
+  r = "#<OpenHAB::Core::Things::Thing #{uid}"
+  r += " #{label.inspect}" if label
+  r += " (#{location.inspect})" if location
+  r += " #{status}"
+  unless status_info.status_detail == org.openhab.core.thing.ThingStatusDetail::NONE
+    r += " (#{status_info.status_detail})"
+  end
+  r += " configuration=#{configuration.properties.to_h}" unless configuration.properties.empty?
+  r += " properties=#{properties.to_h}" unless properties.empty?
+  "#{r}>"
+end
+
+
+ +
+

+ + #offline?true, false + + + + + +

+
+

Check if thing status == OFFLINE

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/things/thing.rb', line 129
+
+
+
+
+ +
+

+ + #online?true, false + + + + + +

+
+

Check if thing status == ONLINE

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/things/thing.rb', line 123
+
+
+
+
+ +
+

+ + #providerorg.openhab.core.common.registry.Provider? + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+211
+212
+213
+
+
# File 'lib/openhab/core/things/thing.rb', line 211
+
+def provider
+  Provider.registry.provider_for(uid)
+end
+
+
+ +
+

+ + #removed?true, false + + + + + +

+
+

Check if thing status == REMOVED

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+147
+148
+149
+
+
# File 'lib/openhab/core/things/thing.rb', line 147
+
+ThingStatus.constants.each do |thingstatus|
+  define_method(:"#{thingstatus.to_s.downcase}?") { status == ThingStatus.value_of(thingstatus) }
+end
+
+
+ +
+

+ + #removing?true, false + + + + + +

+
+

Check if thing status == REMOVING

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/things/thing.rb', line 135
+
+
+
+
+ +
+

+ + #to_sString + + + + + +

+
+

Return Thing's uid as a string

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+206
+207
+208
+
+
# File 'lib/openhab/core/things/thing.rb', line 206
+
+def to_s
+  uid.to_s
+end
+
+
+ +
+

+ + #uninitialized?true, false + + + + + +

+
+

Check if thing status == UNINITIALIZED

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/things/thing.rb', line 105
+
+
+
+
+ +
+

+ + #unknown?true, false + + + + + +

+
+

Check if thing status == UNKNOWN

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/things/thing.rb', line 117
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/Thing/ChannelsArray.html b/5.33/OpenHAB/Core/Things/Thing/ChannelsArray.html new file mode 100644 index 0000000000..d635ffb139 --- /dev/null +++ b/5.33/OpenHAB/Core/Things/Thing/ChannelsArray.html @@ -0,0 +1,3820 @@ + + + + + + + Class: OpenHAB::Core::Things::Thing::ChannelsArray + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Things::Thing::ChannelsArray + + + +

+
+ +
+
Inherits:
+
+ Array + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/things/thing.rb
+
+ +
+ +

Overview

+
+

Array wrapper class to allow searching a list of channels +by channel id

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods inherited from Array

+

wrap

+
+

Constructor Details

+ +
+

+ + #initialize(thing, array) ⇒ ChannelsArray + + + + + +

+
+

Returns a new instance of ChannelsArray.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+78
+79
+80
+81
+
+
# File 'lib/openhab/core/things/thing.rb', line 78
+
+def initialize(thing, array)
+  super(array)
+  @thing = thing
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #[](index) ⇒ Channel? + + + + + +

+
+

Allows indexing by both integer as an array or channel id acting like a hash.

+ + +
+
+
+

Parameters:

+
    + +
  • + + index + + + (Integer, String, ChannelUID) + + + + — +

    Numeric index, string channel id, or a ChannelUID to search for.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Channel, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+87
+88
+89
+90
+91
+92
+
+
# File 'lib/openhab/core/things/thing.rb', line 87
+
+def [](index)
+  return @thing.get_channel(index) if index.is_a?(ChannelUID)
+  return @thing.get_channel(index.to_str) if index.respond_to?(:to_str)
+
+  super
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/ThingType.html b/5.33/OpenHAB/Core/Things/ThingType.html new file mode 100644 index 0000000000..a461c12f2b --- /dev/null +++ b/5.33/OpenHAB/Core/Things/ThingType.html @@ -0,0 +1,4660 @@ + + + + + + + Class: OpenHAB::Core::Things::ThingType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Things::ThingType + + + +

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

Overview

+
+

ThingType contains a list of +channel group definitions, +channel definitions and further meta information.

+

This description is used as template definition for the creation of the +according concrete Thing object.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from AbstractDescriptionType

+

#description, #label

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #categoryString? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+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
+
+
# File 'lib/openhab/core/things/thing_type.rb', line 34
+
+class ThingType < AbstractDescriptionType
+  class << self
+    # @!visibility private
+    def registry
+      @registry ||= OSGi.service("org.openhab.core.thing.type.ThingTypeRegistry")
+    end
+  end
+
+  # @!attribute [r] listed?
+  # @return [true, false]
+  alias_method :listed?, :is_listed
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::ThingType #{uid}"
+    r += " (unlisted)" unless listed?
+    r += " category=#{category.inspect}" if category
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    uid.to_s
+  end
+end
+
+
+ + + +
+

+ + #channel_definitionsArray<ChannelDefinition> (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+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
+
+
# File 'lib/openhab/core/things/thing_type.rb', line 34
+
+class ThingType < AbstractDescriptionType
+  class << self
+    # @!visibility private
+    def registry
+      @registry ||= OSGi.service("org.openhab.core.thing.type.ThingTypeRegistry")
+    end
+  end
+
+  # @!attribute [r] listed?
+  # @return [true, false]
+  alias_method :listed?, :is_listed
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::ThingType #{uid}"
+    r += " (unlisted)" unless listed?
+    r += " category=#{category.inspect}" if category
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    uid.to_s
+  end
+end
+
+
+ + + +
+

+ + #channel_group_definitionsArray<ChannelGroupDefinition> (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+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
+
+
# File 'lib/openhab/core/things/thing_type.rb', line 34
+
+class ThingType < AbstractDescriptionType
+  class << self
+    # @!visibility private
+    def registry
+      @registry ||= OSGi.service("org.openhab.core.thing.type.ThingTypeRegistry")
+    end
+  end
+
+  # @!attribute [r] listed?
+  # @return [true, false]
+  alias_method :listed?, :is_listed
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::ThingType #{uid}"
+    r += " (unlisted)" unless listed?
+    r += " category=#{category.inspect}" if category
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    uid.to_s
+  end
+end
+
+
+ + + +
+

+ + #listed?true, false (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+44
+
+
# File 'lib/openhab/core/things/thing_type.rb', line 44
+
+alias_method :listed?, :is_listed
+
+
+ + + +
+

+ + #propertiesHash<String, String> (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash<String, String>) + + + +
  • + +
+ +
+ + + + +
+
+
+
+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
+
+
# File 'lib/openhab/core/things/thing_type.rb', line 34
+
+class ThingType < AbstractDescriptionType
+  class << self
+    # @!visibility private
+    def registry
+      @registry ||= OSGi.service("org.openhab.core.thing.type.ThingTypeRegistry")
+    end
+  end
+
+  # @!attribute [r] listed?
+  # @return [true, false]
+  alias_method :listed?, :is_listed
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::ThingType #{uid}"
+    r += " (unlisted)" unless listed?
+    r += " category=#{category.inspect}" if category
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    uid.to_s
+  end
+end
+
+
+ + + +
+

+ + #supported_bridge_type_uidsArray<String> (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array<String>) + + + +
  • + +
+ +
+ + + + +
+
+
+
+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
+
+
# File 'lib/openhab/core/things/thing_type.rb', line 34
+
+class ThingType < AbstractDescriptionType
+  class << self
+    # @!visibility private
+    def registry
+      @registry ||= OSGi.service("org.openhab.core.thing.type.ThingTypeRegistry")
+    end
+  end
+
+  # @!attribute [r] listed?
+  # @return [true, false]
+  alias_method :listed?, :is_listed
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::ThingType #{uid}"
+    r += " (unlisted)" unless listed?
+    r += " category=#{category.inspect}" if category
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    uid.to_s
+  end
+end
+
+
+ + + +
+

+ + #uidChannelGroupTypeUID (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+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
+
+
# File 'lib/openhab/core/things/thing_type.rb', line 34
+
+class ThingType < AbstractDescriptionType
+  class << self
+    # @!visibility private
+    def registry
+      @registry ||= OSGi.service("org.openhab.core.thing.type.ThingTypeRegistry")
+    end
+  end
+
+  # @!attribute [r] listed?
+  # @return [true, false]
+  alias_method :listed?, :is_listed
+
+  # @return [String]
+  def inspect
+    r = "#<OpenHAB::Core::Things::ThingType #{uid}"
+    r += " (unlisted)" unless listed?
+    r += " category=#{category.inspect}" if category
+    r += " properties=#{properties.to_h}" unless properties.empty?
+    "#{r}>"
+  end
+
+  # @return [String]
+  def to_s
+    uid.to_s
+  end
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+47
+48
+49
+50
+51
+52
+53
+
+
# File 'lib/openhab/core/things/thing_type.rb', line 47
+
+def inspect
+  r = "#<OpenHAB::Core::Things::ThingType #{uid}"
+  r += " (unlisted)" unless listed?
+  r += " category=#{category.inspect}" if category
+  r += " properties=#{properties.to_h}" unless properties.empty?
+  "#{r}>"
+end
+
+
+ +
+

+ + #to_sString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+56
+57
+58
+
+
# File 'lib/openhab/core/things/thing_type.rb', line 56
+
+def to_s
+  uid.to_s
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/ThingTypeUID.html b/5.33/OpenHAB/Core/Things/ThingTypeUID.html new file mode 100644 index 0000000000..4235b30d99 --- /dev/null +++ b/5.33/OpenHAB/Core/Things/ThingTypeUID.html @@ -0,0 +1,4514 @@ + + + + + + + Class: OpenHAB::Core::Things::ThingTypeUID + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Things::ThingTypeUID + + + +

+
+ +
+
Inherits:
+
+ UID + +
    +
  • Object
  • + + + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/things/thing_type_uid.rb
+
+ +
+ +

Overview

+
+

ThingTypeUID represents a unique identifier for a ThingType.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from UID

+

#binding_id

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Methods inherited from AbstractUID

+

#==, #inspect, #to_str

+ +
+

Instance Attribute Details

+ + + +
+

+ + #categoryString? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+
+
# File 'lib/openhab/core/things/thing_type_uid.rb', line 33
+
+class ThingTypeUID < UID
+  extend Forwardable
+
+  # @!method listed?
+  #   @return [true, false]
+
+  delegate %i[channel_group_definitions
+              channel_definitions
+              supported_bridge_type_uids
+              category
+              properties
+              listed?] => :thing_type
+
+  # @!attribute [r] thing_type
+  # @return [ThingType]
+  def thing_type
+    ThingType.registry.get_thing_type(self)
+  end
+end
+
+
+ + + +
+

+ + #channel_definitionsArray<ChannelDefinition> (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+
+
# File 'lib/openhab/core/things/thing_type_uid.rb', line 33
+
+class ThingTypeUID < UID
+  extend Forwardable
+
+  # @!method listed?
+  #   @return [true, false]
+
+  delegate %i[channel_group_definitions
+              channel_definitions
+              supported_bridge_type_uids
+              category
+              properties
+              listed?] => :thing_type
+
+  # @!attribute [r] thing_type
+  # @return [ThingType]
+  def thing_type
+    ThingType.registry.get_thing_type(self)
+  end
+end
+
+
+ + + +
+

+ + #channel_group_definitionsArray<ChannelGroupDefinition> (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+
+
# File 'lib/openhab/core/things/thing_type_uid.rb', line 33
+
+class ThingTypeUID < UID
+  extend Forwardable
+
+  # @!method listed?
+  #   @return [true, false]
+
+  delegate %i[channel_group_definitions
+              channel_definitions
+              supported_bridge_type_uids
+              category
+              properties
+              listed?] => :thing_type
+
+  # @!attribute [r] thing_type
+  # @return [ThingType]
+  def thing_type
+    ThingType.registry.get_thing_type(self)
+  end
+end
+
+
+ + + +
+

+ + #idString (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+
+
# File 'lib/openhab/core/things/thing_type_uid.rb', line 33
+
+class ThingTypeUID < UID
+  extend Forwardable
+
+  # @!method listed?
+  #   @return [true, false]
+
+  delegate %i[channel_group_definitions
+              channel_definitions
+              supported_bridge_type_uids
+              category
+              properties
+              listed?] => :thing_type
+
+  # @!attribute [r] thing_type
+  # @return [ThingType]
+  def thing_type
+    ThingType.registry.get_thing_type(self)
+  end
+end
+
+
+ + + +
+

+ + #propertiesHash<String, String> (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash<String, String>) + + + +
  • + +
+ +
+ + + + +
+
+
+
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+
+
# File 'lib/openhab/core/things/thing_type_uid.rb', line 33
+
+class ThingTypeUID < UID
+  extend Forwardable
+
+  # @!method listed?
+  #   @return [true, false]
+
+  delegate %i[channel_group_definitions
+              channel_definitions
+              supported_bridge_type_uids
+              category
+              properties
+              listed?] => :thing_type
+
+  # @!attribute [r] thing_type
+  # @return [ThingType]
+  def thing_type
+    ThingType.registry.get_thing_type(self)
+  end
+end
+
+
+ + + +
+

+ + #supported_bridge_type_uidsArray<String> (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array<String>) + + + +
  • + +
+ +
+ + + + +
+
+
+
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+
+
# File 'lib/openhab/core/things/thing_type_uid.rb', line 33
+
+class ThingTypeUID < UID
+  extend Forwardable
+
+  # @!method listed?
+  #   @return [true, false]
+
+  delegate %i[channel_group_definitions
+              channel_definitions
+              supported_bridge_type_uids
+              category
+              properties
+              listed?] => :thing_type
+
+  # @!attribute [r] thing_type
+  # @return [ThingType]
+  def thing_type
+    ThingType.registry.get_thing_type(self)
+  end
+end
+
+
+ + + +
+

+ + #thing_typeThingType (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+48
+49
+50
+
+
# File 'lib/openhab/core/things/thing_type_uid.rb', line 48
+
+def thing_type
+  ThingType.registry.get_thing_type(self)
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #listed?true, false + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+39
+40
+41
+42
+43
+44
+
+
# File 'lib/openhab/core/things/thing_type_uid.rb', line 39
+
+delegate %i[channel_group_definitions
+channel_definitions
+supported_bridge_type_uids
+category
+properties
+listed?] => :thing_type
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/ThingUID.html b/5.33/OpenHAB/Core/Things/ThingUID.html new file mode 100644 index 0000000000..85c8b454f6 --- /dev/null +++ b/5.33/OpenHAB/Core/Things/ThingUID.html @@ -0,0 +1,3923 @@ + + + + + + + Class: OpenHAB::Core::Things::ThingUID + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Things::ThingUID + + + +

+
+ +
+
Inherits:
+
+ UID + +
    +
  • Object
  • + + + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/things/thing_uid.rb
+
+ +
+ +

Overview

+
+

ThingUID represents a unique identifier for a Thing.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from UID

+

#binding_id, #category

+ + + + + + + + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractUID

+

#==, #inspect, #to_str

+ +
+

Instance Attribute Details

+ + + +
+

+ + #bridge_idsArray<string> (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array<string>) + + + +
  • + +
+ +
+ + + + +
+
+
+
+19
+20
+21
+22
+23
+24
+25
+26
+27
+
+
# File 'lib/openhab/core/things/thing_uid.rb', line 19
+
+class ThingUID < UID
+  extend Forwardable
+
+  # @!attribute [r] thing
+  # @return [Thing]
+  def thing
+    EntityLookup.lookup_thing(self)
+  end
+end
+
+
+ + + +
+

+ + #idString (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+19
+20
+21
+22
+23
+24
+25
+26
+27
+
+
# File 'lib/openhab/core/things/thing_uid.rb', line 19
+
+class ThingUID < UID
+  extend Forwardable
+
+  # @!attribute [r] thing
+  # @return [Thing]
+  def thing
+    EntityLookup.lookup_thing(self)
+  end
+end
+
+
+ + + +
+

+ + #thingThing (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Thing) + + + +
  • + +
+ +
+ + + + +
+
+
+
+24
+25
+26
+
+
# File 'lib/openhab/core/things/thing_uid.rb', line 24
+
+def thing
+  EntityLookup.lookup_thing(self)
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Things/UID.html b/5.33/OpenHAB/Core/Things/UID.html new file mode 100644 index 0000000000..e14fe301dc --- /dev/null +++ b/5.33/OpenHAB/Core/Things/UID.html @@ -0,0 +1,3802 @@ + + + + + + + Class: OpenHAB::Core::Things::UID + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Things::UID + + + +

+
+ +
+
Inherits:
+
+ AbstractUID + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/things/uid.rb
+
+ +
+ +

Overview

+
+

Base class for binding related unique identifiers.

+

A UID must always start with a binding ID.

+ + +
+
+
+ + +
+ + + + +

Instance Attribute Summary collapse

+ + + + + + + + + + + + + +

Method Summary

+ +

Methods inherited from AbstractUID

+

#==, #inspect, #to_str

+ +
+

Instance Attribute Details

+ + + +
+

+ + #binding_idString (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+21
+22
+
+
# File 'lib/openhab/core/things/uid.rb', line 21
+
+class UID < AbstractUID
+end
+
+
+ + + +
+

+ + #categoryString? (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+21
+22
+
+
# File 'lib/openhab/core/things/uid.rb', line 21
+
+class UID < AbstractUID
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Timer.html b/5.33/OpenHAB/Core/Timer.html new file mode 100644 index 0000000000..85d68acba2 --- /dev/null +++ b/5.33/OpenHAB/Core/Timer.html @@ -0,0 +1,4390 @@ + + + + + + + Class: OpenHAB::Core::Timer + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Timer + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/timer.rb
+
+ +
+ +

Overview

+
+

Timer allows you to administer the block of code that +has been scheduled to run later with after.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #execution_timeZonedDateTime? (readonly) + + + + + +

+
+

Returns the scheduled execution time, or nil if the timer was cancelled.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (ZonedDateTime, nil) + + + + — +

    the scheduled execution time, or nil if the timer was cancelled

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/timer.rb', line 70
+
+
+
+
+ + + +
+

+ + #idObject? + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+34
+35
+36
+
+
# File 'lib/openhab/core/timer.rb', line 34
+
+def id
+  @id
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #active?true, false + + + + + +

+
+

Check if the timer will execute in the future.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/timer.rb', line 14
+
+
+
+
+ +
+

+ + #canceltrue, false + + + + + +

+
+

Cancel timer

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    True if cancel was successful, false otherwise

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+108
+109
+110
+111
+
+
# File 'lib/openhab/core/timer.rb', line 108
+
+def cancel
+  DSL.timers.delete(self)
+  cancel!
+end
+
+
+ +
+

+ + #cancelled?true, false + + + + + +

+
+

Check if the timer has been cancelled.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/timer.rb', line 18
+
+
+
+
+ +
+

+ + #inspectString + + + + Also known as: + to_s + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+
+
# File 'lib/openhab/core/timer.rb', line 58
+
+def inspect
+  r = "#<#{self.class.name} #{"#{id.inspect} " if id}#{block.source_location.join(":")}"
+  if cancelled?
+    r += " (cancelled)"
+  else
+    r += " @ #{execution_time}"
+    r += " (executed)" if terminated?
+  end
+  "#{r}>"
+end
+
+
+ +
+

+ + #reschedule(time = nil) ⇒ self + + + + + +

+
+

Reschedule timer.

+

If the timer had been cancelled or executed, restart the timer.

+ + +
+
+
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+
+
# File 'lib/openhab/core/timer.rb', line 83
+
+def reschedule(time = nil)
+  return reschedule!(time) unless id
+
+  # re-add ourself to the TimerManager's @timers_by_id
+  DSL.timers.schedule(id) do |old_timer|
+    old_timer&.cancel unless old_timer.eql?(self)
+    self.id = nil
+    reschedule!(time)
+  end
+end
+
+
+ +
+

+ + #running?true, false + + + + + +

+
+

Check if the timer code is currently running.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/timer.rb', line 22
+
+
+
+
+ +
+

+ + #terminated?true, false + + + + + +

+
+

Check if the timer has terminated.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+30
+
+
# File 'lib/openhab/core/timer.rb', line 30
+
+def_delegator :@timer, :has_terminated, :terminated?
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types.html b/5.33/OpenHAB/Core/Types.html new file mode 100644 index 0000000000..6fb87c6ea6 --- /dev/null +++ b/5.33/OpenHAB/Core/Types.html @@ -0,0 +1,3625 @@ + + + + + + + Module: OpenHAB::Core::Types + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Types + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/types.rb,
+ lib/openhab/core/types/type.rb,
lib/openhab/core/types/hsb_type.rb,
lib/openhab/core/types/raw_type.rb,
lib/openhab/core/types/point_type.rb,
lib/openhab/core/types/on_off_type.rb,
lib/openhab/core/types/string_type.rb,
lib/openhab/core/types/time_series.rb,
lib/openhab/core/types/un_def_type.rb,
lib/openhab/core/types/decimal_type.rb,
lib/openhab/core/types/numeric_type.rb,
lib/openhab/core/types/percent_type.rb,
lib/openhab/core/types/refresh_type.rb,
lib/openhab/core/types/up_down_type.rb,
lib/openhab/core/types/quantity_type.rb,
lib/openhab/core/types/date_time_type.rb,
lib/openhab/core/types/stop_move_type.rb,
lib/openhab/core/types/play_pause_type.rb,
lib/openhab/core/types/open_closed_type.rb,
lib/openhab/core/types/string_list_type.rb,
lib/openhab/core/types/next_previous_type.rb,
lib/openhab/core/types/increase_decrease_type.rb,
lib/openhab/core/types/rewind_fastforward_type.rb
+
+
+ +
+ +

Overview

+
+

Contains the core types that openHAB uses as States for items, and +Commands to be sent to control them.

+

Types are the specific data types that commands and states are. They can be +sent to items, be the current state of an item, or be the command, state, +and was field of various +triggers. +Some types have additional useful methods.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: Command, NumericType, State, Type + + + + Classes: DateTimeType, DecimalType, HSBType, IncreaseDecreaseType, NextPreviousType, OnOffType, OpenClosedType, PercentType, PlayPauseType, PointType, QuantityType, RawType, RefreshType, RewindFastforwardType, StopMoveType, StringListType, StringType, TimeSeries, UnDefType, UpDownType + + +

+ + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/Command.html b/5.33/OpenHAB/Core/Types/Command.html new file mode 100644 index 0000000000..f7c817eca5 --- /dev/null +++ b/5.33/OpenHAB/Core/Types/Command.html @@ -0,0 +1,3619 @@ + + + + + + + Module: OpenHAB::Core::Types::Command + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Types::Command + + + +

+
+ + + + + + +
+
Includes:
+
Type
+
+ + + + +
+
Included in:
+
DateTimeType, IncreaseDecreaseType, NextPreviousType, OnOffType, PlayPauseType, PointType, RefreshType, RewindFastforwardType, StopMoveType, StringListType, UpDownType
+
+ + + +
+
Defined in:
+
lib/openhab/core/types/type.rb
+
+ +
+ +

Overview

+
+

This is a marker interface for all command types.

+ + +
+
+
+ + +
+ + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from Type

+

#==, #eql?

+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/DateTimeType.html b/5.33/OpenHAB/Core/Types/DateTimeType.html new file mode 100644 index 0000000000..2be41fa85a --- /dev/null +++ b/5.33/OpenHAB/Core/Types/DateTimeType.html @@ -0,0 +1,5117 @@ + + + + + + + Class: OpenHAB::Core::Types::DateTimeType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::DateTimeType + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Command, State
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/types/date_time_type.rb
+
+ +
+ +

Overview

+
+

DateTimeType uses a ZonedDateTime internally.

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Methods included from Type

+

#==

+ + + + + + +
+

Constructor Details

+ +
+

+ + #initialize(value = nil) ⇒ DateTimeType + + + + + +

+
+

Create a new instance of DateTimeType

+ + +
+
+
+

Parameters:

+
    + +
  • + + value + + + (#to_zoned_date_time, #to_time, #to_str, #to_d, nil) + + + (defaults to: nil) + + +
  • + +
+ + +
+ + + + +
+
+
+
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+
+
# File 'lib/openhab/core/types/date_time_type.rb', line 83
+
+def initialize(value = nil)
+  if value.nil?
+    super()
+    return
+  elsif value.respond_to?(:to_zoned_date_time)
+    super(value.to_zoned_date_time)
+    return
+  elsif value.respond_to?(:to_time)
+    super(value.to_time.to_zoned_date_time)
+    return
+  elsif value.respond_to?(:to_str)
+    # strings respond_do?(:to_d), but we want to avoid that conversion
+    super(value.to_str)
+    return
+  elsif value.respond_to?(:to_d)
+    super(Time.at(value.to_d).to_zoned_date_time)
+    return
+  end
+
+  super
+end
+
+
+ +
+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + +

+ +
+

+ + #method_missing(method, *args, &block) ⇒ Object + + + + + +

+
+

Forward missing methods to the ZonedDateTime object or a ruby Time +object representing the same instant

+ + +
+
+
+ + +
+ + + + +
+
+
+
+213
+214
+215
+216
+217
+218
+
+
# File 'lib/openhab/core/types/date_time_type.rb', line 213
+
+def method_missing(method, *args, &block)
+  return zoned_date_time.send(method, *args, &block) if zoned_date_time.respond_to?(method)
+  return to_time.send(method, *args, &block) if ::Time.instance_methods.include?(method.to_sym)
+
+  super
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .parse(time_string) ⇒ DateTimeType + + + + + +

+
+ +
+ Note: +

openHAB's DateTimeType.new(String) constructor will parse time-only strings and fill in 1970-01-01 +as the date, whereas this method will use the current date.

+
+
+ +

Parse a time string into a OpenHAB::Core::Types::DateTimeType.

+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+39
+40
+41
+42
+43
+
+
# File 'lib/openhab/core/types/date_time_type.rb', line 39
+
+def parse(time_string)
+  DateTimeType.new(DSL.try_parse_time_like(time_string).to_zoned_date_time)
+rescue ArgumentError
+  raise ArgumentError, e.message
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #+(other) ⇒ DateTimeType + + + + + +

+
+

Add other to self

+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+
+
# File 'lib/openhab/core/types/date_time_type.rb', line 225
+
+def +(other)
+  if other.is_a?(Duration)
+    DateTimeType.new(zoned_date_time.plus(other))
+  elsif other.respond_to?(:to_d)
+    DateTimeType.new(zoned_date_time.plus_nanos((other.to_d * 1_000_000_000).to_i))
+  elsif other.respond_to?(:coerce) && (lhs, rhs = other.coerce(to_d))
+    lhs + rhs
+  else
+    raise TypeError, "\#{other.class} can't be coerced into \#{self.class}"
+  end
+end
+
+
+ +
+

+ + #-(other) ⇒ DateTimeType, Duration + + + + + +

+
+

Subtract other from self

+

if other is a Duration-like object, the result is a new +OpenHAB::Core::Types::DateTimeType of duration seconds earlier in time.

+

if other is a DateTime-like object, the result is a Duration +representing how long between the two instants in time.

+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+
+
# File 'lib/openhab/core/types/date_time_type.rb', line 248
+
+def -(other)
+  if other.is_a?(Duration)
+    DateTimeType.new(zoned_date_time.minus(other))
+  elsif other.respond_to?(:to_time)
+    to_time - other.to_time
+  elsif other.respond_to?(:to_d)
+    DateTimeType.new(zoned_date_time.minus_nanos((other.to_d * 1_000_000_000).to_i))
+  elsif other.respond_to?(:coerce) && (lhs, rhs = other.coerce(to_d))
+    lhs - rhs
+  else
+    raise TypeError, "\#{other.class} can't be coerced into \#{self.class}"
+  end
+end
+
+
+ +
+

+ + #<=>(other) ⇒ Integer? + + + + + +

+
+

Comparison

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Object) + + + + — +

    object to compare to

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Integer, nil) + + + + — +

    -1, 0, +1 depending on whether other is +less than, equal to, or greater than self

    +

    nil is returned if the two values are incomparable.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+
+
# File 'lib/openhab/core/types/date_time_type.rb', line 126
+
+def <=>(other)
+  logger.trace { "(#{self.class}) #{self} <=> #{other} (#{other.class})" }
+  if other.is_a?(self.class)
+    zoned_date_time <=> other.zoned_date_time
+  elsif other.respond_to?(:to_time)
+    to_time <=> other.to_time
+  elsif other.respond_to?(:coerce)
+    return nil unless (lhs, rhs = other.coerce(self))
+
+    lhs <=> rhs
+  end
+end
+
+
+ +
+

+ + #coerce(other) ⇒ [DateTimeType, DateTimeType]? + + + + + +

+
+

Type Coercion

+

Coerce object to a DateTimeType

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Time) + + + + — +

    object to coerce to a DateTimeType

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+148
+149
+150
+151
+152
+153
+
+
# File 'lib/openhab/core/types/date_time_type.rb', line 148
+
+def coerce(other)
+  logger.trace { "Coercing #{self} as a request from #{other.class}" }
+  return [other, zoned_date_time] if other.respond_to?(:to_zoned_date_time)
+
+  [DateTimeType.new(other), self] if other.respond_to?(:to_time)
+end
+
+
+ +
+

+ + #eql?(other) ⇒ true, false + + + + + +

+
+

Check equality without type conversion

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    if the same value is represented, without type +conversion

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+110
+111
+112
+113
+114
+
+
# File 'lib/openhab/core/types/date_time_type.rb', line 110
+
+def eql?(other)
+  return false unless other.instance_of?(self.class)
+
+  zoned_date_time.compare_to(other.zoned_date_time).zero?
+end
+
+
+ +
+

+ + #to_fFloat + + + + + +

+
+

Returns the value of time as a floating point number of seconds since the Epoch

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + + — +

    Number of seconds since the Epoch, with nanosecond presicion

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+160
+161
+162
+
+
# File 'lib/openhab/core/types/date_time_type.rb', line 160
+
+def to_f
+  zoned_date_time.to_epoch_second + (zoned_date_time.nano / 1_000_000_000)
+end
+
+
+ +
+

+ + #to_instantInstant + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+55
+56
+57
+58
+59
+60
+
+
# File 'lib/openhab/core/types/date_time_type.rb', line 55
+
+def to_instant(_context = nil)
+  # @deprecated OH 3.4 getInstant() was added in OH 4.0
+  return get_instant if respond_to?(:get_instant)
+
+  zoned_date_time.to_instant
+end
+
+
+ +
+

+ + #to_zoned_date_time(context = nil) ⇒ ZonedTimeTime + + + + + +

+
+ + +
+
+
+

Parameters:

+
    + +
  • + + context + + + (ZonedDateTime, nil) + + + (defaults to: nil) + + + — +

    A ZonedDateTime used to fill in missing +fields during conversion. Not used in this class.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (ZonedTimeTime) + + + +
  • + +
+ +
+ + + + +
+
+
+
+50
+51
+52
+
+
# File 'lib/openhab/core/types/date_time_type.rb', line 50
+
+def to_zoned_date_time(context = nil) # rubocop:disable Lint/UnusedMethodArgument
+  zoned_date_time
+end
+
+
+ +
+

+ + #utc?true, false + + + + + +

+
+

Returns true if time represents a time in UTC (GMT)

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    true if utc_offset == 0, false otherwise

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+178
+179
+180
+
+
# File 'lib/openhab/core/types/date_time_type.rb', line 178
+
+def utc?
+  utc_offset.zero?
+end
+
+
+ +
+

+ + #utc_offsetInteger + + + + + +

+
+

The offset in seconds from UTC

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    The offset from UTC, in seconds

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+169
+170
+171
+
+
# File 'lib/openhab/core/types/date_time_type.rb', line 169
+
+def utc_offset
+  zoned_date_time.offset.total_seconds
+end
+
+
+ +
+

+ + #wdayInteger + + + + + +

+
+

Returns an integer representing the day of the week, 0..6, with Sunday == 0.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    The day of week

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+187
+188
+189
+
+
# File 'lib/openhab/core/types/date_time_type.rb', line 187
+
+def wday
+  zoned_date_time.day_of_week.value % 7
+end
+
+
+ +
+

+ + #zoneString + + + + + +

+
+
Deprecated.

This method has been deprecated in openHAB 4.3.

+
+

The timezone

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    The timezone in [+-]hh:mm(:ss) format (Z for UTC)

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+197
+198
+199
+
+
# File 'lib/openhab/core/types/date_time_type.rb', line 197
+
+def zone
+  zoned_date_time.zone.id
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/DecimalType.html b/5.33/OpenHAB/Core/Types/DecimalType.html new file mode 100644 index 0000000000..6f74d485c4 --- /dev/null +++ b/5.33/OpenHAB/Core/Types/DecimalType.html @@ -0,0 +1,4217 @@ + + + + + + + Class: OpenHAB::Core::Types::DecimalType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::DecimalType + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
NumericType
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/types/decimal_type.rb
+
+ +
+ +

Overview

+
+

DecimalType uses a java.math.BigDecimal internally and thus can be +used for integers, longs and floating point numbers alike.

+ + +
+
+
+ +
+

Examples:

+ + +

DecimalType can be used in case statements with ranges

+

+ +
# Check if number item is less than 50
+case NumberOne.state
+when (0...50)
+  logger.info("#{NumberOne} is less than 50")
+when (50..100)
+  logger.info("#{NumberOne} is greater than 50")
+end
+ + +

DecimalType can be compared directly against Numeric

+

+ +
if NumberOne.state > 10
+  logger.info("Item #{NumberOne.name} is greater than 10")
+end
+ + +

DecimalType can be compared against the value of another DecimalType

+

+ +
if NumberOne.state > NumberTwo.state
+  logger.info("Item #{NumberOne} (#{NumberOne.state}) is greater than #{NumberTwo} (#{NumberTwo.state})")
+end
+ +
+ + +
+

Direct Known Subclasses

+

PercentType

+
+ + + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from NumericType

+

#+@, #eql?, #to_d, #to_f, #to_i

+
+

Constructor Details

+ +
+

+ + #initialize(value) ⇒ DecimalType + + + + + +

+
+

Create a new instance of DecimalType

+ + +
+
+
+

Parameters:

+ + + +
+ + + + +
+
+
+
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+
+
# File 'lib/openhab/core/types/decimal_type.rb', line 48
+
+def initialize(*args)
+  unless args.length == 1
+    super
+    return
+  end
+
+  value = args.first
+  if value.is_a?(java.math.BigDecimal)
+    super
+  elsif value.is_a?(BigDecimal)
+    super(value.to_java.strip_trailing_zeros)
+  elsif value.is_a?(DecimalType)
+    super(value.to_big_decimal)
+  elsif value.respond_to?(:to_d)
+    super(value.to_d.to_java.strip_trailing_zeros)
+  else # rubocop:disable Lint/DuplicateBranch
+    # duplicates the Java BigDecimal branch, but that needs to go first
+    # in order to avoid unnecessary conversions
+    super
+  end
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #-@DecimalType + + + + + +

+
+

Unary minus

+

Negates self

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+130
+131
+132
+
+
# File 'lib/openhab/core/types/decimal_type.rb', line 130
+
+def -@
+  self.class.new(to_big_decimal.negate)
+end
+
+
+ +
+

+ + #<=>(other) ⇒ Integer? + + + + + +

+
+

Comparison

+ + +
+
+
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (Integer, nil) + + + + — +

    -1, 0, +1 depending on whether other is +less than, equal to, or greater than self

    +

    nil is returned if the two values are incomparable.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+
+
# File 'lib/openhab/core/types/decimal_type.rb', line 93
+
+def <=>(other)
+  logger.trace { "(#{self.class}) #{self} <=> #{other} (#{other.class})" }
+  if other.is_a?(QuantityType) || other.is_a?(HSBType)
+    (other <=> self)&.-@
+  elsif other.is_a?(self.class)
+    compare_to(other)
+  elsif other.respond_to?(:to_d)
+    to_d <=> other.to_d
+  elsif other.respond_to?(:coerce)
+    return nil unless (lhs, rhs = other.coerce(self))
+
+    lhs <=> rhs
+  end
+end
+
+
+ +
+

+ + #coerce(other) ⇒ Array<(DecimalType, DecimalType)>? + + + + + +

+
+

Type Coercion

+

Coerce object to a DecimalType

+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+117
+118
+119
+120
+121
+122
+
+
# File 'lib/openhab/core/types/decimal_type.rb', line 117
+
+def coerce(other)
+  logger.trace { "Coercing #{self} as a request from #{other.class}" }
+  return unless other.respond_to?(:to_d)
+
+  [self.class.new(other.to_d), self]
+end
+
+
+ +
+

+ + #|(other) ⇒ QuantityType + + + + + +

+
+

Convert DecimalType to a QuantityType

+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+77
+78
+79
+80
+
+
# File 'lib/openhab/core/types/decimal_type.rb', line 77
+
+def |(other)
+  other = org.openhab.core.types.util.UnitUtils.parse_unit(other.to_str) if other.respond_to?(:to_str)
+  QuantityType.new(to_big_decimal, other)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/HSBType.html b/5.33/OpenHAB/Core/Types/HSBType.html new file mode 100644 index 0000000000..69cc34e74a --- /dev/null +++ b/5.33/OpenHAB/Core/Types/HSBType.html @@ -0,0 +1,5819 @@ + + + + + + + Class: OpenHAB::Core::Types::HSBType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::HSBType + + + +

+
+ +
+
Inherits:
+
+ PercentType + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/types/hsb_type.rb
+
+ +
+ +

Overview

+
+

HSBType is a complex type with constituents for hue, saturation and +brightness and can be used for color items.

+ + +
+
+
+ + +
+ +

+ Constant Summary + collapse +

+ +
+ +
BLACK = +
+
+ + +
+
+
+ +

Returns:

+ + +
+
+
+ +
WHITE = +
+
+ + +
+
+
+ +

Returns:

+ + +
+
+
+ +
RED = +
+
+ + +
+
+
+ +

Returns:

+ + +
+
+
+ +
GREEN = +
+
+ + +
+
+
+ +

Returns:

+ + +
+
+
+ +
BLUE = +
+
+ + +
+
+
+ +

Returns:

+ + +
+
+
+ +
+ + + + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Class Method Summary + collapse +

+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods inherited from PercentType

+

#down?, #off?, #on?, #scale, #to_byte, #up?

+ + + + + + + + + +

Methods inherited from DecimalType

+

#-@, #coerce, #initialize, #|

+ + + + + + + + + + + + + + + +

Methods included from NumericType

+

#+@, #eql?, #to_d, #to_f, #to_i

+
+

Constructor Details

+ +

This class inherits a constructor from OpenHAB::Core::Types::DecimalType

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #bluePercentType (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 181
+
+
+
+
+ + + +
+

+ + #brightnessPercentType (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 172
+
+
+
+
+ + + +
+

+ + #cctQuantityType (readonly) + + + + + +

+
+

Returns The correlated color temperature in Kelvin.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (QuantityType) + + + + — +

    The correlated color temperature in Kelvin

    +
    + +
  • + +
+ +

See Also:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.3

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+196
+197
+198
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 196
+
+def cct
+  ColorUtil.xy_to_kelvin(to_xy[0..1].map { |x| x.double_value / 100 }) | "K"
+end
+
+
+ + + +
+

+ + #duvFloat (readonly) + + + + + +

+
+

Returns The delta u, v.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + + — +

    The delta u, v

    +
    + +
  • + +
+ +

See Also:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.3

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+209
+210
+211
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 209
+
+def duv
+  ColorUtil.xy_to_duv(to_xy[0..1].map { |x| x.double_value / 100 })
+end
+
+
+ + + +
+

+ + #greenPercentType (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 178
+
+
+
+
+ + + +
+

+ + #hueQuantityType (readonly) + + + + + +

+
+

Returns The color's hue component as a QuantityType of unit DEGREE_ANGLE.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+140
+141
+142
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 140
+
+def hue
+  QuantityType.new(raw_hue.to_big_decimal, Units::DEGREE_ANGLE)
+end
+
+
+ + + +
+

+ + #redPercentType (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 175
+
+
+
+
+ + + +
+

+ + #saturationPercentType (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 169
+
+
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .from_cct(cct) ⇒ HSBType + + + + + +

+
+

Create HSBType from a color temperature

+ + +
+
+
+

Parameters:

+
    + +
  • + + cct + + + (QuantityType, Number) + + + + — +

    The color temperature (assumed in Kelvin, if not a QuantityType)

    +
    + +
  • + +
+ +

Returns:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.3

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+109
+110
+111
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 109
+
+def from_cct(cct)
+  from_xy(*ColorUtil.kelvin_to_xy((cct | "K").double_value))
+end
+
+
+ +
+

+ + .from_hsb(hue, saturation, brightness) ⇒ HSBType + + + + + +

+
+

Create HSBType from hue, saturation, and brightness values

+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+59
+60
+61
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 59
+
+def from_hsb(hue, saturation, brightness)
+  new(hue, saturation, brightness)
+end
+
+
+ +
+

+ + .from_rgb(r, g, b) ⇒ HSBType + + + + + +

+
+

Create HSBType from RGB values

+ + +
+
+
+

Parameters:

+
    + +
  • + + r + + + (Integer) + + + + — +

    Red component (0-255)

    +
    + +
  • + +
  • + + g + + + (Integer) + + + + — +

    Green component (0-255)

    +
    + +
  • + +
  • + + b + + + (Integer) + + + + — +

    Blue component (0-255)

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 41
+
+
+
+
+ +
+

+ + .from_xy(x, y) ⇒ HSBType + + + + + +

+
+

Create HSBType representing the provided xy color values in CIE XY color model

+ + +
+
+
+

Parameters:

+
    + +
  • + + x + + + (Float) + + + +
  • + +
  • + + y + + + (Float) + + + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 48
+
+
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #<=>(other) ⇒ Integer? + + + + + +

+
+

Comparison

+ + +
+
+
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (Integer, nil) + + + + — +

    -1, 0, +1 depending on whether other is +less than, equal to, or greater than self

    +

    nil is returned if the two values are incomparable.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+125
+126
+127
+128
+129
+130
+131
+132
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 125
+
+def <=>(other)
+  logger.trace { "(#{self.class}) #{self} <=> #{other} (#{other.class})" }
+  if other.is_a?(HSBType)
+    [brightness, hue, saturation] <=> [other.brightness, other.hue, other.saturation]
+  else
+    super
+  end
+end
+
+
+ +
+

+ + #argbInteger + + + + + +

+
+

Convert to a packed 32-bit RGB value representing the color in the default sRGB color model.

+

The alpha component is always 100%.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+149
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 149
+
+alias_method :argb, :rgb
+
+
+ +
+

+ + #planckian?(duv_tolerance: 0.015, maximum_saturation: 75) ⇒ true, false + + + + Also known as: + white_cct? + + + + +

+
+ +
+ Note: +

The parameters and defaults for this method are subject to change in future +releases of this library, and should be considered beta. For now, the default +parameters should be sufficient to detect most colors that Apple's HomeKit color +temperature color chooser uses as planckian, without detecting most other "real" +colors as planckian.

+
+
+ +

Checks if this color is within a certain tolerance of the planckian locus ("white")

+ + +
+
+
+

Parameters:

+
    + +
  • + + duv_tolerance + + + (Float) + + + (defaults to: 0.015) + + + — +

    The maximum allowed distance from the planckian locus

    +
    + +
  • + +
  • + + maximum_saturation + + + (Numeric, PercentType) + + + (defaults to: 75) + + + — +

    The maximum allowed saturation. +Some colors (bright green for example) may be close to the planckian locus, +but you don't want to treat them as "white" because they are very saturated.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +

See Also:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.3

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+230
+231
+232
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 230
+
+def planckian?(duv_tolerance: 0.015, maximum_saturation: 75)
+  duv.abs < duv_tolerance && saturation < maximum_saturation
+end
+
+
+ +
+

+ + #planckian_cct(range: nil, **kwargs) ⇒ QuantityType? + + + + Also known as: + white_cct + + + + +

+
+ +
+ Note: +

Additional parameters are forwarded to #planckian?

+
+
+ +

Returns the color temperature of this color if it is within a certain tolerance +of the planckian locus ("white"), otherwise returns nil.

+ + +
+
+
+

Parameters:

+
    + +
  • + + range + + + (Range, NumberItem) + + + (defaults to: nil) + + + — +

    An allowed range to additionally restrict +if the CCT should be returned. A NumberItem that represents a CCT channel +may be provided, and NumberItem#range will be used instead. If the range +does not have units (is QuantityType), it is interpreted as being in Kelvin.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (QuantityType, nil) + + + + — +

    The color temperature in Kelvin +(unless the range is in mireds; then it will be in mireds)

    +
    + +
  • + +
+ +

See Also:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.3

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 249
+
+def planckian_cct(range: nil, **kwargs)
+  return unless planckian?(**kwargs)
+
+  range = range.range if range.is_a?(NumberItem)
+  cct = self.cct
+  if range
+    range_type = range.begin || range.end
+    if !range_type.is_a?(QuantityType)
+      range = Range.new(range.begin | "K", range.end | "K")
+    elsif range_type.unit == Units::MIRED
+      cct |= Units::MIRED
+    end
+  end
+  return nil if range && !range.cover?(cct)
+
+  cct
+end
+
+
+ +
+

+ + #rgbInteger + + + + + +

+
+

Convert to a packed 24-bit RGB value representing the color in the default sRGB color model.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+153
+154
+155
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 153
+
+def rgb
+  argb & 0xffffff
+end
+
+
+ +
+

+ + #to_hexString + + + + + +

+
+

Convert to an HTML-style string of 6 hex characters in the default sRGB color model.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    "#xxxxxx"

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+159
+160
+161
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 159
+
+def to_hex
+  Kernel.format("#%06x", rgb)
+end
+
+
+ +
+

+ + #to_rgb[PercentType, PercentType, PercentType] + + + + + +

+
+

Convert to RGB values representing the color in the default sRGB color model

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 184
+
+
+
+
+ +
+

+ + #to_xy[PercentType, PercentType, PercentType] + + + + + +

+
+

Convert to the xyY values representing this object's color in CIE XY color model

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/hsb_type.rb', line 188
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/IncreaseDecreaseType.html b/5.33/OpenHAB/Core/Types/IncreaseDecreaseType.html new file mode 100644 index 0000000000..62fd560b20 --- /dev/null +++ b/5.33/OpenHAB/Core/Types/IncreaseDecreaseType.html @@ -0,0 +1,3840 @@ + + + + + + + Class: OpenHAB::Core::Types::IncreaseDecreaseType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::IncreaseDecreaseType + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Command
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/types/increase_decrease_type.rb
+
+ +
+ +

Overview

+
+

Represents INCREASE and DECREASE commands.

+ + +
+
+
+ + +
+ +

+ Constant Summary + collapse +

+ +
+ +
INCREASE = +
+
+

Increase Command

+ + +
+
+
+ + +
+
+
+ +
DECREASE = +
+
+

Decrease Command

+ + +
+
+
+ + +
+
+
+ +
+ + + + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from Type

+

#==, #eql?

+ + +
+

Instance Method Details

+ + +
+

+ + #decrease?true, false + + + + + +

+
+

Check if self == DECREASE

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/increase_decrease_type.rb', line 23
+
+
+
+
+ +
+

+ + #increase?true, false + + + + + +

+
+

Check if self == INCREASE

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/increase_decrease_type.rb', line 19
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/NextPreviousType.html b/5.33/OpenHAB/Core/Types/NextPreviousType.html new file mode 100644 index 0000000000..46078febe7 --- /dev/null +++ b/5.33/OpenHAB/Core/Types/NextPreviousType.html @@ -0,0 +1,3840 @@ + + + + + + + Class: OpenHAB::Core::Types::NextPreviousType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::NextPreviousType + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Command
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/types/next_previous_type.rb
+
+ +
+ +

Overview

+
+

Implements NEXT and PREVIOUS commands.

+ + +
+
+
+ + +
+ +

+ Constant Summary + collapse +

+ +
+ +
NEXT = +
+
+

Next Command

+ + +
+
+
+ + +
+
+
+ +
PREVIOUS = +
+
+

Previous Command

+ + +
+
+
+ + +
+
+
+ +
+ + + + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from Type

+

#==, #eql?

+ + +
+

Instance Method Details

+ + +
+

+ + #next?true, false + + + + + +

+
+

Check if self == NEXT

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/next_previous_type.rb', line 19
+
+
+
+
+ +
+

+ + #previous?true, false + + + + + +

+
+

Check if self == PREVIOUS

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/next_previous_type.rb', line 23
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/NumericType.html b/5.33/OpenHAB/Core/Types/NumericType.html new file mode 100644 index 0000000000..c849f4fcf1 --- /dev/null +++ b/5.33/OpenHAB/Core/Types/NumericType.html @@ -0,0 +1,3991 @@ + + + + + + + Module: OpenHAB::Core::Types::NumericType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Types::NumericType + + + +

+
+ + + + + + + + + +
+
Included in:
+
DecimalType, QuantityType
+
+ + + +
+
Defined in:
+
lib/openhab/core/types/numeric_type.rb
+
+ +
+ +

Overview

+
+

Mixin for methods common to DecimalType and QuantityType.

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #+@self + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+37
+38
+39
+
+
# File 'lib/openhab/core/types/numeric_type.rb', line 37
+
+def +@
+  self
+end
+
+
+ +
+

+ + #eql?(other) ⇒ true, false + + + + + +

+
+

Check equality without type conversion

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    if the same value is represented, without type +conversion

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+30
+31
+32
+33
+34
+
+
# File 'lib/openhab/core/types/numeric_type.rb', line 30
+
+def eql?(other)
+  return false unless other.instance_of?(self.class)
+
+  compare_to(other).zero?
+end
+
+
+ +
+

+ + #to_dBigDecimal + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (BigDecimal) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/numeric_type.rb', line 41
+
+
+
+
+ +
+

+ + #to_fFloat + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/numeric_type.rb', line 47
+
+
+
+
+ +
+

+ + #to_iInteger + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/numeric_type.rb', line 44
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/OnOffType.html b/5.33/OpenHAB/Core/Types/OnOffType.html new file mode 100644 index 0000000000..4dbd06d634 --- /dev/null +++ b/5.33/OpenHAB/Core/Types/OnOffType.html @@ -0,0 +1,3933 @@ + + + + + + + Class: OpenHAB::Core::Types::OnOffType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::OnOffType + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Command, State
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/types/on_off_type.rb
+
+ +
+ +

Overview

+
+

Implements ON and OFF commands and states.

+

Also, PercentType can be converted to OnOffType +for more semantic comparisons. 0 is OFF, anything +else if ON.

+ + +
+
+
+ + +
+ +

+ Constant Summary + collapse +

+ +
+ +
ON = +
+
+

On Command/State

+ + +
+
+
+ + +
+
+
+ +
OFF = +
+
+

Off Command/State

+ + +
+
+
+ + +
+
+
+ +
+ + + + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from Type

+

#==, #eql?

+ + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #!OnOffType + + + + + +

+
+

Invert the type

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+35
+36
+37
+
+
# File 'lib/openhab/core/types/on_off_type.rb', line 35
+
+def !
+  on? ? OFF : ON
+end
+
+
+ +
+

+ + #off?true, false + + + + + +

+
+

Check if self == OFF

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/on_off_type.rb', line 29
+
+
+
+
+ +
+

+ + #on?true, false + + + + + +

+
+

Check if self == ON

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/on_off_type.rb', line 25
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/OpenClosedType.html b/5.33/OpenHAB/Core/Types/OpenClosedType.html new file mode 100644 index 0000000000..7e678cb76f --- /dev/null +++ b/5.33/OpenHAB/Core/Types/OpenClosedType.html @@ -0,0 +1,3924 @@ + + + + + + + Class: OpenHAB::Core::Types::OpenClosedType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::OpenClosedType + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
State
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/types/open_closed_type.rb
+
+ +
+ +

Overview

+
+

Implements OPEN and CLOSED states.

+ + +
+
+
+ + +
+ +

+ Constant Summary + collapse +

+ +
+ +
OPEN = +
+
+

Open State

+ + +
+
+
+ + +
+
+
+ +
CLOSED = +
+
+

Closed State

+ + +
+
+
+ + +
+
+
+ +
+ + + + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from Type

+

#==, #eql?

+ + +
+

Instance Method Details

+ + +
+

+ + #!OpenClosedType + + + + + +

+
+

Invert the type

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+29
+30
+31
+32
+33
+
+
# File 'lib/openhab/core/types/open_closed_type.rb', line 29
+
+def !
+  return CLOSED if open?
+
+  OPEN if closed?
+end
+
+
+ +
+

+ + #closed?true, false + + + + + +

+
+

Check if self == CLOSED

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/open_closed_type.rb', line 23
+
+
+
+
+ +
+

+ + #open?true, false + + + + + +

+
+

Check if self == OPEN

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/open_closed_type.rb', line 19
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/PercentType.html b/5.33/OpenHAB/Core/Types/PercentType.html new file mode 100644 index 0000000000..fe2eee0686 --- /dev/null +++ b/5.33/OpenHAB/Core/Types/PercentType.html @@ -0,0 +1,4178 @@ + + + + + + + Class: OpenHAB::Core::Types::PercentType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::PercentType + + + +

+
+ +
+
Inherits:
+
+ DecimalType + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/types/percent_type.rb
+
+ +
+ +

Overview

+
+

PercentType extends DecimalType by putting constraints for its value on top (0-100).

+ + +
+
+
+ + +
+

Direct Known Subclasses

+

HSBType

+
+ + + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods inherited from DecimalType

+

#-@, #<=>, #coerce, #initialize, #|

+ + + + + + + + + + + + + + + +

Methods included from NumericType

+

#+@, #eql?, #to_d, #to_f, #to_i

+
+

Constructor Details

+ +

This class inherits a constructor from OpenHAB::Core::Types::DecimalType

+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #down?true, false + + + + + +

+
+

Check if DOWN

+

Note that DOWN is defined as 100% exactly.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+55
+56
+57
+
+
# File 'lib/openhab/core/types/percent_type.rb', line 55
+
+def down?
+  !!as(UpDownType)&.down?
+end
+
+
+ +
+

+ + #off?true, false + + + + + +

+
+

Check if OFF

+

Note that OFF is defined as 0% exactly.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+33
+34
+35
+
+
# File 'lib/openhab/core/types/percent_type.rb', line 33
+
+def off?
+  as(OnOffType).off?
+end
+
+
+ +
+

+ + #on?true, false + + + + + +

+
+

Check if ON

+

Note that ON is defined as any value besides 0%.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+22
+23
+24
+
+
# File 'lib/openhab/core/types/percent_type.rb', line 22
+
+def on?
+  as(OnOffType).on?
+end
+
+
+ +
+

+ + #scale(range) ⇒ Numeric + + + + + +

+
+

Scale the value to a particular range

+ + +
+
+
+

Parameters:

+
    + +
  • + + range + + + (Range) + + + + — +

    the range as a numeric

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Numeric) + + + + — +

    the value as a percentage of the range

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+
+
# File 'lib/openhab/core/types/percent_type.rb', line 71
+
+def scale(range)
+  unless range.is_a?(Range) && range.min.is_a?(Numeric) && range.max.is_a?(Numeric)
+    raise ArgumentError, "range must be a Range of Numerics"
+  end
+
+  result = (to_d * (range.max - range.min) / 100) + range.min
+  case range.max
+  when Integer then result.round
+  when Float then result.to_f
+  else result
+  end
+end
+
+
+ +
+

+ + #to_byteInteger + + + + + +

+
+

scale the value to fit in a single byte

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    an integer in the range 0-255

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+87
+88
+89
+
+
# File 'lib/openhab/core/types/percent_type.rb', line 87
+
+def to_byte
+  scale(0..255)
+end
+
+
+ +
+

+ + #up?true, false + + + + + +

+
+

Check if UP

+

Note that UP is defined as 0% exactly.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+44
+45
+46
+
+
# File 'lib/openhab/core/types/percent_type.rb', line 44
+
+def up?
+  !!as(UpDownType)&.up?
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/PlayPauseType.html b/5.33/OpenHAB/Core/Types/PlayPauseType.html new file mode 100644 index 0000000000..61340f2d9c --- /dev/null +++ b/5.33/OpenHAB/Core/Types/PlayPauseType.html @@ -0,0 +1,3858 @@ + + + + + + + Class: OpenHAB::Core::Types::PlayPauseType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::PlayPauseType + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Command, State
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/types/play_pause_type.rb
+
+ +
+ +

Overview

+
+

Implements PLAY and PAUSE commands and states.

+ + +
+
+
+ + +
+ +

+ Constant Summary + collapse +

+ +
+ +
PLAY = +
+
+

Play Command/Playing State

+ + +
+
+
+ + +
+
+
+ +
PAUSE = +
+
+

Pause Command/Paused State

+ + +
+
+
+ + +
+
+
+ +
+ + + + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from Type

+

#==, #eql?

+ + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #paused?true, false + + + + Also known as: + pause? + + + + +

+
+

Check if self == PAUSE

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/play_pause_type.rb', line 25
+
+
+
+
+ +
+

+ + #playing?true, false + + + + Also known as: + play? + + + + +

+
+

Check if self == PLAY

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/play_pause_type.rb', line 19
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/PointType.html b/5.33/OpenHAB/Core/Types/PointType.html new file mode 100644 index 0000000000..aa0e8108d5 --- /dev/null +++ b/5.33/OpenHAB/Core/Types/PointType.html @@ -0,0 +1,4353 @@ + + + + + + + Class: OpenHAB::Core::Types::PointType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::PointType + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Command, State
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/types/point_type.rb
+
+ +
+ +

Overview

+
+

PointType can be used for items that are dealing with GPS or location awareness functionality.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+

Constructor Details

+ +
+

+ + #initialize(latitude, longitude, altitude) ⇒ PointType + + + + + +

+
+

Returns a new instance of PointType.

+ + +
+
+
+ +
+
+ + +
+
+
+

Parameters:

+ + + +
+ + +
+ + + + +
+
+
+
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+
+
# File 'lib/openhab/core/types/point_type.rb', line 18
+
+def initialize(*args)
+  if (2..3).cover?(args.length)
+    args = args.each_with_index.map do |value, index|
+      if value.is_a?(DecimalType) || value.is_a?(StringType)
+        value
+      elsif value.is_a?(QuantityType)
+        unit = (index == 2) ? DSL.unit(SIUnits::METRE.dimension) || SIUnits::METRE : Units::DEGREE_ANGLE
+        DecimalType.new(value.to_unit(unit).to_big_decimal)
+      elsif value.respond_to?(:to_str)
+        StringType.new(value.to_str)
+      elsif value.respond_to?(:to_d)
+        DecimalType.new(value)
+      end
+    end
+  end
+
+  super(*args)
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #altitudeQuantityType (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+94
+95
+96
+
+
# File 'lib/openhab/core/types/point_type.rb', line 94
+
+def altitude
+  QuantityType.new(raw_altitude.to_big_decimal, SIUnits::METRE)
+end
+
+
+ + + +
+

+ + #latitudeQuantityType (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+82
+83
+84
+
+
# File 'lib/openhab/core/types/point_type.rb', line 82
+
+def latitude
+  QuantityType.new(raw_latitude.to_big_decimal, Units::DEGREE_ANGLE)
+end
+
+
+ + + +
+

+ + #longitudeQuantityType (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+88
+89
+90
+
+
# File 'lib/openhab/core/types/point_type.rb', line 88
+
+def longitude
+  QuantityType.new(raw_longitude.to_big_decimal, Units::DEGREE_ANGLE)
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #==(other) ⇒ true, false + + + + + +

+
+

Check equality with type conversion

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (PointType, String) + + + + — +

    object to compare to

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+
+
# File 'lib/openhab/core/types/point_type.rb', line 56
+
+def ==(other)
+  logger.trace { "(#{self.class}) #{self} == #{other} (#{other.class})" }
+  if other.instance_of?(self.class)
+    equals(other)
+  elsif other.respond_to?(:coerce)
+    return false unless (lhs, rhs = other.coerce(self))
+
+    lhs == rhs
+  end
+end
+
+
+ +
+

+ + #distance_from(other) ⇒ QuantityType + + + + Also known as: + - + + + + +

+
+

Calculate the distance in meters from other, ignoring altitude.

+

This algorithm also ignores the oblate spheroid shape of Earth and +assumes a perfect sphere, so results are inexact.

+ + +
+
+
+ +

Returns:

+ +

Raises:

+
    + +
  • + + + (TypeError) + + + +
  • + +
+ +
+ + + + +
+
+
+
+105
+106
+107
+108
+109
+110
+
+
# File 'lib/openhab/core/types/point_type.rb', line 105
+
+def distance_from(other)
+  logger.trace { "(#{self}).distance_from(#{other} (#{other.class})" }
+  raise TypeError, "#{other.class} can't be coerced into #{self.class}" unless other.is_a?(PointType)
+
+  QuantityType.new(raw_distance_from(other), SIUnits::METRE)
+end
+
+
+ +
+

+ + #eql?(other) ⇒ true, false + + + + + +

+
+

Check equality without type conversion

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    if the same value is represented, without type +conversion

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+42
+43
+44
+45
+46
+
+
# File 'lib/openhab/core/types/point_type.rb', line 42
+
+def eql?(other)
+  return false unless other.instance_of?(self.class)
+
+  equals(other)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/QuantityType.html b/5.33/OpenHAB/Core/Types/QuantityType.html new file mode 100644 index 0000000000..75fef15969 --- /dev/null +++ b/5.33/OpenHAB/Core/Types/QuantityType.html @@ -0,0 +1,4194 @@ + + + + + + + Class: OpenHAB::Core::Types::QuantityType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::QuantityType + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
NumericType
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/types/quantity_type.rb
+
+ +
+ +

Overview

+
+

QuantityType extends DecimalType to handle physical unit measurement.

+

QuantityType is part of the Units of Measurement +framework in openHAB. It is represented as a decimal number with a unit. +You can construct a QuantityType object by using the pipe operator with any Numeric.

+ + +
+
+
+ +
+

Examples:

+ + +

QuantityTypes can perform math operations between them.

+

+ +
(50 | "°F") + (-25 | "°F") # => 25.0 °F
+(100 | "°F") / (2 | "°F") # => 50
+(50 | "°F") - (25 | "°F") # => 25 °F
+(50 | "°F") + (50 | "°F") # => 100 °F
+ + +

If the operand is a number, it will be unit-less, but the result of the operation will have a unit. This only works for multiplication and division.

+

+ +
(50 | "°F") * 2 # => 100 °F
+(100 | "°F") / 2 # => 50 °F
+ + +

If the operand is a dimensioned NumberItem it will automatically be converted to a quantity for the operation.

+

+ +
# NumberF = "2 °F"
+# NumberC = "2 °C"
+(50 | "°F") + NumberF.state # => 52.0 °F
+(50 | "°F") + NumberC.state # => 85.60 °F
+ + +

If the operand is a non-dimensioned NumberItem it can be used only in multiplication and division operations.

+

+ +
# Number Dimensionless = 2
+(50 | "°F") * Dimensionless.state # => 100 °F
+(50 | "°F") / Dimensionless.state # => 25 °F
+ + +

Quantities can be compared, if they have comparable units.

+

+ +
(50 | "°F") >  (25 | "°F")
+(50 | "°F") >  (525 | "°F")
+(50 | "°F") >= (50 | "°F")
+(50 | "°F") == (50 | "°F")
+(50 | "°F") <  (25 | "°C")
+ + +

A Range can be used with QuantityType:

+

+ +
((0 | "°C")..(100 | "°C")).cover?(NumberC)
+ + +

A Range can also be used in a case statement for a dimensioned item:

+

+ +
description = case NumberC.state
+              when (-20 | "°C")...(18 | "°C") then "too cold"
+              when (18 | "°C")...(25 | "°C") then "comfortable"
+              when (25 | "°C")...(40 | "°C") then "too warm"
+              else "out of range"
+              end
+ + +

Dimensioned Number Items can be converted to quantities with other units using the | operator

+

+ +
# NumberC = "23 °C"
+
+# Using a unit
+logger.info("In Fahrenheit #{NumberC.state | ImperialUnits::FAHRENHEIT }")
+
+# Using a string
+logger.info("In Fahrenheit #{NumberC.state | "°F"}")
+ + +

Dimensionless Number Items can be converted to quantities with units using the | operator

+

+ +
# Dimensionless = 70
+
+# Using a unit
+logger.info("In Fahrenheit #{Dimensionless.state | ImperialUnits::FAHRENHEIT }")
+
+# Using a string
+logger.info("In Fahrenheit #{Dimensionless.state | "°F"}")
+ + +

Dimensioned Number Items automatically use their units and convert automatically for math operations

+

+ +
# Number:Temperature NumberC = 23 °C
+# Number:Temperature NumberF = 70 °F
+NumberC.state - NumberF.state # => 1.88 °C
+NumberF.state + NumberC.state # => 143.40 °F
+ + +

Dimensionless Number Items can be used for multiplication and division.

+

+ +
# Number Dimensionless = 2
+# Number:Temperature NumberF = 70 °F
+NumberF.state * Dimensionless.state # => 140.0 °F
+NumberF.state / Dimensionless.state # => 35.0 °F
+Dimensionless.state * NumberF.state # => 140.0 °F
+2 * NumberF.state                   # => 140.0 °F
+ + +

Comparisons work on dimensioned number items with different, but comparable units.

+

+ +
# Number:Temperature NumberC = 23 °C
+# Number:Temperature NumberF = 70 °F
+NumberC.state > NumberF.state # => true
+ + +

For certain unit types, such as temperature, all unit needs to be normalized to the comparator for all operations when combining comparison operators with dimensioned numbers.

+

+ +
(NumberC.state | "°F") - (NumberF.state | "°F") < 4 | "°F"
+ +
+ + +

See Also:

+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from NumericType

+

#+@, #eql?, #to_d, #to_f, #to_i

+ + +
+

Instance Method Details

+ + +
+

+ + #-@Object + + + + + +

+
+

arithmetic operators

+ + +
+
+
+ + +
+ + + + +
+
+
+
+171
+
+
# File 'lib/openhab/core/types/quantity_type.rb', line 171
+
+alias_method :-@, :negate
+
+
+ +
+

+ + #<=>(other) ⇒ Integer? + + + + + +

+
+

Comparison

+

Comparisons against Numeric and DecimalType are allowed only within a +unit block to avoid unit ambiguities. +Comparisons against other types may be done if supported by that type's coercion.

+ + +
+
+
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (Integer, nil) + + + + — +

    -1, 0, +1 depending on whether other is +less than, equal to, or greater than self

    +

    nil is returned if the two values are incomparable.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+
+
# File 'lib/openhab/core/types/quantity_type.rb', line 134
+
+def <=>(other)
+  logger.trace { "(#{self.class}) #{self} <=> #{other} (#{other.class})" }
+  case other
+  when self.class
+    return unitize(other.unit).compare_to(other) if unit == Units::ONE
+    return compare_to(other.unitize(unit)) if other.unit == Units::ONE
+
+    return compare_to(other)
+  when Numeric, DecimalType
+    if (unit = OpenHAB::DSL.unit(dimension))
+      return compare_to(QuantityType.new(other, unit))
+    end
+
+    return nil # don't allow comparison with numeric outside a unit block
+  end
+
+  return nil unless other.respond_to?(:coerce)
+
+  other.coerce(self)&.then { |lhs, rhs| lhs <=> rhs }
+end
+
+
+ +
+

+ + #coerce(other) ⇒ Array<(QuantityType, QuantityType)>? + + + + + +

+
+

Type Coercion

+

Coerce object to a OpenHAB::Core::Types::QuantityType

+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+163
+164
+165
+166
+167
+168
+
+
# File 'lib/openhab/core/types/quantity_type.rb', line 163
+
+def coerce(other)
+  logger.trace { "Coercing #{self} as a request from #{other.class}" }
+  return unless other.respond_to?(:to_d)
+
+  [QuantityType.new(other.to_d.to_java, Units::ONE), self]
+end
+
+
+ +
+

+ + #to_invertible_unit(unit) ⇒ QuantityType + + + + Also known as: + | + + + + +

+
+

Convert this OpenHAB::Core::Types::QuantityType into another unit.

+ + +
+
+
+ +
+

Examples:

+ + +
NumberC.state | ImperialUnits::FAHRENHEIT
+ +
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+10
+
+
# File 'lib/openhab/core/types/quantity_type.rb', line 10
+
+def to_invertible_unit(unit); end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/RawType.html b/5.33/OpenHAB/Core/Types/RawType.html new file mode 100644 index 0000000000..6749fa01c2 --- /dev/null +++ b/5.33/OpenHAB/Core/Types/RawType.html @@ -0,0 +1,3795 @@ + + + + + + + Class: OpenHAB::Core::Types::RawType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::RawType + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
State
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/types/raw_type.rb
+
+ +
+ +

Overview

+
+

This type can be used for all binary data such as images, documents, sounds etc.

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from Type

+

#==, #eql?

+ + +
+

Instance Method Details

+ + +
+

+ + #bytesString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/raw_type.rb', line 19
+
+
+
+
+ +
+

+ + #mime_typeString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/raw_type.rb', line 16
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/RefreshType.html b/5.33/OpenHAB/Core/Types/RefreshType.html new file mode 100644 index 0000000000..4451f3e672 --- /dev/null +++ b/5.33/OpenHAB/Core/Types/RefreshType.html @@ -0,0 +1,3753 @@ + + + + + + + Class: OpenHAB::Core::Types::RefreshType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::RefreshType + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Command
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/types/refresh_type.rb
+
+ +
+ +

Overview

+
+

Implements the REFRESH command.

+ + +
+
+
+ + +
+ +

+ Constant Summary + collapse +

+ +
+ +
REFRESH = +
+
+

Refresh Command

+ + +
+
+
+ + +
+
+
+ +
+ + + + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from Type

+

#==, #eql?

+ + +
+

Instance Method Details

+ + +
+

+ + #refresh?true, false + + + + + +

+
+

Check if self == REFRESH

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/refresh_type.rb', line 17
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/RewindFastforwardType.html b/5.33/OpenHAB/Core/Types/RewindFastforwardType.html new file mode 100644 index 0000000000..cebda8e84c --- /dev/null +++ b/5.33/OpenHAB/Core/Types/RewindFastforwardType.html @@ -0,0 +1,3858 @@ + + + + + + + Class: OpenHAB::Core::Types::RewindFastforwardType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::RewindFastforwardType + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Command, State
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/types/rewind_fastforward_type.rb
+
+ +
+ +

Overview

+
+

Implements the REWIND and FASTFORWARD commands and states.

+ + +
+
+
+ + +
+ +

+ Constant Summary + collapse +

+ +
+ +
REWIND = +
+
+

Rewind Command/Rewinding State

+ + +
+
+
+ + +
+
+
+ +
FASTFORWARD = +
+
+

Fast Forward Command/Fast Forwarding State

+ + +
+
+
+ + +
+
+
+ +
+ + + + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from Type

+

#==, #eql?

+ + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #fast_forwarding?true, false + + + + Also known as: + fast_forward? + + + + +

+
+

Check if self == FASTFORWARD

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/rewind_fastforward_type.rb', line 25
+
+
+
+
+ +
+

+ + #rewinding?true, false + + + + Also known as: + rewind? + + + + +

+
+

Check if self == REWIND

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/rewind_fastforward_type.rb', line 19
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/State.html b/5.33/OpenHAB/Core/Types/State.html new file mode 100644 index 0000000000..fca872d74b --- /dev/null +++ b/5.33/OpenHAB/Core/Types/State.html @@ -0,0 +1,3619 @@ + + + + + + + Module: OpenHAB::Core::Types::State + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Types::State + + + +

+
+ + + + + + +
+
Includes:
+
Type
+
+ + + + +
+
Included in:
+
DateTimeType, OnOffType, OpenClosedType, PlayPauseType, PointType, RawType, RewindFastforwardType, StringListType, UnDefType, UpDownType
+
+ + + +
+
Defined in:
+
lib/openhab/core/types/type.rb
+
+ +
+ +

Overview

+
+

This is a marker interface for all state types.

+ + +
+
+
+ + +
+ + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from Type

+

#==, #eql?

+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/StopMoveType.html b/5.33/OpenHAB/Core/Types/StopMoveType.html new file mode 100644 index 0000000000..c9f263123f --- /dev/null +++ b/5.33/OpenHAB/Core/Types/StopMoveType.html @@ -0,0 +1,3840 @@ + + + + + + + Class: OpenHAB::Core::Types::StopMoveType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::StopMoveType + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Command
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/types/stop_move_type.rb
+
+ +
+ +

Overview

+
+

Implements the STOP and MOVE commands.

+ + +
+
+
+ + +
+ +

+ Constant Summary + collapse +

+ +
+ +
STOP = +
+
+

Stop Command

+ + +
+
+
+ + +
+
+
+ +
MOVE = +
+
+

Move Command

+ + +
+
+
+ + +
+
+
+ +
+ + + + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from Type

+

#==, #eql?

+ + +
+

Instance Method Details

+ + +
+

+ + #move?true, false + + + + + +

+
+

Check if self == MOVE

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/stop_move_type.rb', line 23
+
+
+
+
+ +
+

+ + #stop?true, false + + + + + +

+
+

Check if self == STOP

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/stop_move_type.rb', line 19
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/StringListType.html b/5.33/OpenHAB/Core/Types/StringListType.html new file mode 100644 index 0000000000..98272d6f16 --- /dev/null +++ b/5.33/OpenHAB/Core/Types/StringListType.html @@ -0,0 +1,3762 @@ + + + + + + + Class: OpenHAB::Core::Types::StringListType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::StringListType + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Command, State
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/types/string_list_type.rb
+
+ +
+ +

Overview

+
+

StringListType can be used for items that are dealing with telephony functionality.

+

The entries can be accessed like an array.

+ + +
+
+
+ +
+

Examples:

+ + +
string_list = StringListType.new("a", "b", "c")
+logger.info "first entry: #{string_list.first}" # => "a"
+logger.info "second entry: #{string_list[1]}" # => "b"
+logger.info "last entry: #{string_list.last}" # => "c"
+logger.info "length: #{string_list.size}" # => 3
+ +
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Methods included from Type

+

#eql?

+ + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #to_aArray<String> + + + + + +

+
+

Returns the values as an array.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array<String>) + + + + — +

    the values as an array

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+36
+37
+38
+
+
# File 'lib/openhab/core/types/string_list_type.rb', line 36
+
+def to_a
+  typeDetails.to_a
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/StringType.html b/5.33/OpenHAB/Core/Types/StringType.html new file mode 100644 index 0000000000..25caa1cb6f --- /dev/null +++ b/5.33/OpenHAB/Core/Types/StringType.html @@ -0,0 +1,3949 @@ + + + + + + + Class: OpenHAB::Core::Types::StringType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::StringType + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/types/string_type.rb
+
+ +
+ +

Overview

+
+

StringType represents a String as a Type and a Command.

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #<=>(other) ⇒ Integer? + + + + + +

+
+

Comparison

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (StringType, String) + + + + — +

    object to compare to

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Integer, nil) + + + + — +

    -1, 0, +1 depending on whether other is +less than, equal to, or greater than self

    +

    nil is returned if the two values are incomparable.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+
+
# File 'lib/openhab/core/types/string_type.rb', line 43
+
+def <=>(other)
+  logger.trace { "(#{self.class}) #{self} <=> #{other} (#{other.class})" }
+  if other.respond_to?(:to_str)
+    to_str <=> other.to_str
+  elsif other.respond_to?(:coerce)
+    return nil unless (lhs, rhs = other.coerce(self))
+
+    lhs <=> rhs
+  end
+end
+
+
+ +
+

+ + #coerce(other) ⇒ [StringType, StringType]? + + + + + +

+
+

Type Coercion

+

Coerce object to a StringType

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (String) + + + + — +

    object to coerce to a StringType

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+63
+64
+65
+66
+
+
# File 'lib/openhab/core/types/string_type.rb', line 63
+
+def coerce(other)
+  logger.trace { "Coercing #{self} as a request from #{other.class}" }
+  [other.to_str, self] if other.respond_to?(:to_str)
+end
+
+
+ +
+

+ + #eql?(other) ⇒ true, false + + + + + +

+
+

Check equality without type conversion

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    if the same value is represented, without type +conversion

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+26
+27
+28
+29
+30
+
+
# File 'lib/openhab/core/types/string_type.rb', line 26
+
+def eql?(other)
+  return false unless other.instance_of?(self.class)
+
+  to_s == other.to_s
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/TimeSeries.html b/5.33/OpenHAB/Core/Types/TimeSeries.html new file mode 100644 index 0000000000..c60c2da14c --- /dev/null +++ b/5.33/OpenHAB/Core/Types/TimeSeries.html @@ -0,0 +1,4817 @@ + + + + + + + Class: OpenHAB::Core::Types::TimeSeries + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::TimeSeries + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
LazyArray
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/types/time_series.rb
+
+ +
+ +

Overview

+
+

TimeSeries is used to transport a set of states together with their timestamp.

+

The states are sorted chronologically. The entries can be accessed like an array.

+ + +
+
+
+ +
+

Examples:

+ + +
time_series = TimeSeries.new # defaults to :replace policy
+                        .add(Time.at(2), DecimalType.new(2))
+                        .add(Time.at(1), DecimalType.new(1))
+                        .add(Time.at(3), DecimalType.new(3))
+logger.info "first entry: #{time_series.first.state}" # => 1
+logger.info "last entry: #{time_series.last.state}" # => 3
+logger.info "second entry: #{time_series[1].state}" # => 2
+logger.info "sum: #{time_series.sum(&:state)}" # => 6
+ +
+ + +

See Also:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.1

    +
    + +
  • + +
+ +
+ + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #begin ⇒ Instant + + + + + + + + + readonly + + + + + + + + + +

    Returns the timestamp of the first element in this series.

    +
    + +
  • + + +
  • + + + #end ⇒ Instant + + + + + + + + + readonly + + + + + + + + + +

    Returns the timestamp of the last element in this series.

    +
    + +
  • + + +
  • + + + #policy ⇒ org.openhab.core.types.TimeSeries.Policy + + + + + + + + + readonly + + + + + + + + + +

    Returns the persistence policy of this series.

    +
    + +
  • + + +
  • + + + #size ⇒ Integer + + + + + + + + + readonly + + + + + + + + + +

    Returns the number of elements in this series.

    +
    + +
  • + + +
+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods included from LazyArray

+

#each, #method_missing, #to_ary

+ + + + + + + + + +

Methods included from Enumerable

+

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update, #update!

+
+

Constructor Details

+ +
+

+ + #initialize(policy = :replace) ⇒ TimeSeries + + + + + +

+
+

Create a new instance of TimeSeries

+ + +
+
+
+

Parameters:

+ + +

Since:

+
    + +
  • + + + + + +

    openHAB 4.1

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+59
+60
+61
+62
+
+
# File 'lib/openhab/core/types/time_series.rb', line 59
+
+def initialize(policy = :replace)
+  policy = Policy.value_of(policy.to_s.upcase) if policy.is_a?(Symbol)
+  super
+end
+
+
+ +
+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::LazyArray + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #beginInstant (readonly) + + + + + +

+
+

Returns the timestamp of the first element in this series.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/time_series.rb', line 41
+
+
+
+
+ + + +
+

+ + #endInstant (readonly) + + + + + +

+
+

Returns the timestamp of the last element in this series.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/time_series.rb', line 45
+
+
+
+
+ + + +
+

+ + #policyorg.openhab.core.types.TimeSeries.Policy (readonly) + + + + + +

+
+

Returns the persistence policy of this series.

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/time_series.rb', line 36
+
+
+
+
+ + + +
+

+ + #sizeInteger (readonly) + + + + + +

+
+

Returns the number of elements in this series.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/time_series.rb', line 49
+
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #<<(entry) ⇒ self + + + + + +

+
+

Appends an entry to self, returns self

+ + +
+
+
+ +
+

Examples:

+ + +

Append an entry

+

+ +
time_series << [Time.at(2), 2]
+ +
+

Parameters:

+
    + +
  • + + entry + + + (Array<Instant, State>) + + + + — +

    a two-element array with the timestamp and state. +The timestamp can be an Instant or any object that responds to #to_zoned_date_time.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.1

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+135
+136
+137
+138
+139
+140
+141
+142
+
+
# File 'lib/openhab/core/types/time_series.rb', line 135
+
+def <<(entry)
+  raise ArgumentError, "entry must be an Array, but was #{entry.class}" unless entry.respond_to?(:to_ary)
+
+  entry = entry.to_ary
+  raise ArgumentError, "entry must be an Array of size 2, but was #{entry.size}" unless entry.size == 2
+
+  add(entry[0], entry[1])
+end
+
+
+ +
+

+ + #add(timestamp, state) ⇒ self + + + + + +

+
+ +
+ Note: +

This method returns self so it can be chained, unlike the Java version.

+
+
+ +

Adds a new element to this series.

+

Elements can be added in an arbitrary order and are sorted chronologically.

+ + +
+
+
+

Parameters:

+
    + +
  • + + timestamp + + + (Instant, #to_zoned_date_time, #to_instant) + + + + — +

    An instant for the given state.

    +
    + +
  • + +
  • + + state + + + (State, String, Numeric) + + + + — +

    The State at the given timestamp. +If a String is given, it will be converted to StringType. +If a Numeric is given, it will be converted to DecimalType.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + + — +

    if state is not a State, String or Numeric

    +
    + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.1

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+118
+119
+120
+121
+122
+123
+
+
# File 'lib/openhab/core/types/time_series.rb', line 118
+
+def add(timestamp, state)
+  timestamp = to_instant(timestamp)
+  state = format_state(state)
+  add_instant(timestamp, state)
+  self
+end
+
+
+ +
+

+ + #add?true, false + + + + + +

+
+

Returns true if the series' policy is ADD.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.1

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+66
+67
+68
+
+
# File 'lib/openhab/core/types/time_series.rb', line 66
+
+def add?
+  policy == Policy::ADD
+end
+
+
+ +
+

+ + #replace?true, false + + + + + +

+
+

Returns true if the series' policy is REPLACE.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.1

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+72
+73
+74
+
+
# File 'lib/openhab/core/types/time_series.rb', line 72
+
+def replace?
+  policy == Policy::REPLACE
+end
+
+
+ +
+

+ + #statesArray<org.openhab.core.types.TimeSeries.Entry> + + + + + +

+
+

Returns the content of this series.

+ + +
+
+
+ +

Returns:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.1

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+96
+97
+98
+
+
# File 'lib/openhab/core/types/time_series.rb', line 96
+
+def states
+  to_a
+end
+
+
+ +
+

+ + #to_aArray + + + + + +

+
+

Explicit conversion to Array

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array) + + + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.1

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+88
+89
+90
+
+
# File 'lib/openhab/core/types/time_series.rb', line 88
+
+def to_a
+  get_states.to_array.to_a.freeze
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/Type.html b/5.33/OpenHAB/Core/Types/Type.html new file mode 100644 index 0000000000..4de884d9fb --- /dev/null +++ b/5.33/OpenHAB/Core/Types/Type.html @@ -0,0 +1,3842 @@ + + + + + + + Module: OpenHAB::Core::Types::Type + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::Types::Type + + + +

+
+ + + + + + + + + +
+
Included in:
+
Command, State
+
+ + + +
+
Defined in:
+
lib/openhab/core/types/type.rb
+
+ +
+ +

Overview

+
+

This is a parent interface for all States and Commands. It +was introduced as many states can be commands at the same time and vice +versa. E.g. a light can have the state ON or OFF and one can also +send ON and OFF as commands to the device. This duality is captured +by this marker interface and allows implementing classes to be both +state and command at the same time.

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #==(other) ⇒ true, false + + + + + +

+
+

Check equality, including type conversion

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    if the same value is represented, including +type conversions

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+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
+
+
# File 'lib/openhab/core/types/type.rb', line 45
+
+def ==(other)
+  logger.trace { "(#{self.class}) #{self} == #{other} (#{other.class})" }
+  return true if equal?(other)
+
+  # i.e. ON == OFF, REFRESH == ON, ON == REFRESH
+  # (RefreshType isn't really coercible)
+  return equals(other) if other.instance_of?(self.class) || is_a?(RefreshType) || other.is_a?(RefreshType)
+
+  if other.respond_to?(:coerce)
+    begin
+      return false unless (lhs, rhs = other.coerce(self))
+    rescue TypeError
+      # this one is a bit odd. 50 (Integer) == ON is internally
+      # flipping the argument and calling this method. but it responds
+      # to coerce, and then raises a TypeError (from Float???) that
+      # it couldn't convert to OnOffType. it probably should have
+      # returned nil. catch it and return false instead
+      return false
+    end
+
+    return lhs == rhs
+  end
+
+  super
+end
+
+
+ +
+

+ + #eql?(other) ⇒ true, false + + + + + +

+
+

Check equality without type conversion

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    if the same value is represented, without type +conversion

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+33
+34
+35
+36
+37
+
+
# File 'lib/openhab/core/types/type.rb', line 33
+
+def eql?(other)
+  return false unless other.instance_of?(self.class)
+
+  equals(other)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/UnDefType.html b/5.33/OpenHAB/Core/Types/UnDefType.html new file mode 100644 index 0000000000..724e636373 --- /dev/null +++ b/5.33/OpenHAB/Core/Types/UnDefType.html @@ -0,0 +1,3848 @@ + + + + + + + Class: OpenHAB::Core::Types::UnDefType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::UnDefType + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
State
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/types/un_def_type.rb
+
+ +
+ +

Overview

+
+

There are situations when item states do not have any defined value. +This might be because they have not been initialized yet (never +received an state update so far) or because their state is ambiguous +(e.g. a group item with members whose states do not match will be +NULL).

+ + +
+
+
+ + +
+ +

+ Constant Summary + collapse +

+ +
+ +
NULL = +
+
+

Null State

+ + +
+
+
+ + +
+
+
+ +
UNDEF = +
+
+

Undef State

+ + +
+
+
+ + +
+
+
+ +
+ + + + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from Type

+

#==, #eql?

+ + +
+

Instance Method Details

+ + +
+

+ + #null?true, false + + + + + +

+
+

Check if self == NULL

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/un_def_type.rb', line 23
+
+
+
+
+ +
+

+ + #undef?true, false + + + + + +

+
+

Check if self == UNDEF

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/un_def_type.rb', line 27
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/Types/UpDownType.html b/5.33/OpenHAB/Core/Types/UpDownType.html new file mode 100644 index 0000000000..4a3a2cd60d --- /dev/null +++ b/5.33/OpenHAB/Core/Types/UpDownType.html @@ -0,0 +1,3937 @@ + + + + + + + Class: OpenHAB::Core::Types::UpDownType + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Core::Types::UpDownType + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Command, State
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core/types/up_down_type.rb
+
+ +
+ +

Overview

+
+

Implements the UP and DOWN commands.

+

Also, PercentType can be converted to UpDownType +for more semantic comparisons. 0 is UP, 100 is +DOWN, and anything in-between is neither.

+ + +
+
+
+ + +
+ +

+ Constant Summary + collapse +

+ +
+ +
UP = +
+
+

Up Command/State

+ + +
+
+
+ + +
+
+
+ +
DOWN = +
+
+

Down Command/State

+ + +
+
+
+ + +
+
+
+ +
+ + + + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from Type

+

#==, #eql?

+ + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #!UpDownType + + + + + +

+
+

Invert the type

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+38
+39
+40
+41
+42
+
+
# File 'lib/openhab/core/types/up_down_type.rb', line 38
+
+def !
+  return UP if down?
+
+  DOWN if up?
+end
+
+
+ +
+

+ + #down?true, false + + + + + +

+
+

Check if self == DOWN

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/up_down_type.rb', line 29
+
+
+
+
+ +
+

+ + #up?true, false + + + + + +

+
+

Check if self == UP

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core/types/up_down_type.rb', line 25
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Core/ValueCache.html b/5.33/OpenHAB/Core/ValueCache.html new file mode 100644 index 0000000000..b7d156a10d --- /dev/null +++ b/5.33/OpenHAB/Core/ValueCache.html @@ -0,0 +1,4761 @@ + + + + + + + Module: OpenHAB::Core::ValueCache + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Core::ValueCache + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core/value_cache.rb
+
+ +
+ +

Overview

+
+ +
+ Note: +

Only the sharedCache is exposed in Ruby. +For a private cache, simply use an instance variable. See +Instance Variables.

+
+
+ +
+ Note: +

Because every script or UI rule gets its own JRuby engine instance, +you cannot rely on being able to access Ruby objects between them. Only +objects that implement a Java interface that's part of Java or openHAB +Core (such as Hash implements java.util.Map, or other basic +datatypes) can be reliably stored and accessed from the shared cache. +Likewise, you can use the cache to access data from other scripting +languages, but they'll be all but useless in Ruby. It's best to stick +to simple data types. If you're having troubles, serializing to_json +before storing may help.

+
+
+ +

ValueCache is the interface used to access a +shared cache available between scripts and/or +rule executions.

+

While ValueCache looks somewhat like a Hash, it does not support +iteration of the contained elements. So it's limited to strictly storing, +fetching, or removing known elements.

+

Shared caches are not persisted between openHAB restarts. And in fact, +if all scripts are unloaded that reference a particular key, that key is +removed.

+ + +
+
+
+ +
+

Examples:

+ + +
shared_cache.compute_if_absent(:execution_count) { 0 }
+shared_cache[:execution_count] += 1
+ +
+ + +

See Also:

+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #[](key) ⇒ Object + + + + Also known as: + store + + + + +

+
+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/openhab/core/value_cache.rb', line 49
+
+def [](key)
+  get(key.to_s)
+end
+
+
+ +
+

+ + #[]=(key, value) ⇒ Object + + + + + +

+
+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+65
+66
+67
+
+
# File 'lib/openhab/core/value_cache.rb', line 65
+
+def []=(key, value)
+  put(key.to_s, value)
+end
+
+
+ +
+

+ + #assoc(key) ⇒ Object + + + + + +

+
+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+109
+110
+111
+112
+113
+114
+115
+
+
# File 'lib/openhab/core/value_cache.rb', line 109
+
+def assoc(key)
+  [key,
+   fetch(key) do
+     # return nil directly, without storing a value to the cache
+     return nil
+   end]
+end
+
+
+ +
+

+ + #compute_if_absent(key, &block) ⇒ Object + + + + + +

+
+

Compute and store new value for key if the key is absent. This method is atomic.

+ + +
+
+
+

Parameters:

+
    + +
  • + + key + + + (String) + + + +
  • + +
+ +

Yield Returns:

+
    + +
  • + + + (Object) + + + + — +

    new value

    +
    + +
  • + +
+

Returns:

+
    + +
  • + + + (Object) + + + + — +

    new value or current value

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+60
+61
+62
+
+
# File 'lib/openhab/core/value_cache.rb', line 60
+
+def compute_if_absent(key, &block)
+  get(key.to_s, &block)
+end
+
+
+ +
+

+ + #delete(key) ⇒ Object + + + + + +

+
+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+71
+72
+73
+74
+75
+76
+77
+78
+79
+
+
# File 'lib/openhab/core/value_cache.rb', line 71
+
+def delete(key)
+  key = key.to_s
+  if block_given?
+    fetch(key) do
+      return yield(key)
+    end
+  end
+  remove(key)
+end
+
+
+ +
+

+ + #dig(key, *identifiers) ⇒ Object + + + + + +

+
+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+118
+119
+120
+121
+
+
# File 'lib/openhab/core/value_cache.rb', line 118
+
+def dig(key, *identifiers)
+  r = fetch(key) { return nil }
+  r&.dig(*identifiers)
+end
+
+
+ +
+

+ + #fetch(key, *default_value) ⇒ Object + + + + + +

+
+ + +
+
+
+ +
+

Examples:

+ + +
shared_cache.fetch(:key_from_another_script) # raises NoKeyError
+ +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+
+
# File 'lib/openhab/core/value_cache.rb', line 86
+
+def fetch(key, *default_value)
+  if default_value.length > 1
+    raise ArgumentError,
+          "wrong number of arguments (given #{default_value.length + 1}, expected 0..1)"
+  end
+
+  key = key.to_s
+  if default_value.empty?
+    if block_given?
+      get(key) do
+        return yield(key)
+      end
+    else
+      get(key) do
+        raise KeyError.new("key not found: #{key.inspect}", key: key)
+      end
+    end
+  else
+    get(key) { return default_value.first }
+  end
+end
+
+
+ +
+

+ + #fetch_values(*keys, &block) ⇒ Object + + + + + +

+
+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+
+
# File 'lib/openhab/core/value_cache.rb', line 124
+
+def fetch_values(*keys, &block)
+  result = []
+  keys.each do |key|
+    if block
+      result << fetch(key, &block)
+    else
+      has_value = true
+      value = fetch(key) { has_value = false }
+      result << value if has_value
+    end
+  end
+  result
+end
+
+
+ +
+

+ + #key?(key) ⇒ Boolean + + + + Also known as: + has_key?, include?, member? + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+139
+140
+141
+
+
# File 'lib/openhab/core/value_cache.rb', line 139
+
+def key?(key)
+  !!fetch(key) { return false }
+end
+
+
+ +
+

+ + #merge!(*other_hashes) ⇒ Object + + + + Also known as: + update + + + + +

+
+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+
+
# File 'lib/openhab/core/value_cache.rb', line 147
+
+def merge!(*other_hashes)
+  other_hashes.each do |hash|
+    hash.each do |(k, v)|
+      k = k.to_s
+      if block_given?
+        dup = true
+        old_value = fetch(k) do
+          dup = false
+        end
+        self[k] = dup ? yield(k, old_value, v) : v
+      else
+        self[k] = v
+      end
+    end
+  end
+  self
+end
+
+
+ +
+

+ + #slice(*keys) ⇒ Object + + + + + +

+
+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+167
+168
+169
+170
+171
+172
+173
+174
+
+
# File 'lib/openhab/core/value_cache.rb', line 167
+
+def slice(*keys)
+  result = {}
+  keys.each do |k|
+    k = k.to_s
+    result[k] = self[k] if key?(k)
+  end
+  result
+end
+
+
+ +
+

+ + #to_procObject + + + + + +

+
+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+177
+178
+179
+
+
# File 'lib/openhab/core/value_cache.rb', line 177
+
+def to_proc
+  @to_proc ||= ->(k) { self[k] }
+end
+
+
+ +
+

+ + #values_at(*keys) ⇒ Object + + + + + +

+
+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+182
+183
+184
+185
+186
+
+
# File 'lib/openhab/core/value_cache.rb', line 182
+
+def values_at(*keys)
+  keys.map do |k|
+    self[k]
+  end
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt.html b/5.33/OpenHAB/CoreExt.html new file mode 100644 index 0000000000..c47c7630dd --- /dev/null +++ b/5.33/OpenHAB/CoreExt.html @@ -0,0 +1,3610 @@ + + + + + + + Module: OpenHAB::CoreExt + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::CoreExt + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core_ext.rb,
+ lib/openhab/core_ext/between.rb,
lib/openhab/core_ext/ephemeris.rb,
lib/openhab/core_ext/java/time.rb,
lib/openhab/core_ext/java/class.rb,
lib/openhab/core_ext/java/month.rb,
lib/openhab/core_ext/ruby/range.rb,
lib/openhab/core_ext/java/period.rb,
lib/openhab/core_ext/ruby/object.rb,
lib/openhab/core_ext/java/instant.rb,
lib/openhab/core_ext/ruby/numeric.rb,
lib/openhab/core_ext/java/duration.rb,
lib/openhab/core_ext/java/month_day.rb,
lib/openhab/core_ext/java/local_date.rb,
lib/openhab/core_ext/java/local_time.rb,
lib/openhab/core_ext/java/temporal_amount.rb,
lib/openhab/core_ext/java/zoned_date_time.rb
+
+
+ +
+ +

Overview

+
+

Extensions to core classes

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: Between, Ephemeris, Java, Ruby + + + + +

+ + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt/Between.html b/5.33/OpenHAB/CoreExt/Between.html new file mode 100644 index 0000000000..07a6eefb63 --- /dev/null +++ b/5.33/OpenHAB/CoreExt/Between.html @@ -0,0 +1,3819 @@ + + + + + + + Module: OpenHAB::CoreExt::Between + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::CoreExt::Between + + + +

+
+ + + + + + + + + +
+
Included in:
+
Date, DateTime, Java::Duration, Java::Instant, Java::LocalDate, Java::LocalTime, Java::Month, Java::MonthDay, Java::ZonedDateTime, Time
+
+ + + +
+
Defined in:
+
lib/openhab/core_ext/between.rb
+
+ +
+ +

Overview

+
+

Extensions that apply to both Date and Time classes

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + + #between?(min, max) ⇒ true, false + + #between?(range) ⇒ true, false + + + + + + +

+
+

Checks whether the the object falls between the given range.

+ + +
+
+
+ +

Overloads:

+
    + + +
  • + #between?(min, max) ⇒ true, false +
    +
    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + min + + + (Object) + + + + — +

      The minimum value to check, inclusive

      +
      + +
    • + +
    • + + max + + + (Object) + + + + — +

      The maximum value to check, inclusive

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (true, false) + + + +
    • + +
    + +
    +
  • + + +
  • + #between?(range) ⇒ true, false +
    +
    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + range + + + (Range) + + + + — +

      A range to check

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (true, false) + + + +
    • + +
    + +
    +
  • + +
+ + +
+ + + + +
+
+
+
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+
+
# File 'lib/openhab/core_ext/between.rb', line 19
+
+def between?(min, max = nil)
+  range = if max
+            Range.new(min, max, false)
+          else
+            raise ArgumentError, "Expecting a range when given a single argument" unless min.is_a?(Range)
+
+            min
+          end
+
+  OpenHAB::DSL.between(range).cover?(self)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt/Ephemeris.html b/5.33/OpenHAB/CoreExt/Ephemeris.html new file mode 100644 index 0000000000..be00c7195c --- /dev/null +++ b/5.33/OpenHAB/CoreExt/Ephemeris.html @@ -0,0 +1,4262 @@ + + + + + + + Module: OpenHAB::CoreExt::Ephemeris + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::CoreExt::Ephemeris + + + +

+
+ + + + + + + + + +
+
Included in:
+
Date, DateTime, Java::LocalDate, Java::MonthDay, Time
+
+ + + +
+
Defined in:
+
lib/openhab/core_ext/ephemeris.rb
+
+ +
+ +

Overview

+
+ +
+ Note: +

openHAB's built-in holiday definitions are based on bank +holidays, so may give some unexpected results. For example, 2022-12-25 +is not Christmas in England because it lands on a Sunday that year, +so Christmas is considered to be 2022-12-26. See +the source +for exact definitions. You can always provide your own holiday +definitions with holiday_file or +holiday_file!.

+
+
+ +

Forwards ephemeris helper methods to #to_zoned_date_time provided by +the mixed-in class.

+ + +
+
+
+ + +

See Also:

+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #days_until(holiday, holiday_file = nil) ⇒ Integer + + + + + +

+
+

Calculate the number of days until a specific holiday

+ + +
+
+
+ +
+

Examples:

+ + +
Time.now.days_until(:christmas) # => 2
+ +
+

Parameters:

+
    + +
  • + + holiday + + + (String, Symbol) + + + +
  • + +
  • + + holiday_file + + + (String, nil) + + + (defaults to: nil) + + + — +

    Optional path to XML file to use for holiday definitions.

    +
    + +
  • + +
+ +

Returns:

+ +

Raises:

+
    + +
  • + + + (ArgumentError) + + + + — +

    if the holiday isn't valid

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+48
+49
+50
+
+
# File 'lib/openhab/core_ext/ephemeris.rb', line 48
+
+def days_until(holiday, holiday_file = nil)
+  to_zoned_date_time.days_until(holiday, holiday_file)
+end
+
+
+ +
+

+ + #holiday(holiday_file = nil) ⇒ Symbol? + + + + + +

+
+

Name of the holiday for this date.

+ + +
+
+
+ +
+

Examples:

+ + +
MonthDay.parse("12-25").holiday # => :christmas
+ +
+

Parameters:

+
    + +
  • + + holiday_file + + + (String, nil) + + + (defaults to: nil) + + + — +

    Optional path to XML file to use for holiday definitions.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Symbol, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/openhab/core_ext/ephemeris.rb', line 23
+
+def holiday(holiday_file = nil)
+  to_zoned_date_time.holiday(holiday_file)
+end
+
+
+ +
+

+ + #holiday?(holiday_file = nil) ⇒ true, false + + + + + +

+
+

Determines if this date is on a holiday.

+ + +
+
+
+

Parameters:

+
    + +
  • + + holiday_file + + + (String, nil) + + + (defaults to: nil) + + + — +

    Optional path to XML file to use for holiday definitions.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+28
+29
+30
+
+
# File 'lib/openhab/core_ext/ephemeris.rb', line 28
+
+def holiday?(holiday_file = nil)
+  to_zoned_date_time.holiday?(holiday_file)
+end
+
+
+ +
+

+ + #in_dayset?(set) ⇒ true, false + + + + + +

+
+

Determines if this time is during a specific dayset

+ + +
+
+
+ +
+

Examples:

+ + +
Time.now.in_dayset?("school")
+ +
+

Parameters:

+
    + +
  • + + set + + + (String, Symbol) + + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+43
+44
+45
+
+
# File 'lib/openhab/core_ext/ephemeris.rb', line 43
+
+def in_dayset?(set)
+  to_zoned_date_time.in_dayset?(set)
+end
+
+
+ +
+

+ + #next_holiday(holiday_file = nil) ⇒ Symbol + + + + + +

+
+

Name of the closest holiday on or after this date.

+ + +
+
+
+

Parameters:

+
    + +
  • + + holiday_file + + + (String, nil) + + + (defaults to: nil) + + + — +

    Optional path to XML file to use for holiday definitions.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + +
  • + +
+ +
+ + + + +
+
+
+
+33
+34
+35
+
+
# File 'lib/openhab/core_ext/ephemeris.rb', line 33
+
+def next_holiday(holiday_file = nil)
+  to_zoned_date_time.next_holiday(holiday_file)
+end
+
+
+ +
+

+ + #weekend?true, false + + + + + +

+
+

Determines if this time is during a weekend.

+ + +
+
+
+ +
+

Examples:

+ + +
Time.now.weekend?
+ +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+38
+39
+40
+
+
# File 'lib/openhab/core_ext/ephemeris.rb', line 38
+
+def weekend?
+  to_zoned_date_time.weekend?
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt/Java.html b/5.33/OpenHAB/CoreExt/Java.html new file mode 100644 index 0000000000..b3c81d3995 --- /dev/null +++ b/5.33/OpenHAB/CoreExt/Java.html @@ -0,0 +1,3612 @@ + + + + + + + Module: OpenHAB::CoreExt::Java + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::CoreExt::Java + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core_ext.rb,
+ lib/openhab/core_ext/java/time.rb,
lib/openhab/core_ext/java/class.rb,
lib/openhab/core_ext/java/month.rb,
lib/openhab/core_ext/java/period.rb,
lib/openhab/core_ext/java/instant.rb,
lib/openhab/core_ext/java/duration.rb,
lib/openhab/core_ext/java/month_day.rb,
lib/openhab/core_ext/java/local_date.rb,
lib/openhab/core_ext/java/local_time.rb,
lib/openhab/core_ext/java/temporal_amount.rb,
lib/openhab/core_ext/java/zoned_date_time.rb
+
+
+ +
+ +

Overview

+
+

Extensions to core Java classes

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: TemporalAmount, Time + + + + Classes: Class, Duration, Instant, LocalDate, LocalTime, Month, MonthDay, Period, ZonedDateTime + + +

+ + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt/Java/Class.html b/5.33/OpenHAB/CoreExt/Java/Class.html new file mode 100644 index 0000000000..c69a48fe1b --- /dev/null +++ b/5.33/OpenHAB/CoreExt/Java/Class.html @@ -0,0 +1,3793 @@ + + + + + + + Class: OpenHAB::CoreExt::Java::Class + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::CoreExt::Java::Class + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core_ext/java/class.rb
+
+ +
+ +

Overview

+
+

Extensions to Class

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #ancestorsArray<Class> + + + + + +

+
+

self, all superclasses and interfaces, recursively.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+15
+16
+17
+18
+19
+
+
# File 'lib/openhab/core_ext/java/class.rb', line 15
+
+def ancestors
+  ([self] +
+    Array(superclass&.ancestors) +
+    interfaces.flat_map(&:ancestors)).uniq
+end
+
+
+ +
+

+ + #generic_ancestorsArray<java.lang.reflect.Type> + + + + + +

+
+

self, all superclasses and interfaces, recursively.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+26
+27
+28
+29
+30
+
+
# File 'lib/openhab/core_ext/java/class.rb', line 26
+
+def generic_ancestors
+  ancestors.flat_map do |klass|
+    Array(klass.generic_superclass) + klass.generic_interfaces
+  end.uniq
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt/Java/Duration.html b/5.33/OpenHAB/CoreExt/Java/Duration.html new file mode 100644 index 0000000000..24cb6e9c5a --- /dev/null +++ b/5.33/OpenHAB/CoreExt/Java/Duration.html @@ -0,0 +1,4141 @@ + + + + + + + Class: OpenHAB::CoreExt::Java::Duration + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::CoreExt::Java::Duration + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Between, TemporalAmount
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core_ext/java/duration.rb
+
+ +
+ +

Overview

+
+

Extensions to Java Duration

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods included from TemporalAmount

+

#-@, #ago, #from_now, #inspect

+ + + + + + + + + +

Methods included from Between

+

#between?

+ + +
+

Instance Method Details

+ + +
+

+ + #<=>(other) ⇒ Integer? + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+51
+52
+53
+54
+55
+56
+57
+
+
# File 'lib/openhab/core_ext/java/duration.rb', line 51
+
+def <=>(other)
+  return to_f <=> other if other.is_a?(Numeric)
+
+  super
+rescue TypeError
+  nil
+end
+
+
+ +
+

+ + #coerce(other) ⇒ Array? + + + + + +

+
+

Converts other to OpenHAB::CoreExt::Java::Duration, if possible.

+ + +
+
+
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (Array, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+65
+66
+67
+68
+69
+
+
# File 'lib/openhab/core_ext/java/duration.rb', line 65
+
+def coerce(other)
+  return [other.seconds, self] if other.is_a?(Numeric)
+
+  [other.to_i.seconds, self] if other.is_a?(Period)
+end
+
+
+ +
+

+ + #positive?true, false + + + + + +

+
+

Returns true if the duration is greater than zero.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    Returns true if the duration is greater than zero.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+34
+35
+36
+
+
# File 'lib/openhab/core_ext/java/duration.rb', line 34
+
+def positive?
+  self > 0 # rubocop:disable Style/NumericPredicate
+end
+
+
+ +
+

+ + #to_fFloat + + + + + +

+
+

Convert to number of seconds

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + +
  • + +
+ +
+ + + + +
+
+
+
+44
+45
+46
+
+
# File 'lib/openhab/core_ext/java/duration.rb', line 44
+
+def to_f
+  to_i + (nano / 1_000_000_000.0)
+end
+
+
+ +
+

+ + #to_iInteger + + + + + +

+
+

Convert to integer number of seconds

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+18
+
+
# File 'lib/openhab/core_ext/java/duration.rb', line 18
+
+alias_method :to_i, :seconds
+
+
+ +
+

+ + #zero?true, false + + + + + +

+
+

Returns true if the duration is zero length.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    Returns true if the duration is zero length.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core_ext/java/duration.rb', line 20
+
+
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt/Java/Instant.html b/5.33/OpenHAB/CoreExt/Java/Instant.html new file mode 100644 index 0000000000..43227fd100 --- /dev/null +++ b/5.33/OpenHAB/CoreExt/Java/Instant.html @@ -0,0 +1,5316 @@ + + + + + + + Class: OpenHAB::CoreExt::Java::Instant + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::CoreExt::Java::Instant + + + +

+
+ +
+
Inherits:
+
+ java.lang.Object + + + show all + +
+
+ + + + + + +
+
Includes:
+
Between, Time
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core_ext/java/instant.rb
+
+ +
+ +

Overview

+
+

Extensions to java.time.Instant

+ + +
+
+
+ + +
+ + + +

Class Attribute Summary collapse

+
    + +
  • + + + .now ⇒ Instant + + + + + + + + + readonly + + + + + + + + + +
    + +
  • + + +
+ + + + + +

+ Class Method Summary + collapse +

+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from Between

+

#between?

+ + + + + + + + + + + + + + + + + + + +
+

Class Attribute Details

+ + + +
+

+ + .nowInstant (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core_ext/java/instant.rb', line 21
+
+
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .parse(text, formatter = nil) ⇒ Instant + + + + + +

+
+

Parses a string into an Instant object.

+ + +
+
+
+

Parameters:

+
    + +
  • + + text + + + (String) + + + + — +

    The text to parse.

    +
    + +
  • + +
  • + + formatter + + + (java.time.format.DateTimeFormatter) + + + (defaults to: nil) + + + — +

    The formatter to use.

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core_ext/java/instant.rb', line 24
+
+
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #+(other) ⇒ Instant + + + + + +

+
+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (TemporalAmount, Numeric) + + + + — +

    If other is a Numeric, it's interpreted as seconds.

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+81
+82
+83
+84
+85
+
+
# File 'lib/openhab/core_ext/java/instant.rb', line 81
+
+def +(other)
+  return plus(other.seconds) if other.is_a?(Numeric)
+
+  plus(other)
+end
+
+
+ +
+

+ + #-(other) ⇒ Duration, Instant + + + + + +

+
+ + +
+
+
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (Duration) + + + + — +

    If other responds to #to_zoned_date_time

    +
    + +
  • + +
  • + + + (Instant) + + + + — +

    If other is a TemporalAmount

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+
+
# File 'lib/openhab/core_ext/java/instant.rb', line 64
+
+def -(other)
+  if other.is_a?(Instant)
+    java.time.Duration.between(other, self)
+  elsif other.respond_to?(:to_instant)
+    java.time.Duration.between(other.to_instant, self)
+  elsif other.respond_to?(:to_zoned_date_time)
+    java.time.Duration.between(other.to_zoned_date_time.to_instant, self)
+  elsif other.is_a?(Numeric)
+    minus(other.seconds)
+  else
+    minus(other)
+  end
+end
+
+
+ +
+

+ + #<=>(other) ⇒ Integer? + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+
+
# File 'lib/openhab/core_ext/java/instant.rb', line 109
+
+def <=>(other)
+  logger.trace { "(#{self.class}) #{self} <=> #{other} (#{other.class})" }
+  # compare instants, otherwise it will differ by timezone, which we don't want
+  # (use eql? if you care about that)
+  if other.respond_to?(:to_instant)
+    logger.trace { "Comparing #{self} to #{other.to_instant}" }
+    compare_to(other.to_instant(to_zoned_date_time))
+  elsif other.respond_to?(:coerce) && (lhs, rhs = other.coerce(self))
+    lhs <=> rhs
+  end
+end
+
+
+ +
+

+ + #coerce(other) ⇒ Array? + + + + + +

+
+

Converts other to OpenHAB::CoreExt::Java::Instant, if possible

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (#to_instant) + + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Array, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+139
+140
+141
+142
+143
+144
+
+
# File 'lib/openhab/core_ext/java/instant.rb', line 139
+
+def coerce(other)
+  logger.trace { "Coercing #{self} as a request from #{other.class}" }
+  return [other.to_instant(to_zoned_date_time), self] if other.respond_to?(:to_instant)
+
+  [other.to_zoned_date_time(zoned_date_time).to_instant, self] if other.respond_to?(:to_zoned_date_time)
+end
+
+
+ +
+

+ + #to_dateDate + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Date) + + + +
  • + +
+ +
+ + + + +
+
+
+
+50
+51
+52
+53
+54
+55
+56
+57
+58
+
+
# File 'lib/openhab/core_ext/java/instant.rb', line 50
+
+def_delegators :to_zoned_date_time,
+:to_local_time,
+:to_local_date,
+:to_date,
+:to_month_day,
+:to_month,
+:yesterday?,
+:today?,
+:tomorrow?
+
+
+ +
+

+ + #to_fFloat + + + + + +

+
+

The number of seconds since the Unix epoch.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + +
  • + +
+ +
+ + + + +
+
+
+
+99
+100
+101
+
+
# File 'lib/openhab/core_ext/java/instant.rb', line 99
+
+def to_f
+  ((epoch_second * 1_000_000_000) + nano).fdiv(1_000_000_000.0)
+end
+
+
+ +
+

+ + #to_iInteger + + + + + +

+
+

The number of seconds since the Unix epoch.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+91
+92
+93
+
+
# File 'lib/openhab/core_ext/java/instant.rb', line 91
+
+def to_i
+  epoch_second
+end
+
+
+ +
+

+ + #to_local_dateLocalDate + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+50
+51
+52
+53
+54
+55
+56
+57
+58
+
+
# File 'lib/openhab/core_ext/java/instant.rb', line 50
+
+def_delegators :to_zoned_date_time,
+:to_local_time,
+:to_local_date,
+:to_date,
+:to_month_day,
+:to_month,
+:yesterday?,
+:today?,
+:tomorrow?
+
+
+ +
+

+ + #to_local_timeLocalTime + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+50
+51
+52
+53
+54
+55
+56
+57
+58
+
+
# File 'lib/openhab/core_ext/java/instant.rb', line 50
+
+def_delegators :to_zoned_date_time,
+:to_local_time,
+:to_local_date,
+:to_date,
+:to_month_day,
+:to_month,
+:yesterday?,
+:today?,
+:tomorrow?
+
+
+ +
+

+ + #to_monthMonth + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Month) + + + +
  • + +
+ +
+ + + + +
+
+
+
+50
+51
+52
+53
+54
+55
+56
+57
+58
+
+
# File 'lib/openhab/core_ext/java/instant.rb', line 50
+
+def_delegators :to_zoned_date_time,
+:to_local_time,
+:to_local_date,
+:to_date,
+:to_month_day,
+:to_month,
+:yesterday?,
+:today?,
+:tomorrow?
+
+
+ +
+

+ + #to_month_dayMonthDay + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+50
+51
+52
+53
+54
+55
+56
+57
+58
+
+
# File 'lib/openhab/core_ext/java/instant.rb', line 50
+
+def_delegators :to_zoned_date_time,
+:to_local_time,
+:to_local_date,
+:to_date,
+:to_month_day,
+:to_month,
+:yesterday?,
+:today?,
+:tomorrow?
+
+
+ +
+

+ + #to_timeTime + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Time) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core_ext/java/instant.rb', line 105
+
+
+
+
+ +
+

+ + #to_zoned_date_time(context = nil) ⇒ ZonedDateTime + + + + + +

+
+ + +
+
+
+

Parameters:

+
    + +
  • + + context + + + (ZonedDateTime, nil) + + + (defaults to: nil) + + + — +

    A ZonedDateTime used to match the zone id. Defaults to UTC.

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+123
+124
+125
+126
+
+
# File 'lib/openhab/core_ext/java/instant.rb', line 123
+
+def to_zoned_date_time(context = nil)
+  zone = context&.zone || java.time.ZoneOffset::UTC
+  at_zone(zone)
+end
+
+
+ +
+

+ + #today?true, false + + + + + +

+
+

Returns true if the date, converted to the system time zone, is today.

+

This is the equivalent of checking if the current datetime is between midnight and end of the day +of the system time zone.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+50
+51
+52
+53
+54
+55
+56
+57
+58
+
+
# File 'lib/openhab/core_ext/java/instant.rb', line 50
+
+def_delegators :to_zoned_date_time,
+:to_local_time,
+:to_local_date,
+:to_date,
+:to_month_day,
+:to_month,
+:yesterday?,
+:today?,
+:tomorrow?
+
+
+ +
+

+ + #tomorrow?true, false + + + + + +

+
+

Returns true if the date, converted to the system time zone, is tomorrow.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+50
+51
+52
+53
+54
+55
+56
+57
+58
+
+
# File 'lib/openhab/core_ext/java/instant.rb', line 50
+
+def_delegators :to_zoned_date_time,
+:to_local_time,
+:to_local_date,
+:to_date,
+:to_month_day,
+:to_month,
+:yesterday?,
+:today?,
+:tomorrow?
+
+
+ +
+

+ + #yesterday?true, false + + + + + +

+
+

Returns true if the date, converted to the system time zone, is yesterday.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+50
+51
+52
+53
+54
+55
+56
+57
+58
+
+
# File 'lib/openhab/core_ext/java/instant.rb', line 50
+
+def_delegators :to_zoned_date_time,
+:to_local_time,
+:to_local_date,
+:to_date,
+:to_month_day,
+:to_month,
+:yesterday?,
+:today?,
+:tomorrow?
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt/Java/LocalDate.html b/5.33/OpenHAB/CoreExt/Java/LocalDate.html new file mode 100644 index 0000000000..eb7e3540de --- /dev/null +++ b/5.33/OpenHAB/CoreExt/Java/LocalDate.html @@ -0,0 +1,4696 @@ + + + + + + + Class: OpenHAB::CoreExt::Java::LocalDate + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::CoreExt::Java::LocalDate + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Between, Ephemeris, Time
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core_ext/java/local_date.rb
+
+ +
+ +

Overview

+
+

Extensions to java.time.LocalDate

+ + +
+
+
+ + +
+ + + +

Class Attribute Summary collapse

+ + + + + + +

+ Class Method Summary + collapse +

+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods included from Ephemeris

+

#days_until, #holiday, #holiday?, #in_dayset?, #next_holiday, #weekend?

+ + + + + + + + + +

Methods included from Between

+

#between?

+ + + + + + + + + +

Methods included from Time

+

#<=>, #coerce

+ + + + + + + +
+

Class Attribute Details

+ + + +
+

+ + .nowLocalDate (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core_ext/java/local_date.rb', line 18
+
+
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .parse(text, formatter = nil) ⇒ LocalDate + + + + + +

+
+

Converts the given text into a LocalDate.

+ + +
+
+
+

Parameters:

+
    + +
  • + + text + + + (String) + + + + — +

    The text to parse

    +
    + +
  • + +
  • + + formatter + + + (java.time.format.DateTimeFormatter) + + + (defaults to: nil) + + + — +

    The formatter to use

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core_ext/java/local_date.rb', line 21
+
+
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #+(other) ⇒ LocalDate + + + + + +

+
+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (TemporalAmount, Numeric) + + + + — +

    If other is a Numeric, it's interpreted as days.

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+
+
# File 'lib/openhab/core_ext/java/local_date.rb', line 53
+
+def +(other)
+  case other
+  when Duration
+    plus_days(other.to_days)
+  when Numeric
+    plus_days(other.to_i)
+  else
+    plus(other)
+  end
+end
+
+
+ +
+

+ + #-(other) ⇒ LocalDate, Period + + + + + +

+
+ + +
+
+
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (LocalDate) + + + + — +

    If other is a TemporalAmount or Numeric

    +
    + +
  • + +
  • + + + (Period) + + + + — +

    If other is a LocalDate

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+
+
# File 'lib/openhab/core_ext/java/local_date.rb', line 33
+
+def -(other)
+  case other
+  when Date
+    self - other.to_local_date
+  when MonthDay
+    self - other.at_year(year)
+  when LocalDate
+    Period.between(other, self)
+  when Duration
+    minus_days(other.to_days)
+  when Numeric
+    minus_days(other.ceil)
+  else
+    minus(other)
+  end
+end
+
+
+ +
+

+ + #succLocalDate + + + + + +

+
+

Returns the next day

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+69
+70
+71
+
+
# File 'lib/openhab/core_ext/java/local_date.rb', line 69
+
+def succ
+  plus_days(1)
+end
+
+
+ +
+

+ + #to_dateDate + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Date) + + + +
  • + +
+ +
+ + + + +
+
+
+
+74
+75
+76
+
+
# File 'lib/openhab/core_ext/java/local_date.rb', line 74
+
+def to_date
+  Date.new(year, month_value, day_of_month)
+end
+
+
+ +
+

+ + #to_instant(context = nil) ⇒ Instant + + + + + +

+
+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+104
+105
+106
+107
+
+
# File 'lib/openhab/core_ext/java/local_date.rb', line 104
+
+def to_instant(context = nil)
+  zone = context&.zone || java.time.ZoneOffset::UTC
+  at_start_of_day(zone).to_instant
+end
+
+
+ +
+

+ + #to_local_date(_context = nil) ⇒ self + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+87
+88
+89
+
+
# File 'lib/openhab/core_ext/java/local_date.rb', line 87
+
+def to_local_date(_context = nil)
+  self
+end
+
+
+ +
+

+ + #to_monthMonth + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Month) + + + +
  • + +
+ +
+ + + + +
+
+
+
+79
+
+
# File 'lib/openhab/core_ext/java/local_date.rb', line 79
+
+alias_method :to_month, :month
+
+
+ +
+

+ + #to_month_dayMonthDay + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+82
+83
+84
+
+
# File 'lib/openhab/core_ext/java/local_date.rb', line 82
+
+def to_month_day
+  MonthDay.of(month, day_of_month)
+end
+
+
+ +
+

+ + #to_zoned_date_time(context = nil) ⇒ ZonedDateTime + + + + + +

+
+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+95
+96
+97
+98
+
+
# File 'lib/openhab/core_ext/java/local_date.rb', line 95
+
+def to_zoned_date_time(context = nil)
+  zone = context&.zone || java.time.ZoneId.system_default
+  at_start_of_day(zone)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt/Java/LocalTime.html b/5.33/OpenHAB/CoreExt/Java/LocalTime.html new file mode 100644 index 0000000000..142e718580 --- /dev/null +++ b/5.33/OpenHAB/CoreExt/Java/LocalTime.html @@ -0,0 +1,4455 @@ + + + + + + + Class: OpenHAB::CoreExt::Java::LocalTime + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::CoreExt::Java::LocalTime + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Between
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core_ext/java/local_time.rb
+
+ +
+ +

Overview

+
+

Extensions to java.time.LocalTime

+ + +
+
+
+ +
+

Examples:

+ + +
break_time = LocalTime::NOON
+
+if LocalTime.now > LocalTime.of(17, 30) # comparing two LocalTime objects
+  # do something
+elsif LocalTime.now < LocalTime.parse('8:30') # comparison against a string
+  # do something
+end
+four_pm = LocalTime.parse('16:00')
+ + +
# Trigger security light between sunset and sunrise when motion is detected
+rule 'Outside Light Motion' do
+  updated Motion_Sensor, to: OPEN
+  run do
+    astro = things['astro:sun:home']
+    sunrise = astro.get_event_time('SUN_RISE', nil, nil).to_local_time
+    sunset = astro.get_event_time('SUN_SET', nil, nil).to_local_time
+    next if (sunrise..sunset).cover?(Time.now)
+
+    Security_Light.on for: 10.minutes
+  end
+end
+ +
+ + +
+ + + +

Class Attribute Summary collapse

+ + + + + + +

+ Class Method Summary + collapse +

+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods included from Between

+

#between?

+ +
+

Class Attribute Details

+ + + +
+

+ + .nowLocalTime (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core_ext/java/local_time.rb', line 42
+
+
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .parse(string, formatter = nil) ⇒ LocalTime + + + + + +

+
+

Parses strings in the form "h[:mm[:ss]] [am/pm]" when no formatter is given.

+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+
+
# File 'lib/openhab/core_ext/java/local_time.rb', line 55
+
+def parse(string, formatter = nil)
+  return raw_parse(string, formatter) if formatter
+
+  format = /(am|pm)$/i.match?(string) ? "h[:mm[:ss][.S]][ ]a" : "H[:mm[:ss][.S]]"
+  java_send(:parse,
+            [java.lang.CharSequence, java.time.format.DateTimeFormatter],
+            string,
+            java.time.format.DateTimeFormatterBuilder.new
+                                                     .parse_case_insensitive
+                                                     .parse_lenient
+                                                     .append_pattern(format)
+                                                     .to_formatter(java.util.Locale::ENGLISH))
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #+(other) ⇒ LocalTime + + + + + +

+
+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (TemporalAmount, Numeric) + + + + — +

    If other is a Numeric, it's interpreted as seconds.

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+83
+84
+85
+86
+87
+88
+
+
# File 'lib/openhab/core_ext/java/local_time.rb', line 83
+
+def +(other)
+  return plus(other.seconds) if other.is_a?(Numeric)
+  return self if other.is_a?(Period)
+
+  plus(other)
+end
+
+
+ +
+

+ + #-(other) ⇒ LocalTime + + + + + +

+
+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (TemporalAmount, Numeric) + + + + — +

    If other is a Numeric, it's interpreted as seconds.

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+73
+74
+75
+76
+77
+78
+
+
# File 'lib/openhab/core_ext/java/local_time.rb', line 73
+
+def -(other)
+  return minus(other.seconds) if other.is_a?(Numeric)
+  return self if other.is_a?(Period)
+
+  minus(other)
+end
+
+
+ +
+

+ + #succLocalTime + + + + + +

+
+

Returns the next second

+

Will loop back to the beginning of the day if necessary.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+97
+98
+99
+
+
# File 'lib/openhab/core_ext/java/local_time.rb', line 97
+
+def succ
+  plus_seconds(1)
+end
+
+
+ +
+

+ + #to_instant(context = nil) ⇒ Instant + + + + + +

+
+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+119
+120
+121
+122
+
+
# File 'lib/openhab/core_ext/java/local_time.rb', line 119
+
+def to_instant(context = nil)
+  context ||= Instant.now.to_zoned_date_time
+  to_zoned_date_time(context).to_instant
+end
+
+
+ +
+

+ + #to_local_timeself + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+102
+103
+104
+
+
# File 'lib/openhab/core_ext/java/local_time.rb', line 102
+
+def to_local_time
+  self
+end
+
+
+ +
+

+ + #to_zoned_date_time(context = nil) ⇒ ZonedDateTime + + + + + +

+
+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+110
+111
+112
+113
+
+
# File 'lib/openhab/core_ext/java/local_time.rb', line 110
+
+def to_zoned_date_time(context = nil)
+  context ||= ZonedDateTime.now
+  context.with(self)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt/Java/Month.html b/5.33/OpenHAB/CoreExt/Java/Month.html new file mode 100644 index 0000000000..2526c60350 --- /dev/null +++ b/5.33/OpenHAB/CoreExt/Java/Month.html @@ -0,0 +1,4386 @@ + + + + + + + Class: OpenHAB::CoreExt::Java::Month + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::CoreExt::Java::Month + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Between, Time
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core_ext/java/month.rb
+
+ +
+ +

Overview

+
+

Extensions to java.time.Month

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods included from Time

+

#<=>, #coerce

+ + + + + + + + + + + + + + + +

Methods included from Between

+

#between?

+ + +
+

Instance Method Details

+ + +
+

+ + #+(other) ⇒ Month + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Month) + + + +
  • + +
+ +
+ + + + +
+
+
+
+16
+17
+18
+
+
# File 'lib/openhab/core_ext/java/month.rb', line 16
+
+def +(other)
+  plus(other)
+end
+
+
+ +
+

+ + #-(other) ⇒ Month + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Month) + + + +
  • + +
+ +
+ + + + +
+
+
+
+21
+22
+23
+
+
# File 'lib/openhab/core_ext/java/month.rb', line 21
+
+def -(other)
+  minus(other)
+end
+
+
+ +
+

+ + #succMonth + + + + + +

+
+

Returns the next month

+

Will loop back to January if necessary.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Month) + + + +
  • + +
+ +
+ + + + +
+
+
+
+32
+33
+34
+
+
# File 'lib/openhab/core_ext/java/month.rb', line 32
+
+def succ
+  plus(1)
+end
+
+
+ +
+

+ + #to_date(context = nil) ⇒ Date + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Date) + + + +
  • + +
+ +
+ + + + +
+
+
+
+44
+45
+46
+
+
# File 'lib/openhab/core_ext/java/month.rb', line 44
+
+def to_date(context = nil)
+  to_local_date(context).to_date
+end
+
+
+ +
+

+ + #to_instant(context = nil) ⇒ Instant + + + + + +

+
+ + +
+
+
+

Parameters:

+
    + +
  • + + context + + + (ZonedDateTime, nil) + + + (defaults to: nil) + + + — +

    A ZonedDateTime used to fill in the year during conversion, +with the date set to the first day of the month. +Instant.now is assumed if not given.

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+71
+72
+73
+74
+
+
# File 'lib/openhab/core_ext/java/month.rb', line 71
+
+def to_instant(context = nil)
+  context ||= Instant.now.to_zoned_date_time
+  to_local_date(context).to_instant
+end
+
+
+ +
+

+ + #to_local_date(context = nil) ⇒ LocalDate + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+37
+38
+39
+40
+41
+
+
# File 'lib/openhab/core_ext/java/month.rb', line 37
+
+def to_local_date(context = nil)
+  context ||= java.time.Year.now
+  year = java.time.Year.from(context)
+  year.at_month_day(to_month_day)
+end
+
+
+ +
+

+ + #to_monthself + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/openhab/core_ext/java/month.rb', line 49
+
+def to_month
+  self
+end
+
+
+ +
+

+ + #to_month_dayMonthDay + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+54
+55
+56
+
+
# File 'lib/openhab/core_ext/java/month.rb', line 54
+
+def to_month_day
+  MonthDay.of(self, 1)
+end
+
+
+ +
+

+ + #to_zoned_date_time(context = nil) ⇒ ZonedDateTime + + + + + +

+
+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+62
+63
+64
+
+
# File 'lib/openhab/core_ext/java/month.rb', line 62
+
+def to_zoned_date_time(context = nil)
+  to_local_date(context).to_zoned_date_time(context)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt/Java/MonthDay.html b/5.33/OpenHAB/CoreExt/Java/MonthDay.html new file mode 100644 index 0000000000..7e28676d73 --- /dev/null +++ b/5.33/OpenHAB/CoreExt/Java/MonthDay.html @@ -0,0 +1,4674 @@ + + + + + + + Class: OpenHAB::CoreExt::Java::MonthDay + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::CoreExt::Java::MonthDay + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Between, Ephemeris, Time
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core_ext/java/month_day.rb
+
+ +
+ +

Overview

+
+

Extensions to java.time.MonthDay

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods included from Time

+

#<=>, #coerce

+ + + + + + + + + + + + + + + +

Methods included from Ephemeris

+

#days_until, #holiday, #holiday?, #in_dayset?, #next_holiday, #weekend?

+ + + + + + + + + +

Methods included from Between

+

#between?

+ + +
+

Class Method Details

+ + +
+

+ + .parse(string) ⇒ MonthDay + + + + + +

+
+

Parses strings in the form "M-d"

+ + +
+
+
+

Parameters:

+
    + +
  • + + string + + + (String) + + + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+22
+23
+24
+25
+26
+27
+28
+
+
# File 'lib/openhab/core_ext/java/month_day.rb', line 22
+
+def parse(string)
+  logger.trace { "#{self.class}.parse #{string} (#{string.class})" }
+  java_send(:parse,
+            [java.lang.CharSequence, java.time.format.DateTimeFormatter],
+            string.to_s,
+            java.time.format.DateTimeFormatter.ofPattern("[--]M-d"))
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #+(other) ⇒ MonthDay + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+42
+43
+44
+45
+46
+47
+48
+49
+
+
# File 'lib/openhab/core_ext/java/month_day.rb', line 42
+
+def +(other)
+  case other
+  when java.time.temporal.TemporalAmount, Numeric
+    (LocalDate.of(1900, month, day_of_month) + other).to_month_day
+  else
+    (to_local_date(other.to_local_date) + other).to_month_day
+  end
+end
+
+
+ +
+

+ + #-(other) ⇒ MonthDay, Period + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+
+
# File 'lib/openhab/core_ext/java/month_day.rb', line 52
+
+def -(other)
+  d = case other
+      when java.time.temporal.TemporalAmount, Numeric
+        LocalDate.of(1900, month, day_of_month) - other
+      else
+        to_local_date(other.to_local_date) - other
+      end
+  return d if d.is_a?(java.time.Period)
+
+  d.to_month_day
+end
+
+
+ +
+

+ + #succMonthDay + + + + + +

+
+

Returns the next day

+

Will go to the next month, or loop back to January if necessary.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+71
+72
+73
+74
+75
+76
+77
+78
+79
+
+
# File 'lib/openhab/core_ext/java/month_day.rb', line 71
+
+def succ
+  if day_of_month == month.max_length
+    return MonthDay.of(1, 1) if month_value == 12
+
+    return MonthDay.of(month_value + 1, 1)
+  end
+
+  MonthDay.of(month_value, day_of_month + 1)
+end
+
+
+ +
+

+ + #to_date(context = nil) ⇒ Date + + + + + +

+
+ + +
+
+
+

Parameters:

+
    + +
  • + + context + + + (Date, nil) + + + (defaults to: nil) + + + — +

    A Date used to fill in missing fields +during conversion. Date.today is assumed if not given.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Date) + + + +
  • + +
+ +
+ + + + +
+
+
+
+98
+99
+100
+101
+
+
# File 'lib/openhab/core_ext/java/month_day.rb', line 98
+
+def to_date(context = nil)
+  context ||= Date.today
+  Date.new(context.year, month_value, day_of_month)
+end
+
+
+ +
+

+ + #to_instant(context = nil) ⇒ Instant + + + + + +

+
+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+120
+121
+122
+123
+
+
# File 'lib/openhab/core_ext/java/month_day.rb', line 120
+
+def to_instant(context = nil)
+  context ||= Instant.now.to_zoned_date_time
+  to_local_date(context).to_instant
+end
+
+
+ +
+

+ + #to_local_date(context = nil) ⇒ LocalDate + + + + + +

+
+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+85
+86
+87
+88
+89
+
+
# File 'lib/openhab/core_ext/java/month_day.rb', line 85
+
+def to_local_date(context = nil)
+  context ||= java.time.Year.now
+  year = java.time.Year.from(context)
+  year.at_month_day(self)
+end
+
+
+ +
+

+ + #to_monthMonth + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Month) + + + +
  • + +
+ +
+ + + + +
+
+
+
+92
+
+
# File 'lib/openhab/core_ext/java/month_day.rb', line 92
+
+alias_method :to_month, :month
+
+
+ +
+

+ + #to_month_dayself + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+104
+105
+106
+
+
# File 'lib/openhab/core_ext/java/month_day.rb', line 104
+
+def to_month_day
+  self
+end
+
+
+ +
+

+ + #to_sString + + + + Also known as: + inspect + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+32
+33
+34
+35
+
+
# File 'lib/openhab/core_ext/java/month_day.rb', line 32
+
+def to_s
+  # Remove -- from MonthDay string representation
+  to_string.delete_prefix("--")
+end
+
+
+ +
+

+ + #to_zoned_date_time(context = nil) ⇒ ZonedDateTime + + + + + +

+
+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+112
+113
+114
+
+
# File 'lib/openhab/core_ext/java/month_day.rb', line 112
+
+def to_zoned_date_time(context = nil)
+  to_local_date(context).to_zoned_date_time(context)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt/Java/Period.html b/5.33/OpenHAB/CoreExt/Java/Period.html new file mode 100644 index 0000000000..32bda3793e --- /dev/null +++ b/5.33/OpenHAB/CoreExt/Java/Period.html @@ -0,0 +1,3978 @@ + + + + + + + Class: OpenHAB::CoreExt::Java::Period + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::CoreExt::Java::Period + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
TemporalAmount
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core_ext/java/period.rb
+
+ +
+ +

Overview

+
+

Extensions to java.time.Period

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods included from TemporalAmount

+

#-@, #ago, #from_now, #inspect

+ + +
+

Instance Method Details

+ + +
+

+ + #<=>(other) ⇒ Integer? + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+37
+38
+39
+40
+41
+
+
# File 'lib/openhab/core_ext/java/period.rb', line 37
+
+def <=>(other)
+  return to_i <=> other if other.is_a?(Numeric)
+
+  super
+end
+
+
+ +
+

+ + #coerce(other) ⇒ Array? + + + + + +

+
+

Convert self and other to Duration, if other is a Numeric

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Numeric) + + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Array, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/openhab/core_ext/java/period.rb', line 49
+
+def coerce(other)
+  [other.seconds, to_i.seconds] if other.is_a?(Numeric)
+end
+
+
+ +
+

+ + #to_fFloat + + + + + +

+
+

Convert to number of seconds

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + +
  • + +
+ +
+ + + + +
+
+
+
+30
+31
+32
+
+
# File 'lib/openhab/core_ext/java/period.rb', line 30
+
+def to_f
+  to_i.to_f
+end
+
+
+ +
+

+ + #to_iInteger + + + + + +

+
+

Convert to number of seconds

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+17
+18
+19
+20
+21
+22
+23
+
+
# File 'lib/openhab/core_ext/java/period.rb', line 17
+
+def to_i
+  [java.time.temporal.ChronoUnit::YEARS,
+   java.time.temporal.ChronoUnit::MONTHS,
+   java.time.temporal.ChronoUnit::DAYS].sum do |unit|
+    get(unit) * unit.duration.to_i
+  end
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt/Java/TemporalAmount.html b/5.33/OpenHAB/CoreExt/Java/TemporalAmount.html new file mode 100644 index 0000000000..60dfebd70e --- /dev/null +++ b/5.33/OpenHAB/CoreExt/Java/TemporalAmount.html @@ -0,0 +1,3922 @@ + + + + + + + Module: OpenHAB::CoreExt::Java::TemporalAmount + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::CoreExt::Java::TemporalAmount + + + +

+
+ + + + + + + + + +
+
Included in:
+
Duration, Period
+
+ + + +
+
Defined in:
+
lib/openhab/core_ext/java/temporal_amount.rb
+
+ +
+ +

Overview

+
+

Extensions to java.time.temporal.TemporalAmount

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #-@TemporalAmount + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/openhab/core_ext/java/temporal_amount.rb', line 23
+
+def -@
+  negated
+end
+
+
+ +
+

+ + #agoZonedDateTime + + + + + +

+
+

Subtract self to ZonedDateTime.now

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+12
+13
+14
+
+
# File 'lib/openhab/core_ext/java/temporal_amount.rb', line 12
+
+def ago
+  ZonedDateTime.now - self
+end
+
+
+ +
+

+ + #from_nowZonedDateTime + + + + + +

+
+

Add self to ZonedDateTime.now

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+18
+19
+20
+
+
# File 'lib/openhab/core_ext/java/temporal_amount.rb', line 18
+
+def from_now
+  ZonedDateTime.now + self
+end
+
+
+ +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+28
+29
+30
+
+
# File 'lib/openhab/core_ext/java/temporal_amount.rb', line 28
+
+def inspect
+  to_s
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt/Java/Time.html b/5.33/OpenHAB/CoreExt/Java/Time.html new file mode 100644 index 0000000000..1a0dc2e0e6 --- /dev/null +++ b/5.33/OpenHAB/CoreExt/Java/Time.html @@ -0,0 +1,3828 @@ + + + + + + + Module: OpenHAB::CoreExt::Java::Time + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::CoreExt::Java::Time + + + +

+
+ + + + + + + + + +
+
Included in:
+
Instant, LocalDate, Month, MonthDay, ZonedDateTime
+
+ + + +
+
Defined in:
+
lib/openhab/core_ext/java/time.rb
+
+ +
+ +

Overview

+
+

Common extensions to Java Date/Time classes

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #<=>(other) ⇒ Integer + + + + + +

+
+

Compare against another time object

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Object) + + + + — +

    The other time object to compare against.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    -1, 0, +1 depending on whether other is +less than, equal to, or greater than self

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+
+
# File 'lib/openhab/core_ext/java/time.rb', line 40
+
+def <=>(other)
+  logger.trace { "(#{self.class}) #{self} <=> #{other} (#{other.class})" }
+  if other.is_a?(self.class)
+    compare_to(other)
+  elsif other.respond_to?(:coerce)
+    return nil unless (lhs, rhs = other.coerce(self))
+
+    lhs <=> rhs
+  end
+end
+
+
+ +
+

+ + #coerce(other) ⇒ Array? + + + + + +

+
+

Convert other to this class, if possible

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+53
+54
+55
+56
+57
+58
+59
+60
+
+
# File 'lib/openhab/core_ext/java/time.rb', line 53
+
+def coerce(other)
+  logger.trace { "Coercing #{self} as a request from #{other.class}" }
+  coercion_method = self.class.coercion_method
+  return unless other.respond_to?(coercion_method)
+  return [other.send(coercion_method), self] if other.method(coercion_method).arity.zero?
+
+  [other.send(coercion_method, self), self]
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt/Java/ZonedDateTime.html b/5.33/OpenHAB/CoreExt/Java/ZonedDateTime.html new file mode 100644 index 0000000000..0277791545 --- /dev/null +++ b/5.33/OpenHAB/CoreExt/Java/ZonedDateTime.html @@ -0,0 +1,5927 @@ + + + + + + + Class: OpenHAB::CoreExt::Java::ZonedDateTime + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::CoreExt::Java::ZonedDateTime + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Between, Time
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core_ext/java/zoned_date_time.rb
+
+ +
+ +

Overview

+
+

Extensions to java.time.ZonedDateTime

+ + +
+
+
+ + +
+ + + +

Class Attribute Summary collapse

+ + + + + + +

+ Ephemeris Methods + collapse +

+ +
+
+ +
+ Note: +

openHAB's built-in holiday definitions are based on bank +holidays, so may give some unexpected results. For example, 2022-12-25 +is not Christmas in England because it lands on a Sunday that year, +so Christmas is considered to be 2022-12-26. See +the source +for exact definitions. You can always provide your own holiday +definitions with holiday_file or +holiday_file!.

+
+
+ +

Forwards ephemeris helper methods to #to_zoned_date_time provided by +the mixed-in class.

+ + +
+
+
+ + +

See Also:

+ + +
+ + + +

+ Class Method Summary + collapse +

+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from Between

+

#between?

+ + + + + + + + + + + + + +
+

Class Attribute Details

+ + + +
+

+ + .nowZonedDateTime (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 21
+
+
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .parse(text, formatter = nil) ⇒ ZonedDateTime + + + + + +

+
+

Parses a string into a ZonedDateTime object.

+ + +
+
+
+

Parameters:

+
    + +
  • + + text + + + (String) + + + + — +

    The text to parse.

    +
    + +
  • + +
  • + + formatter + + + (java.time.format.DateTimeFormatter) + + + (defaults to: nil) + + + — +

    The formatter to use.

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 24
+
+
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #+(other) ⇒ ZonedDateTime + + + + + +

+
+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (TemporalAmount, Numeric) + + + + — +

    If other is a Numeric, it's interpreted as seconds.

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+59
+60
+61
+62
+63
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 59
+
+def +(other)
+  return plus(other.seconds) if other.is_a?(Numeric)
+
+  plus(other)
+end
+
+
+ +
+

+ + #-(other) ⇒ Duration, ZonedDateTime + + + + + +

+
+ + +
+
+
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (Duration) + + + + — +

    If other responds to #to_zoned_date_time

    +
    + +
  • + +
  • + + + (ZonedDateTime) + + + + — +

    If other is a TemporalAmount

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+46
+47
+48
+49
+50
+51
+52
+53
+54
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 46
+
+def -(other)
+  if other.respond_to?(:to_zoned_date_time)
+    java.time.Duration.between(other.to_zoned_date_time, self)
+  elsif other.is_a?(Numeric)
+    minus(other.seconds)
+  else
+    minus(other)
+  end
+end
+
+
+ +
+

+ + #<=>(other) ⇒ Integer? + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+222
+223
+224
+225
+226
+227
+228
+229
+230
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 222
+
+def <=>(other)
+  # compare instants, otherwise it will differ by timezone, which we don't want
+  # (use eql? if you care about that)
+  if other.respond_to?(:to_zoned_date_time)
+    to_instant.compare_to(other.to_zoned_date_time(self).to_instant)
+  elsif other.respond_to?(:coerce) && (lhs, rhs = other.coerce(self))
+    lhs <=> rhs
+  end
+end
+
+
+ +
+

+ + #coerce(other) ⇒ Array? + + + + + +

+
+

Converts other to OpenHAB::CoreExt::Java::ZonedDateTime, if possible

+ + +
+
+
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (Array, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+252
+253
+254
+255
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 252
+
+def coerce(other)
+  logger.trace { "Coercing #{self} as a request from #{other.class}" }
+  [other.to_zoned_date_time(self), self] if other.respond_to?(:to_zoned_date_time)
+end
+
+
+ +
+

+ + #days_until(holiday, holiday_file = nil) ⇒ Integer + + + + + +

+
+

Calculate the number of days until a specific holiday

+ + +
+
+
+ +
+

Examples:

+ + +
Time.now.days_until(:christmas) # => 2
+ +
+

Parameters:

+
    + +
  • + + holiday + + + (String, Symbol) + + + +
  • + +
  • + + holiday_file + + + (String, nil) + + + (defaults to: nil) + + + — +

    Optional path to XML file to use for holiday definitions.

    +
    + +
  • + +
+ +

Returns:

+ +

Raises:

+
    + +
  • + + + (ArgumentError) + + + + — +

    if the holiday isn't valid

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+211
+212
+213
+214
+215
+216
+217
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 211
+
+def days_until(holiday, holiday_file = nil)
+  holiday = holiday.to_s.upcase
+  r = ::Ephemeris.get_days_until(*[self, holiday, holiday_file || DSL.holiday_file].compact)
+  raise ArgumentError, "#{holiday.inspect} isn't a recognized holiday" if r == -1
+
+  r
+end
+
+
+ +
+

+ + #holiday(holiday_file = nil) ⇒ Symbol? + + + + + +

+
+

Name of the holiday for this date.

+ + +
+
+
+ +
+

Examples:

+ + +
MonthDay.parse("12-25").holiday # => :christmas
+ +
+

Parameters:

+
    + +
  • + + holiday_file + + + (String, nil) + + + (defaults to: nil) + + + — +

    Optional path to XML file to use for holiday definitions.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Symbol, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+151
+152
+153
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 151
+
+def holiday(holiday_file = nil)
+  ::Ephemeris.get_bank_holiday_name(*[self, holiday_file || DSL.holiday_file].compact)&.downcase&.to_sym
+end
+
+
+ +
+

+ + #holiday?(holiday_file = nil) ⇒ true, false + + + + + +

+
+

Determines if this date is on a holiday.

+ + +
+
+
+

Parameters:

+
    + +
  • + + holiday_file + + + (String, nil) + + + (defaults to: nil) + + + — +

    Optional path to XML file to use for holiday definitions.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+161
+162
+163
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 161
+
+def holiday?(holiday_file = nil)
+  ::Ephemeris.bank_holiday?(*[self, holiday_file || DSL.holiday_file].compact)
+end
+
+
+ +
+

+ + #in_dayset?(set) ⇒ true, false + + + + + +

+
+

Determines if this time is during a specific dayset

+ + +
+
+
+ +
+

Examples:

+ + +
Time.now.in_dayset?("school")
+ +
+

Parameters:

+
    + +
  • + + set + + + (String, Symbol) + + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+196
+197
+198
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 196
+
+def in_dayset?(set)
+  ::Ephemeris.in_dayset?(set.to_s, self)
+end
+
+
+ +
+

+ + #next_holiday(holiday_file = nil) ⇒ Symbol + + + + + +

+
+

Name of the closest holiday on or after this date.

+ + +
+
+
+

Parameters:

+
    + +
  • + + holiday_file + + + (String, nil) + + + (defaults to: nil) + + + — +

    Optional path to XML file to use for holiday definitions.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + +
  • + +
+ +
+ + + + +
+
+
+
+171
+172
+173
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 171
+
+def next_holiday(holiday_file = nil)
+  ::Ephemeris.get_next_bank_holiday(*[self, holiday_file || DSL.holiday_file].compact).downcase.to_sym
+end
+
+
+ +
+

+ + #to_dateDate + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Date) + + + +
  • + +
+ +
+ + + + +
+
+
+
+82
+83
+84
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 82
+
+def to_date
+  Date.new(year, month_value, day_of_month)
+end
+
+
+ +
+

+ + #to_fFloat + + + + + +

+
+

The number of seconds since the Unix epoch.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + +
  • + +
+ +
+ + + + +
+
+
+
+79
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 79
+
+delegate %i[to_i to_f] => :to_instant
+
+
+ +
+

+ + #to_iInteger + + + + + +

+
+

The number of seconds since the Unix epoch.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 65
+
+
+
+
+ +
+

+ + #to_instantInstant + + + + + +

+
+

Converts this object to an Instant

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+236
+237
+238
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 236
+
+def to_instant(_context = nil)
+  raw_to_instant
+end
+
+
+ +
+

+ + #to_local_date(_context = nil) ⇒ LocalDate + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+87
+88
+89
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 87
+
+def to_local_date(_context = nil)
+  toLocalDate
+end
+
+
+ +
+

+ + #to_local_time(_context = nil) ⇒ LocalTime + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+35
+36
+37
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 35
+
+def to_local_time(_context = nil)
+  toLocalTime
+end
+
+
+ +
+

+ + #to_monthMonth + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Month) + + + +
  • + +
+ +
+ + + + +
+
+
+
+40
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 40
+
+alias_method :to_month, :month
+
+
+ +
+

+ + #to_month_dayMonthDay + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+92
+93
+94
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 92
+
+def to_month_day
+  MonthDay.of(month, day_of_month)
+end
+
+
+ +
+

+ + #to_timeTime + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Time) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 98
+
+
+
+
+ +
+

+ + #to_zoned_date_time(context = nil) ⇒ self + + + + + +

+
+ + +
+
+
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+105
+106
+107
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 105
+
+def to_zoned_date_time(context = nil) # rubocop:disable Lint/UnusedMethodArgument
+  self
+end
+
+
+ +
+

+ + #today?true, false + + + + + +

+
+

Returns true if the date, converted to the system time zone, is today.

+

This is the equivalent of checking if the current datetime is between midnight and end of the day +of the system time zone.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+126
+127
+128
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 126
+
+def today?
+  with_zone_same_instant(ZoneId.system_default).to_local_date == LocalDate.now
+end
+
+
+ +
+

+ + #tomorrow?true, false + + + + + +

+
+

Returns true if the date, converted to the system time zone, is tomorrow.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+135
+136
+137
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 135
+
+def tomorrow?
+  with_zone_same_instant(ZoneId.system_default).to_local_date == LocalDate.now + 1
+end
+
+
+ +
+

+ + #weekend?true, false + + + + + +

+
+

Determines if this time is during a weekend.

+ + +
+
+
+ +
+

Examples:

+ + +
Time.now.weekend?
+ +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+183
+184
+185
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 183
+
+def weekend?
+  ::Ephemeris.weekend?(self)
+end
+
+
+ +
+

+ + #yesterday?true, false + + + + + +

+
+

Returns true if the date, converted to the system time zone, is yesterday.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+114
+115
+116
+
+
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 114
+
+def yesterday?
+  with_zone_same_instant(ZoneId.system_default).to_local_date == LocalDate.now - 1
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt/Ruby.html b/5.33/OpenHAB/CoreExt/Ruby.html new file mode 100644 index 0000000000..abe941d267 --- /dev/null +++ b/5.33/OpenHAB/CoreExt/Ruby.html @@ -0,0 +1,3626 @@ + + + + + + + Module: OpenHAB::CoreExt::Ruby + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::CoreExt::Ruby + + + +

+
+ + + + + + +
+
Includes:
+
QuantityTypeConversion
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core_ext.rb,
+ lib/openhab/core_ext/ruby/range.rb,
lib/openhab/core_ext/ruby/object.rb,
lib/openhab/core_ext/ruby/numeric.rb
+
+
+ +
+ +

Overview

+
+

Extensions to core Ruby classes

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: Numeric, QuantityTypeConversion, Range + + + + +

+ + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from QuantityTypeConversion

+

#|

+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt/Ruby/Numeric.html b/5.33/OpenHAB/CoreExt/Ruby/Numeric.html new file mode 100644 index 0000000000..9acf3905af --- /dev/null +++ b/5.33/OpenHAB/CoreExt/Ruby/Numeric.html @@ -0,0 +1,3625 @@ + + + + + + + Module: OpenHAB::CoreExt::Ruby::Numeric + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::CoreExt::Ruby::Numeric + + + +

+
+ + + + + + +
+
Includes:
+
QuantityTypeConversion
+
+ + + + +
+
Included in:
+
Numeric
+
+ + + +
+
Defined in:
+
lib/openhab/core_ext/ruby/numeric.rb
+
+ +
+ +

Overview

+
+

Extensions to Numeric

+ + +
+
+
+ + +
+ + + + + + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from QuantityTypeConversion

+

#|

+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt/Ruby/QuantityTypeConversion.html b/5.33/OpenHAB/CoreExt/Ruby/QuantityTypeConversion.html new file mode 100644 index 0000000000..0cb240609a --- /dev/null +++ b/5.33/OpenHAB/CoreExt/Ruby/QuantityTypeConversion.html @@ -0,0 +1,3735 @@ + + + + + + + Module: OpenHAB::CoreExt::Ruby::QuantityTypeConversion + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::CoreExt::Ruby::QuantityTypeConversion + + + +

+
+ + + + + + + + + +
+
Included in:
+
Integer, OpenHAB::CoreExt::Ruby, Numeric
+
+ + + +
+
Defined in:
+
lib/openhab/core_ext/ruby/numeric.rb
+
+ +
+ +

Overview

+
+

Extend Numeric to create quantity object

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #|(unit) ⇒ QuantityType + + + + + +

+
+

Convert Numeric to a QuantityType

+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+
+
# File 'lib/openhab/core_ext/ruby/numeric.rb', line 153
+
+def |(unit) # rubocop:disable Naming/BinaryOperatorParameterName
+  if unit.respond_to?(:to_str)
+    parsed_unit = org.openhab.core.types.util.UnitUtils.parse_unit(unit.to_str)
+    raise ArgumentError, "Unknown unit #{unit}" unless parsed_unit
+
+    unit = parsed_unit
+  end
+
+  return super unless unit.is_a?(javax.measure.Unit)
+
+  Core::Types::QuantityType.new(to_d.to_java, unit)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/CoreExt/Ruby/Range.html b/5.33/OpenHAB/CoreExt/Ruby/Range.html new file mode 100644 index 0000000000..81b01fa1c4 --- /dev/null +++ b/5.33/OpenHAB/CoreExt/Ruby/Range.html @@ -0,0 +1,3891 @@ + + + + + + + Module: OpenHAB::CoreExt::Ruby::Range + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::CoreExt::Ruby::Range + + + +

+
+ + + + + + + + + +
+
Included in:
+
Range
+
+ + + +
+
Defined in:
+
lib/openhab/core_ext/ruby/range.rb
+
+ +
+ +

Overview

+
+

Extensions to Range

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #circular?true, false + + + + + +

+
+

Checks if this range is circular

+

A circular range is one whose data type will repeat if keep you keep +calling #succ on it, and whose beginning is after its end.

+

Used by #cover? to check if the value is between end and begin, +instead of begin and end.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+
+
# File 'lib/openhab/core_ext/ruby/range.rb', line 54
+
+def circular?
+  return false if self.begin.nil? || self.end.nil?
+  return false if self.begin <= self.end
+
+  case self.begin || self.end
+  when java.time.LocalTime, java.time.MonthDay, java.time.Month
+    true
+  else
+    false
+  end
+end
+
+
+ +
+

+ + #cover?(object) ⇒ Boolean + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+11
+12
+13
+14
+15
+16
+
+
# File 'lib/openhab/core_ext/ruby/range.rb', line 8
+
+def cover?(object)
+  # inverted circular range
+  if circular?
+    return object >= self.begin || object < self.end if exclude_end?
+
+    return object >= self.begin || object <= self.end
+  end
+  super
+end
+
+
+ +
+

+ + #eachObject + + + + + +

+
+

normal Range#each will not yield at all if begin > end

+ + +
+
+
+ + +
+ + + + +
+
+
+
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+
+
# File 'lib/openhab/core_ext/ruby/range.rb', line 27
+
+def each
+  return super unless circular?
+  return to_enum(:each) unless block_given?
+
+  val = self.begin
+  loop do
+    is_end = val == self.end
+    break if is_end && exclude_end?
+
+    yield val
+    break if is_end
+
+    val = val.succ
+  end
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL.html b/5.33/OpenHAB/DSL.html new file mode 100644 index 0000000000..12e1ac73cb --- /dev/null +++ b/5.33/OpenHAB/DSL.html @@ -0,0 +1,8819 @@ + + + + + + + Module: OpenHAB::DSL + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::DSL + + + +

+
+ + + + + + +
+
Includes:
+
Core::Actions, Core::EntityLookup, Core::ScriptHandling, Rules::Terse
+
+ + + + +
+
Included in:
+
Items::Builder, Rules::BuilderDSL
+
+ + + +
+
Defined in:
+
lib/openhab/dsl.rb,
+ lib/openhab/dsl/rules.rb,
lib/openhab/dsl/events.rb,
lib/openhab/dsl/version.rb,
lib/openhab/dsl/debouncer.rb,
lib/openhab/dsl/rules/guard.rb,
lib/openhab/dsl/rules/terse.rb,
lib/openhab/dsl/items/ensure.rb,
lib/openhab/dsl/thread_local.rb,
lib/openhab/dsl/items/builder.rb,
lib/openhab/dsl/rules/builder.rb,
lib/openhab/dsl/timer_manager.rb,
lib/openhab/dsl/rules/property.rb,
lib/openhab/dsl/rules/triggers.rb,
lib/openhab/dsl/things/builder.rb,
lib/openhab/dsl/sitemaps/builder.rb,
lib/openhab/dsl/events/watch_event.rb,
lib/openhab/dsl/items/timed_command.rb,
lib/openhab/dsl/rules/rule_triggers.rb,
lib/openhab/dsl/rules/name_inference.rb,
lib/openhab/dsl/rules/automation_rule.rb,
lib/openhab/dsl/rules/triggers/changed.rb,
lib/openhab/dsl/rules/triggers/channel.rb,
lib/openhab/dsl/rules/triggers/command.rb,
lib/openhab/dsl/rules/triggers/trigger.rb,
lib/openhab/dsl/rules/triggers/updated.rb,
lib/openhab/dsl/rules/triggers/cron/cron.rb,
lib/openhab/dsl/rules/triggers/conditions.rb,
lib/openhab/dsl/config_description/builder.rb,
lib/openhab/dsl/rules/triggers/cron/cron_handler.rb,
lib/openhab/dsl/rules/triggers/conditions/generic.rb,
lib/openhab/dsl/rules/triggers/conditions/duration.rb,
lib/openhab/dsl/rules/triggers/watch/watch_handler.rb
+
+
+ +
+ +

Overview

+
+

The main DSL available to rules.

+

Methods on this module are extended onto main, the top level self in +any file. You can also access them as class methods on the module for use +inside of other classes, or include the module.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: ConfigDescription, Events, Items, Rules, Sitemaps, Things + + + + Classes: Debouncer, TimerManager + + +

+ + +

+ Constant Summary + collapse +

+ +
+ +
VERSION = +
+
+

Version of openHAB helper libraries

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+
+
"5.33.0"
+ +
+ + + + + + + + + +

+ Rule Creation + collapse +

+ + + + + +

+ Rule Support + collapse +

+ + + + + +

+ Object Access + collapse +

+ + + + + +

+ Utilities + collapse +

+ + + + + +

+ Block Modifiers + collapse +

+ +
+
+

These methods allow certain operations to be grouped inside the given block +to reduce repetitions

+ + +
+
+
+ + +
+ + + + + + + + + + + + + + +

Methods included from Rules::Terse

+

#changed, #channel, #channel_linked, #channel_unlinked, #cron, #every, #item_added, #item_removed, #item_updated, #on_start, #received_command, #thing_added, #thing_removed, #thing_updated, #updated

+ + + + + + + + + +

Methods included from Core::ScriptHandling

+

script_loaded, script_unloaded

+ + + + + + + + + +

Methods included from Core::Actions

+

notify

+ + + + + + +
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + +

+ +
+

+ + #method_missingObject (private) + + + + + +

+
+

Provide access to the script context / variables +see OpenHAB::DSL::Rules::AutomationRule#execute!

+ + +
+
+
+ + +
+ + + + +
+
+
+
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+
+
# File 'lib/openhab/dsl.rb', line 1059
+
+ruby2_keywords def method_missing(method, *args)
+  return super unless args.empty? && !block_given?
+
+  if (context = Thread.current[:openhab_context]) && context.key?(method)
+    logger.trace { "DSL#method_missing found context variable: '#{method}'" }
+    return context[method]
+  elsif Core.ui_context&.key?(method)
+    logger.trace { "DSL#method_missing found UI context variable: '#{method}'" }
+    return Core.ui_context[method]
+  end
+  super
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .after(duration, id: nil, reschedule: true) {|timer| ... } ⇒ Core::Timer + + + + + +

+
+

Create a timer and execute the supplied block after the specified duration

+

#Reentrant Timers

+

Timers with an id are reentrant by id. Reentrant means that when the same id is encountered, +the timer is rescheduled rather than creating a second new timer. Note that the timer will +execute the block provided in the latest call.

+

This removes the need for the usual boilerplate code to manually keep track of timer objects.

+

Timers with id can be managed with the built-in timers object.

+

When a timer is cancelled, it will be removed from the object.

+

Be sure that your ids are unique. For example, if you're using items as your +ids, you either need to be sure you don't use the same item for multiple logical contexts, +or you need to make your id more specific, by doing something like embedding the item in +array with a symbol of the timer's purpose, like [:vacancy, item]. But also note that +assuming default settings, every Ruby file (for file-based rules) or UI rule gets its +own instance of the timers object, so you don't need to worry about collisions among +different files.

+ + +
+
+
+ +
+

Examples:

+ + +

Create a simple timer

+

+ +
after 5.seconds do
+  logger.info("Timer Fired")
+end
+ + +

Timers delegate methods to openHAB timer objects

+

+ +
after 1.second do |timer|
+  logger.info("Timer is active? #{timer.active?}")
+end
+ + +

Timers can be rescheduled to run again, waiting the original duration

+

+ +
after 3.seconds do |timer|
+  logger.info("Timer Fired")
+  timer.reschedule
+end
+ + +

Timers can be rescheduled for different durations

+

+ +
after 3.seconds do |timer|
+  logger.info("Timer Fired")
+  timer.reschedule 5.seconds
+end
+ + +

Timers can be manipulated through the returned object

+

+ +
mytimer = after 1.minute do
+  logger.info("It has been 1 minute")
+end
+
+mytimer.cancel
+ + +

Reentrant timers will automatically reschedule if the same id is encountered again

+

+ +
rule "Turn off closet light after 10 minutes" do
+  changed ClosetLights.members, to: ON
+  triggered do |item|
+    after 10.minutes, id: item do
+      item.ensure.off
+    end
+  end
+end
+ + +

Timers with id can be managed through the built-in timers object

+

+ +
after 1.minute, id: :foo do
+  logger.info("managed timer has fired")
+end
+
+timers.cancel(:foo)
+
+if timers.include?(:foo)
+  logger.info("The timer :foo is not active")
+end
+ + +

Only create a new timer if it isn't already scheduled

+

+ +
after(1.minute, id: :foo, reschedule: false) do
+  logger.info("Timer fired")
+end
+ + +

Reentrant timers will execute the block from the most recent call

+

+ +
# In the following example, if Item1 received a command, followed by Item2,
+# the timer will execute the block referring to Item2.
+rule "Execute The Most Recent Block" do
+  received_command Item1, Item2
+  run do |event|
+    after(10.minutes, id: :common_timer) do
+      logger.info "The latest command was received from #{event.item}"
+    end
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + duration + + + (java.time.temporal.TemporalAmount, #to_zoned_date_time, Proc) + + + + — +

    Duration after which to execute the block

    +
    + +
  • + +
  • + + id + + + (Object) + + + (defaults to: nil) + + + — +

    ID to associate with timer. The timer can be managed via timers.

    +
    + +
  • + +
  • + + reschedule + + + (true, false) + + + (defaults to: true) + + + — +

    Reschedule the timer if it already exists.

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block to execute when the timer is elapsed.

    +
    + +
  • + +
+

Yield Parameters:

+ +

Returns:

+
    + +
  • + + + (Core::Timer) + + + + — +

    if reschedule is false, the existing timer. +Otherwise the new timer.

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+380
+381
+382
+383
+384
+385
+386
+
+
# File 'lib/openhab/dsl.rb', line 380
+
+def after(duration, id: nil, reschedule: true, &block)
+  raise ArgumentError, "Block is required" unless block
+
+  # Carry rule name to timer
+  thread_locals = ThreadLocal.persist
+  timers.create(duration, id: id, reschedule: reschedule, thread_locals: thread_locals, block: block)
+end
+
+
+ +
+

+ + .between(range) ⇒ Range + + + + + +

+
+

Convert a string based range into a range of LocalTime, LocalDate, MonthDay, or ZonedDateTime +depending on the format of the string.

+ + +
+
+
+ +
+

Examples:

+ + +

Range#cover?

+

+ +
logger.info("Within month-day range") if between('02-20'..'06-01').cover?(MonthDay.now)
+ + +

Use in a Case

+

+ +
case MonthDay.now
+when between('01-01'..'03-31')
+  logger.info("First quarter")
+when between('04-01'..'06-30')
+ logger.info("Second quarter")
+end
+ + +

Create a time range

+

+ +
between('7am'..'12pm').cover?(LocalTime.now)
+ +
+ +

Returns:

+
    + +
  • + + + (Range) + + + + — +

    converted range object

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+410
+411
+412
+413
+414
+415
+416
+
+
# File 'lib/openhab/dsl.rb', line 410
+
+def between(range)
+  raise ArgumentError, "Supplied object must be a range" unless range.is_a?(Range)
+
+  start = try_parse_time_like(range.begin)
+  finish = try_parse_time_like(range.end)
+  Range.new(start, finish, range.exclude_end?)
+end
+
+
+ +
+

+ + .config_description(uri = nil) { ... } ⇒ org.openhab.core.config.core.ConfigDescription + + + + + +

+
+

Create a ConfigDescription object.

+ + +
+
+
+ +
+

Examples:

+ + +
config_description = config_description do
+  parameter :ungrouped_parameter, :decimal, label: "Ungrouped Parameter", min: 1, max: 5
+
+  group "Config Group", label: "Grouped parameters", advanced: true do
+    parameter :my_parameter, :string, label: "My Parameter", description: "My Parameter Description"
+    parameter :other_parameter, :integer, label: "Other Parameter", description: "Other Parameter Description"
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + uri + + + (String, java.net.URI) + + + (defaults to: nil) + + + — +

    The URI for the ConfigDescription. When nil, a dummy URI is used which will +be replaced by the profile with the correct URI for that profile.

    +
    + +
  • + +
+ +

Yields:

+ +

Returns:

+ +

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +
+ + + + +
+
+
+
+224
+225
+226
+227
+228
+
+
# File 'lib/openhab/dsl.rb', line 224
+
+def config_description(uri = nil, &block)
+  raise ArgumentError, "Block is required" unless block
+
+  ConfigDescription::Builder.new.build(uri, &block)
+end
+
+
+ +
+

+ + .debounce_for(debounce_time, id: nil, &block) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Waits until calls to this method have stopped firing for a period of time +before executing the block.

+

This method acts as a guard for the given block to ensure that it doesn't get executed +too frequently. The debounce_for method can be called as frequently as possible. +The given block, however, will only be executed once the debounce_time has passed +since the last call to debounce_for.

+

This method can be used from within a UI rule as well as from a file-based rule.

+ + +
+
+
+ +
+

Examples:

+ + +

Run a block of code only after an item has stopped changing

+

+ +
# This can be placed inside a UI rule with an Item Change trigger for
+# a Door contact sensor.
+# If the door state has stopped changing state for 10 minutes,
+# execute the block.
+debounce_for(10.minutes) do
+  if DoorState.open?
+    Voice.say("The door has been left open!")
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + id + + + (Object) + + + (defaults to: nil) + + + — +

    ID to associate with this call.

    +
    + +
  • + +
  • + + block + + + (Block) + + + + — +

    The block to be debounced.

    +
    + +
  • + +
  • + + debounce_time + + + (Duration, Range) + + + + — +

    The minimum interval between two consecutive +triggers before the rules are allowed to run.

    +

    When specified just as a Duration or an endless range, it sets the minimum interval +between two consecutive triggers before rules are executed. It will +wait endlessly unless this condition is met or an end of range was specified.

    +

    When the end of the range is specified, it sets the maximum amount of time to wait +from the first trigger before the rule will execute, even when triggers continue +to occur more frequently than the minimum interval.

    +

    When an equal beginning and ending values are given, it will behave just like +throttle_for.

    +
    + +
  • + +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+482
+483
+484
+485
+
+
# File 'lib/openhab/dsl.rb', line 482
+
+def debounce_for(debounce_time, id: nil, &block)
+  idle_time = debounce_time.is_a?(Range) ? debounce_time.begin : debounce_time
+  debounce(for: debounce_time, idle_time: idle_time, id: id, &block)
+end
+
+
+ +
+

+ + .ensure_states { ... } ⇒ Object + + + + + +

+
+

Global method that takes a block and for the duration of the block +all commands sent will check if the item is in the command's state +before sending the command. This also applies to updates.

+ + +
+
+
+ +
+

Examples:

+ + +

Turn on several switches only if they're not already on

+

+ +
ensure_states do
+  Switch1.on
+  Switch2.on
+end
+ + +
# VirtualSwitch is in state `ON`
+ensure_states do
+  VirtualSwitch << ON       # No command will be sent
+  VirtualSwitch.update(ON)  # No update will be posted
+  VirtualSwitch << OFF      # Off command will be sent
+  VirtualSwitch.update(OFF) # No update will be posted
+end
+ + +
ensure_states do
+  rule 'Items in an execution block will have ensure_states applied to them' do
+    changed VirtualSwitch
+    run do
+      VirtualSwitch.on
+      VirtualSwitch2.on
+    end
+  end
+end
+ + +
rule 'ensure_states must be in an execution block' do
+  changed VirtualSwitch
+  run do
+     ensure_states do
+        VirtualSwitch.on
+        VirtualSwitch2.on
+     end
+  end
+end
+ +
+ +

Yields:

+
    + +
  • + + + + + + +
  • + +
+

Returns:

+
    + +
  • + + + (Object) + + + + — +

    The result of the block.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+670
+671
+672
+673
+674
+675
+
+
# File 'lib/openhab/dsl.rb', line 670
+
+def ensure_states
+  old = ensure_states!
+  yield
+ensure
+  ensure_states!(active: old)
+end
+
+
+ +
+

+ + .ensure_states!(active: true) ⇒ Boolean + + + + + +

+
+ +
+ Note: +

This method is only intended for use at the top level of rule +scripts. If it's used within library methods, or hap-hazardly within +rules, things can get very confusing because the prior state won't be +properly restored.

+
+
+ +

Permanently enable conditional execution of commands and updates for the current thread.

+

When conditional executions are enabled, commands and updates will only be sent if the +item's current state is not the same as the command or updated state. +This eliminates the need to chain the command and update calls through +ensure.

+

When conditional executions are enabled either by this method or within a block of ensure_states, +commands and updates can still be forcefully executed using the corresponding bang methods, e.g. +Item1.on!, Item1.command!(50), or Item1.update!(ON).

+ + +
+
+
+ +
+

Examples:

+ + +

Make ensure_states the default for the rest of the script

+

+ +
ensure_states!
+
+# From now, all commands are "ensured", i.e. only sent when the current state is different
+Item1.on
+Item2.command(ON)
+
+# While ensure_states! is active, we can still forcibly send a command
+# regardless of the item's current state
+Item2.on!
+ +
+

Parameters:

+
    + +
  • + + active + + + (Boolean) + + + (defaults to: true) + + + — +

    Whether to enable or disable conditional executions.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    The previous ensure_states setting.

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+619
+620
+621
+622
+623
+
+
# File 'lib/openhab/dsl.rb', line 619
+
+def ensure_states!(active: true)
+  old = Thread.current[:openhab_ensure_states]
+  Thread.current[:openhab_ensure_states] = active
+  old
+end
+
+
+ +
+

+ + + .holiday_file(file) { ... } ⇒ Object + + .holiday_fileString? + + + + + + +

+
+ + +
+
+
+ +

Overloads:

+
    + + +
  • + .holiday_file(file) { ... } ⇒ Object +
    +
    +

    Sets a thread local variable to use a specific holiday file +for ephemeris calls inside the block.

    + + +
    +
    +
    + +
    +

    Examples:

    + + +

    Set a specific holiday configuration file temporarily

    +

    + +
    holiday_file("/home/cody/holidays.xml") do
    +  Time.now.next_holiday
    +end
    + +
    +

    Parameters:

    +
      + +
    • + + file + + + (String, nil) + + + + — +

      Path to a file defining holidays; +nil to reset to default.

      +
      + +
    • + +
    + +

    Yields:

    +
      + +
    • + + + + + + + +

      [] Block executed in context of the supplied holiday file

      +
      + +
    • + +
    +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +

      The return value from the block.

      +
      + +
    • + +
    + +

    See Also:

    + + +
    +
  • + + +
  • + .holiday_fileString? +
    +
    +

    Returns the current thread local value for the holiday file.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (String, nil) + + + + — +

      the current holiday file

      +
      + +
    • + +
    + +
    +
  • + +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+
+
# File 'lib/openhab/dsl.rb', line 1000
+
+def holiday_file(*args)
+  raise ArgumentError, "wrong number of arguments (given #{args.length}, expected 0..1)" if args.length > 1
+
+  old = Thread.current[:openhab_holiday_file]
+  return old if args.empty?
+
+  holiday_file!(args.first)
+  yield
+ensure
+  holiday_file!(old)
+end
+
+
+ +
+

+ + .holiday_file!(file = nil) ⇒ Symbol? + + + + + +

+
+

Sets a thread local variable to set the default holiday file.

+ + +
+
+
+ +
+

Examples:

+ + +
holiday_file!("/home/cody/holidays.xml")
+Time.now.next_holiday
+ +
+

Parameters:

+
    + +
  • + + file + + + (String, nil) + + + (defaults to: nil) + + + — +

    Path to a file defining holidays; +nil to reset to default.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Symbol, nil) + + + + — +

    the new holiday file

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+1025
+1026
+1027
+
+
# File 'lib/openhab/dsl.rb', line 1025
+
+def holiday_file!(file = nil)
+  Thread.current[:openhab_holiday_file] = file
+end
+
+
+ +
+

+ + .itemsCore::Items::Registry + + + + + +

+
+

Fetches all items from the item registry

+

The examples all assume the following items exist.

+
Dimmer DimmerTest "Test Dimmer"
+Switch SwitchTest "Test Switch"
+
+ + +
+
+
+ +
+

Examples:

+ + +
logger.info("Item Count: #{items.count}")  # Item Count: 2
+logger.info("Items: #{items.map(&:label).sort.join(', ')}")  # Items: Test Dimmer, Test Switch'
+logger.info("DimmerTest exists? #{items.key?('DimmerTest')}") # DimmerTest exists? true
+logger.info("StringTest exists? #{items.key?('StringTest')}") # StringTest exists? false
+ + +
rule 'Use dynamic item lookup to increase related dimmer brightness when switch is turned on' do
+  changed SwitchTest, to: ON
+  triggered { |item| items[item.name.gsub('Switch','Dimmer')].brighten(10) }
+end
+ + +
rule 'search for a suitable item' do
+  on_load
+  triggered do
+    # Send ON to DimmerTest if it exists, otherwise send it to SwitchTest
+    (items['DimmerTest'] || items['SwitchTest'])&.on
+  end
+end
+ +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+2
+
+
# File 'lib/openhab/dsl.rb', line 2
+
+def items; end
+
+
+ +
+

+ + .only_every(interval, id: nil, &block) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Limit how often the given block executes to the specified interval.

+

only_every will execute the given block but prevents further executions +until the given interval has passed. In contrast, throttle_for will not +execute the block immediately, and will wait until the end of the interval.

+ + +
+
+
+ +
+

Examples:

+ + +

Prevent door bell from ringing repeatedly

+

+ +
# This can be called from a UI rule.
+# For file based rule, use the `only_every` rule guard
+only_every(30.seconds) { Audio.play_sound("doorbell.mp3") }
+ +
+

Parameters:

+
    + +
  • + + id + + + (Object) + + + (defaults to: nil) + + + — +

    ID to associate with this call.

    +
    + +
  • + +
  • + + block + + + (Block) + + + + — +

    The block to be throttled.

    +
    + +
  • + +
  • + + interval + + + (Duration, :second, :minute, :hour, :day) + + + + — +

    The period during which +subsequent triggers are ignored.

    +
    + +
  • + +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+545
+546
+547
+548
+
+
# File 'lib/openhab/dsl.rb', line 545
+
+def only_every(interval, id: nil, &block)
+  interval = 1.send(interval) if %i[second minute hour day].include?(interval)
+  debounce(for: interval, leading: true, id: id, &block)
+end
+
+
+ +
+

+ + .persistence(service) { ... } ⇒ Object + + + + + +

+
+

Sets a thread local variable to set the default persistence service +for method calls inside the block

+ + +
+
+
+ +
+

Examples:

+ + +
persistence(:influxdb) do
+  Item1.persist
+  Item1.changed_since(1.hour)
+  Item1.average_since(12.hours)
+end
+ +
+

Parameters:

+
    + +
  • + + service + + + (Object) + + + + — +

    Persistence service either as a String or a Symbol

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    [] Block executed in context of the supplied persistence service

    +
    + +
  • + +
+

Returns:

+
    + +
  • + + + (Object) + + + + — +

    The return value from the block.

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+695
+696
+697
+698
+699
+700
+
+
# File 'lib/openhab/dsl.rb', line 695
+
+def persistence(service)
+  old = persistence!(service)
+  yield
+ensure
+  persistence!(old)
+end
+
+
+ +
+

+ + .persistence!(service = nil) ⇒ Object? + + + + + +

+
+ +
+ Note: +

This method is only intended for use at the top level of rule +scripts. If it's used within library methods, or hap-hazardly within +rules, things can get very confusing because the prior state won't be +properly restored.

+
+
+ +

Permanently sets the default persistence service for the current thread

+ + +
+
+
+

Parameters:

+
    + +
  • + + service + + + (Object) + + + (defaults to: nil) + + + — +

    Persistence service either as a String or a Symbol. When nil, use +the system's default persistence service.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Object, nil) + + + + — +

    The previous persistence service settings, or nil when using the system's default.

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+717
+718
+719
+720
+721
+
+
# File 'lib/openhab/dsl.rb', line 717
+
+def persistence!(service = nil)
+  old = Thread.current[:openhab_persistence_service]
+  Thread.current[:openhab_persistence_service] = service
+  old
+end
+
+
+ +
+

+ + .profile(id, label: nil, config_description: nil) {|event, command: nil, state: nil, trigger: nil, time_series: nil, callback:, link:, item:, channel_uid:, configuration:, context:| ... } ⇒ void + + + + + +

+
+

This method returns an undefined value.

Defines a new profile that can be applied to item channel links.

+

To create a profile that can be used in the UI, provide a label and optionally a config_description, +otherwise the profile will not be visible in the UI.

+ + +
+
+
+ +
+

Examples:

+ + +

Vetoing a command

+

+ +
profile(:veto_closing_shades) do |event, item:, command:|
+  next false if command&.down?
+
+  true
+end
+
+items.build do
+  rollershutter_item "MyShade" do
+    channel "thing:rollershutter", profile: "ruby:veto_closing_shades"
+  end
+end
+# can also be referenced from an `.items` file:
+# Rollershutter MyShade { channel="thing:rollershutter"[profile="ruby:veto_closing_shades"] }
+ + +

Overriding units from a binding

+

+ +
profile(:set_uom) do |event, callback:, configuration:, state:, command:|
+  unless configuration["unit"]
+    logger.warn("Unit configuration not provided for set_uom profile")
+     next true
+  end
+
+  case event
+  when :state_from_handler
+    next true unless state.is_a?(DecimalType) || state.is_a?(QuantityType) # what is it then?!
+
+    state = state.to_d if state.is_a?(QuantityType) # ignore the units if QuantityType was given
+    callback.send_update(state | configuration["unit"])
+    false
+  when :command_from_item
+    # strip the unit from the command, as the binding likely can't handle it
+    next true unless command.is_a?(QuantityType)
+
+    callback.handle_command(DecimalType.new(command.to_d))
+    false
+  else
+    true # pass other events through as normal
+  end
+end
+# can also be referenced from an `.items` file:
+# Number:Temperature MyTempWithNonUnitValueFromBinding "I prefer Celsius [%d °C]" { channel="something_that_returns_F"[profile="ruby:set_uom", unit="°F"] }
+ + +

Create a profile that is usable in the UI

+

+ +
config_description = config_description do
+  parameter :min, :decimal, label: "Minimum", description: "Minimum value"
+  parameter :max, :decimal, label: "Maximum", description: "Maximum value"
+end
+
+profile(:range_filter, label: "Range Filter", config_description: config_description) do |event, state:, configuration:|
+  return true unless event == :state_from_handler
+
+  (configuration["min"]..configuration["max"]).cover?(state)
+end
+ +
+

Parameters:

+
    + +
  • + + id + + + (String, Symbol) + + + + — +

    The id for the profile.

    +
    + +
  • + +
  • + + label + + + (String, nil) + + + (defaults to: nil) + + + — +

    The label for the profile. When nil, the profile will not be visible in the UI.

    +
    + +
  • + +
  • + + config_description + + + (org.openhab.core.config.core.ConfigDescription, nil) + + + (defaults to: nil) + + + — +

    The configuration description for the profile so that it can be configured in the UI.

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + (event, command: nil, state: nil, trigger: nil, time_series: nil, callback:, link:, item:, channel_uid:, configuration:, context:) + + + + — +

    All keyword params are optional. Any that aren't defined won't be passed.

    +
    + +
  • + +
+

Yield Parameters:

+
    + +
  • + + event + + + (:command_from_item, :state_from_item, :command_from_handler, :state_from_handler, :time_series_from_handler, :trigger_from_handler) + + + + — +

    The event that needs to be processed.

    +
    + +
  • + +
  • + + command + + + (Command, nil) + + + + — +

    The command being sent for :command_from_item and :command_from_handler events.

    +
    + +
  • + +
  • + + state + + + (State, nil) + + + + — +

    The state being sent for :state_from_item and :state_from_handler events.

    +
    + +
  • + +
  • + + trigger + + + (String) + + + + — +

    The event being sent for :trigger_from_handler events.

    +
    + +
  • + +
  • + + time_series + + + (TimeSeries) + + + + — +

    The time series for :time_series_from_handler events. +Only available since openHAB 4.1.

    +
    + +
  • + +
  • + + callback + + + (Core::Things::ProfileCallback) + + + + — +

    The callback to be used to customize the action taken.

    +
    + +
  • + +
  • + + link + + + (Core::Things::ItemChannelLink) + + + + — +

    The link between the item and the channel, including its configuration.

    +
    + +
  • + +
  • + + item + + + (Item) + + + + — +

    The linked item.

    +
    + +
  • + +
  • + + channel_uid + + + (Core::Things::ChannelUID) + + + + — +

    The linked channel.

    +
    + +
  • + +
  • + + configuration + + + (Hash) + + + + — +

    The profile configuration.

    +
    + +
  • + +
  • + + context + + + (org.openhab.core.thing.profiles.ProfileContext) + + + + — +

    The profile context.

    +
    + +
  • + +
+

Yield Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    Return true from the block in order to have default processing.

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+194
+195
+196
+197
+198
+199
+200
+201
+202
+
+
# File 'lib/openhab/dsl.rb', line 194
+
+def profile(id, label: nil, config_description: nil, &block)
+  raise ArgumentError, "Block is required" unless block
+
+  id = id.to_s
+
+  ThreadLocal.thread_local(openhab_rule_type: "profile", openhab_rule_uid: id) do
+    Core::ProfileFactory.instance.register(id, block, label: label, config_description: config_description)
+  end
+end
+
+
+ +
+

+ + .provider(*providers, **providers_by_type) { ... } ⇒ Object + + + + + +

+
+

Sets the implicit provider(s) for operations inside the block.

+ + +
+
+
+ +
+

Examples:

+ + +
provider(metadata: :persistent) do
+  Switch1.metadata[:last_status_from_service] = status
+end
+
+provider!(metadata: { last_status_from_service: :persistent }, Switch2: :persistent)
+Switch1.metadata[:last_status_from_service] = status # this will persist in JSONDB
+Switch1.metadata[:homekit] = "Lightbulb" # this will be removed when the script is deleted
+Switch2.metadata[:homekit] = "Lightbulb" # this will persist in JSONDB
+ +
+

Parameters:

+
    + +
  • + + providers + + + (Core::Provider, org.openhab.core.common.registry.ManagedProvider, :persistent, :transient, Proc) + + + + — +

    An explicit provider to use. If it's a Core::Provider, the type will be inferred automatically. +Otherwise it's applied to all types.

    +
    + +
  • + +
  • + + providers_by_type + + + (Hash) + + + + — +

    A list of providers by type. Type can be :items, :metadata, :things, :links, +an Item applying the provider to all metadata on that item, or a String or Symbol +applying the provider to all metadata of that namespace.

    +

    The provider can be a Provider, :persistent, +:transient, or a Proc returning one of those types. When the Proc is called for metadata +elements, the Core::Items::Metadata::Hash will be passed as an argument. Therefore it's +recommended that you use a Proc, not a Lambda, for permissive argument matching.

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    [] The block will be executed using the specified provider(s).

    +
    + +
  • + +
+

Returns:

+
    + +
  • + + + (Object) + + + + — +

    the result of the block

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+871
+872
+873
+874
+875
+876
+877
+878
+879
+880
+
+
# File 'lib/openhab/dsl.rb', line 871
+
+def provider(*providers, **providers_by_type)
+  raise ArgumentError, "You must give a block to set the provider for the duration of" unless block_given?
+
+  begin
+    old_providers = provider!(*providers, **providers_by_type)
+    yield
+  ensure
+    Thread.current[:openhab_providers] = old_providers
+  end
+end
+
+
+ +
+

+ + .provider!(things: nil, items: nil, metadata: nil, links: nil, **metadata_items) ⇒ Hash + + + + + +

+
+ +
+ Note: +

This method is only intended for use at the top level of rule +scripts. If it's used within library methods, or hap-hazardly within +rules, things can get very confusing because the prior state won't be +properly restored.

+
+
+ +

Permanently set the implicit provider(s) for this thread.

+

provider! calls are cumulative - additional calls will not erase the effects +of previous calls unless they are for the same provider type.

+ + +
+
+
+ + +

Parameters:

+
    + +
  • + + providers + + + (Core::Provider, org.openhab.core.common.registry.ManagedProvider, :persistent, :transient, Proc) + + + + — +

    An explicit provider to use. If it's a Core::Provider, the type will be inferred automatically. +Otherwise it's applied to all types.

    +
    + +
  • + +
  • + + providers_by_type + + + (Hash) + + + + — +

    A list of providers by type. Type can be :items, :metadata, :things, :links, +an Item applying the provider to all metadata on that item, or a String or Symbol +applying the provider to all metadata of that namespace.

    +

    The provider can be a Provider, :persistent, +:transient, or a Proc returning one of those types. When the Proc is called for metadata +elements, the Core::Items::Metadata::Hash will be passed as an argument. Therefore it's +recommended that you use a Proc, not a Lambda, for permissive argument matching.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Hash) + + + + — +

    the prior provider configuration.

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+913
+914
+915
+916
+917
+918
+919
+920
+921
+922
+923
+924
+925
+926
+927
+928
+929
+930
+931
+932
+933
+934
+935
+936
+937
+938
+939
+940
+941
+942
+943
+944
+945
+946
+947
+948
+949
+950
+951
+952
+953
+954
+955
+956
+957
+958
+959
+960
+961
+962
+963
+964
+965
+966
+967
+968
+969
+970
+971
+972
+
+
# File 'lib/openhab/dsl.rb', line 913
+
+def provider!(*providers, **providers_by_type)
+  thread_providers = Thread.current[:openhab_providers] ||= {}
+  old_providers = thread_providers.dup
+
+  providers.each do |provider|
+    case provider
+    when Core::Provider
+      thread_providers[provider.class.type] = provider
+    when org.openhab.core.common.registry.ManagedProvider
+      type = provider.type
+      unless type
+        raise ArgumentError, "#{provider.inspect} is for objects which are not supported by openhab-scripting"
+      end
+
+      thread_providers[type] = provider
+    when Proc,
+      :transient,
+      :persistent
+      Core::Provider::KNOWN_TYPES.each do |known_type|
+        thread_providers[known_type] = provider
+      end
+    when Hash
+      # non-symbols can't be used as kwargs, so Item keys show up as a separate hash here
+      # just merge it in, and allow it to be handled below
+      providers_by_type.merge!(provider)
+    else
+      raise ArgumentError, "#{provider.inspect} is not a valid provider"
+    end
+  end
+
+  providers_by_type.each do |type, provider|
+    case provider
+    when Proc,
+      org.openhab.core.common.registry.ManagedProvider,
+      :transient,
+      :persistent,
+      nil
+      nil
+    else
+      raise ArgumentError, "#{provider.inspect} is not a valid provider"
+    end
+
+    case type
+    when :items, :metadata, :things, :links
+      if provider.is_a?(org.openhab.core.common.registry.ManagedProvider) && provider.type != type
+        raise ArgumentError, "#{provider.inspect} is not a provider for #{type}"
+      end
+
+      thread_providers[type] = provider
+    when Symbol, String
+      (thread_providers[:metadata_namespaces] ||= {})[type.to_s] = provider
+    when Item
+      (thread_providers[:metadata_items] ||= {})[type.name] = provider
+    else
+      raise ArgumentError, "#{type.inspect} is not provider type"
+    end
+  end
+
+  old_providers
+end
+
+
+ +
+

+ + .rule(name = nil, id: nil, **kwargs) {|rule| ... } ⇒ Core::Rules::Rule? + + + + + +

+
+

Create a new rule

+

The rule must have at least one trigger and one execution block. +To create a "script" without any triggers, use script.

+

When explicit id is not provided, the rule's ID will be inferred from the block's source location, +and a suffix will be added to avoid clashing against existing rules.

+

When an explicit id is provided and an existing rule with the same id already exists, +the rule will not be created, and the method will return nil.

+

To ensure that a rule is created even when the same id already exists, use rule! or call +rules.remove to remove any existing rule prior to creating the new rule.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "name" do
+  <one or more triggers>
+  <one or more execution blocks>
+  <zero or more guards>
+end
+ + +

Create a rule with an explicit id, deleting any existing rule with the same id

+

+ +
rule! "name", id: "my_happy_day_reminder" do
+  every :day
+  run { logger.info "Happy new day!" }
+end
+ +
+

Parameters:

+
    + +
  • + + name + + + (String) + + + (defaults to: nil) + + + — +

    The rule name

    +
    + +
  • + +
  • + + id + + + (String) + + + (defaults to: nil) + + + — +

    The rule's ID. This can also be defined in the block using uid.

    +
    + +
  • + +
+ +

Yields:

+ +

Yield Parameters:

+
    + +
  • + + rule + + + (Rules::BuilderDSL) + + + + — +

    Optional parameter to access the rule configuration from within execution blocks and guards.

    +
    + +
  • + +
+

Returns:

+
    + +
  • + + + (Core::Rules::Rule, nil) + + + + — +

    The rule object, or nil if no rule was created.

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+61
+62
+63
+
+
# File 'lib/openhab/dsl.rb', line 61
+
+def rule(name = nil, id: nil, **kwargs, &block)
+  rules.build { rule(name, id: id, **kwargs, &block) }
+end
+
+
+ +
+

+ + .rule!(name = nil, id: nil, **kwargs, &block) ⇒ Object + + + + + +

+
+

Creates a rule that will remove existing rules with the same id, even when the id has been inferred.

+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+67
+68
+69
+
+
# File 'lib/openhab/dsl.rb', line 67
+
+def rule!(name = nil, id: nil, **kwargs, &block)
+  rules.build { rule(name, id: id, replace: true, **kwargs, &block) }
+end
+
+
+ +
+

+ + .rulesCore::Rules::Registry + + + + + +

+
+

Fetches all rules from the rule registry.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+257
+258
+259
+
+
# File 'lib/openhab/dsl.rb', line 257
+
+def rules
+  Core::Rules::Registry.instance
+end
+
+
+ +
+

+ + .scene(name = nil, description: nil, id: nil, tag: nil, tags: nil, **kwargs) { ... } ⇒ Core::Rules::Rule? + + + + + +

+
+

Create a new scene

+

A scene is a rule with no triggers. It can be called by various other actions, +such as the Run Rules action.

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String) + + + (defaults to: nil) + + + — +

    A name for the scene

    +
    + +
  • + +
  • + + description + + + (String) + + + (defaults to: nil) + + + — +

    A description of the scene

    +
    + +
  • + +
  • + + id + + + (String) + + + (defaults to: nil) + + + — +

    The script's ID

    +
    + +
  • + +
  • + + tag + + + (String, Symbol, Semantics::Tag, Array<String, Symbol, Semantics::Tag>, nil) + + + (defaults to: nil) + + + — +

    Tags to assign to the script

    +
    + +
  • + +
  • + + tags + + + (String, Symbol, Semantics::Tag, Array<String, Symbol, Semantics::Tag>, nil) + + + (defaults to: nil) + + + — +

    Fluent alias for tag

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    [] Block executed when the script is executed.

    +
    + +
  • + +
+

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+72
+73
+74
+
+
# File 'lib/openhab/dsl.rb', line 72
+
+def scene(name = nil, description: nil, id: nil, tag: nil, tags: nil, **kwargs, &block)
+  rules.build { scene(name, description: description, id: id, tag: tag, tags: tags, **kwargs, &block) }
+end
+
+
+ +
+

+ + .scene!(name = nil, description: nil, id: nil, tag: nil, tags: nil, **kwargs, &block) ⇒ Object + + + + + +

+
+

Creates a scene that will remove existing rules/scenes with the same id, even when the id has been inferred.

+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+78
+79
+80
+81
+82
+
+
# File 'lib/openhab/dsl.rb', line 78
+
+def scene!(name = nil, description: nil, id: nil, tag: nil, tags: nil, **kwargs, &block)
+  rules.build do
+    scene(name, description: description, id: id, tag: tag, tags: tags, replace: true, **kwargs, &block)
+  end
+end
+
+
+ +
+

+ + .script(name = nil, description: nil, id: nil, tag: nil, tags: nil, **kwargs) { ... } ⇒ Core::Rules::Rule? + + + + + +

+
+

Create a new script

+

A script is a rule with no triggers. It can be called by various other actions, +such as the Run Rules action, or by calling Core::Rules::Rule#trigger.

+

Scripts can be executed with some additional context, similar to method parameters +(see Core::Rules::Rule#trigger). +The context can be accessed from within the script's execution block as a "local" variable.

+ + +
+
+
+ +
+

Examples:

+ + +

A simple script

+

+ +
# return the script object into a variable
+door_check = script "Check all doors", id: "door_check", tags: :security do
+  open_doors = gDoors.members.select(&:open?).map(&:label).join(", ")
+  Notification.send("The following doors are open: #{open_doors}") unless open_doors.empty?
+end
+
+# run is an alias of trigger
+door_check.run
+ + +

A script with context

+

+ +
# This script expects to be called with `message` as context/parameter
+DESTINATION_EMAIL = "myemail@example.com"
+script "Send Notifications", id: "send_alert" do
+  Notification.send(message)
+  things["mail:smtp:local"].send_mail(DESTINATION_EMAIL, "OpenHAB Alert", message)
+end
+
+rules.scripts["send_alert"].run(message: "The door is open!")
+ +
+

Parameters:

+
    + +
  • + + name + + + (String) + + + (defaults to: nil) + + + — +

    A name for the script

    +
    + +
  • + +
  • + + description + + + (String) + + + (defaults to: nil) + + + — +

    A description of the script

    +
    + +
  • + +
  • + + id + + + (String) + + + (defaults to: nil) + + + — +

    The script's ID

    +
    + +
  • + +
  • + + tag + + + (String, Symbol, Semantics::Tag, Array<String, Symbol, Semantics::Tag>, nil) + + + (defaults to: nil) + + + — +

    Tags to assign to the script

    +
    + +
  • + +
  • + + tags + + + (String, Symbol, Semantics::Tag, Array<String, Symbol, Semantics::Tag>, nil) + + + (defaults to: nil) + + + — +

    Fluent alias for tag

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    [] Block executed when the script is executed.

    +
    + +
  • + +
+

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+85
+86
+87
+
+
# File 'lib/openhab/dsl.rb', line 85
+
+def script(name = nil, description: nil, id: nil, tag: nil, tags: nil, **kwargs, &block)
+  rules.build { script(name, description: description, id: id, tag: tag, tags: tags, **kwargs, &block) }
+end
+
+
+ +
+

+ + .script!(name = nil, description: nil, id: nil, tag: nil, tags: nil, **kwargs, &block) ⇒ Object + + + + + +

+
+

Creates a script that will remove existing rules/scripts with the same id, even when the id has been inferred.

+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+91
+92
+93
+94
+95
+
+
# File 'lib/openhab/dsl.rb', line 91
+
+def script!(name = nil, description: nil, id: nil, tag: nil, tags: nil, **kwargs, &block)
+  rules.build do
+    script(name, description: description, id: id, tag: tag, tags: tags, replace: true, **kwargs, &block)
+  end
+end
+
+
+ +
+

+ + .shared_cacheCore::ValueCache + + + + + +

+
+ +
+ Note: +

Only the sharedCache is exposed in Ruby. +For a private cache, simply use an instance variable. See +Instance Variables.

+
+
+ +
+ Note: +

Because every script or UI rule gets its own JRuby engine instance, +you cannot rely on being able to access Ruby objects between them. Only +objects that implement a Java interface that's part of Java or openHAB +Core (such as Hash implements java.util.Map, or other basic +datatypes) can be reliably stored and accessed from the shared cache. +Likewise, you can use the cache to access data from other scripting +languages, but they'll be all but useless in Ruby. It's best to stick +to simple data types. If you're having troubles, serializing to_json +before storing may help.

+
+
+ +

ValueCache is the interface used to access a +shared cache available between scripts and/or +rule executions.

+

While ValueCache looks somewhat like a Hash, it does not support +iteration of the contained elements. So it's limited to strictly storing, +fetching, or removing known elements.

+

Shared caches are not persisted between openHAB restarts. And in fact, +if all scripts are unloaded that reference a particular key, that key is +removed.

+ + +
+
+
+ +
+

Examples:

+ + +
shared_cache.compute_if_absent(:execution_count) { 0 }
+shared_cache[:execution_count] += 1
+ +
+ +

Returns:

+
    + +
  • + + + (Core::ValueCache) + + + + — +

    the cache shared among all scripts and UI rules in all languages.

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+248
+249
+250
+
+
# File 'lib/openhab/dsl.rb', line 248
+
+def shared_cache
+  $sharedCache
+end
+
+
+ +
+

+ + .sitemapsCore::Sitemaps::Provider + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+262
+263
+264
+
+
# File 'lib/openhab/dsl.rb', line 262
+
+def sitemaps
+  Core::Sitemaps::Provider.instance
+end
+
+
+ +
+

+ + .store_states(*items) ⇒ Core::Items::StateStorage + + + + + +

+
+

Store states of supplied items

+

Takes one or more items and returns a map {Item => State} with the +current state of each item. It is implemented by calling openHAB's +events.storeStates().

+ + +
+
+
+ +
+

Examples:

+ + +
states = store_states Item1, Item2
+...
+states.restore
+ + +

With a block

+

+ +
store_states Item1, Item2 do
+  ...
+end # the states will be restored here
+ +
+

Parameters:

+
    + +
  • + + items + + + (Item) + + + + — +

    Items to store states of.

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+571
+572
+573
+574
+575
+576
+577
+578
+
+
# File 'lib/openhab/dsl.rb', line 571
+
+def store_states(*items)
+  states = Core::Items::StateStorage.from_items(*items)
+  if block_given?
+    yield
+    states.restore
+  end
+  states
+end
+
+
+ +
+

+ + .thingsCore::Things::Registry + + + + + +

+
+

Get all things known to openHAB

+ + +
+
+
+ +
+

Examples:

+ + +
things.each { |thing| logger.info("Thing: #{thing.uid}")}
+logger.info("Thing: #{things['astro:sun:home'].uid}")
+homie_things = things.select { |t| t.thing_type_uid == "mqtt:homie300" }
+zwave_things = things.select { |t| t.binding_id == "zwave" }
+homeseer_dimmers = zwave_things.select { |t| t.thing_type_uid.id == "homeseer_hswd200_00_000" }
+things['zwave:device:512:node90'].uid.bridge_ids # => ["512"]
+things['mqtt:topic:4'].uid.bridge_ids # => []
+ +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+5
+
+
# File 'lib/openhab/dsl.rb', line 5
+
+def things; end
+
+
+ +
+

+ + .throttle_for(duration, id: nil, &block) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Rate-limits block executions by delaying calls and only executing the last +call within the given duration.

+

When throttle_for is called, it will hold from executing the block and start +a fixed timer for the given duration. Should more calls occur during +this time, keep holding and once the wait time is over, execute the block.

+

throttle_for will execute the block after it had waited for the given duration, +regardless of how frequently throttle_for was called. +In contrast, debounce_for will wait until there is a minimum interval +between two triggers.

+

throttle_for is ideal in situations where regular status updates need to be made +for frequently changing values. It is also useful when a rule responds to triggers +from multiple related items that are updated at around the same time. Instead of +executing the rule multiple times, throttle_for will wait for a pre-set amount +of time since the first group of triggers occurred before executing the rule.

+ + +
+
+
+

Parameters:

+
    + +
  • + + id + + + (Object) + + + (defaults to: nil) + + + — +

    ID to associate with this call.

    +
    + +
  • + +
  • + + block + + + (Block) + + + + — +

    The block to be throttled.

    +
    + +
  • + +
  • + + duration + + + (Duration) + + + + — +

    The minimum amount of time to wait inbetween rule +executions.

    +
    + +
  • + +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+515
+516
+517
+
+
# File 'lib/openhab/dsl.rb', line 515
+
+def throttle_for(duration, id: nil, &block)
+  debounce(for: duration, id: id, &block)
+end
+
+
+ +
+

+ + .timersTimerManager + + + + + +

+
+

Provides access to timers created by after

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+270
+271
+272
+
+
# File 'lib/openhab/dsl.rb', line 270
+
+def timers
+  TimerManager.instance
+end
+
+
+ +
+

+ + .transform(type, function, value) ⇒ String + + + + + +

+
+

Applies a transformation of a given type with some function to a value.

+ + +
+
+
+ +
+

Examples:

+ + +

Run a transformation

+

+ +
transform(:map, "myfan.map", 0)
+ +
+

Parameters:

+
    + +
  • + + type + + + (String, Symbol) + + + + — +

    The transformation type, e.g. REGEX +or MAP

    +
    + +
  • + +
  • + + function + + + (String, Symbol) + + + + — +

    The function to call. This value depends +on the transformation type

    +
    + +
  • + +
  • + + value + + + (String) + + + + — +

    The value to apply the transformation to

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    the transformed value, or the original value if an error occurred

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+520
+521
+522
+
+
# File 'lib/openhab/dsl.rb', line 520
+
+def transform(type, function, value)
+  Transformation.transform(type, function, value)
+end
+
+
+ +
+

+ + + .unit(*units) { ... } ⇒ Object + + .unit(dimension) ⇒ javax.measure.Unit + + + + + + +

+
+

Sets the implicit unit(s) for operations inside the block.

+ + +
+
+
+ +

Overloads:

+
    + + +
  • + .unit(*units) { ... } ⇒ Object +
    +
    +

    Sets the implicit unit(s) for this thread such that classes +operating inside the block can perform automatic conversions to the +supplied unit for QuantityType.

    +

    To facilitate conversion of multiple dimensioned and dimensionless +numbers the unit block may be used. The unit block attempts to do the +right thing based on the mix of dimensioned and dimensionless items +within the block. Specifically all dimensionless items are converted to +the supplied unit, except when they are used for multiplication or +division.

    + + +
    +
    +
    + +
    +

    Examples:

    + + +

    Arithmetic Operations Between QuantityType and Numeric

    +

    + +
    # Number:Temperature NumberC = 23 °C
    +# Number:Temperature NumberF = 70 °F
    +# Number Dimensionless = 2
    +unit('°F') { NumberC.state - NumberF.state < 4 }                                      # => true
    +unit('°F') { NumberC.state - 24 | '°C' < 4 }                                          # => true
    +unit('°F') { (24 | '°C') - NumberC.state < 4 }                                        # => true
    +unit('°C') { NumberF.state - 20 < 2 }                                                 # => true
    +unit('°C') { NumberF.state - Dimensionless.state }                                    # => 19.11 °C
    +unit('°C') { NumberF.state - Dimensionless.state < 20 }                               # => true
    +unit('°C') { Dimensionless.state + NumberC.state == 25 }                              # => true
    +unit('°C') { 2 + NumberC.state == 25 }                                                # => true
    +unit('°C') { Dimensionless.state * NumberC.state == 46 }                              # => true
    +unit('°C') { 2 * NumberC.state == 46 }                                                # => true
    +unit('°C') { ( (2 * (NumberF.state + NumberC.state) ) / Dimensionless.state ) < 45 }  # => true
    +unit('°C') { [NumberC.state, NumberF.state, Dimensionless.state].min }                # => 2
    + + +

    Commands and Updates inside a unit block

    +

    + +
    unit('°F') { NumberC << 32 }; NumberC.state                                           # => 0 °C
    +# Equivalent to
    +NumberC << "32 °F"
    +# or
    +NumberC << 32 | "°F"
    + + +

    Specifying Multiple Units

    +

    + +
    unit("°C", "kW") do
    +  TemperatureItem.update("50 °F")
    +  TemperatureItem.state < 20          # => true. TemperatureItem.state < 20 °C
    +  PowerUsage.update("3000 W")
    +  PowerUsage.state < 10               # => true. PowerUsage.state < 10 kW
    +end
    + +
    +

    Parameters:

    +
      + +
    • + + units + + + (String, javax.measure.Unit) + + + + — +

      Unit or String representing unit

      +
      + +
    • + +
    + +

    Yields:

    +
      + +
    • + + + + + + + +

      [] The block will be executed in the context of the specified unit(s).

      +
      + +
    • + +
    +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +

      the result of the block

      +
      + +
    • + +
    + +
    +
  • + + +
  • + .unit(dimension) ⇒ javax.measure.Unit +
    +
    +

    Returns The current unit for the thread of the specified dimensions.

    + + +
    +
    +
    + +
    +

    Examples:

    + + +
    unit(SIUnits::METRE.dimension) # => ImperialUnits::FOOT
    + +
    +

    Parameters:

    + + +

    Returns:

    +
      + +
    • + + + (javax.measure.Unit) + + + + — +

      The current unit for the thread of the specified dimensions

      +
      + +
    • + +
    + +
    +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +
+ + + + +
+
+
+
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+
+
# File 'lib/openhab/dsl.rb', line 784
+
+def unit(*units)
+  if units.length == 1 && units.first.is_a?(javax.measure.Dimension)
+    return Thread.current[:openhab_units]&.[](units.first)
+  end
+
+  raise ArgumentError, "You must give a block to set the unit for the duration of" unless block_given?
+
+  begin
+    old_units = unit!(*units)
+    yield
+  ensure
+    Thread.current[:openhab_units] = old_units
+  end
+end
+
+
+ +
+

+ + + .unit!(*units) ⇒ Hash<javax.measure.Dimension=>javax.measure.Unit> + + .unit!Hash<javax.measure.Dimension=>javax.measure.Unit> + + + + + + +

+
+ +
+ Note: +

This method is only intended for use at the top level of rule +scripts. If it's used within library methods, or hap-hazardly within +rules, things can get very confusing because the prior state won't be +properly restored.

+
+
+ +

Permanently sets the implicit unit(s) for this thread

+

unit! calls are cumulative - additional calls will not erase the effects +of previous calls unless they are for the same dimension.

+ + +
+
+
+ +

Overloads:

+
    + + +
  • + .unit!(*units) ⇒ Hash<javax.measure.Dimension=>javax.measure.Unit> +
    +
    + + +
    +
    +
    + +
    +

    Examples:

    + + +

    Set several defaults at once

    +

    + +
    unit!("°F", "ft", "lbs")
    +(50 | "°F") == 50 # => true
    + + +

    Calls are cumulative

    +

    + +
    unit!("°F")
    +unit!("ft")
    +(50 | "°F") == 50 # => true
    +(2 | "yd") == 6 # => true
    + + +

    Subsequent calls override the same dimension from previous calls

    +

    + +
    unit!("yd")
    +unit!("ft")
    +(2 | "yd") == 6 # => true
    + +
    +

    Parameters:

    +
      + +
    • + + units + + + (String, javax.measure.Unit) + + + + — +

      Unit or String representing unit.

      +
      + +
    • + +
    + + +
    +
  • + + +
  • + .unit!Hash<javax.measure.Dimension=>javax.measure.Unit> +
    +
    +

    Clear all unit settings

    + + +
    +
    +
    + +
    +

    Examples:

    + + +

    Clear all unit settings

    +

    + +
    unit!("ft")
    +unit!
    +(2 | "yd") == 6 # => false
    + +
    + + +
    +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+
+
# File 'lib/openhab/dsl.rb', line 840
+
+def unit!(*units)
+  units = units.each_with_object({}) do |unit, r|
+    unit = org.openhab.core.types.util.UnitUtils.parse_unit(unit) if unit.is_a?(String)
+    r[unit.dimension] = unit
+  end
+
+  old_units = Thread.current[:openhab_units] || {}
+  Thread.current[:openhab_units] = units.empty? ? {} : old_units.merge(units)
+  old_units
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/ConfigDescription.html b/5.33/OpenHAB/DSL/ConfigDescription.html new file mode 100644 index 0000000000..4af9b5461b --- /dev/null +++ b/5.33/OpenHAB/DSL/ConfigDescription.html @@ -0,0 +1,3608 @@ + + + + + + + Module: OpenHAB::DSL::ConfigDescription + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::DSL::ConfigDescription + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/config_description/builder.rb
+
+ +
+ +

Overview

+
+

Contains the DSL for creating org.openhab.core.config.core.ConfigDescription instances.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + + + Classes: Builder + + +

+ + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/ConfigDescription/Builder.html b/5.33/OpenHAB/DSL/ConfigDescription/Builder.html new file mode 100644 index 0000000000..7046942dc2 --- /dev/null +++ b/5.33/OpenHAB/DSL/ConfigDescription/Builder.html @@ -0,0 +1,4593 @@ + + + + + + + Class: OpenHAB::DSL::ConfigDescription::Builder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::ConfigDescription::Builder + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/config_description/builder.rb
+
+ +
+ +

Overview

+
+

A ConfigDescriptionBuilder is used to create a org.openhab.core.config.core.ConfigDescription +instance.

+ + +
+
+
+ + +

See Also:

+
    + +
  • config_description
  • + +
+ +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + +
+

Constructor Details

+ +
+

+ + #initializeBuilder + + + + + +

+
+

Returns a new instance of Builder.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+16
+17
+18
+19
+20
+
+
# File 'lib/openhab/dsl/config_description/builder.rb', line 16
+
+def initialize
+  @parameters = []
+  @parameter_groups = []
+  @current_group = nil
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #build(uri = nil) { ... } ⇒ org.openhab.core.config.core.ConfigDescription + + + + + +

+
+

Build the config description

+ + +
+
+
+

Parameters:

+
    + +
  • + + uri + + + (String, java.net.URI) + + + (defaults to: nil) + + + — +

    The URI for the config description. When nil, it will default to dummy:uri

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block executed in the context of this builder. Inside the block, you can call #parameter and #group.

    +
    + +
  • + +
+

Returns:

+ +

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +
+ + + + +
+
+
+
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+
+
# File 'lib/openhab/dsl/config_description/builder.rb', line 142
+
+def build(uri = nil, &block)
+  instance_eval(&block) if block
+  raise ArgumentError, "No parameters defined" if @parameters.empty?
+
+  uri ||= "dummy:uri"
+  uri = java.net.URI.new(uri.to_s) unless uri.is_a?(java.net.URI)
+  org.openhab.core.config.core.ConfigDescriptionBuilder
+     .create(uri)
+     .with_parameters(@parameters)
+     .with_parameter_groups(@parameter_groups)
+     .build
+end
+
+
+ +
+

+ + #group(name, label: nil, description: nil, advanced: false, context: nil) { ... } ⇒ void + + + + + +

+
+

This method returns an undefined value.

Create a parameter group.

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String, Symbol) + + + + — +

    The group name. This name will be referred to by #parameter.

    +
    + +
  • + +
  • + + label + + + (String, nil) + + + (defaults to: nil) + + + — +

    The group label

    +
    + +
  • + +
  • + + description + + + (String, nil) + + + (defaults to: nil) + + + — +

    The group description

    +
    + +
  • + +
  • + + advanced + + + (Boolean) + + + (defaults to: false) + + + — +

    Whether the group is advanced

    +
    + +
  • + +
  • + + context + + + (<Type>) + + + (defaults to: nil) + + + — +

    Context for the group

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block executed in the context of this group. Any #parameter calls within the block will +automatically be added to this group, unless it specifies a different group name.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+
+
# File 'lib/openhab/dsl/config_description/builder.rb', line 36
+
+def group(name, label: nil, description: nil, advanced: false, context: nil, &block)
+  raise ArgumentError, "Groups cannot be nested" if @current_group
+
+  name = name.to_s
+  @parameter_groups << org.openhab.core.config.core.ConfigDescriptionParameterGroupBuilder
+                          .create(name)
+                          .with_label(label)
+                          .with_description(description)
+                          .with_advanced(advanced)
+                          .with_context(context)
+                          .build
+
+  @current_group = name
+  instance_eval(&block) if block
+ensure
+  @current_group = nil
+end
+
+
+ +
+

+ + #parameter(name, type, label: nil, description: nil, min: nil, max: nil, step: nil, pattern: nil, required: false, read_only: false, multiple: false, context: nil, default: nil, options: {}, filter_criteria: {}, group_name: nil, advanced: false, limit_to_options: false, multiple_limit: nil, unit: nil, unit_label: nil, verify: false) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Adds a parameter to the config description.

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String, Symbol) + + + + — +

    Parameter name

    +
    + +
  • + +
  • + + type + + + (:text, :integer, :decimal, :boolean) + + + + — + + +
  • + +
  • + + label + + + (String, nil) + + + (defaults to: nil) + + + — +

    Parameter label

    +
    + +
  • + +
  • + + description + + + (String, nil) + + + (defaults to: nil) + + + — +

    Parameter description

    +
    + +
  • + +
  • + + min + + + (Numeric, nil) + + + (defaults to: nil) + + + — +

    Minimum value for numeric types

    +
    + +
  • + +
  • + + max + + + (Numeric, nil) + + + (defaults to: nil) + + + — +

    Maximum value for numeric types

    +
    + +
  • + +
  • + + step + + + (Numeric, nil) + + + (defaults to: nil) + + + — +

    Step size for numeric types

    +
    + +
  • + +
  • + + pattern + + + (String, nil) + + + (defaults to: nil) + + + — +

    Regular expression pattern for string types

    +
    + +
  • + +
  • + + required + + + (true, false) + + + (defaults to: false) + + + — +

    Whether the parameter is required

    +
    + +
  • + +
  • + + read_only + + + (true, false) + + + (defaults to: false) + + + — +

    Whether the parameter is read only

    +
    + +
  • + +
  • + + multiple + + + (true, false) + + + (defaults to: false) + + + — +

    Whether the parameter is a list of values

    +
    + +
  • + +
  • + + context + + + (String, nil) + + + (defaults to: nil) + + + — +

    Context for the parameter

    +
    + +
  • + +
  • + + default + + + (Object, nil) + + + (defaults to: nil) + + + — +

    Default value for the parameter

    +
    + +
  • + +
  • + + options + + + (Hash) + + + (defaults to: {}) + + + — +

    Options for the parameter

    +
    + +
  • + +
  • + + filter_criteria + + + (Hash) + + + (defaults to: {}) + + + — +

    Filter criteria for the parameter

    +
    + +
  • + +
  • + + group_name + + + (String, nil) + + + (defaults to: nil) + + + — +

    Parameter group name. +When nil, it will be inferred when this method is called inside a #group block.

    +
    + +
  • + +
  • + + advanced + + + (true, false) + + + (defaults to: false) + + + — +

    Whether the parameter is advanced

    +
    + +
  • + +
  • + + limit_to_options + + + (true, false) + + + (defaults to: false) + + + — +

    Whether the parameter is limited to the given options

    +
    + +
  • + +
  • + + multiple_limit + + + (Integer, nil) + + + (defaults to: nil) + + + — +

    Maximum number of values for a multiple parameter

    +
    + +
  • + +
  • + + unit + + + (String, nil) + + + (defaults to: nil) + + + — +

    Parameter unit

    +
    + +
  • + +
  • + + unit_label + + + (String, nil) + + + (defaults to: nil) + + + — +

    Parameter unit label

    +
    + +
  • + +
  • + + verify + + + (true, false) + + + (defaults to: false) + + + — +

    Whether the parameter value should be verified

    +
    + +
  • + +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+
+
# File 'lib/openhab/dsl/config_description/builder.rb', line 86
+
+def parameter(name,
+              type,
+              label: nil,
+              description: nil,
+              min: nil,
+              max: nil,
+              step: nil,
+              pattern: nil,
+              required: false,
+              read_only: false,
+              multiple: false,
+              context: nil,
+              default: nil,
+              options: {},
+              filter_criteria: {},
+              group_name: nil,
+              advanced: false,
+              limit_to_options: false,
+              multiple_limit: nil,
+              unit: nil,
+              unit_label: nil,
+              verify: false)
+  # Extract the named arguments into a hash
+  @parameters << method(__method__).parameters
+                                   .select { |param_type, _| param_type == :key }
+                                   .to_h { |_, key| [key, binding.local_variable_get(key)] }
+                                   .then do |p|
+    p[:options] = p[:options].map do |opt_value, opt_label|
+      org.openhab.core.config.core.ParameterOption.new(opt_value, opt_label)
+    end
+    p[:filter_criteria] = p[:filter_criteria].map do |filter_name, filter_value|
+      org.openhab.core.config.core.FilterCriteria.new(filter_name, filter_value)
+    end
+    p[:minimum] = p.delete(:min)&.to_d&.to_java
+    p[:maximum] = p.delete(:max)&.to_d&.to_java
+    p[:step] = p.delete(:step)&.to_d&.to_java
+    p[:group_name] ||= @current_group
+    type = org.openhab.core.config.core.ConfigDescriptionParameter::Type.value_of(type.to_s.upcase)
+
+    parameter = org.openhab.core.config.core.ConfigDescriptionParameterBuilder.create(name.to_s, type)
+
+    p.each do |key, value|
+      parameter.send(:"with_#{key}", value) unless value.nil?
+    end
+    parameter.build
+  end
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Debouncer.html b/5.33/OpenHAB/DSL/Debouncer.html new file mode 100644 index 0000000000..f2192acc87 --- /dev/null +++ b/5.33/OpenHAB/DSL/Debouncer.html @@ -0,0 +1,4540 @@ + + + + + + + Class: OpenHAB::DSL::Debouncer + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Debouncer + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/debouncer.rb
+
+ +
+ +

Overview

+
+

Provides the feature for debouncing calls to a given block.

+

The debouncer can filter events and only allow the events on the leading or trailing edge +of the given interval. Its behavior can be customized through settings passed to its +constructor.

+

The following timing diagram illustrates the incoming triggers and the actual executions +using various options.

+
                             1    1    2    2    3    3    4    4
+                   0    5    0    5    0    5    0    5    0    5
+Triggers        : 'X.X...X...X..XX.X.X......XXXXXXXXXXX....X.....'
+leading: false
+for:5           : '|....X|....X |....X      |....X|....X   |....X'
+leading: true
+for:5           : 'X.....X......X....X......X....X....X....X.....'
+
+more options, leading: false
+Triggers        : 'X.X...X...X..XX.X.X......XXXXXXXXXXX....X.....'
+for:5 idle:3    : '|....X|......X|......X...|............X.|....X'
+for:5 idle:5    : '|......................X.|..............X.....'
+for:5..5 idle:X : '|....X|....X.|....X......|....X|....X...|....X'
+for:5..6 idle:5 : '|.....X...|.....X.|....X.|.....X|.....X.|....X'
+for:5..7 idle:5 : '|......X..|......X|....X.|......X|......X.....'
+for:5..8 idle:5 : '|.......X.|.......X......|.......X|.....X.....'
+for:5..8 idle:3 : '|....X|......X|......X...|.......X|....X|....X'
+for:5..8 idle:2 : '|....X|.....X|......X....|.......X|....X|....X'
+
+

Notes:

+
    +
  • | indicates the start of the debounce period
  • +
  • With for: 5..5 (a range with begin=end), the idle_time argument is irrelevant +and be unset/set to any value as it will not alter the debouncer's behavior.
  • +
  • Without an idle_time, the range end in for: X..Y is irrelevant. It is equivalent to +for: X without the end of the range.
  • +
+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #idle_time ⇒ Duration? + + + + + + + + + readonly + + + + + + + + + +

    The minimum idle time to stop debouncing.

    +
    + +
  • + + +
  • + + + #interval ⇒ Range? + + + + + + + + + readonly + + + + + + + + + +

    The range of accepted debounce period, or nil if debouncing is disabled.

    +
    + +
  • + + +
+ + + + + +

+ Instance Method Summary + collapse +

+ + + +
    + +
  • + + + #call { ... } ⇒ void + + + + + + + + + + + + + +

    Debounces calls to the given block.

    +
    + +
  • + + +
  • + + + #call! ⇒ Object + + + + + + + + + + + + + +

    Executes the latest block passed to the #debounce call regardless of any debounce settings.

    +
    + +
  • + + +
  • + + + #flush ⇒ Boolean + + + + + + + + + + + + + +

    Immediately executes any outstanding event of a trailing edge debounce.

    +
    + +
  • + + +
  • + + + #initialize(for:, leading: false, idle_time: nil) ⇒ void + + + + + + + constructor + + + + + + + + +

    Constructor to create a debouncer object.

    +
    + +
  • + + +
  • + + + #leading? ⇒ true, false + + + + + + + + + + + + + +

    Returns true to indicate that this is a leading edge debouncer.

    +
    + +
  • + + +
  • + + + #reset ⇒ Boolean + + + + + + + + + + + + + +

    Resets the debounce period and cancels any outstanding block executions of a trailing edge debouncer.

    +
    + +
  • + + +
+ + + +
+

Constructor Details

+ +
+

+ + #initialize(for:, leading: false, idle_time: nil) ⇒ void + + + + + +

+
+

Constructor to create a debouncer object.

+

The constructor sets the options and behaviour of the debouncer when the #call +method is called.

+

Terminology:

+
    +
  • calls are invocations of the #call method, i.e. the events that need to be throttled / debounced.
  • +
  • executions are the actual code executions of the given block. Executions usually occur +less frequently than the call to the debounce method.
  • +
+ + +
+
+
+

Parameters:

+
    + +
  • + + for + + + (Duration, Range, nil) + + + + — +

    The minimum and optional maximum execution interval.

    +
      +
    • Duration: The minimum interval between executions. The debouncer will not execute +the given block more often than this.
    • +
    • Range: A range of Durations for the minimum to maximum interval between executions. +The range end defines the maximum duration from the initial trigger, at which +the debouncer will execute the block, even when an idle_time argument was given and +calls continue to occur at an interval less than idle_time.
    • +
    • nil: When nil, no debouncing is performed, all the other parameters are ignored, +and every call will result in immediate execution of the given block.
    • +
    +
    + +
  • + +
  • + + leading + + + (true, false) + + + (defaults to: false) + + + — +
      +
    • true: Perform leading edge "debouncing". Execute the first call then ignore +subsequent calls that occur within the debounce period.
    • +
    • false: Perform trailing edge debouncing. Execute the last call at the end of +the debounce period and ignore all the calls leading up to it.
    • +
    +
    + +
  • + +
  • + + idle_time + + + (Duration, nil) + + + (defaults to: nil) + + + — +

    The minimum idle time between calls to stop debouncing. +The debouncer will continue to hold until the interval between two calls is longer +than the idle time or until the maximum interval between executions, when +specified, is reached.

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+
+
# File 'lib/openhab/dsl/debouncer.rb', line 84
+
+def initialize(for:, leading: false, idle_time: nil)
+  @interval = binding.local_variable_get(:for)
+  return unless @interval
+
+  @interval = (@interval..) unless @interval.is_a?(Range)
+
+  @leading = leading
+  @idle_time = idle_time
+  @mutex = Mutex.new
+  @block = nil
+  @timer = nil
+  reset
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #idle_timeDuration? (readonly) + + + + + +

+
+

Returns The minimum idle time to stop debouncing.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Duration, nil) + + + + — +

    The minimum idle time to stop debouncing.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+48
+49
+50
+
+
# File 'lib/openhab/dsl/debouncer.rb', line 48
+
+def idle_time
+  @idle_time
+end
+
+
+ + + +
+

+ + #intervalRange? (readonly) + + + + + +

+
+

Returns The range of accepted debounce period, or nil if debouncing is disabled.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Range, nil) + + + + — +

    The range of accepted debounce period, or nil if debouncing is disabled.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+45
+46
+47
+
+
# File 'lib/openhab/dsl/debouncer.rb', line 45
+
+def interval
+  @interval
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #call { ... } ⇒ void + + + + + +

+
+

This method returns an undefined value.

Debounces calls to the given block.

+

This method is meant to be called repeatedly with the same given block. +However, if no block is given, it will call and debounce the previously given block

+ + +
+
+
+ +
+

Examples:

+ + +

Basic trailing edge debouncing

+

+ +
debouncer = Debouncer.new(for: 1.minute)
+(1..100).each do
+  debouncer.call { logger.info "I won't log more often than once a minute" }
+  sleep 20 # call the debouncer every 20 seconds
+end
+ + +

Call the previous debounced block

+

+ +
debouncer = Debouncer.new(for: 1.minute)
+debouncer.call { logger.info "Hello. It is #{Time.now}" } # First call to debounce
+
+after(20.seconds) do |timer|
+  debouncer.call # Call the original block above
+  timer.reschedule unless timer.cancelled?
+end
+ +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block to be debounced

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +
+ + + + +
+
+
+
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+
+
# File 'lib/openhab/dsl/debouncer.rb', line 124
+
+def call(&block)
+  @block = block if block
+  raise ArgumentError, "No block has been provided" unless @block
+
+  return call! unless @interval # passthrough mode, no debouncing when @interval is nil
+
+  now = ZonedDateTime.now
+  if leading?
+    leading_edge_debounce(now)
+  else
+    trailing_edge_debounce(now)
+  end
+  @mutex.synchronize { @last_timestamp = now }
+end
+
+
+ +
+

+ + #call!Object + + + + + +

+
+

Executes the latest block passed to the OpenHAB::DSL#debounce call regardless of any debounce settings.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +

    The return value of the block

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+144
+145
+146
+
+
# File 'lib/openhab/dsl/debouncer.rb', line 144
+
+def call!
+  @block.call
+end
+
+
+ +
+

+ + #flushBoolean + + + + + +

+
+

Immediately executes any outstanding event of a trailing edge debounce. +The next call will start a new period.

+

It has no effect on a leading edge debouncer - use #reset instead.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    True if an existing debounce timer was rescheduled to run immediately. +False if there were no outstanding executions.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+173
+174
+175
+176
+177
+178
+179
+180
+
+
# File 'lib/openhab/dsl/debouncer.rb', line 173
+
+def flush
+  @mutex.synchronize do
+    if @timer&.cancel
+      call!
+      true
+    end
+  end
+end
+
+
+ +
+

+ + #leading?true, false + + + + + +

+
+

Returns true to indicate that this is a leading edge debouncer.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    True if this object was created to be a leading edge debouncer. False otherwise.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+187
+188
+189
+
+
# File 'lib/openhab/dsl/debouncer.rb', line 187
+
+def leading?
+  @leading
+end
+
+
+ +
+

+ + #resetBoolean + + + + + +

+
+

Resets the debounce period and cancels any outstanding block executions of a trailing edge debouncer.

+
    +
  • A leading edge debouncer will execute its block on the next call and start a new debounce period.
  • +
  • A trailing edge debouncer will reset its debounce timer and the next call will become the start +of a new debounce period.
  • +
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    True if a pending execution was cancelled.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+157
+158
+159
+160
+161
+162
+
+
# File 'lib/openhab/dsl/debouncer.rb', line 157
+
+def reset
+  @mutex.synchronize do
+    @last_timestamp = @leading_timestamp = @interval.begin.ago - 1.second if leading?
+    @timer&.cancel
+  end
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Events.html b/5.33/OpenHAB/DSL/Events.html new file mode 100644 index 0000000000..5fa79f256b --- /dev/null +++ b/5.33/OpenHAB/DSL/Events.html @@ -0,0 +1,3610 @@ + + + + + + + Module: OpenHAB::DSL::Events + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::DSL::Events + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/events.rb,
+ lib/openhab/dsl/events/watch_event.rb
+
+
+ +
+ +

Overview

+
+

Contains event classes for events defined by the DSL.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + + + Classes: WatchEvent + + +

+ + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Events/WatchEvent.html b/5.33/OpenHAB/DSL/Events/WatchEvent.html new file mode 100644 index 0000000000..b9e5e3374e --- /dev/null +++ b/5.33/OpenHAB/DSL/Events/WatchEvent.html @@ -0,0 +1,3876 @@ + + + + + + + Class: OpenHAB::DSL::Events::WatchEvent + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Events::WatchEvent + + + +

+
+ +
+
Inherits:
+
+ Struct + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/events/watch_event.rb
+
+ +
+ +

Overview

+
+

Event object passed by a Rules::BuilderDSL#watch trigger.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #attachment ⇒ Object + + + + + + + + + readonly + + + + + + + + + +

    The trigger's attachment.

    +
    + +
  • + + +
  • + + + #path ⇒ Pathname + + + + + + + + + readonly + + + + + + + + + +

    The path that had an event.

    +
    + +
  • + + +
  • + + + #type ⇒ :created, ... + + + + + + + + + readonly + + + + + + + + + +

    Type of change.

    +
    + +
  • + + +
+ + + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #attachmentObject (readonly) + + + + + +

+
+

Returns The trigger's attachment.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +

    The trigger's attachment

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+15
+
+
# File 'lib/openhab/dsl/events/watch_event.rb', line 15
+
+WatchEvent = Struct.new(:type, :path, :attachment)
+
+
+ + + +
+

+ + #pathPathname (readonly) + + + + + +

+
+

Returns The path that had an event.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Pathname) + + + + — +

    The path that had an event

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+15
+
+
# File 'lib/openhab/dsl/events/watch_event.rb', line 15
+
+WatchEvent = Struct.new(:type, :path, :attachment)
+
+
+ + + +
+

+ + #type:created, ... (readonly) + + + + + +

+
+

Returns Type of change.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (:created, :modified, :deleted) + + + + — +

    Type of change

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+15
+
+
# File 'lib/openhab/dsl/events/watch_event.rb', line 15
+
+WatchEvent = Struct.new(:type, :path, :attachment)
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Items.html b/5.33/OpenHAB/DSL/Items.html new file mode 100644 index 0000000000..abfd759885 --- /dev/null +++ b/5.33/OpenHAB/DSL/Items.html @@ -0,0 +1,3612 @@ + + + + + + + Module: OpenHAB::DSL::Items + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::DSL::Items + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/items/builder.rb,
+ lib/openhab/dsl/items/ensure.rb,
lib/openhab/dsl/items/timed_command.rb
+
+
+ +
+ +

Overview

+
+

Contains extensions to simplify working with Items.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: Builder, Ensure, TimedCommand + + + + Classes: GroupItemBuilder, ItemBuilder + + +

+ + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Items/Builder.html b/5.33/OpenHAB/DSL/Items/Builder.html new file mode 100644 index 0000000000..37fff5cca3 --- /dev/null +++ b/5.33/OpenHAB/DSL/Items/Builder.html @@ -0,0 +1,5791 @@ + + + + + + + Module: OpenHAB::DSL::Items::Builder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::DSL::Items::Builder + + + +

+
+ + + + + + +
+
Includes:
+
Core::EntityLookup, OpenHAB::DSL
+
+ + + + +
+
Included in:
+
GroupItemBuilder
+
+ + + +
+
Defined in:
+
lib/openhab/dsl/items/builder.rb
+
+ +
+ +

Overview

+
+

An item builder allows you to dynamically create openHAB items at runtime. +This can be useful either to create items as soon as the script loads, +or even later based on a rule executing.

+ + +
+
+
+ +
+

Examples:

+ + +
items.build do
+  switch_item MySwitch, "My Switch"
+  switch_item NotAutoupdating, autoupdate: false, channel: "mqtt:topic:1#light"
+  group_item MyGroup do
+    contact_item ItemInGroup, channel: "binding:thing#channel"
+  end
+  # passing `thing` to a group item will automatically use it as the base
+  # for item channels
+  group_item Equipment, tags: Semantics::HVAC, thing: "binding:thing"
+    string_item Mode, tags: Semantics::Control, channel: "mode"
+  end
+
+  # dimension Temperature inferred
+  number_item OutdoorTemp, format: "%.1f %unit%", unit: "°F"
+
+  # unit lx, dimension Illuminance, format "%s %unit%" inferred
+  number_item OutdoorBrightness, state: 10_000 | "lx"
+end
+ +
+ + +
+ + +

Constant Summary

+ +

Constants included + from OpenHAB::DSL

+

VERSION

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods included from OpenHAB::DSL

+

after, between, config_description, debounce_for, ensure_states, ensure_states!, holiday_file, holiday_file!, items, only_every, persistence, persistence!, profile, provider, provider!, rule, rule!, rules, scene, scene!, script, script!, shared_cache, sitemaps, store_states, things, throttle_for, timers, transform, unit, unit!

+ + + + + + + + + +

Methods included from Rules::Terse

+

#changed, #channel, #channel_linked, #channel_unlinked, #cron, #every, #item_added, #item_removed, #item_updated, #on_start, #received_command, #thing_added, #thing_removed, #thing_updated, #updated

+ + + + + + + + + +

Methods included from Core::ScriptHandling

+

script_loaded, script_unloaded

+ + + + + + + + + +

Methods included from Core::Actions

+

notify

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::DSL + +

+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #call_item(name, label = nil, **kwargs) {|builder| ... } ⇒ CallItem + + + + + +

+
+

Create a new call item

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String, Symbol, Core::Items::Proxy) + + + + — +

    The name for the new item. +Note that you can use a string, a symbol, or even a literal constant name

    +
    + +
  • + +
  • + + label + + + (String) + + + (defaults to: nil) + + + — +

    The item label

    +
    + +
  • + +
+ +

Yield Parameters:

+
    + +
  • + + builder + + + (ItemBuilder) + + + + — +

    Item for further customization

    +
    + +
  • + +
+

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+59
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 59
+
+def_item_method(:call)
+
+
+ +
+

+ + #color_item(name, label = nil, **kwargs) {|builder| ... } ⇒ ColorItem + + + + + +

+
+

Create a new color item

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String, Symbol, Core::Items::Proxy) + + + + — +

    The name for the new item. +Note that you can use a string, a symbol, or even a literal constant name

    +
    + +
  • + +
  • + + label + + + (String) + + + (defaults to: nil) + + + — +

    The item label

    +
    + +
  • + +
+ +

Yield Parameters:

+
    + +
  • + + builder + + + (ItemBuilder) + + + + — +

    Item for further customization

    +
    + +
  • + +
+

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+61
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 61
+
+def_item_method(:color)
+
+
+ +
+

+ + #contact_item(name, label = nil, **kwargs) {|builder| ... } ⇒ ContactItem + + + + + +

+
+

Create a new contact item

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String, Symbol, Core::Items::Proxy) + + + + — +

    The name for the new item. +Note that you can use a string, a symbol, or even a literal constant name

    +
    + +
  • + +
  • + + label + + + (String) + + + (defaults to: nil) + + + — +

    The item label

    +
    + +
  • + +
+ +

Yield Parameters:

+
    + +
  • + + builder + + + (ItemBuilder) + + + + — +

    Item for further customization

    +
    + +
  • + +
+

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+63
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 63
+
+def_item_method(:contact)
+
+
+ +
+

+ + #date_time_item(name, label = nil, **kwargs) {|builder| ... } ⇒ DateTimeItem + + + + + +

+
+

Create a new date_time item

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String, Symbol, Core::Items::Proxy) + + + + — +

    The name for the new item. +Note that you can use a string, a symbol, or even a literal constant name

    +
    + +
  • + +
  • + + label + + + (String) + + + (defaults to: nil) + + + — +

    The item label

    +
    + +
  • + +
+ +

Yield Parameters:

+
    + +
  • + + builder + + + (ItemBuilder) + + + + — +

    Item for further customization

    +
    + +
  • + +
+

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+65
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 65
+
+def_item_method(:date_time)
+
+
+ +
+

+ + #dimmer_item(name, label = nil, **kwargs) {|builder| ... } ⇒ DimmerItem + + + + + +

+
+

Create a new dimmer item

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String, Symbol, Core::Items::Proxy) + + + + — +

    The name for the new item. +Note that you can use a string, a symbol, or even a literal constant name

    +
    + +
  • + +
  • + + label + + + (String) + + + (defaults to: nil) + + + — +

    The item label

    +
    + +
  • + +
+ +

Yield Parameters:

+
    + +
  • + + builder + + + (ItemBuilder) + + + + — +

    Item for further customization

    +
    + +
  • + +
+

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+67
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 67
+
+def_item_method(:dimmer)
+
+
+ +
+

+ + #group_item(name, label = nil, **kwargs) {|builder| ... } ⇒ GroupItem + + + + + +

+
+

Create a new GroupItem

+ + +
+
+
+

Parameters:

+ + +

Yield Parameters:

+
    + +
  • + + builder + + + (GroupItemBuilder) + + + + — +

    Item for further customization

    +
    + +
  • + +
+

Returns:

+ + +
+ + + + +
+
+
+
+91
+92
+93
+94
+95
+96
+97
+98
+99
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 91
+
+def group_item(*args, **kwargs, &block)
+  item = GroupItemBuilder.new(*args, provider: provider, **kwargs)
+  item.instance_eval(&block) if block
+  result = provider.add(item)
+  item.members.each do |i|
+    provider.add(i)
+  end
+  result
+end
+
+
+ +
+

+ + #image_item(name, label = nil, **kwargs) {|builder| ... } ⇒ ImageItem + + + + + +

+
+

Create a new image item

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String, Symbol, Core::Items::Proxy) + + + + — +

    The name for the new item. +Note that you can use a string, a symbol, or even a literal constant name

    +
    + +
  • + +
  • + + label + + + (String) + + + (defaults to: nil) + + + — +

    The item label

    +
    + +
  • + +
+ +

Yield Parameters:

+
    + +
  • + + builder + + + (ItemBuilder) + + + + — +

    Item for further customization

    +
    + +
  • + +
+

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+69
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 69
+
+def_item_method(:image)
+
+
+ +
+

+ + #location_item(name, label = nil, **kwargs) {|builder| ... } ⇒ LocationItem + + + + + +

+
+

Create a new location item

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String, Symbol, Core::Items::Proxy) + + + + — +

    The name for the new item. +Note that you can use a string, a symbol, or even a literal constant name

    +
    + +
  • + +
  • + + label + + + (String) + + + (defaults to: nil) + + + — +

    The item label

    +
    + +
  • + +
+ +

Yield Parameters:

+
    + +
  • + + builder + + + (ItemBuilder) + + + + — +

    Item for further customization

    +
    + +
  • + +
+

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+71
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 71
+
+def_item_method(:location)
+
+
+ +
+

+ + #number_item(name, label = nil, **kwargs) {|builder| ... } ⇒ NumberItem + + + + + +

+
+

Create a new number item

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String, Symbol, Core::Items::Proxy) + + + + — +

    The name for the new item. +Note that you can use a string, a symbol, or even a literal constant name

    +
    + +
  • + +
  • + + label + + + (String) + + + (defaults to: nil) + + + — +

    The item label

    +
    + +
  • + +
+ +

Yield Parameters:

+
    + +
  • + + builder + + + (ItemBuilder) + + + + — +

    Item for further customization

    +
    + +
  • + +
+

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+73
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 73
+
+def_item_method(:number)
+
+
+ +
+

+ + #player_item(name, label = nil, **kwargs) {|builder| ... } ⇒ PlayerItem + + + + + +

+
+

Create a new player item

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String, Symbol, Core::Items::Proxy) + + + + — +

    The name for the new item. +Note that you can use a string, a symbol, or even a literal constant name

    +
    + +
  • + +
  • + + label + + + (String) + + + (defaults to: nil) + + + — +

    The item label

    +
    + +
  • + +
+ +

Yield Parameters:

+
    + +
  • + + builder + + + (ItemBuilder) + + + + — +

    Item for further customization

    +
    + +
  • + +
+

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+75
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 75
+
+def_item_method(:player)
+
+
+ +
+

+ + #rollershutter_item(name, label = nil, **kwargs) {|builder| ... } ⇒ RollershutterItem + + + + + +

+
+

Create a new rollershutter item

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String, Symbol, Core::Items::Proxy) + + + + — +

    The name for the new item. +Note that you can use a string, a symbol, or even a literal constant name

    +
    + +
  • + +
  • + + label + + + (String) + + + (defaults to: nil) + + + — +

    The item label

    +
    + +
  • + +
+ +

Yield Parameters:

+
    + +
  • + + builder + + + (ItemBuilder) + + + + — +

    Item for further customization

    +
    + +
  • + +
+

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+77
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 77
+
+def_item_method(:rollershutter)
+
+
+ +
+

+ + #string_item(name, label = nil, **kwargs) {|builder| ... } ⇒ StringItem + + + + + +

+
+

Create a new string item

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String, Symbol, Core::Items::Proxy) + + + + — +

    The name for the new item. +Note that you can use a string, a symbol, or even a literal constant name

    +
    + +
  • + +
  • + + label + + + (String) + + + (defaults to: nil) + + + — +

    The item label

    +
    + +
  • + +
+ +

Yield Parameters:

+
    + +
  • + + builder + + + (ItemBuilder) + + + + — +

    Item for further customization

    +
    + +
  • + +
+

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+79
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 79
+
+def_item_method(:string)
+
+
+ +
+

+ + #switch_item(name, label = nil, **kwargs) {|builder| ... } ⇒ SwitchItem + + + + + +

+
+

Create a new switch item

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String, Symbol, Core::Items::Proxy) + + + + — +

    The name for the new item. +Note that you can use a string, a symbol, or even a literal constant name

    +
    + +
  • + +
  • + + label + + + (String) + + + (defaults to: nil) + + + — +

    The item label

    +
    + +
  • + +
+ +

Yield Parameters:

+
    + +
  • + + builder + + + (ItemBuilder) + + + + — +

    Item for further customization

    +
    + +
  • + +
+

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+81
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 81
+
+def_item_method(:switch)
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Items/Ensure.html b/5.33/OpenHAB/DSL/Items/Ensure.html new file mode 100644 index 0000000000..4c17d1ed4e --- /dev/null +++ b/5.33/OpenHAB/DSL/Items/Ensure.html @@ -0,0 +1,3608 @@ + + + + + + + Module: OpenHAB::DSL::Items::Ensure + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::DSL::Items::Ensure + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/items/ensure.rb
+
+ +
+ +

Overview

+
+

Functionality to implement ensure/ensure_states

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: Ensurable, Item + + + + +

+ + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Items/Ensure/Ensurable.html b/5.33/OpenHAB/DSL/Items/Ensure/Ensurable.html new file mode 100644 index 0000000000..90e6b5c034 --- /dev/null +++ b/5.33/OpenHAB/DSL/Items/Ensure/Ensurable.html @@ -0,0 +1,3704 @@ + + + + + + + Module: OpenHAB::DSL::Items::Ensure::Ensurable + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::DSL::Items::Ensure::Ensurable + + + +

+
+ + + + + + + + + +
+
Included in:
+
Core::Items::GroupItem::Members, Item
+
+ + + +
+
Defined in:
+
lib/openhab/dsl/items/ensure.rb
+
+ +
+ +

Overview

+
+

Contains the ensure method mixed into Item and Core::Items::GroupItem::Members

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + +
    + +
  • + + + #ensure ⇒ Object + + + + + + + + + + + + + +

    Fluent method call that you can chain commands on to, that will then automatically ensure that the item is not in the command's state before sending the command.

    +
    + +
  • + + +
+ + + + + +
+

Instance Method Details

+ + +
+

+ + #ensureObject + + + + + +

+
+

Fluent method call that you can chain commands on to, that will +then automatically ensure that the item is not in the command's +state before sending the command.

+ + +
+
+
+ +
+

Examples:

+ + +

Turn switch on only if it's not on

+

+ +
MySwitch.ensure.on
+ + +

Turn on all switches in a group that aren't already on

+

+ +
MySwitchGroup.members.ensure.on
+ +
+ + +
+ + + + +
+
+
+
+20
+21
+22
+
+
# File 'lib/openhab/dsl/items/ensure.rb', line 20
+
+def ensure
+  ItemDelegate.new(self)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Items/Ensure/Item.html b/5.33/OpenHAB/DSL/Items/Ensure/Item.html new file mode 100644 index 0000000000..0500c8fbb3 --- /dev/null +++ b/5.33/OpenHAB/DSL/Items/Ensure/Item.html @@ -0,0 +1,3628 @@ + + + + + + + Module: OpenHAB::DSL::Items::Ensure::Item + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::DSL::Items::Ensure::Item + + + +

+
+ + + + + + +
+
Includes:
+
Ensurable
+
+ + + + +
+
Included in:
+
Core::Items::GenericItem
+
+ + + +
+
Defined in:
+
lib/openhab/dsl/items/ensure.rb
+
+ +
+ +

Overview

+
+

Extensions for Item to implement OpenHAB::DSL::Items::Ensure's functionality

+ + +
+
+
+ + +

See Also:

+ + +
+ + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from Ensurable

+

#ensure

+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Items/GroupItemBuilder.html b/5.33/OpenHAB/DSL/Items/GroupItemBuilder.html new file mode 100644 index 0000000000..f122b726ad --- /dev/null +++ b/5.33/OpenHAB/DSL/Items/GroupItemBuilder.html @@ -0,0 +1,4641 @@ + + + + + + + Class: OpenHAB::DSL::Items::GroupItemBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Items::GroupItemBuilder + + + +

+
+ +
+
Inherits:
+
+ ItemBuilder + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Builder
+
+ + + + + + +
+
Defined in:
+
lib/openhab/dsl/items/builder.rb
+
+ +
+ +

Overview

+
+

Allows customizing a group. You can also call any method from Builder, and those +items will automatically be a member of this group.

+ + +
+
+
+ + +
+ + +

Constant Summary

+ +

Constants included + from OpenHAB::DSL

+

VERSION

+ + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from ItemBuilder

+

#autoupdate, #channels, #command_options, #dimension, #format, #groups, #icon, #label, #metadata, #name, #range, #read_only, #state, #state_options, #step, #tags, #type

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods included from Builder

+

#call_item, #color_item, #contact_item, #date_time_item, #dimmer_item, #group_item, #image_item, #location_item, #number_item, #player_item, #rollershutter_item, #string_item, #switch_item

+ + + + + + + + + +

Methods included from OpenHAB::DSL

+

after, between, config_description, debounce_for, ensure_states, ensure_states!, holiday_file, holiday_file!, items, only_every, persistence, persistence!, profile, provider, provider!, rule, rule!, rules, scene, scene!, script, script!, shared_cache, sitemaps, store_states, things, throttle_for, timers, transform, unit, unit!

+ + + + + + + + + +

Methods included from Rules::Terse

+

#changed, #channel, #channel_linked, #channel_unlinked, #cron, #every, #item_added, #item_removed, #item_updated, #on_start, #received_command, #thing_added, #thing_removed, #thing_updated, #updated

+ + + + + + + + + +

Methods included from Core::ScriptHandling

+

script_loaded, script_unloaded

+ + + + + + + + + +

Methods included from Core::Actions

+

notify

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+ + + + + + + + + +

Methods inherited from ItemBuilder

+

#alexa, #channel, #expire, #ga, #group, #homekit, #inspect, #tag, #to_s

+
+

Constructor Details

+ +
+

+ + #initialize(*args, type: nil, function: nil, thing: nil, **kwargs) ⇒ GroupItemBuilder + + + + + +

+
+

Returns a new instance of GroupItemBuilder.

+ + +
+
+
+

Parameters:

+ + +

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +
+ + + + +
+
+
+
+732
+733
+734
+735
+736
+737
+738
+739
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 732
+
+def initialize(*args, type: nil, function: nil, thing: nil, **kwargs)
+  raise ArgumentError, "invalid function #{function}" if function && !function.match?(FUNCTION_REGEX)
+
+  super(type, *args, **kwargs)
+  @function = function
+  @members = []
+  @thing = thing
+end
+
+
+ +
+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::DSL + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #functionString? + + + + + +

+
+

The combiner function for this group

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+713
+714
+715
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 713
+
+def function
+  @function
+end
+
+
+ + + +
+

+ + #label_baseString? + + + + + +

+
+

A prefix to be added to the label of any member items

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+722
+723
+724
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 722
+
+def label_base
+  @label_base
+end
+
+
+ + + +
+

+ + #membersArray<ItemBuilder> (readonly) + + + + + +

+
+

Members to be created in this group

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+725
+726
+727
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 725
+
+def members
+  @members
+end
+
+
+ + + +
+

+ + #name_baseString? + + + + + +

+
+

A prefix to be added to the name of any member items

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+719
+720
+721
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 719
+
+def name_base
+  @name_base
+end
+
+
+ + + +
+

+ + #thingCore::Things::ThingUID, ... + + + + + +

+
+

A thing to be used as the base for the channel of any member items

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+716
+717
+718
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 716
+
+def thing
+  @thing
+end
+
+
+ + + +
+

+ + #unitString? (readonly) + + + + + +

+
+

Unit (for number items only)

+

Due to ItemBuilder#format inference, setting the unit is cross-compatible with +openHAB 3.4 and 4.0.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+694
+695
+696
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 694
+
+def unit
+  @unit
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Items/ItemBuilder.html b/5.33/OpenHAB/DSL/Items/ItemBuilder.html new file mode 100644 index 0000000000..c91ee3f999 --- /dev/null +++ b/5.33/OpenHAB/DSL/Items/ItemBuilder.html @@ -0,0 +1,6720 @@ + + + + + + + Class: OpenHAB::DSL::Items::ItemBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Items::ItemBuilder + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Core::EntityLookup
+
+ + + + + + +
+
Defined in:
+
lib/openhab/dsl/items/builder.rb
+
+ +
+ +

Overview

+
+

The ItemBuilder DSL allows you to customize an Item

+ + +
+
+
+ + +
+

Direct Known Subclasses

+

GroupItemBuilder

+
+ + + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Constructor Details

+ +
+

+ + #initialize(type, name = nil, label = nil, provider:, dimension: nil, unit: nil, format: nil, range: nil, step: nil, read_only: nil, command_options: nil, state_options: nil, icon: nil, group: nil, groups: nil, tag: nil, tags: nil, autoupdate: nil, thing: nil, channel: nil, expire: nil, alexa: nil, ga: nil, homekit: nil, metadata: nil, state: nil) ⇒ ItemBuilder + + + + + +

+
+

Returns a new instance of ItemBuilder.

+ + +
+
+
+

Parameters:

+
    + +
  • + + dimension + + + (Symbol, String, nil) + + + (defaults to: nil) + + + — +

    The unit dimension for a NumberItem (see #dimension) +Note the dimension must be properly capitalized.

    +
    + +
  • + +
  • + + unit + + + (Symbol, String, nil) + + + (defaults to: nil) + + + — +

    The unit for a NumberItem (see #unit)

    +
    + +
  • + +
  • + + format + + + (String, nil) + + + (defaults to: nil) + + + — +

    The formatting pattern for the item's state (see #format)

    +
    + +
  • + +
  • + + icon + + + (Symbol, String, nil) + + + (defaults to: nil) + + + — +

    The icon to be associated with the item (see #icon)

    +
    + +
  • + +
  • + + group + + + (String, GroupItem, GroupItemBuilder, Array<String, GroupItem, GroupItemBuilder>, nil) + + + (defaults to: nil) + + + — +

    Group(s) to which this item should be added (see #group).

    +
    + +
  • + +
  • + + groups + + + (String, GroupItem, GroupItemBuilder, Array<String, GroupItem, GroupItemBuilder>, nil) + + + (defaults to: nil) + + + — +

    Fluent alias for group.

    +
    + +
  • + +
  • + + tag + + + (String, Symbol, Semantics::Tag, Array<String, Symbol, Semantics::Tag>, nil) + + + (defaults to: nil) + + + — +

    Tag(s) to apply to this item (see #tag).

    +
    + +
  • + +
  • + + tags + + + (String, Symbol, Semantics::Tag, Array<String, Symbol, Semantics::Tag>, nil) + + + (defaults to: nil) + + + — +

    Fluent alias for tag.

    +
    + +
  • + +
  • + + autoupdate + + + (true, false, nil) + + + (defaults to: nil) + + + — +

    Autoupdate setting (see #autoupdate)

    +
    + +
  • + +
  • + + thing + + + (String, Core::Things::Thing, Core::Things::ThingUID, nil) + + + (defaults to: nil) + + + — +

    A Thing to be used as the base for the channel.

    +
    + +
  • + +
  • + + channel + + + (String, Symbol, Core::Things::ChannelUID, Core::Things::Channel, nil) + + + (defaults to: nil) + + + — +

    Channel to link the item to (see #channel).

    +
    + +
  • + +
  • + + expire + + + (String) + + + (defaults to: nil) + + + — +

    An expiration specification (see #expire).

    +
    + +
  • + +
  • + + alexa + + + (String, Symbol, Array<(String, Hash<String, Object>)>, nil) + + + (defaults to: nil) + + + — +

    Alexa metadata (see #alexa)

    +
    + +
  • + +
  • + + ga + + + (String, Symbol, Array<(String, Hash<String, Object>)>, nil) + + + (defaults to: nil) + + + — +

    Google Assistant metadata (see #ga)

    +
    + +
  • + +
  • + + homekit + + + (String, Symbol, Array<(String, Hash<String, Object>)>, nil) + + + (defaults to: nil) + + + — +

    Homekit metadata (see #homekit)

    +
    + +
  • + +
  • + + metadata + + + (Hash<String, Hash>) + + + (defaults to: nil) + + + — +

    Generic metadata (see #metadata)

    +
    + +
  • + +
  • + + state + + + (State) + + + (defaults to: nil) + + + — +

    Initial state

    +
    + +
  • + +
+ +

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +
+ + + + +
+
+
+
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 335
+
+def initialize(type,
+               name = nil,
+               label = nil,
+               provider:,
+               dimension: nil,
+               unit: nil,
+               format: nil,
+               range: nil,
+               step: nil,
+               read_only: nil,
+               command_options: nil,
+               state_options: nil,
+               icon: nil,
+               group: nil,
+               groups: nil,
+               tag: nil,
+               tags: nil,
+               autoupdate: nil,
+               thing: nil,
+               channel: nil,
+               expire: nil,
+               alexa: nil,
+               ga: nil, # rubocop:disable Naming/MethodParameterName
+               homekit: nil,
+               metadata: nil,
+               state: nil)
+  raise ArgumentError, "`name` cannot be nil" if name.nil?
+
+  if dimension
+    raise ArgumentError, "`dimension` can only be specified with NumberItem" unless type == :number
+
+    begin
+      org.openhab.core.types.util.UnitUtils.parse_dimension(dimension.to_s)
+    rescue java.lang.IllegalArgumentException
+      raise ArgumentError, "Invalid dimension '#{dimension}'"
+    end
+  end
+
+  name = name.name if name.respond_to?(:name)
+  if provider.is_a?(GroupItemBuilder)
+    name = "#{provider.name_base}#{name}"
+    label = "#{provider.label_base}#{label}".strip if label
+  end
+  @provider = provider
+  @type = type
+  @name = name.to_s
+  @label = label
+  @dimension = dimension
+  @format = format
+  @range = range
+  @step = step
+  @read_only = read_only
+  @command_options = command_options
+  @state_options = state_options
+  self.unit = unit
+  @icon = icon
+  @groups = []
+  @tags = []
+  @metadata = Core::Items::Metadata::NamespaceHash.new
+  @metadata.merge!(metadata) if metadata
+  @autoupdate = autoupdate
+  @channels = []
+  @thing = thing
+  @expire = nil
+  if expire
+    expire = Array(expire)
+    expire_config = expire.pop if expire.last.is_a?(Hash)
+    expire_config ||= {}
+    self.expire(*expire, **expire_config)
+  end
+  self.alexa(alexa) if alexa
+  self.ga(ga) if ga
+  self.homekit(homekit) if homekit
+  self.state = state
+
+  self.group(*group)
+  self.group(*groups)
+
+  self.tag(*tag)
+  self.tag(*tags)
+
+  self.channel(*channel) if channel
+end
+
+
+ +
+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #autoupdatetrue, ... + + + + + +

+
+

Autoupdate setting

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+254
+255
+256
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 254
+
+def autoupdate
+  @autoupdate
+end
+
+
+ + + +
+

+ + #channelsString, ... + + + + + +

+
+

Channel to link the item to

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+257
+258
+259
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 257
+
+def channels
+  @channels
+end
+
+
+ + + +
+

+ + #command_optionsHash, ... + + + + + +

+
+

A list of valid commands +If a hash, keys are commands, and values are labels

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash, Array, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+238
+239
+240
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 238
+
+def command_options
+  @command_options
+end
+
+
+ + + +
+

+ + #dimensionString? + + + + + +

+
+

Unit dimension (for number items only)

+

If #unit is provided, and #dimension is not, it will be inferred.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+211
+212
+213
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 211
+
+def dimension
+  @dimension
+end
+
+
+ + + +
+

+ + #formatString? + + + + + +

+
+

The formatting pattern for the item's state

+

If #unit is provided, and #format is not, it will be inferred.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+224
+225
+226
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 224
+
+def format
+  @format
+end
+
+
+ + + +
+

+ + #groupsArray<String, GroupItem> (readonly) + + + + + +

+
+

Groups to which this item should be added

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+248
+249
+250
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 248
+
+def groups
+  @groups
+end
+
+
+ + + +
+

+ + #iconSymbol, ... + + + + + +

+
+

The icon to be associated with the item

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol, String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+245
+246
+247
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 245
+
+def icon
+  @icon
+end
+
+
+ + + +
+

+ + #labelString? + + + + + +

+
+

Item label

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+205
+206
+207
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 205
+
+def label
+  @label
+end
+
+
+ + + +
+

+ + #metadataCore::Items::Metadata::NamespaceHash (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+259
+260
+261
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 259
+
+def metadata
+  @metadata
+end
+
+
+ + + +
+

+ + #nameString + + + + + +

+
+

Item name

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+202
+203
+204
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 202
+
+def name
+  @name
+end
+
+
+ + + +
+

+ + #rangeRange? + + + + + +

+
+

The valid range for a number item

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Range, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+227
+228
+229
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 227
+
+def range
+  @range
+end
+
+
+ + + +
+

+ + #read_onlytrue, ... + + + + Also known as: + read_only? + + + + +

+
+

If the item is read-only, and does not accept commands

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+233
+234
+235
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 233
+
+def read_only
+  @read_only
+end
+
+
+ + + +
+

+ + #stateCore::Types::State + + + + + +

+
+

Initial state

+

If #state is set to a QuantityType, and #unit is not set, it will be inferred.

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+265
+266
+267
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 265
+
+def state
+  @state
+end
+
+
+ + + +
+

+ + #state_optionsHash, ... + + + + + +

+
+

A list of valid states +If a hash, keys are commands, and values are labels

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash, Array, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+242
+243
+244
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 242
+
+def state_options
+  @state_options
+end
+
+
+ + + +
+

+ + #stepNumber? + + + + + +

+
+

The step size for a number item

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Number, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+230
+231
+232
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 230
+
+def step
+  @step
+end
+
+
+ + + +
+

+ + #tagsArray<String, Semantics::Tag> (readonly) + + + + + +

+
+

Tags to apply to this item

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+251
+252
+253
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 251
+
+def tags
+  @tags
+end
+
+
+ + + +
+

+ + #typeSymbol (readonly) + + + + + +

+
+

The type of this item

+ + +
+
+
+ +
+

Examples:

+ + +
type #=> :switch
+ +
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + +
  • + +
+ +
+ + + + +
+
+
+
+199
+200
+201
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 199
+
+def type
+  @type
+end
+
+
+ + + +
+

+ + #unitString? + + + + + +

+
+

Unit (for number items only)

+

Due to #format inference, setting the unit is cross-compatible with +openHAB 3.4 and 4.0.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+218
+219
+220
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 218
+
+def unit
+  @unit
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #alexa(value, config = nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Shortcut for adding Alexa metadata

+ + +
+
+
+

Parameters:

+
    + +
  • + + value + + + (String, Symbol) + + + + — +

    Type of Alexa endpoint

    +
    + +
  • + +
  • + + config + + + (Hash, nil) + + + (defaults to: nil) + + + — +

    Additional Alexa configuration

    +
    + +
  • + +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 454
+
+
+
+
+ +
+

+ + #channel(channel, config = {}) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Add a channel link to this item.

+ + +
+
+
+ +
+

Examples:

+ + +
items.build do
+  date_time_item Bedroom_Light_Updated do
+    channel "hue:0210:1:bulb1:color", profile: "system:timestamp-update"
+  end
+end
+ + +

Relative channel name

+

+ +
items.build do
+  switch_item Bedroom_Light, thing: "mqtt:topic:bedroom-light", channel: :power
+end
+ +
+

Parameters:

+
    + +
  • + + channel + + + (String, Symbol, Core::Things::ChannelUID, Core::Things::Channel) + + + + — +

    Channel to link the item to. When thing is set, this can be a relative channel name.

    +
    + +
  • + +
  • + + config + + + (Hash) + + + (defaults to: {}) + + + — +

    Additional configuration, such as profile

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+514
+515
+516
+517
+518
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 514
+
+def channel(channel, config = {})
+  channel = channel.to_s
+  channel = "#{@thing}:#{channel}" if @thing && !channel.include?(":")
+  @channels << [channel, config]
+end
+
+
+ +
+

+ + #expire(duration, command: nil, state: nil, ignore_state_updates: nil, ignore_commands: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Configure item expiration

+ + +
+
+
+ +
+

Examples:

+ + +

Get the current expire setting

+

+ +
expire
+ + +

Clear any expire setting

+

+ +
expire nil
+ + +

Use a duration

+

+ +
expire 5.hours
+ + +

Use a string duration

+

+ +
expire "5h"
+ + +

Set a specific state on expiration

+

+ +
expire 5.minutes, NULL
+expire 5.minutes, state: NULL
+ + +

Send a command on expiration

+

+ +
expire 5.minutes, command: OFF
+ + +

Specify the duration and command in the same string

+

+ +
expire "5h,command=OFF"
+ + +

Set the expire configuration

+

+ +
expire 5.minutes, ignore_state_updates: true
+ +
+

Parameters:

+
    + +
  • + + duration + + + (String, Duration, nil) + + + + — +

    Duration after which the command or state should be applied

    +
    + +
  • + +
  • + + command + + + (String, nil) + + + (defaults to: nil) + + + — +

    Command to send on expiration

    +
    + +
  • + +
  • + + state + + + (String, nil) + + + (defaults to: nil) + + + — +

    State to set on expiration

    +
    + +
  • + +
  • + + ignore_state_updates + + + (true, false) + + + (defaults to: nil) + + + — +

    When true, state updates will not reset the expire timer

    +
    + +
  • + +
  • + + ignore_commands + + + (true, false) + + + (defaults to: nil) + + + — +

    When true, commands will not reset the expire timer

    +
    + +
  • + +
+ +

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +
+ + + + +
+
+
+
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 550
+
+def expire(*args, command: nil, state: nil, ignore_state_updates: nil, ignore_commands: nil)
+  unless (0..2).cover?(args.length)
+    raise ArgumentError,
+          "wrong number of arguments (given #{args.length}, expected 0..2)"
+  end
+  return @expire if args.empty?
+
+  state = args.last if args.length == 2
+  raise ArgumentError, "cannot provide both command and state" if command && state
+
+  duration = args.first
+  return @expire = nil if duration.nil?
+
+  duration = duration.to_s[2..].downcase if duration.is_a?(Duration)
+  state = "'#{state}'" if state.respond_to?(:to_str) && type == :string
+
+  value = duration
+  value += ",state=#{state}" if state
+  value += ",command=#{command}" if command
+
+  config = { ignoreStateUpdates: ignore_state_updates, ignoreCommands: ignore_commands }
+  config.compact!
+  @expire = [value, config]
+end
+
+
+ +
+

+ + #ga(value, config = nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Shortcut for adding Google Assistant metadata

+ + +
+
+
+

Parameters:

+
    + +
  • + + value + + + (String, Symbol) + + + + — +

    Type of Google Assistant endpoint

    +
    + +
  • + +
  • + + config + + + (Hash, nil) + + + (defaults to: nil) + + + — +

    Additional Google Assistant configuration

    +
    + +
  • + +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 465
+
+
+
+
+ +
+

+ + #group(*groups) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Add this item to a group

+ + +
+
+
+

Parameters:

+ + + +
+ + + + +
+
+
+
+444
+445
+446
+447
+448
+449
+450
+451
+452
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 444
+
+def group(*groups)
+  unless groups.all? do |group|
+           group.is_a?(String) || group.is_a?(Core::Items::GroupItem) || group.is_a?(GroupItemBuilder)
+         end
+    raise ArgumentError, "`group` must be a `GroupItem`, `GroupItemBuilder`, or a `String`"
+  end
+
+  @groups.concat(groups)
+end
+
+
+ +
+

+ + #homekit(value, config = nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Shortcut for adding Homekit metadata

+ + +
+
+
+

Parameters:

+
    + +
  • + + value + + + (String, Symbol) + + + + — +

    Type of Homekit accessory or characteristic

    +
    + +
  • + +
  • + + config + + + (Hash, nil) + + + (defaults to: nil) + + + — +

    Additional Homekit configuration

    +
    + +
  • + +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+487
+488
+489
+490
+491
+492
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 487
+
+%i[alexa ga homekit].each do |shortcut|
+  define_method(shortcut) do |value = nil, config = nil|
+    value, config = value if value.is_a?(Array)
+    metadata[shortcut] = [value, config]
+  end
+end
+
+
+ +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+657
+658
+659
+660
+661
+662
+663
+664
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 657
+
+def inspect
+  s = "#<OpenHAB::Core::Items::#{inspect_type}ItemBuilder#{type_details} #{name} #{label.inspect}"
+  s += " category=#{icon.inspect}" if icon
+  s += " tags=#{tags.inspect}" unless tags.empty?
+  s += " groups=#{groups.map { |g| g.respond_to?(:name) ? g.name : g }.inspect}" unless groups.empty?
+  s += " metadata=#{metadata.to_h.inspect}" unless metadata.empty?
+  "#{s}>"
+end
+
+
+ +
+

+ + #tag(*tags) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Tag item

+ + +
+
+
+

Parameters:

+ + + +
+ + + + +
+
+
+
+434
+435
+436
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 434
+
+def tag(*tags)
+  @tags += self.class.normalize_tags(*tags)
+end
+
+
+ +
+

+ + #to_sString + + + + + +

+
+

The item's label if one is defined, otherwise its name.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+424
+425
+426
+
+
# File 'lib/openhab/dsl/items/builder.rb', line 424
+
+def to_s
+  label || name
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Items/TimedCommand.html b/5.33/OpenHAB/DSL/Items/TimedCommand.html new file mode 100644 index 0000000000..833481d293 --- /dev/null +++ b/5.33/OpenHAB/DSL/Items/TimedCommand.html @@ -0,0 +1,3992 @@ + + + + + + + Module: OpenHAB::DSL::Items::TimedCommand + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::DSL::Items::TimedCommand + + + +

+
+ + + + + + + + + +
+
Included in:
+
Core::Items::GenericItem, Core::Items::GroupItem
+
+ + + +
+
Defined in:
+
lib/openhab/dsl/items/timed_command.rb
+
+ +
+ +

Overview

+
+

Extensions for Item to implement timed commands

+

All items have an implicit timer associated with them, enabling to +easily set an item into a specific state for a specified duration and +then at the expiration of that duration have the item automatically +change to another state. These timed commands are reentrant, meaning +if the same timed command is triggered while an outstanding timed +command exist, that timed command will be rescheduled rather than +creating a distinct timed command.

+

Timed commands are initiated by using the 'for:' argument with the +command. This is available on both the 'command' method and any +command-specific methods, e.g. Core::Items::SwitchItem#on.

+

The timer will be cancelled, and the item's state will not be changed +to the on_expire state if:

+
    +
  • The item receives any command within the timed command duration.
  • +
  • The item is updated to a different state, even if it is then updated +back to the same state.
  • +
+

For example, if you have a Switch on a timer and another rule sends +a command to that item, even when it's commanded to the same state, +the timer will be automatically canceled.

+

Sending a different duration (for:) value for the timed +command will reschedule the timed command for that new duration.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + + + Classes: TimedCommandDetails + + +

+ + + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #command(command, for: nil, on_expire: nil, only_when_ensured: false, **kwargs) {|timed_command| ... } ⇒ self + + + + + +

+
+ +
+ Note: +

If a block is provided, and the timer is canceled because the +item changed state while it was waiting, the block will still be +executed. The timed command can be reinstated by calling #resume or +#reschedule.

+

If the timer expired, the timed command can be rescheduled from inside the block by calling +#reschedule.

+

Be sure to check #expired? +and/or #cancelled? to determine why +the block was called.

+
+
+ +

Sends command to an item for specified duration, then on timer expiration sends +the expiration command to the item

+ + +
+
+
+ +
+

Examples:

+ + +
Switch.command(ON, for: 5.minutes)
+ + +
Switch.on for: 5.minutes
+ + +
Dimmer.on for: 5.minutes, on_expire: 50
+ + +
Dimmer.on(for: 5.minutes) { |event| Dimmer.off if Light.on? }
+ + +

Only start a timed command if the command was ensured

+

+ +
rule "Motion Detected" do
+  received_command Motion_Sensor, command: ON
+  run do
+    # Start the timer only if the command was ensured
+    # i.e. the light was off before the command was sent
+    # but if the timer was already started, extend it
+    FrontPorchLight.ensure.on for: 30.minutes, only_when_ensured: true
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + command + + + (Command) + + + + — +

    to send to object

    +
    + +
  • + +
  • + + for + + + (Duration) + + + (defaults to: nil) + + + — +

    duration for item to be in command state

    +
    + +
  • + +
  • + + on_expire + + + (Command) + + + (defaults to: nil) + + + — +

    Command to send when duration expires

    +
    + +
  • + +
  • + + only_when_ensured + + + (true, false) + + + (defaults to: false) + + + — +

    if true, only start the timed command if the command was ensured

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    If a block is provided, on_expire is ignored and the block +is expected to set the item to the desired state or carry out some +other action.

    +
    + +
  • + +
+

Yield Parameters:

+ +

Returns:

+
    + +
  • + + + (self) + + + +
  • + +
+ +
+ + + + +
+
+
+
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+
+
# File 'lib/openhab/dsl/items/timed_command.rb', line 152
+
+def command(command, for: nil, on_expire: nil, only_when_ensured: false, **kwargs, &block)
+  duration = binding.local_variable_get(:for)
+  return super(command, **kwargs) unless duration
+
+  on_expire = block if block
+
+  create_ensured_timed_command = proc do
+    on_expire ||= default_on_expire(command)
+    if only_when_ensured
+      DSL.ensure_states do
+        create_timed_command(command, duration: duration, on_expire: on_expire) if super(command, **kwargs)
+      end
+    else
+      super(command, **kwargs)
+      create_timed_command(command, duration: duration, on_expire: on_expire)
+    end
+  end
+
+  TimedCommand.timed_commands.compute(self) do |_key, timed_command_details|
+    if timed_command_details.nil?
+      # no prior timed command
+      create_ensured_timed_command.call
+    else
+      timed_command_details.mutex.synchronize do
+        if timed_command_details.resolution
+          # timed command that finished, but hadn't removed itself from the map yet
+          # (it doesn't do so under the mutex to prevent a deadlock).
+          # just create a new one
+          create_ensured_timed_command.call
+        else
+          # timed command still pending; reset it
+          logger.trace { "Outstanding Timed Command #{timed_command_details} encountered - rescheduling" }
+          timed_command_details.on_expire = on_expire unless on_expire.nil?
+          timed_command_details.timer.reschedule(duration)
+          # disable the cancel rule while we send the new command
+          DSL.rules[timed_command_details.rule_uid].disable
+          super(command, **kwargs) # This returns nil when "ensured"
+          DSL.rules[timed_command_details.rule_uid].enable
+          timed_command_details
+        end
+      end
+    end
+  end
+
+  self
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Items/TimedCommand/TimedCommandDetails.html b/5.33/OpenHAB/DSL/Items/TimedCommand/TimedCommandDetails.html new file mode 100644 index 0000000000..deda3c05a9 --- /dev/null +++ b/5.33/OpenHAB/DSL/Items/TimedCommand/TimedCommandDetails.html @@ -0,0 +1,3944 @@ + + + + + + + Class: OpenHAB::DSL::Items::TimedCommand::TimedCommandDetails + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Items::TimedCommand::TimedCommandDetails + + + +

+
+ +
+
Inherits:
+
+ Struct + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/items/timed_command.rb
+
+ +
+ +

Overview

+
+

Provides information about why the expiration block of a +timed command is being called.

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #cancelled?true, false + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+64
+65
+66
+
+
# File 'lib/openhab/dsl/items/timed_command.rb', line 64
+
+def cancelled?
+  resolution == :cancelled
+end
+
+
+ +
+

+ + #expired?true, false + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+59
+60
+61
+
+
# File 'lib/openhab/dsl/items/timed_command.rb', line 59
+
+def expired?
+  resolution == :expired
+end
+
+
+ +
+

+ + #reschedule(time = nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Reschedule the timed command.

+

If the timed command was cancelled, this will also resume it.

+ + +
+
+
+

Parameters:

+
    + +
  • + + time + + + (java.time.temporal.TemporalAmount, #to_zoned_date_time, Proc, nil) + + + (defaults to: nil) + + + — +

    When to reschedule the timer for. If unspecified, the original time is used.

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+77
+78
+79
+80
+
+
# File 'lib/openhab/dsl/items/timed_command.rb', line 77
+
+def reschedule(time = nil)
+  self.resolution = nil
+  timer.reschedule(time)
+end
+
+
+ +
+

+ + #resumevoid + + + + + +

+
+

This method returns an undefined value.

Resume a cancelled timed command to its original expiration time.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+87
+88
+89
+90
+91
+92
+93
+
+
# File 'lib/openhab/dsl/items/timed_command.rb', line 87
+
+def resume
+  if expired?
+    logger.warn "Cannot resume a timed command that has expired. Use reschedule instead."
+  else
+    self.resolution = nil
+  end
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Rules.html b/5.33/OpenHAB/DSL/Rules.html new file mode 100644 index 0000000000..698c00a1a0 --- /dev/null +++ b/5.33/OpenHAB/DSL/Rules.html @@ -0,0 +1,3612 @@ + + + + + + + Module: OpenHAB::DSL::Rules + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::DSL::Rules + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/rules/builder.rb,
+ lib/openhab/dsl/rules.rb,
lib/openhab/dsl/rules/guard.rb,
lib/openhab/dsl/rules/terse.rb,
lib/openhab/dsl/rules/property.rb,
lib/openhab/dsl/rules/triggers.rb,
lib/openhab/dsl/rules/rule_triggers.rb,
lib/openhab/dsl/rules/name_inference.rb,
lib/openhab/dsl/rules/automation_rule.rb,
lib/openhab/dsl/rules/triggers/changed.rb,
lib/openhab/dsl/rules/triggers/channel.rb,
lib/openhab/dsl/rules/triggers/command.rb,
lib/openhab/dsl/rules/triggers/trigger.rb,
lib/openhab/dsl/rules/triggers/updated.rb,
lib/openhab/dsl/rules/triggers/cron/cron.rb,
lib/openhab/dsl/rules/triggers/conditions.rb,
lib/openhab/dsl/rules/triggers/cron/cron_handler.rb,
lib/openhab/dsl/rules/triggers/conditions/generic.rb,
lib/openhab/dsl/rules/triggers/conditions/duration.rb,
lib/openhab/dsl/rules/triggers/watch/watch_handler.rb
+
+
+ +
+ +

Overview

+
+

Creates and manages openHAB Rules

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: Terse + + + + Classes: Builder, BuilderDSL + + +

+ + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Rules/Builder.html b/5.33/OpenHAB/DSL/Rules/Builder.html new file mode 100644 index 0000000000..fd740a09d4 --- /dev/null +++ b/5.33/OpenHAB/DSL/Rules/Builder.html @@ -0,0 +1,4656 @@ + + + + + + + Class: OpenHAB::DSL::Rules::Builder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Rules::Builder + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Core::EntityLookup, Terse
+
+ + + + + + +
+
Defined in:
+
lib/openhab/dsl/rules/builder.rb
+
+ +
+ +

Overview

+
+

A rules builder allows you to create openHAB rules.

+

Note that all methods on this module are also availabe directly on OpenHAB::DSL.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+ + + + + + + + + +

Methods included from Terse

+

#changed, #channel, #channel_linked, #channel_unlinked, #cron, #every, #item_added, #item_removed, #item_updated, #on_start, #received_command, #thing_added, #thing_removed, #thing_updated, #updated

+
+

Constructor Details

+ +
+

+ + #initialize(provider) ⇒ Builder + + + + + +

+
+

Returns a new instance of Builder.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+33
+34
+35
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 33
+
+def initialize(provider)
+  @provider = Core::Rules::Provider.current(provider)
+end
+
+
+ +
+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #providerorg.openhab.core.automation.RuleProvider (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+31
+32
+33
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 31
+
+def provider
+  @provider
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #rule(name = nil, id: nil, replace: nil, script: nil, binding: nil) {|rule| ... } ⇒ Core::Rules::Rule? + + + + + +

+
+

Create a new rule

+

The rule must have at least one trigger and one execution block. +To create a "script" without any triggers, use script.

+

When explicit id is not provided, the rule's ID will be inferred from the block's source location, +and a suffix will be added to avoid clashing against existing rules.

+

When an explicit id is provided and an existing rule with the same id already exists, +the rule will not be created, and the method will return nil.

+

To ensure that a rule is created even when the same id already exists, use OpenHAB::DSL.rule! or call +rules.remove to remove any existing rule prior to creating the new rule.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "name" do
+  <one or more triggers>
+  <one or more execution blocks>
+  <zero or more guards>
+end
+ + +

Create a rule with an explicit id, deleting any existing rule with the same id

+

+ +
rule! "name", id: "my_happy_day_reminder" do
+  every :day
+  run { logger.info "Happy new day!" }
+end
+ +
+

Parameters:

+
    + +
  • + + name + + + (String) + + + (defaults to: nil) + + + — +

    The rule name

    +
    + +
  • + +
  • + + id + + + (String) + + + (defaults to: nil) + + + — +

    The rule's ID. This can also be defined in the block using uid.

    +
    + +
  • + +
+ +

Yields:

+ +

Yield Parameters:

+
    + +
  • + + rule + + + (Rules::BuilderDSL) + + + + — +

    Optional parameter to access the rule configuration from within execution blocks and guards.

    +
    + +
  • + +
+

Returns:

+
    + +
  • + + + (Core::Rules::Rule, nil) + + + + — +

    The rule object, or nil if no rule was created.

    +
    + +
  • + +
+

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 76
+
+def rule(name = nil, id: nil, replace: nil, script: nil, binding: nil, &block)
+  raise ArgumentError, "Block is required" unless block
+
+  inferred_id = nil
+  id ||= inferred_id = NameInference.infer_rule_id_from_block(block)
+  script ||= block.source rescue nil # rubocop:disable Style/RescueModifier
+
+  builder = nil
+
+  ThreadLocal.thread_local(openhab_rule_type: "rule", openhab_rule_uid: id) do
+    builder = BuilderDSL.new(binding || block.binding)
+    builder.uid(id)
+    builder.instance_exec(builder, &block)
+
+    if replace
+      logger.debug { "Removing existing rule '#{builder.uid}'." } if DSL.rules.remove(builder.uid)
+    elsif replace.nil?
+      id_not_inferred = inferred_id.nil? || inferred_id != builder.uid
+      if id_not_inferred && (existing_rule = $rules.get(builder.uid))
+        logger.warn "Rule '#{builder.uid}' is not created because " \
+                    "another rule/script/scene with the same id already exists: #{existing_rule.inspect}."
+        return nil
+      end
+    end
+
+    builder.guard = Guard.new(run_context: builder.caller,
+                              only_if: builder.only_if,
+                              not_if: builder.not_if)
+
+    name ||= NameInference.infer_rule_name(builder)
+    name ||= id
+
+    builder.name(name)
+    logger.trace { builder.inspect }
+    builder.build(provider, script)
+  end
+end
+
+
+ +
+

+ + #scene(name = nil, description: nil, id: nil, tag: nil, tags: nil, replace: false, script: nil) { ... } ⇒ Core::Rules::Rule? + + + + + +

+
+

Create a new scene

+

A scene is a rule with no triggers. It can be called by various other actions, +such as the Run Rules action.

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String) + + + (defaults to: nil) + + + — +

    A name for the scene

    +
    + +
  • + +
  • + + description + + + (String) + + + (defaults to: nil) + + + — +

    A description of the scene

    +
    + +
  • + +
  • + + id + + + (String) + + + (defaults to: nil) + + + — +

    The script's ID

    +
    + +
  • + +
  • + + tag + + + (String, Symbol, Semantics::Tag, Array<String, Symbol, Semantics::Tag>, nil) + + + (defaults to: nil) + + + — +

    Tags to assign to the script

    +
    + +
  • + +
  • + + tags + + + (String, Symbol, Semantics::Tag, Array<String, Symbol, Semantics::Tag>, nil) + + + (defaults to: nil) + + + — +

    Fluent alias for tag

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    [] Block executed when the script is executed.

    +
    + +
  • + +
+

Returns:

+ +

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +

See Also:

+
    + +
  • DSL.rule
  • + +
  • DSL.scene!
  • + +
+ +
+ + + + +
+
+
+
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 206
+
+def scene(name = nil, description: nil, id: nil, tag: nil, tags: nil, replace: false, script: nil, &block)
+  raise ArgumentError, "Block is required" unless block
+
+  inferred_id = nil # rubocop:disable Lint/UselessAssignment
+  id ||= inferred_id = NameInference.infer_rule_id_from_block(block)
+  name ||= id
+  script ||= block.source rescue nil # rubocop:disable Style/RescueModifier
+
+  if replace
+    logger.debug { "Removing existing rule '#{id}'." } if DSL.rules.remove(id)
+  elsif inferred_id.nil? && (existing_rule = $rules.get(id))
+    logger.warn "Scene '#{id}' is not created because " \
+                "another script/scene/rule with the same id already exists: #{existing_rule.inspect}."
+    return nil
+  end
+
+  builder = nil
+  ThreadLocal.thread_local(openhab_rule_type: "script", openhab_rule_uid: id) do
+    builder = BuilderDSL.new(block.binding)
+    builder.uid(id)
+    builder.tags("Scene", *Array.wrap(tag), *Array.wrap(tags))
+    builder.name(name)
+    builder.description(description)
+    builder.script(&block)
+    logger.trace { builder.inspect }
+    builder.build(provider, script)
+  end
+end
+
+
+ +
+

+ + #script(name = nil, description: nil, id: nil, tag: nil, tags: nil, replace: false, script: nil) { ... } ⇒ Core::Rules::Rule? + + + + + +

+
+

Create a new script

+

A script is a rule with no triggers. It can be called by various other actions, +such as the Run Rules action, or by calling Core::Rules::Rule#trigger.

+

Scripts can be executed with some additional context, similar to method parameters +(see Core::Rules::Rule#trigger). +The context can be accessed from within the script's execution block as a "local" variable.

+ + +
+
+
+ +
+

Examples:

+ + +

A simple script

+

+ +
# return the script object into a variable
+door_check = script "Check all doors", id: "door_check", tags: :security do
+  open_doors = gDoors.members.select(&:open?).map(&:label).join(", ")
+  Notification.send("The following doors are open: #{open_doors}") unless open_doors.empty?
+end
+
+# run is an alias of trigger
+door_check.run
+ + +

A script with context

+

+ +
# This script expects to be called with `message` as context/parameter
+DESTINATION_EMAIL = "myemail@example.com"
+script "Send Notifications", id: "send_alert" do
+  Notification.send(message)
+  things["mail:smtp:local"].send_mail(DESTINATION_EMAIL, "OpenHAB Alert", message)
+end
+
+rules.scripts["send_alert"].run(message: "The door is open!")
+ +
+

Parameters:

+
    + +
  • + + name + + + (String) + + + (defaults to: nil) + + + — +

    A name for the script

    +
    + +
  • + +
  • + + description + + + (String) + + + (defaults to: nil) + + + — +

    A description of the script

    +
    + +
  • + +
  • + + id + + + (String) + + + (defaults to: nil) + + + — +

    The script's ID

    +
    + +
  • + +
  • + + tag + + + (String, Symbol, Semantics::Tag, Array<String, Symbol, Semantics::Tag>, nil) + + + (defaults to: nil) + + + — +

    Tags to assign to the script

    +
    + +
  • + +
  • + + tags + + + (String, Symbol, Semantics::Tag, Array<String, Symbol, Semantics::Tag>, nil) + + + (defaults to: nil) + + + — +

    Fluent alias for tag

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    [] Block executed when the script is executed.

    +
    + +
  • + +
+

Returns:

+ +

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 158
+
+def script(name = nil, description: nil, id: nil, tag: nil, tags: nil, replace: false, script: nil, &block)
+  raise ArgumentError, "Block is required" unless block
+
+  inferred_id = nil # rubocop:disable Lint/UselessAssignment it is used below
+  id ||= inferred_id = NameInference.infer_rule_id_from_block(block)
+  name ||= id
+  script ||= block.source rescue nil # rubocop:disable Style/RescueModifier
+
+  if replace
+    logger.debug { "Removing existing rule '#{id}'." } if DSL.rules.remove(id)
+  elsif inferred_id.nil? && (existing_rule = $rules.get(id))
+    logger.warn "Script '#{id}' is not created because " \
+                "another script/scene/rule with the same id already exists: #{existing_rule.inspect}."
+    return nil
+  end
+
+  builder = nil
+  ThreadLocal.thread_local(openhab_rule_type: "script", openhab_rule_uid: id) do
+    builder = BuilderDSL.new(block.binding)
+    builder.uid(id)
+    builder.tags("Script", *Array.wrap(tag), *Array.wrap(tags))
+    builder.name(name)
+    builder.description(description)
+    builder.script(&block)
+    logger.trace { builder.inspect }
+    builder.build(provider, script)
+  end
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Rules/BuilderDSL.html b/5.33/OpenHAB/DSL/Rules/BuilderDSL.html new file mode 100644 index 0000000000..705fcb8b34 --- /dev/null +++ b/5.33/OpenHAB/DSL/Rules/BuilderDSL.html @@ -0,0 +1,9835 @@ + + + + + + + Class: OpenHAB::DSL::Rules::BuilderDSL + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Rules::BuilderDSL + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Core::EntityLookup, OpenHAB::DSL
+
+ + + + + + +
+
Defined in:
+
lib/openhab/dsl/rules/builder.rb
+
+ +
+ +

Overview

+
+

Rule configuration for openHAB Rules engine

+ + +
+
+
+ + +
+ + +

Constant Summary

+ +

Constants included + from OpenHAB::DSL

+

VERSION

+ + + + + + +

+ Execution Blocks + collapse +

+ + + + + +

+ Configuration + collapse +

+ + + + + +

+ Guards + collapse +

+ +
+
+

Guards exist to only permit rules to run if certain conditions are +satisfied. Think of these as declarative if statements that keep +the run block free of conditional logic, although you can of course +still use conditional logic in run blocks if you prefer.

+

#Guard Combination

+

Multiple guards can be used on the same rule. All must be satisfied +for a rule to execute.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "Set OutsideDimmer to 50% if LightSwitch turned on and OtherSwitch is OFF and Door is CLOSED" do
+  changed LightSwitch, to: ON
+  run { OutsideDimmer << 50 }
+  only_if { Door.closed? }
+  not_if { OtherSwitch.on? }
+end
+ +
+ + +
+ +
    + +
  • + + + #between(range) ⇒ void + + + + + + + + + + + + + +

    Only execute rule if the current time is between the supplied time ranges.

    +
    + +
  • + + +
  • + + + #debounce_for(debounce_time) ⇒ void + + + + + + + + + + + + + +

    Waits until triggers have stopped firing for a period of time before executing the rule.

    +
    + +
  • + + +
  • + + + #not_if {|event| ... } ⇒ void + + + + + + + + + + + + + +

    Prevents execution of rules when the block's result is true and allows it when it's true.

    +
    + +
  • + + +
  • + + + #only_every(interval) ⇒ void + + + + + + + + + + + + + +

    Executes the rule then ignores subsequent triggers for a given duration.

    +
    + +
  • + + +
  • + + + #only_if {|event| ... } ⇒ void + + + + + + + + + + + + + +

    Allows rule execution when the block's result is true and prevents it when it's false.

    +
    + +
  • + + +
  • + + + #throttle_for(duration) ⇒ void + + + + + + + + + + + + + +

    Rate-limits rule executions by delaying triggers and executing the last trigger within the given duration.

    +
    + +
  • + + +
+ +

+ Triggers + collapse +

+ +
+
+ +
+ Note: +

The trigger attachment feature is not available for UI rules.

+
+
+ +

Triggers specify what will cause the execution blocks to run. +Multiple triggers can be defined within the same rule.

+

#Trigger Attachments

+

All triggers support event attachments that enable the association +of an object to a trigger. This enables one to use the same rule +and take different actions if the trigger is different. The +attached object is passed to the execution block through the +OpenHAB::Core::Events::AbstractEvent#attachment accessor.

+ + +
+
+
+ +
+

Examples:

+ + +
rule 'Set Dark switch at sunrise and sunset' do
+  channel 'astro:sun:home:rise#event', attach: OFF
+  channel 'astro:sun:home:set#event', attach: ON
+  run { |event| Dark << event.attachment }
+end
+ +
+ + +
+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Methods included from OpenHAB::DSL

+

after, between, config_description, debounce_for, ensure_states, ensure_states!, holiday_file, holiday_file!, items, only_every, persistence, persistence!, profile, provider, provider!, rule, rule!, rules, scene, scene!, script, script!, shared_cache, sitemaps, store_states, things, throttle_for, timers, transform, unit, unit!

+ + + + + + + + + + + + + + + +

Methods included from Core::ScriptHandling

+

script_loaded, script_unloaded

+ + + + + + + + + +

Methods included from Core::Actions

+

notify

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+ + + + + + +
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::DSL + +

+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #at(item, offset: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Creates a trigger based on the date and time stored in a DateTimeItem

+

The trigger will dynamically update whenever the state of the item changes. +If the item is NULL or UNDEF, the trigger will not run.

+

To trigger just on the time portion of the item, use #every instead, e.g. +every :day, at: MyDateTimeItem.

+

The event passed to run blocks will be a Core::Events::TimerEvent.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "say hello when the kids get home from school" do
+  at HomeFromSchool_Time
+  run do
+    KitchenEcho_TTS << "hi kids! how was school?"
+  end
+end
+
+rule "set home from school time" do
+  on_load
+  every :day, at: "5:00am" do
+  run do
+    HomeFromSchool_Time.ensure.update(school_day? ? LocalTime.parse("3:30pm") : NULL)
+  end
+end
+ + +

Using an offset

+

+ +
rule "Turn on lights 15 minutes before sunset" do
+  at Sunset_Time, offset: -15.minutes
+  run { Lights.on }
+end
+ +
+

Parameters:

+
    + +
  • + + item + + + (Item, String, Symbol) + + + + — +

    The item (or its name)

    +
    + +
  • + +
  • + + offset + + + (Duration, Integer, nil) + + + (defaults to: nil) + + + — +

    Offset the execution time from the time specified in the item. +This can be a negative value to execute the rule before the time specified in the item. +A Duration will be converted to its total length in seconds, with any excess precision information dropped. +@since openHAB 4.3

    +
    + +
  • + +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+1844
+1845
+1846
+1847
+1848
+1849
+1850
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 1844
+
+def at(item, offset: nil)
+  item = item.name if item.is_a?(Item)
+  offset ||= 0
+  offset = offset.to_i if offset.is_a?(Duration)
+  @ruby_triggers << [:at, item, { offset: offset }]
+  trigger("timer.DateTimeTrigger", itemName: item.to_s, offset: offset)
+end
+
+
+ +
+

+ + #between(range) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Only execute rule if the current time is between the supplied time ranges.

+

If the range is of strings, it will be parsed to an appropriate time class.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "Between guard" do
+  changed MotionSensor, to: OPEN
+  between "6:05".."14:05:05" # Include end
+  run { Light.on }
+end
+ + +
rule "Between guard" do
+  changed MotionSensor, to: OPEN
+  between "6:05".."14:05:05" # Excludes end second
+  run { Light.on }
+end
+ + +
rule "Between guard" do
+  changed MotionSensor, to: OPEN
+  between LocalTime.of(6, 5)..LocalTime.of(14, 15, 5)
+  run { Light.on }
+end
+ + +

String of LocalTime

+

+ +
rule 'Log an entry if started between 3:30:04 and midnight using strings' do
+  on_load
+  run { logger.info ("Started at #{LocalTime.now}")}
+  between '3:30:04'..LocalTime::MIDNIGHT
+end
+ + +

+ +
rule 'Log an entry if started between 3:30:04 and midnight using LocalTime objects' do
+  on_load
+  run { logger.info ("Started at #{LocalTime.now}")}
+  between LocalTime.of(3, 30, 4)..LocalTime::MIDNIGHT
+end
+ + +

String of MonthDay

+

+ +
rule 'Log an entry if started between March 9th and April 10ths' do
+  on_load
+  run { logger.info ("Started at #{Time.now}")}
+  between '03-09'..'04-10'
+end
+ + +

+ +
rule 'Log an entry if started between March 9th and April 10ths' do
+  on_load
+  run { logger.info ("Started at #{Time.now}")}
+  between MonthDay.of(03,09)..'04-06'
+end
+ +
+

Parameters:

+
    + +
  • + + range + + + (Range) + + + +
  • + +
+ + +
+ + + + +
+
+
+
+609
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 609
+
+prop :between
+
+
+ +
+

+ + #changed(*items, to: nil, from: nil, for: nil, attach: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Creates a trigger when an item, member of a group, or a thing changed +states.

+

When the changed element is a Thing, the from +and to values will accept symbols and strings, where the symbol' +matches the +supported status.

+

The event passed to run blocks will be an +Core::Events::ItemStateChangedEvent or a +Core::Events::ThingStatusInfoChangedEvent depending on if the +triggering element was an item or a thing.

+ + +
+
+
+ +
+

Examples:

+ + +

Single item trigger

+

+ +
rule "Execute rule when a sensor changed" do
+  changed FrontMotion_Sensor
+  run { |event| logger.info("Motion detected by #{event.item.name}") }
+end
+ + +

Multiple items can be separated with a comma:

+

+ +
rule "Execute rule when either sensor changed" do
+  changed FrontMotion_Sensor, RearMotion_Sensor
+  run { |event| logger.info("Motion detected by #{event.item.name}") }
+end
+ + +

Group member trigger

+

+ +
rule "Execute rule when member changed" do
+  changed Sensors.members
+  run { |event| logger.info("Motion detected by #{event.item.name}") }
+end
+ + +

You can optionally provide from and/or to states to restrict the cases in which the rule executes:

+

+ +
rule "Execute rule when item is changed to specific number, from specific number" do
+  changed Alarm_Mode, from: 8, to: [14,12]
+  run { logger.info("Alarm Mode Updated") }
+end
+ + +

Works with ranges:

+

+ +
rule "Execute when item changed to a range of numbers, from a range of numbers" do
+  changed Alarm_Mode, from: 8..10, to: 12..14
+  run { logger.info("Alarm Mode Updated") }
+end
+ + +

Works with endless ranges:

+

+ +
rule "Execute rule when item is changed to any number greater than 12"
+  changed Alarm_Mode, to: (12..)   # Parenthesis required for endless ranges
+  run { logger.info("Alarm Mode Updated") }
+end
+ + +

Works with procs:

+

+ +
rule "Execute when item state is changed from an odd number, to an even number" do
+  changed Alarm_Mode, from: proc { |from| from.odd? }, to: proc {|to| to.even? }
+  run { logger.info("Alarm Mode Updated") }
+end
+ + +

Works with lambdas:

+

+ +
rule "Execute when item state is changed from an odd number, to an even number" do
+  changed Alarm_Mode, from: -> from { from.odd? }, to: -> to { to.even? }
+  run { logger.info("Alarm Mode Updated") }
+end
+ + +

Works with regexes:

+

+ +
rule "Execute when item state is changed to something matching a regex" do
+  changed Alarm_Mode, to: /armed/
+  run { logger.info("Alarm armed") }
+end
+ + +

Delay the trigger until the item has been in the same state for 10 seconds

+

+ +
rule "Execute rule when item is changed for specified duration" do
+  changed Closet_Door, to: CLOSED, for: 10.seconds
+  run do
+    Closet_Light.off
+  end
+end
+ + +

for parameter can be a proc that returns a duration:

+

+ +
Alarm_Delay << 20
+
+rule "Execute rule when item is changed for specified duration" do
+  changed Alarm_Mode, for: -> { Alarm_Delay.state.to_i.seconds }
+  run { logger.info("Alarm Mode Updated") }
+end
+ + +

Works with Things:

+

+ +
rule "Execute rule when thing is changed" do
+  changed things["astro:sun:home"], :from => :online, :to => :uninitialized
+  run { |event| logger.info("Thing #{event.uid} status <trigger> to #{event.status}") }
+end
+ + +

Trigger when any Thing changes status

+

+ +
rule "Thing status monitoring" do
+  changed things, to: :offline
+  run do |event|
+    Notification.send("Thing #{event.thing.uid} is offline")
+  end
+end
+ + +

Real World Example

+

+ +
rule "Log (or notify) when an exterior door is left open for more than 5 minutes" do
+  changed ExteriorDoors.members, to: OPEN, for: 5.minutes
+  triggered {|door| logger.info("#{door.name} has been left open!") }
+end
+ +
+

Parameters:

+
    + +
  • + + items + + + (Item, GroupItem::Members, Thing, ThingUID, Things::Registry) + + + + — +

    Objects to create trigger for.

    +
    + +
  • + +
  • + + from + + + (State, Array<State>, #===, nil) + + + (defaults to: nil) + + + — +

    Only execute rule if previous state matches from state(s).

    +
    + +
  • + +
  • + + to + + + (State, Array<State>, #===, nil) + + + (defaults to: nil) + + + — +

    Only execute rule if new state matches to state(s).

    +
    + +
  • + +
  • + + for + + + (java.time.temporal.TemporalAmount, Proc, nil) + + + (defaults to: nil) + + + — +

    Duration for which the item/thing must remain in the same state before executing the execution blocks. +When a proc is provided, it will be called when the rule is triggered to get the duration.

    +
    + +
  • + +
  • + + attach + + + (Object, nil) + + + (defaults to: nil) + + + — +

    object to be attached to the trigger

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 1164
+
+def changed(*items, to: nil, from: nil, for: nil, attach: nil)
+  changed = Changed.new(rule_triggers: @rule_triggers)
+  # for is a reserved word in ruby, so use local_variable_get :for
+  duration = binding.local_variable_get(:for)
+
+  @ruby_triggers << [:changed, items, { to: to, from: from, duration: duration }]
+
+  from = [nil] if from.nil?
+  to = [nil] if to.nil?
+  items.each do |item|
+    case item
+    when Core::Things::Thing,
+         Core::Things::ThingUID,
+         Core::Things::Registry,
+         Core::Items::Item,
+         Core::Items::GroupItem::Members
+      nil
+    else
+      raise ArgumentError,
+            "items must be an Item, GroupItem::Members, Thing, ThingUID, or Things::Registry"
+    end
+
+    logger.trace { "Creating changed trigger for entity(#{item}), to(#{to.inspect}), from(#{from.inspect})" }
+
+    Array.wrap(from).each do |from_state|
+      Array.wrap(to).each do |to_state|
+        changed.trigger(item: item, from: from_state, to: to_state, duration: duration, attach: attach)
+      end
+    end
+  end
+end
+
+
+ +
+

+ + #channel(*channels, thing: nil, triggered: nil, attach: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Creates a channel trigger

+

The channel trigger executes rule when a specific channel is triggered. The syntax +supports one or more channels with one or more triggers. thing is an optional +parameter that makes it easier to set triggers on multiple channels on the same thing.

+

The event passed to run blocks will be a Core::Events::ChannelTriggeredEvent.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "Execute rule when channel is triggered" do
+  channel "astro:sun:home:rise#event"
+  run { logger.info("Channel triggered") }
+end
+# The above is the same as each of the below
+
+rule "Execute rule when channel is triggered" do
+  channel "rise#event", thing: "astro:sun:home"
+  run { logger.info("Channel triggered") }
+end
+
+rule "Execute rule when channel is triggered" do
+  channel "rise#event", thing: things["astro:sun:home"]
+  run { logger.info("Channel triggered") }
+end
+
+rule "Execute rule when channel is triggered" do
+  channel "rise#event", thing: things["astro:sun:home"].uid
+  run { logger.info("Channel triggered") }
+end
+
+rule "Execute rule when channel is triggered" do
+  channel "rise#event", thing: ["astro:sun:home"]
+  run { logger.info("Channel triggered") }
+end
+
+rule "Execute rule when channel is triggered" do
+  channel things["astro:sun:home"].channels["rise#event"]
+  run { logger.info("Channel triggered") }
+end
+
+rule "Execute rule when channel is triggered" do
+  channel things["astro:sun:home"].channels["rise#event"].uid
+  run { logger.info("Channel triggered") }
+end
+ + +
rule "Rule provides access to channel trigger events in run block" do
+  channel "astro:sun:home:rise#event", triggered: 'START'
+  run { |trigger| logger.info("Channel(#{trigger.channel}) triggered event: #{trigger.event}") }
+end
+ + +
rule "Keypad Code Received test" do
+  channel "mqtt:homie300:mosquitto:backgate:keypad#code"
+  run do |event|
+    logger.info("Received keycode from #{event.channel.thing.uid.id}")
+  end
+end
+ + +
rule "Rules support multiple channels" do
+  channel "rise#event", "set#event", thing: "astro:sun:home"
+  run { logger.info("Channel triggered") }
+end
+ + +
rule "Rules support multiple channels and triggers" do
+  channel "rise#event", "set#event", thing: "astro:sun:home", triggered: ["START", "STOP"]
+  run { logger.info("Channel triggered") }
+end
+ + +
rule "Rules support multiple things" do
+  channel "keypad#code", thing: ["mqtt:homie300:keypad1", "mqtt:homie300:keypad2"]
+  run { logger.info("Channel triggered") }
+end
+ +
+

Parameters:

+
    + +
  • + + channels + + + (String, Core::Things::Channel, Core::Things::ChannelUID) + + + + — +

    channels to create triggers for in form of 'binding_id:type_id:thing_id#channel_id' +or 'channel_id' if thing is provided.

    +
    + +
  • + +
  • + + thing + + + (String, Core::Things::Thing, Core::Things::ThingUID) + + + (defaults to: nil) + + + — +

    Thing(s) to create trigger for if not specified with the channel.

    +
    + +
  • + +
  • + + triggered + + + (String, Array<String>) + + + (defaults to: nil) + + + — +

    Only execute rule if the event on the channel matches this/these event/events.

    +
    + +
  • + +
  • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

    object to be attached to the trigger

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+982
+983
+984
+985
+986
+987
+988
+989
+990
+991
+992
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 982
+
+def channel(*channels, thing: nil, triggered: nil, attach: nil)
+  channel_trigger = Channel.new(rule_triggers: @rule_triggers)
+  flattened_channels = Channel.channels(channels: channels, thing: thing)
+  triggers = [triggered].flatten
+  @ruby_triggers << [:channel, flattened_channels, { triggers: triggers }]
+  flattened_channels.each do |channel|
+    triggers.each do |trigger|
+      channel_trigger.trigger(channel: channel, trigger: trigger, attach: attach)
+    end
+  end
+end
+
+
+ +
+

+ + #channel_linked(item: nil, channel: nil, attach: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Creates a channel linked trigger

+

The event passed to run blocks will be an Core::Events::ItemChannelLinkAddedEvent.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "channel linked" do
+  channel_linked
+  run do |event|
+    logger.info("#{event.link.item.name} linked to #{event.link.channel_uid}.")
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + item + + + (Item, String, nil) + + + (defaults to: nil) + + + — +

    The item to create a trigger for. If nil, all items are matched.

    +
    + +
  • + +
  • + + channel + + + (Core::Things::Channel, Core::Things::ChannelUID, String, nil) + + + (defaults to: nil) + + + — +

    The channel to create a trigger for. If nil, all channels are matched.

    +
    + +
  • + +
  • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

    object to be attached to the trigger

    +
    + +
  • + +
+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.0 Support for filtering with item and channel was added

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1014
+1015
+1016
+1017
+1018
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 1014
+
+def channel_linked(item: nil, channel: nil, attach: nil)
+  pattern = (item.nil? && channel.nil?) ? "*" : "#{item || "*"}-#{channel || "*"}"
+  @ruby_triggers << [:channel_linked, pattern]
+  event("openhab/links/#{pattern}/added", types: "ItemChannelLinkAddedEvent", attach: attach)
+end
+
+
+ +
+

+ + #channel_unlinked(item: nil, channel: nil, attach: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Creates a channel unlinked trigger

+

The event passed to run blocks will be an Core::Events::ItemChannelLinkRemovedEvent.

+

Note that the item or the thing it's linked to may no longer exist, +so if you try to access those objects they'll be nil.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "channel unlinked" do
+  channel_unlinked
+  run do |event|
+    logger.info("#{event.link.item_name} unlinked from #{event.link.channel_uid}.")
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + item + + + (Item, String, nil) + + + (defaults to: nil) + + + — +

    The item to create a trigger for. If nil, all items are matched.

    +
    + +
  • + +
  • + + channel + + + (Core::Things::Channel, Core::Things::ChannelUID, String, nil) + + + (defaults to: nil) + + + — +

    The channel to create a trigger for. If nil, all channels are matched.

    +
    + +
  • + +
  • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

    object to be attached to the trigger

    +
    + +
  • + +
+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.0 Support for filtering with item and channel was added

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1043
+1044
+1045
+1046
+1047
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 1043
+
+def channel_unlinked(item: nil, channel: nil, attach: nil)
+  pattern = (item.nil? && channel.nil?) ? "*" : "#{item || "*"}-#{channel || "*"}"
+  @ruby_triggers << [:channel_unlinked, pattern]
+  event("openhab/links/#{pattern}/removed", types: "ItemChannelLinkRemovedEvent", attach: attach)
+end
+
+
+ +
+

+ + + #cron(expression, attach: nil) ⇒ void + + #cron(second: nil, minute: nil, hour: nil, dom: nil, month: nil, dow: nil, year: nil, attach: nil) ⇒ void + + + + + + +

+
+

This method returns an undefined value.

Create a cron trigger

+

The event passed to run blocks will be a Core::Events::TimerEvent.

+ + +
+
+
+ +

Overloads:

+
    + + +
  • + #cron(expression, attach: nil) ⇒ void +
    +
    + + +
    +
    +
    + +
    +

    Examples:

    + + +

    Using a cron expression

    +

    + +
    rule "cron expression" do
    +  cron "43 46 13 ? * ?"
    +  run { Light.on }
    +end
    + +
    +

    Parameters:

    +
      + +
    • + + expression + + + (String, nil) + + + + — + + +
    • + +
    • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

      object to be attached to the trigger

      +
      + +
    • + +
    + + +
    +
  • + + +
  • + #cron(second: nil, minute: nil, hour: nil, dom: nil, month: nil, dow: nil, year: nil, attach: nil) ⇒ void +
    +
    +

    The trigger can be created by specifying each field as keyword arguments.

    +

    When certain fields were omitted:

    +
      +
    • The more specific fields will default to 0 for hour, minute, and second, +to MON for dow, and to 1 for dom and month.
    • +
    • The less specific fields will default to * or ? as appropriate.
    • +
    +

    Each field is optional, but at least one must be specified.

    +

    The same rules for the standard +cron expression +apply for each field. For example, multiple values can be separated +with a comma within a string, and ranges can be specified with a dash or with +a Ruby Range.

    + + +
    +
    +
    + +
    +

    Examples:

    + + +

    Using String values

    +

    + +
    # Run every 3 minutes on Monday to Friday
    +# equivalent to the cron expression "0 */3 * ? * MON-FRI *"
    +rule "Using cron fields" do
    +  cron minute: "*/3", dow: "MON-FRI"
    +  run { logger.info "Cron rule executed" }
    +end
    + + +

    Defaults for unspecified fields

    +

    + +
    # Run at midnight on the first day of January, February, and March
    +# equivalent to the cron expression "0 0 0 1 JAN-MAR ? *"
    +rule "Using cron fields" do
    +  cron month: "JAN-MAR"
    +  run { logger.info "Cron rule executed" }
    +end
    + + +

    Using Ruby Range values

    +

    + +
    # Run on the hour, every hour between 1pm and 5pm
    +# equivalent to the cron expression "0 0 13-17 ? * ? *"
    +rule "Using cron fields" do
    +  cron hour: 13..17
    +  run { logger.info "Cron rule executed" }
    +end
    + +
    +

    Parameters:

    +
      + +
    • + + second + + + (Integer, String, Range, nil) + + + (defaults to: nil) + + +
    • + +
    • + + minute + + + (Integer, String, Range, nil) + + + (defaults to: nil) + + +
    • + +
    • + + hour + + + (Integer, String, Range, nil) + + + (defaults to: nil) + + +
    • + +
    • + + dom + + + (Integer, String, Symbol, Range, nil) + + + (defaults to: nil) + + +
    • + +
    • + + month + + + (Integer, String, Symbol, Range, nil) + + + (defaults to: nil) + + +
    • + +
    • + + dow + + + (Integer, String, Symbol, Range, nil) + + + (defaults to: nil) + + +
    • + +
    • + + year + + + (Integer, String, Range, nil) + + + (defaults to: nil) + + +
    • + +
    • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

      object to be attached to the trigger

      +
      + +
    • + +
    + + +
    +
  • + +
+ +

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +
+ + + + +
+
+
+
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 1262
+
+def cron(expression = nil, attach: nil, **fields)
+  if fields.any?
+    raise ArgumentError, "Cron elements cannot be used with a cron expression" if expression
+
+    cron_expression = Cron.from_fields(fields)
+    return cron(cron_expression, attach: attach)
+  end
+
+  raise ArgumentError, "Missing cron expression or elements" unless expression
+
+  cron = Cron.new(rule_triggers: @rule_triggers)
+  cron.trigger(config: { "cronExpression" => expression }, attach: attach)
+end
+
+
+ +
+

+ + #debounce_for(debounce_time) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Waits until triggers have stopped firing for a period of time before executing the rule.

+

It ignores triggers that are "bouncing around" (rapidly firing) by ignoring +them until they have quiesced (stopped triggering for a while).

+

#Comparison Table

+ + + + + + + + + + + + + + + + + + + + + + + + + +
GuardTriggers ImmediatelyDescription
#debounce_forNoWaits until there is a minimum interval between triggers.
#throttle_forNoRate-limits the executions to a minimum interval, regardless of the interval between triggers. Waits until the end of the period before executing, ignores any leading triggers.
#only_everyYesRate-limits the executions to a minimum interval. Immediately executes the first trigger, then ignores subsequent triggers for the period.
+

#Timing Diagram

+

The following timing diagram illustrates the difference between #debounce_for, +#throttle_for, and #only_every guards:

+
TIME INDEX ===>                1    1    2    2    3    3    4    4
+                     0    5    0    5    0    5    0    5    0    5
+Triggers          : "X.X...X...X..XX.X.X....X.XXXXXXXXXXX....X....."
+debounce_for 5    : "|......................X.|..............X....."
+debounce_for 5..5 : "|....X|....X.|....X....|....X|....X|....X....X"
+debounce_for 5..6 : "|.....X...|.....X.|....X.|.....X|.....X.|....X"
+debounce_for 5..7 : "|......X..|......X|....X.|......X|......X....."
+debounce_for 5..8 : "|.......X.|.......X....|.......X|.......X....."
+debounce_for 5..20: "|...................X..|................X....."
+# throttle_for will fire every 5 intervals after the "first" trigger
+throttle_for 5    : "|....X|....X.|....X....|....X|....X|....X....."
+only_every 5      : "X.....X......X....X....X....X....X......X....."
+
+Triggers          : "X.X...X...X..XX.X.X..X...XXXXXXXXXXX.X..X.X..."
+debounce_for 5..44: "|...........................................X."
+
+# Notice above, triggers keep firing with intervals less than 5, so
+# debouncer keeps waiting, but puts a stop at 44 (the end of range).
+
+ + +
+
+
+ +
+

Examples:

+ + +

Wait until item stopped changing for at least 1 minute before running the rule

+

+ +
rule do
+  changed Item1
+  debounce_for 1.minute
+  run { ... }
+end
+ + +

Alert when door is open for a while

+

+ +
# Note: When combined with a state check (only_if), this becomes functionally
+# equivalent to the changed duration feature.
+rule "Door alert" do
+  changed Door_State
+  debounce_for 10.minutes
+  only_if { Door_State.open? }
+  run { Notification.send("The Door has been open for 10 minutes!") }
+end
+ +
+

Parameters:

+
    + +
  • + + debounce_time + + + (Duration, Range) + + + + — +

    The minimum interval between two consecutive +triggers before the rules are allowed to run.

    +

    When specified just as a Duration or an endless range, it sets the minimum interval +between two consecutive triggers before rules are executed. It will +wait endlessly unless this condition is met or an end of range was specified.

    +

    When the end of the range is specified, it sets the maximum amount of time to wait +from the first trigger before the rule will execute, even when triggers continue +to occur more frequently than the minimum interval.

    +

    When an equal beginning and ending values are given, it will behave just like +#throttle_for.

    +
    + +
  • + +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+750
+751
+752
+753
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 750
+
+def debounce_for(debounce_time)
+  idle_time = debounce_time.is_a?(Range) ? debounce_time.begin : debounce_time
+  debounce(for: debounce_time, idle_time: idle_time)
+end
+
+
+ +
+

+ + #delay(duration) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Add a wait between or after run blocks.

+

The delay property is a non thread-blocking element that is executed +after, before, or between run blocks.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "delay execution" do
+  changed MotionSensor, to: CLOSED
+  delay 5.seconds
+  run { Light.off }
+end
+ + +
rule 'Delay sleeps between execution elements' do
+  on_load
+  run { logger.info("Sleeping") }
+  delay 5.seconds
+  run { logger.info("Awake") }
+end
+ + +

Like other execution blocks, multiple can exist in a single rule.

+

+ +
rule 'Multiple delays can exist in a rule' do
+  on_load
+  run { logger.info("Sleeping") }
+  delay 5.seconds
+  run { logger.info("Sleeping Again") }
+  delay 5.seconds
+  run { logger.info("Awake") }
+end
+ + +

You can use Ruby code in your rule across multiple execution blocks like a run and a delay.

+

+ +
rule 'Dim a switch on system startup over 100 seconds' do
+  on_load
+  100.times do
+    run { DimmerSwitch.dim }
+    delay 1.second
+  end
+end
+ +
+

Parameters:

+ + + +
+ + + + +
+
+
+
+418
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 418
+
+prop_array :delay, array_name: :run_queue, wrapper: Delay
+
+
+ +
+

+ + #dependencies(trigger_types = %i[changed updated]) ⇒ Array<Item, GroupItem::Members> + + + + + +

+
+

Returns all Items (or GroupItem::Members) referenced +by the specified trigger types in this rule.

+ + +
+
+
+ +
+

Examples:

+ + +

Ensure all dependencies have a state when executing a rule

+

+ +
rule do |rule|
+  changed Item1, Item2, Item3
+  only_if { rule.dependencies.all?(&:state?) }
+  run { FormulaItem.update(Item3.state - (Item1.state + Item2.state)) }
+end
+ +
+

Parameters:

+
    + +
  • + + trigger_types + + + (Symbol, Array<Symbol>) + + + (defaults to: %i[changed updated]) + + + — +

    Trigger types to search for dependencies

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+520
+521
+522
+523
+524
+525
+526
+527
+528
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 520
+
+def dependencies(trigger_types = %i[changed updated])
+  trigger_types = Array.wrap(trigger_types)
+
+  ruby_triggers.flat_map do |t|
+    next [] unless trigger_types.include?(t.first)
+
+    t[1].select { |i| i.is_a?(Item) || i.is_a?(GroupItem::Members) }
+  end.uniq
+end
+
+
+ +
+

+ + #description(value) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Set the rule's description.

+ + +
+
+
+

Parameters:

+
    + +
  • + + value + + + (String) + + + +
  • + +
+ + +
+ + + + +
+
+
+
+474
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 474
+
+prop :description
+
+
+ +
+

+ + #enabled(value) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Enable or disable the rule from executing

+ + +
+
+
+ +
+

Examples:

+ + +
rule "disabled rule" do
+  enabled(false)
+end
+ +
+

Parameters:

+
    + +
  • + + value + + + (true, false) + + + +
  • + +
+ + +
+ + + + +
+
+
+
+504
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 504
+
+prop :enabled
+
+
+ +
+

+ + #event(topic, source: nil, types: nil, attach: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Creates a trigger on events coming through the event bus

+ + +
+
+
+ +
+

Examples:

+ + +
rule "thing updated" do
+  event("openhab/things/*/updated", types: "ThingUpdatedEvent")
+  run do |event|
+    logger.info("#{event.thing.uid} updated")
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + topic + + + (String) + + + + — +

    The topic to trigger on; can contain the wildcard *.

    +
    + +
  • + +
  • + + source + + + (String, nil) + + + (defaults to: nil) + + + — +

    The sender of the event to trigger on. +Default does not filter on source.

    +
    + +
  • + +
  • + + types + + + (String, Array<String>, nil) + + + (defaults to: nil) + + + — +

    Only subscribe to certain event types. +Default does not filter on event types.

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+1788
+1789
+1790
+1791
+1792
+1793
+1794
+1795
+1796
+1797
+1798
+1799
+1800
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 1788
+
+def event(topic, source: nil, types: nil, attach: nil)
+  types = types.join(",") if types.is_a?(Enumerable)
+  # @deprecated OH3.4 - OH3 config uses eventXXX vs OH4 uses `topic`, `source`, and `types`
+  # See https://github.com/openhab/openhab-core/pull/3299
+  trigger("core.GenericEventTrigger",
+          eventTopic: topic,
+          eventSource: source,
+          eventTypes: types, # @deprecated OH3.4
+          topic: topic,
+          source: source,
+          types: types,
+          attach: attach)
+end
+
+
+ +
+

+ + #every(*values, at: nil, offset: nil, attach: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Create a rule that executes at the specified interval.

+

The event passed to run blocks will be a Core::Events::TimerEvent.

+

For a more complex schedule, use #cron.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "Daily" do
+  every :day, at: '5:15'
+  run do
+    Light.on
+  end
+end
+ + +

The above rule could also be expressed using LocalTime class as below

+

+ +
rule "Daily" do
+  every :day, at: LocalTime.of(5, 15)
+  run { Light.on }
+end
+ + +

Specific day of the week

+

+ +
rule "Weekly" do
+  every :monday, at: '5:15'
+  run do
+    Light.on
+  end
+end
+ + +

Symbolic interval

+

+ +
rule "Often" do
+  every :minute
+  run do
+    Light.on
+  end
+end
+ + +
rule "Hourly" do
+  every :hour
+  run do
+    Light.on
+  end
+end
+ + +

Duration interval

+

+ +
rule "Often" do
+  every 5.minutes
+  run do
+    Light.on
+  end
+end
+ + +

MonthDay

+

+ +
rule 'Every 14th of Feb at 2pm' do
+  every '02-14', at: '2pm'
+  run { logger.info "Happy Valentine's Day!" }
+end
+ + +

Multiple day-of-week

+

+ +
rule "Weekend" do
+  every :saturday, :sunday, at: "10:00"
+  run { logger.info "It's the weekend!" }
+end
+ + +

Trigger at the time portion of a DateTime Item

+

+ +
rule "Every day at sunset" do
+  every :day, at: Sunset_Time
+  run { logger.info "It's sunset!" }
+end
+ + +

Using DateTime trigger with offset

+

+ +
rule "Every day before sunset" do
+  every :day, at: Sunset_Time, offset: -20.minutes
+  run { logger.info "It's almost sunset!" }
+end
+ +
+

Parameters:

+
    + +
  • + + values + + + (String, Duration, java.time.MonthDay, :second, :minute, :hour, :day, :week, :month, :year, :monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday) + + + + — +

    When to execute rule. Multiple day-of-week can be specified. Otherwise, only one value is allowed.

    +
    + +
  • + +
  • + + at + + + (LocalTime, String, Core::Items::DateTimeItem, nil) + + + (defaults to: nil) + + + — +

    What time of day to execute rule +If value is :day, at can be a DateTimeItem, and +the trigger will run every day at the (time only portion of) current state of the +item. If the item is NULL or UNDEF, the trigger will not run.

    +
    + +
  • + +
  • + + offset + + + (Duration, Integer, nil) + + + (defaults to: nil) + + + — +

    Offset the execution time from the time specified in the item. +This can be a negative value to execute the rule before the time specified in the item. +A Duration will be converted to its total length in seconds, with any excess precision information dropped. +@since openHAB 4.3

    +
    + +
  • + +
  • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

    Object to be attached to the trigger

    +
    + +
  • + +
+ +

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 1385
+
+def every(*values, at: nil, offset: nil, attach: nil)
+  raise ArgumentError, "Missing values" if values.empty?
+  raise ArgumentError, "Offset can only be used when 'at' is given a DateTimeItem" if offset && !at.is_a?(Item)
+
+  if Cron.all_dow_symbols?(values)
+    @ruby_triggers << [:every, values.join(", "), { at: at }]
+    return cron(Cron.from_dow_symbols(values, at), attach: attach)
+  end
+
+  if values.size != 1
+    raise ArgumentError,
+          "Multiple values are only allowed for day-of-week. " \
+          "Otherwise only one value is allowed, given: #{values.size}"
+  end
+
+  value = values.first
+  value = java.time.MonthDay.parse(value.to_str) if value.respond_to?(:to_str)
+
+  @ruby_triggers << [:every, value, { at: at }]
+
+  if value == :day && at.is_a?(Item)
+    # @deprecated OH 3.4 - attachments are supported in OH 4.0+
+    if Core.version <= Core::V4_0 && !attach.nil?
+      raise ArgumentError, "Attachments are not supported with dynamic datetime triggers in openHAB 3.x"
+    end
+
+    offset ||= 0
+    offset = offset.to_i # Duration#to_i converts it to seconds, but we also want to convert float/string to int
+    @ruby_triggers.last[2][:offset] = offset
+    return trigger("timer.DateTimeTrigger", itemName: at.name, timeOnly: true, offset: offset, attach: attach)
+  end
+
+  cron_expression = case value
+                    when Symbol then Cron.from_symbol(value, at)
+                    when Duration then Cron.from_duration(value, at)
+                    when java.time.MonthDay then Cron.from_monthday(value, at)
+                    else raise ArgumentError, "Unknown interval"
+                    end
+  cron(cron_expression, attach: attach)
+end
+
+
+ +
+

+ + #inspectString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+2136
+2137
+2138
+2139
+2140
+2141
+2142
+2143
+2144
+2145
+2146
+2147
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 2136
+
+def inspect
+  <<~TEXT.tr("\n", " ")
+    #<OpenHAB::DSL::Rules::Builder: #{uid}
+    triggers=#{triggers.inspect},
+    run blocks=#{run.inspect},
+    on_load=#{!@on_load.nil?},
+    Trigger Conditions=#{trigger_conditions.inspect},
+    Trigger UIDs=#{triggers.map(&:id).inspect},
+    Attachments=#{attachments.inspect}
+    >
+  TEXT
+end
+
+
+ +
+

+ + #item_added(pattern = "*", attach: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Creates an item added trigger

+

The event passed to run blocks will be an Core::Events::ItemAddedEvent.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "item added" do
+  item_added
+  run do |event|
+    logger.info("#{event.item.name} added.")
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + pattern + + + (String, nil) + + + (defaults to: "*") + + + — +

    The pattern to match items against

    +
    + +
  • + +
  • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

    object to be attached to the trigger

    +
    + +
  • + +
+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.0 Support for pattern filter was added

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1650
+1651
+1652
+1653
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 1650
+
+def item_added(pattern = "*", attach: nil)
+  @ruby_triggers << [:item_added, pattern]
+  event("openhab/items/#{pattern}/added", types: "ItemAddedEvent", attach: attach)
+end
+
+
+ +
+

+ + #item_removed(pattern = "*", attach: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Creates an item removed trigger

+

The event passed to run blocks will be an Core::Events::ItemRemovedEvent.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "item removed" do
+  item_removed
+  run do |event|
+    logger.info("#{event.item.name} removed.")
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + pattern + + + (String, nil) + + + (defaults to: "*") + + + — +

    The pattern to match items against

    +
    + +
  • + +
  • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

    object to be attached to the trigger

    +
    + +
  • + +
+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.0 Support for pattern filter was added

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1673
+1674
+1675
+1676
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 1673
+
+def item_removed(pattern = "*", attach: nil)
+  @ruby_triggers << [:item_removed, pattern]
+  event("openhab/items/#{pattern}/removed", types: "ItemRemovedEvent", attach: attach)
+end
+
+
+ +
+

+ + #item_updated(pattern = "*", attach: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Creates an item updated trigger

+

The event passed to run blocks will be an Core::Events::ItemUpdatedEvent.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "item updated" do
+  item_updated
+  run do |event|
+    logger.info("#{event.item.name} updated.")
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + pattern + + + (String, nil) + + + (defaults to: "*") + + + — +

    The pattern to match items against

    +
    + +
  • + +
  • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

    object to be attached to the trigger

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+1695
+1696
+1697
+1698
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 1695
+
+def item_updated(pattern = "*", attach: nil)
+  @ruby_triggers << [:item_updated, pattern]
+  event("openhab/items/#{pattern}/updated", types: "ItemUpdatedEvent", attach: attach)
+end
+
+
+ +
+

+ + #name(value) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Set the rule's name.

+ + +
+
+
+

Parameters:

+
    + +
  • + + value + + + (String) + + + +
  • + +
+ + +
+ + + + +
+
+
+
+464
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 464
+
+prop :name
+
+
+ +
+

+ + #not_if {|event| ... } ⇒ void + + + + + +

+
+

This method returns an undefined value.

Prevents execution of rules when the block's result is true and allows it when it's true.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "Set OutsideDimmer to 50% if LightSwtich turned on and OtherSwitch is OFF" do
+  changed LightSwitch, to: ON
+  run { OutsideDimmer << 50 }
+  not_if { OtherSwitch.on? }
+end
+ + +

Multiple #not_if statements can be used and if any of them are not satisfied the rule will not run.

+

+ +
rule "Set OutsideDimmer to 50% if LightSwitch turned on and OtherSwitch is OFF and Door is not CLOSED" do
+  changed LightSwitch, to: ON
+  run { OutsideDimmer << 50 }
+  not_if { OtherSwitch.on? }
+  not_if { Door.closed? }
+end
+ +
+ +

Yield Parameters:

+ +

Yield Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    A value indicating if the rule should not run.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+670
+671
+672
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 670
+
+prop_array(:not_if) do |item|
+  raise ArgumentError, "Object passed to not_if must be a proc" unless item.is_a?(Proc)
+end
+
+
+ +
+

+ + #on_load(delay: nil, attach: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Creates a trigger that executes when the script is loaded

+

Execute the rule whenever the script is first loaded, including on openHAB start up, +and on subsequent reloads on file modifications. +This is useful to perform initialization routines, especially when combined with other triggers.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "script startup rule" do
+  on_load
+  run do
+    <calculate some item state>
+  end
+end
+ + +
rule "Ensure all security lights are on" do
+  on_load
+  run { Security_Lights.on }
+end
+ +
+

Parameters:

+
    + +
  • + + delay + + + (Duration) + + + (defaults to: nil) + + + — +

    The amount of time to wait before executing the rule. +When nil, execute immediately.

    +
    + +
  • + +
  • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

    Object to be attached to the trigger

    +
    + +
  • + +
+ +

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +
+ + + + +
+
+
+
+1452
+1453
+1454
+1455
+1456
+1457
+1458
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 1452
+
+def on_load(delay: nil, attach: nil)
+  # prevent overwriting @on_load
+  raise ArgumentError, "on_load can only be used once within a rule" if @on_load
+
+  @on_load = { module: SecureRandom.uuid, delay: delay }
+  attachments[@on_load[:module]] = attach
+end
+
+
+ +
+

+ + #on_start(at_level: nil, at_levels: nil, attach: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Creates a trigger that executes when openHAB reaches a certain start level

+

The event passed to run blocks will be a Core::Events::StartlevelEvent.

+

This will only trigger once during openHAB start up. It won't trigger on script reloads.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "Trigger at openHAB system start" do
+  on_start # trigger at the default startlevel 100
+  run { logger.info "openHAB start up complete." }
+end
+ + +

Trigger at a specific start level

+

+ +
rule "Trigger after things are loaded" do
+  on_start at_level: :things
+  run { logger.info "Things are ready!" }
+end
+ + +

Trigger at multiple levels

+

+ +
rule "Multiple start up triggers" do
+  on_start at_levels: %i[ui things complete]
+  run do |event|
+    logger.info "openHAB startlevel has reached level #{event.startlevel}"
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + at_level + + + (Integer, :rules, :ruleengine, :ui, :things, :complete) + + + (defaults to: nil) + + + — +

    Zero or more start levels. Note that Startlevels less than 40 are not available as triggers +because the rule engine needs to start up first before it can execute any rules

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SymbolStart Level
    :osgi10
    :model20
    :state30
    :rules40
    :ruleengine50
    :ui70
    :things80
    :complete100
    +
    + +
  • + +
  • + + at_levels + + + (Array<Integer,:rules,:ruleengine,:ui,:things,:complete>) + + + (defaults to: nil) + + + — +

    Fluent alias for at_level

    +
    + +
  • + +
  • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

    Object to be attached to the trigger

    +
    + +
  • + +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+1507
+1508
+1509
+1510
+1511
+1512
+1513
+1514
+1515
+1516
+1517
+1518
+1519
+1520
+1521
+1522
+1523
+1524
+1525
+1526
+1527
+1528
+1529
+1530
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 1507
+
+def on_start(at_level: nil, at_levels: nil, attach: nil)
+  levels = Array.wrap(at_level) | Array.wrap(at_levels)
+  levels = [100] if levels.empty?
+
+  levels.map! do |level|
+    next level unless level.is_a?(Symbol)
+
+    begin
+      klass = org.openhab.core.service.StartLevelService.java_class
+      klass.declared_field("STARTLEVEL_#{level.upcase}").get_int(klass)
+    rescue java.lang.NoSuchFieldException
+      raise ArgumentError, "Invalid symbol for at_level: :#{level}"
+    end
+  end
+
+  @ruby_triggers << [:on_start, levels]
+  levels.each do |level|
+    logger.warn "Rule engine doesn't start until start level 40" if level < 40
+    config = { startlevel: level }
+    logger.trace { "Creating a SystemStartlevelTrigger with startlevel=#{level}" }
+    Triggers::Trigger.new(rule_triggers: @rule_triggers)
+                     .append_trigger(type: "core.SystemStartlevelTrigger", config: config, attach: attach)
+  end
+end
+
+
+ +
+

+ + #only_every(interval) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Executes the rule then ignores subsequent triggers for a given duration.

+

Additional triggers that occur within the given duration after the rule execution +will be ignored. This results in executions happening only at the specified interval or +more.

+

Unlike #throttle_for, this guard will execute the rule as soon as a new trigger +occurs instead of waiting for the specified duration. This is ideal for triggers +such as a door bell where the rule should run as soon as a new trigger is detected +but ignore subsequent triggers if they occur too soon after.

+ + +
+
+
+ +
+

Examples:

+ + +

Only allow executions every 10 minutes or more

+

+ +
rule "Aircon Vent Control" do
+  changed BedRoom_Temperature
+  only_every 10.minutes
+  run do
+    # Adjust BedRoom_Aircon_Vent
+  end
+end
+ + +

Run only on the first update and ignore subsequent triggers for the next minute

+

+ +
# They can keep pressing the door bell as often as they like,
+# but the bell will only ring at most once every minute
+rule do
+  updated DoorBell_Button, to: "single"
+  only_every 1.minute
+  run { Audio.play_stream "doorbell.mp3" }
+end
+ + +

Using symbolic duration

+

+ +
rule "Display update" do
+  updated Power_Usage
+  only_every :minute
+  run { Power_Usage_Display.update "Current power usage: #{Power_Usage.average_since(1.minute.ago)}" }
+end
+ +
+

Parameters:

+
    + +
  • + + interval + + + (Duration, :second, :minute, :hour, :day) + + + + — +

    The period during which +subsequent triggers are ignored.

    +
    + +
  • + +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+849
+850
+851
+852
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 849
+
+def only_every(interval)
+  interval = 1.send(interval) if %i[second minute hour day].include?(interval)
+  debounce(for: interval, leading: true)
+end
+
+
+ +
+

+ + #only_if {|event| ... } ⇒ void + + + + + +

+
+

This method returns an undefined value.

Allows rule execution when the block's result is true and prevents it when it's false.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "Set OutsideDimmer to 50% if LightSwitch turned on and OtherSwitch is also ON" do
+  changed LightSwitch, to: ON
+  run { OutsideDimmer << 50 }
+  only_if { OtherSwitch.on? }
+end
+ + +

Multiple #only_if statements can be used and all must be true for the rule to run.

+

+ +
rule "Set OutsideDimmer to 50% if LightSwitch turned on and OtherSwitch is also ON and Door is closed" do
+  changed LightSwitch, to: ON
+  run { OutsideDimmer << 50 }
+  only_if { OtherSwitch.on? }
+  only_if { Door.closed? }
+end
+ + +

Guards have access to event information.

+

+ +
rule "Set OutsideDimmer to 50% if any switch in group Switches starting with Outside is switched On" do
+  changed Switches.items, to: ON
+  run { OutsideDimmer << 50 }
+  only_if { |event| event.item.name.start_with?("Outside") }
+end
+ +
+ +

Yield Parameters:

+ +

Yield Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    A value indicating if the rule should run.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+642
+643
+644
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 642
+
+prop_array(:only_if) do |item|
+  raise ArgumentError, "Object passed to only_if must be a proc" unless item.is_a?(Proc)
+end
+
+
+ +
+

+ + #otherwise {|event| ... } ⇒ Object + + + + + +

+
+

Add a block that will be passed event data, to be run if guards are +not satisfied.

+

The #otherwise property is the automation code that is executed when +a rule is triggered and guards are not satisfied. This property +accepts a block of code and executes it. The block is automatically +passed an event object which can be used to access multiple +properties about the triggering event.

+ + +
+
+
+ +
+

Examples:

+ + +
rule 'Turn switch ON or OFF based on value of another switch' do
+  on_load
+  run { TestSwitch << ON }
+  otherwise { TestSwitch << OFF }
+  only_if { OtherSwitch.on? }
+end
+ +
+ +

Yield Parameters:

+ + +
+ + + + +
+
+
+
+442
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 442
+
+prop_array :otherwise, array_name: :run_queue, wrapper: Otherwise
+
+
+ +
+

+ + #received_command(*items, command: nil, commands: nil, attach: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Creates a trigger for when an item or group receives a command.

+

The command/commands parameters are replicated for DSL fluency.

+

The event passed to run blocks will be an +Core::Events::ItemCommandEvent.

+ + +
+
+
+ +
+

Examples:

+ + +
rule 'Execute rule when item received command' do
+  received_command Alarm_Mode
+  run { |event| logger.info("Item received command: #{event.command}" ) }
+end
+ + +
rule 'Execute rule when item receives specific command' do
+  received_command Alarm_Mode, command: 7
+  run { |event| logger.info("Item received command: #{event.command}" ) }
+end
+ + +
rule 'Execute rule when item receives one of many specific commands' do
+  received_command Alarm_Mode, commands: [7,14]
+  run { |event| logger.info("Item received command: #{event.command}" ) }
+end
+ + +
rule 'Execute rule when group receives a specific command' do
+  received_command AlarmModes
+  triggered { |item| logger.info("Group #{item.name} received command")}
+end
+ + +
rule 'Execute rule when member of group receives any command' do
+  received_command AlarmModes.members
+  triggered { |item| logger.info("Group item #{item.name} received command")}
+end
+ + +
rule 'Execute rule when member of group is changed to one of many states' do
+  received_command AlarmModes.members, commands: [7, 14]
+  triggered { |item| logger.info("Group item #{item.name} received command")}
+end
+ + +
rule 'Execute rule when item receives a range of commands' do
+  received_command Alarm_Mode, commands: 7..14
+  run { |event| logger.info("Item received command: #{event.command}" ) }
+end
+ + +

Works with procs

+

+ +
rule 'Execute rule when Alarm Mode command is odd' do
+  received_command Alarm_Mode, command: proc { |c| c.odd? }
+  run { |event| logger.info("Item received command: #{event.command}" ) }
+end
+ + +

Works with lambdas

+

+ +
rule 'Execute rule when Alarm Mode command is odd' do
+  received_command Alarm_Mode, command: -> c { c.odd? }
+  run { |event| logger.info("Item received command: #{event.command}" ) }
+end
+ + +

Works with regexes

+

+ +
rule 'Execute rule when Alarm Mode command matches a substring' do
+  received_command Alarm_Mode, command: /arm/
+  run { |event| logger.info("Item received command: #{event.command}" ) }
+end
+ +
+

Parameters:

+
    + +
  • + + items + + + (Item, GroupItem::Members) + + + + — +

    Items to create trigger for

    +
    + +
  • + +
  • + + command + + + (Core::Types::Command, Array<Core::Types::Command>, #===, nil) + + + (defaults to: nil) + + + — +

    commands to match for trigger

    +
    + +
  • + +
  • + + commands + + + (Array<Core::Types::Command>, #===, nil) + + + (defaults to: nil) + + + — +

    Fluent alias for command

    +
    + +
  • + +
  • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

    object to be attached to the trigger

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+1606
+1607
+1608
+1609
+1610
+1611
+1612
+1613
+1614
+1615
+1616
+1617
+1618
+1619
+1620
+1621
+1622
+1623
+1624
+1625
+1626
+1627
+1628
+1629
+1630
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 1606
+
+def received_command(*items, command: nil, commands: nil, attach: nil)
+  command_trigger = Command.new(rule_triggers: @rule_triggers)
+
+  # if neither command nor commands is specified, ensure that we create
+  # a trigger that isn't looking for a specific command.
+  commands = [nil] if command.nil? && commands.nil?
+  commands = Array.wrap(command) | Array.wrap(commands)
+
+  @ruby_triggers << [:received_command, items, { command: commands }]
+
+  items.each do |item|
+    case item
+    when Core::Items::Item,
+         Core::Items::GroupItem::Members
+      nil
+    else
+      raise ArgumentError, "items must be an Item or GroupItem::Members"
+    end
+    commands.each do |cmd|
+      logger.trace { "Creating received command trigger for items #{item.inspect} and commands #{cmd.inspect}" }
+
+      command_trigger.trigger(item: item, command: cmd, attach: attach)
+    end
+  end
+end
+
+
+ +
+

+ + #run {|event| ... } ⇒ void + + + + + +

+
+

This method returns an undefined value.

Add a block that will be passed event data.

+

The run property is the automation code that is executed when a rule +is triggered. This property accepts a block of code and executes it. +The block is automatically passed an event object which can be used +to access multiple properties about the triggering event. The code +for the automation can be entirely within the run block and can call +methods defined in the Ruby script.

+ + +
+
+
+ +
+

Examples:

+ + +

{} style used for single line blocks.

+

+ +
rule 'Access Event Properties' do
+  changed TestSwitch
+  run { |event| logger.info("#{event.item.name} triggered from #{event.was} to #{event.state}") }
+end
+ + +

do/end style used for multi-line blocks.

+

+ +
rule 'Multi Line Run Block' do
+  changed TestSwitch
+  run do |event|
+    logger.info("#{event.item.name} triggered")
+    logger.info("from #{event.was}") if event.was?
+    logger.info("to #{event.state}") if event.state?
+   end
+end
+ + +

Rules can have multiple run blocks and they are executed in order. Useful when used in combination with #delay.

+

+ +
rule 'Multiple Run Blocks' do
+  changed TestSwitch
+  run { |event| logger.info("#{event.item.name} triggered") }
+  run { |event| logger.info("from #{event.was}") if event.was? }
+  run { |event| logger.info("to #{event.state}") if event.state?  }
+end
+ +
+ +

Yield Parameters:

+ + +
+ + + + +
+
+
+
+321
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 321
+
+prop_array :run, array_name: :run_queue, wrapper: Run
+
+
+ +
+

+ + #tags(*tags) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Set the rule's tags.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "tagged rule" do
+  tags "lighting", "security"
+end
+ +
+

Parameters:

+
    + +
  • + + tags + + + (String, Symbol, Semantics::Tag) + + + + — +

    A list of tags to assign to the rule.

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+489
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 489
+
+prop :tags
+
+
+ +
+

+ + #thing_added(pattern = "*", attach: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Creates a thing added trigger

+

The event passed to run blocks will be a Core::Events::ThingAddedEvent.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "thing added" do
+  thing_added
+  run do |event|
+    logger.info("#{event.thing.uid} added.")
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + pattern + + + (String, nil) + + + (defaults to: "*") + + + — +

    The pattern to match things against

    +
    + +
  • + +
  • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

    object to be attached to the trigger

    +
    + +
  • + +
+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.0 Support for pattern filter was added

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1718
+1719
+1720
+1721
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 1718
+
+def thing_added(pattern = "*", attach: nil)
+  @ruby_triggers << [:thing_added, pattern]
+  event("openhab/things/#{pattern}/added", types: "ThingAddedEvent", attach: attach)
+end
+
+
+ +
+

+ + #thing_removed(pattern = "*", attach: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Creates a thing removed trigger

+

The event passed to run blocks will be a Core::Events::ThingRemovedEvent.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "thing removed" do
+  thing_removed
+  run do |event|
+    logger.info("#{event.thing.uid} removed.")
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + pattern + + + (String, nil) + + + (defaults to: "*") + + + — +

    The pattern to match things against

    +
    + +
  • + +
  • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

    object to be attached to the trigger

    +
    + +
  • + +
+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.0 Support for pattern filter was added

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1741
+1742
+1743
+1744
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 1741
+
+def thing_removed(pattern = "*", attach: nil)
+  @ruby_triggers << [:thing_removed, pattern]
+  event("openhab/things/#{pattern}/removed", types: "ThingRemovedEvent", attach: attach)
+end
+
+
+ +
+

+ + #thing_updated(pattern = "*", attach: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Creates a thing updated trigger

+

The event passed to run blocks will be a Core::Events::ThingUpdatedEvent.

+ + +
+
+
+ +
+

Examples:

+ + +
rule "thing updated" do
+  thing_updated
+  run do |event|
+    logger.info("#{event.thing.uid} updated.")
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + pattern + + + (String, nil) + + + (defaults to: "*") + + + — +

    The pattern to match things against

    +
    + +
  • + +
  • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

    object to be attached to the trigger

    +
    + +
  • + +
+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.0 Support for pattern filter was added

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1765
+1766
+1767
+1768
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 1765
+
+def thing_updated(pattern = "*", attach: nil)
+  @ruby_triggers << [:thing_updated, pattern]
+  event("openhab/things/#{pattern}/updated", types: "ThingUpdatedEvent", attach: attach)
+end
+
+
+ +
+

+ + #throttle_for(duration) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Rate-limits rule executions by delaying triggers and executing the last +trigger within the given duration.

+

When a new trigger occurs, it will hold the execution and start a fixed timer for +the given duration. Should more triggers occur during this time, keep holding +and once the wait time is over, execute the latest trigger.

+

#throttle_for will execute rules after it had waited +for the given duration, regardless of how frequently the triggers were occuring. +In contrast, #debounce_for will wait until there is a minimum interval +between two triggers.

+

#throttle_for is ideal in situations where regular status updates need to be made +for frequently changing values. It is also useful when a rule responds to triggers +from multiple related items that are updated at around the same time. Instead of +executing the rule multiple times, #throttle_for will wait for a pre-set amount +of time since the first group of triggers occurred before executing the rule.

+ + +
+
+
+ +
+

Examples:

+ + +

Perform calculations from multiple items

+

+ +
rule "Update Power Summary " do |rule|
+  changed Power_From_Solar, Power_Load, Power_From_Grid
+  throttle_for 1.second
+  only_if { rule.dependencies.all?(&:state?) } # make sure all items have a state
+  run do
+    msg = []
+    msg << Power_Load.state.negate.to_unit("kW").format("Load: %.2f %unit%")
+    msg << Power_From_Solar.state.to_unit("kW").format("PV: %.2f %unit%")
+    if Power_From_Grid.positive?
+      msg << Power_From_Grid.state.to_unit("kW").format("From Grid: %.1f %unit%")
+    else
+      msg << Power_From_Grid.state.negate.to_unit("kW").format("To Grid: %.1f %unit%")
+    end
+    Power_Summary.update(msg.join(", "))
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + duration + + + (Duration) + + + + — +

    The minimum amount of time to wait inbetween rule +executions.

    +
    + +
  • + +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+801
+802
+803
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 801
+
+def throttle_for(duration)
+  debounce(for: duration)
+end
+
+
+ +
+

+ + #time_series_updated(*items, attach: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Creates a time series updated trigger

+

The event passed to run blocks will be a Core::Events::ItemTimeSeriesUpdatedEvent

+ + +
+
+
+ +
+

Examples:

+ + +
rule 'Execute rule when item time series is updated' do
+  time_series_updated MyItem
+  run do |event|
+    logger.info("Item time series updated: #{event.item.name}.")
+    logger.info("  TimeSeries size: #{event.time_series.size}, policy: #{event.time_series.policy}")
+    event.time_series.each do |entry|
+      timestamp = entry.timestamp.to_time.strftime("%Y-%m-%d %H:%M:%S")
+      logger.info("    Entry: #{timestamp}: State: #{entry.state}")
+    end
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + items + + + (Item) + + + + — +

    Items to create trigger for.

    +
    + +
  • + +
  • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

    Object to be attached to the trigger.

    +
    + +
  • + +
+ + +

See Also:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.1

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+2025
+2026
+2027
+2028
+2029
+2030
+2031
+2032
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 2025
+
+def time_series_updated(*items, attach: nil)
+  @ruby_triggers << [:time_series_updated, items]
+  items.map do |item|
+    raise ArgumentError, "items must be an Item or GroupItem::Members" unless item.is_a?(Core::Items::Item)
+
+    event("openhab/items/#{item.name}/timeseriesupdated", types: "ItemTimeSeriesUpdatedEvent", attach: attach)
+  end
+end
+
+
+ +
+

+ + #trigger(type, attach: nil, **configuration) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Create a generic trigger given the trigger type uid and a configuration hash

+

This provides the ability to create a trigger type not already covered by the other methods.

+ + +
+
+
+ +
+

Examples:

+ + +

Create a trigger for the PID Controller Automation add-on.

+

+ +
rule 'PID Control' do
+  trigger 'pidcontroller.trigger',
+    input: InputItem.name,
+    setpoint: SetPointItem.name,
+    kp: 10,
+    ki: 10,
+    kd: 10,
+    kdTimeConstant: 1,
+    loopTime: 1000
+
+  run do |event|
+    logger.info("PID controller command: #{event.command}")
+    ControlItem << event.command
+  end
+end
+ + +

DateTime Trigger

+

+ +
rule 'DateTime Trigger' do
+  description 'Triggers at a time specified in MyDateTimeItem'
+  trigger 'timer.DateTimeTrigger', itemName: MyDateTimeItem.name
+  run do
+    logger.info("DateTimeTrigger has been triggered")
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + type + + + (String) + + + + — +

    Trigger type UID

    +
    + +
  • + +
  • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

    object to be attached to the trigger

    +
    + +
  • + +
  • + + configuration + + + (Hash) + + + + — +

    A hash containing the trigger configuration entries

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+1888
+1889
+1890
+1891
+1892
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 1888
+
+def trigger(type, attach: nil, **configuration)
+  logger.trace { "Creating trigger (#{type}) with configuration(#{configuration})" }
+  Triggers::Trigger.new(rule_triggers: @rule_triggers)
+                   .append_trigger(type: type, config: configuration, attach: attach)
+end
+
+
+ +
+

+ + #triggered {|item| ... } ⇒ void + + + + + +

+
+

This method returns an undefined value.

Add a block that will be passed the triggering item.

+

This property is the same as the #run property except rather than +passing an event object to the automation block the triggered item is +passed. This enables optimizations for simple cases and supports +Ruby's pretzel colon &: operator..

+ + +
+
+
+ +
+

Examples:

+ + +
rule "motion sensor triggered" do
+  changed MotionSensor.members, to: :OPEN
+  triggered do |item|
+    logger.info("#{item.name} detected motion")
+  end
+end
+ + +
rule 'Triggered has access directly to item triggered' do
+  changed TestSwitch
+  triggered { |item| logger.info("#{item.name} triggered") }
+end
+ + +

Triggered items are highly useful when working with groups

+

+ +
# Switches is a group of Switch items
+rule 'Triggered item is item changed when a group item is changed.' do
+  changed Switches.members
+  triggered { |item| logger.info("Switch #{item.name} changed to #{item.state}")}
+end
+
+rule 'Turn off any switch that changes' do
+  changed Switches.members
+  triggered(&:off)
+end
+ + +

Like other execution blocks, multiple triggered blocks are supported in a single rule

+

+ +
rule 'Turn a switch off and log it, 5 seconds after turning it on' do
+  changed Switches.members, to: ON
+  delay 5.seconds
+  triggered(&:off)
+  triggered {|item| logger.info("#{item.label} turned off") }
+end
+ +
+ +

Yield Parameters:

+
    + +
  • + + item + + + (Item) + + + +
  • + +
+ +
+ + + + +
+
+
+
+371
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 371
+
+prop_array :triggered, array_name: :run_queue, wrapper: Trigger
+
+
+ +
+

+ + #uid(id) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Set the rule's UID.

+ + +
+
+
+

Parameters:

+
    + +
  • + + id + + + (String) + + + +
  • + +
+ + +
+ + + + +
+
+
+
+454
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 454
+
+prop(:uid) { |id| Thread.current[:openhab_rule_uid] = id }
+
+
+ +
+

+ + #updated(*items, to: nil, attach: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Create a trigger when item, group or thing is updated

+

The event passed to run blocks will be an +Core::Events::ItemStateEvent or a +Core::Events::ThingStatusInfoEvent depending on if the triggering +element was an item or a thing.

+ + +
+
+
+ +
+

Examples:

+ + +
rule 'Execute rule when item is updated to any value' do
+  updated Alarm_Mode
+  run { logger.info("Alarm Mode Updated") }
+end
+ + +
rule 'Execute rule when item is updated to specific number' do
+  updated Alarm_Mode, to: 7
+  run { logger.info("Alarm Mode Updated") }
+end
+ + +
rule 'Execute rule when item is updated to one of many specific states' do
+  updated Alarm_Mode, to: [7, 14]
+  run { logger.info("Alarm Mode Updated")}
+end
+ + +
rule 'Execute rule when item is within a range' do
+  updated Alarm_Mode, to: 7..14
+  run { logger.info("Alarm Mode Updated to a value between 7 and 14")}
+end
+ + +
rule 'Execute rule when group is updated to any state' do
+  updated AlarmModes
+  triggered { |item| logger.info("Group #{item.name} updated")}
+end
+ + +
rule 'Execute rule when member of group is changed to any state' do
+  updated AlarmModes.members
+  triggered { |item| logger.info("Group item #{item.name} updated")}
+end
+ + +
rule 'Execute rule when member of group is changed to one of many states' do
+  updated AlarmModes.members, to: [7, 14]
+  triggered { |item| logger.info("Group item #{item.name} updated")}
+end
+ + +

Works with procs

+

+ +
rule 'Execute rule when member of group is changed to an odd state' do
+  updated AlarmModes.members, to: proc { |t| t.odd? }
+  triggered { |item| logger.info("Group item #{item.name} updated")}
+end
+ + +

Works with lambdas:

+

+ +
rule 'Execute rule when member of group is changed to an odd state' do
+  updated AlarmModes.members, to: -> t { t.odd? }
+  triggered { |item| logger.info("Group item #{item.name} updated")}
+end
+ + +

Works with regexes:

+

+ +
rule 'Execute rule when member of group is changed to a substring' do
+  updated AlarmModes.members, to: /armed/
+  triggered { |item| logger.info("Group item #{item.name} updated")}
+end
+ + +

Works with things as well

+

+ +
rule 'Execute rule when thing is updated' do
+   updated things['astro:sun:home'], :to => :uninitialized
+   run { |event| logger.info("Thing #{event.uid} status <trigger> to #{event.status}") }
+end
+ +
+

Parameters:

+
    + +
  • + + items + + + (Item, GroupItem::Members, Thing) + + + + — +

    Objects to create trigger for.

    +
    + +
  • + +
  • + + to + + + (State, Array<State>, Symbol, String, #===, nil) + + + (defaults to: nil) + + + — +

    Only execute rule if the state matches to state(s). If the +updated element is a Core::Things::Thing, the to accepts +symbols and strings that match +supported thing statuses.

    +
    + +
  • + +
  • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

    object to be attached to the trigger

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+1978
+1979
+1980
+1981
+1982
+1983
+1984
+1985
+1986
+1987
+1988
+1989
+1990
+1991
+1992
+1993
+1994
+1995
+1996
+1997
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 1978
+
+def updated(*items, to: nil, attach: nil)
+  updated = Updated.new(rule_triggers: @rule_triggers)
+  @ruby_triggers << [:updated, items, { to: to }]
+  items.map do |item|
+    case item
+    when Core::Things::Thing,
+         Core::Things::ThingUID,
+         Core::Items::Item,
+         Core::Items::GroupItem::Members
+      nil
+    else
+      raise ArgumentError, "items must be an Item, GroupItem::Members, Thing, or ThingUID"
+    end
+
+    logger.trace { "Creating updated trigger for item(#{item}) to(#{to})" }
+    [to].flatten.map do |to_state|
+      updated.trigger(item: item, to: to_state, attach: attach)
+    end
+  end.flatten
+end
+
+
+ +
+

+ + #watch(path, glob: "*", for: %i[created deleted modified], attach: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Create a trigger to watch a path

+

It provides the ability to create a trigger on file and directory +changes.

+

If a file or a path that does not exist is supplied as the argument +to watch, the parent directory will be watched and the file or +non-existent part of the supplied path will become the glob. For +example, if the path given is /tmp/foo/bar and /tmp/foo +exists but bar does not exist inside of of /tmp/foo then the +directory /tmp/foo will be watched for any files that match +*/bar.

+

If the last part of the path contains any glob characters e.g. +/tmp/foo/*bar, the parent directory will be watched and the last +part of the path will be treated as if it was passed as the glob +argument. In other words, watch '/tmp/foo/*bar' is equivalent to +watch '/tmp/foo', glob: '*bar'

+

#Watching inside subdirectories

+

Subdirectories aren't watched unless:

+
    +
  • One of the glob patterns include the recursive match pattern **, or
  • +
  • The glob patterns include subdirectories, see examples below.
  • +
+

The event passed to run blocks will be a Events::WatchEvent.

+ + +
+
+
+ +
+

Examples:

+ + +

Watch items directory inside of the openHAB configuration path and log any changes.

+

+ +
rule 'watch directory' do
+  watch OpenHAB::Core.config_folder / 'items'
+  run { |event| logger.info("#{event.path.basename} - #{event.type}") }
+end
+ + +

Watch items directory for files that end in *.erb and log any changes

+

+ +
rule 'watch directory' do
+  watch OpenHAB::Core.config_folder / 'items', glob: '*.erb'
+  run { |event| logger.info("#{event.path.basename} - #{event.type}") }
+end
+ + +

Watch items/foo.items log any changes

+

+ +
rule 'watch directory' do
+  watch OpenHAB::Core.config_folder / 'items/foo.items'
+  run { |event| logger.info("#{event.path.basename} - #{event.type}") }
+end
+ + +

Watch items/*.items log any changes

+

+ +
rule 'watch directory' do
+  watch OpenHAB::Core.config_folder / 'items/*.items'
+  run { |event| logger.info("#{event.path.basename} - #{event.type}") }
+end
+ + +

Watch items/*.items for when items files are deleted or created (ignore changes)

+

+ +
rule 'watch directory' do
+  watch OpenHAB::Core.config_folder / 'items/*.items', for: [:deleted, :created]
+  run { |event| logger.info("#{event.path.basename} - #{event.type}") }
+end
+ + +

Watch for changes inside all subdirs of config_folder/automation/ruby/lib

+

+ +
rule "Watch recursively" do
+  watch OpenHAB::Core.config_folder / "automation/ruby/lib/**"
+  run { |event| logger.info("#{event.path} - #{event.type}") }
+end
+ + +

Recursively watch using subdirectory in glob

+

+ +
rule "Monitor changes in the list of installed gems" do
+  watch ENV['GEM_HOME'], glob: "gems/*"
+  run { |event| logger.info("#{event.path} - #{event.type}") }
+end
+ + +

Recursively watch using glob option

+

+ +
rule "Watch recursively" do
+  watch OpenHAB::Core.config_folder / "automation/ruby/lib", glob: "**"
+  run { |event| logger.info("#{event.path} - #{event.type}") }
+end
+ +
+

Parameters:

+
    + +
  • + + path + + + (String) + + + + — +

    Path to watch. Can be a directory or a file.

    +
    + +
  • + +
  • + + glob + + + (String) + + + (defaults to: "*") + + + — +

    Limit events to paths matching this glob. Globs are matched using glob +PathMatcher +rules.

    +
    + +
  • + +
  • + + for + + + (Array<:created, :deleted, :modified>, :created, :deleted, :modified) + + + (defaults to: %i[created deleted modified]) + + + — +

    Types of changes to watch for.

    +
    + +
  • + +
  • + + attach + + + (Object) + + + (defaults to: nil) + + + — +

    object to be attached to the trigger

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+2120
+2121
+2122
+2123
+2124
+2125
+2126
+2127
+2128
+2129
+
+
# File 'lib/openhab/dsl/rules/builder.rb', line 2120
+
+def watch(path, glob: "*", for: %i[created deleted modified], attach: nil)
+  types = [binding.local_variable_get(:for)].flatten
+
+  WatchHandler::WatchTriggerHandlerFactory.instance # ensure it's registered
+  trigger(WatchHandler::WATCH_TRIGGER_MODULE_ID,
+          path: path.to_s,
+          types: types.map(&:to_s),
+          glob: glob.to_s,
+          attach: attach)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Rules/Terse.html b/5.33/OpenHAB/DSL/Rules/Terse.html new file mode 100644 index 0000000000..81609179ca --- /dev/null +++ b/5.33/OpenHAB/DSL/Rules/Terse.html @@ -0,0 +1,4644 @@ + + + + + + + Module: OpenHAB::DSL::Rules::Terse + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::DSL::Rules::Terse + + + +

+
+ + + + + + + + + +
+
Included in:
+
OpenHAB::DSL, Builder
+
+ + + +
+
Defined in:
+
lib/openhab/dsl/rules/terse.rb
+
+ +
+ +

Overview

+
+

If you have a single trigger and execution block, you can use a terse rule: +All parameters to the trigger are passed through, and an optional name: parameter is added.

+ + +
+
+
+ +
+

Examples:

+ + +
changed TestSwitch do |event|
+  logger.info("TestSwitch changed to #{event.state}")
+end
+ + +
received_command TestSwitch, name: "My Test Switch Rule", command: ON do
+  logger.info("TestSwitch received command ON")
+end
+ +
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + +
    + +
  • + + + #changed ⇒ Object + + + + + + + + + + + + + +

    *args, id: nil, name :nil, description: nil, tag: nil, tags: nil, on_load: false, **kwargs, &block).

    +
    + +
  • + + +
  • + + + #channel ⇒ Object + + + + + + + + + + + + + +

    *args, id: nil, name :nil, description: nil, tag: nil, tags: nil, on_load: false, **kwargs, &block).

    +
    + +
  • + + +
  • + + + #channel_linked ⇒ Object + + + + + + + + + + + + + +

    *args, id: nil, name :nil, description: nil, tag: nil, tags: nil, on_load: false, **kwargs, &block).

    +
    + +
  • + + +
  • + + + #channel_unlinked ⇒ Object + + + + + + + + + + + + + +

    *args, id: nil, name :nil, description: nil, tag: nil, tags: nil, on_load: false, **kwargs, &block).

    +
    + +
  • + + +
  • + + + #cron ⇒ Object + + + + + + + + + + + + + +

    *args, id: nil, name :nil, description: nil, tag: nil, tags: nil, on_load: false, **kwargs, &block).

    +
    + +
  • + + +
  • + + + #every ⇒ Object + + + + + + + + + + + + + +

    *args, id: nil, name :nil, description: nil, tag: nil, tags: nil, on_load: false, **kwargs, &block).

    +
    + +
  • + + +
  • + + + #item_added ⇒ Object + + + + + + + + + + + + + +

    *args, id: nil, name :nil, description: nil, tag: nil, tags: nil, on_load: false, **kwargs, &block).

    +
    + +
  • + + +
  • + + + #item_removed ⇒ Object + + + + + + + + + + + + + +

    *args, id: nil, name :nil, description: nil, tag: nil, tags: nil, on_load: false, **kwargs, &block).

    +
    + +
  • + + +
  • + + + #item_updated ⇒ Object + + + + + + + + + + + + + +

    *args, id: nil, name :nil, description: nil, tag: nil, tags: nil, on_load: false, **kwargs, &block).

    +
    + +
  • + + +
  • + + + #on_start ⇒ Object + + + + + + + + + + + + + +

    *args, id: nil, name :nil, description: nil, tag: nil, tags: nil, on_load: false, **kwargs, &block).

    +
    + +
  • + + +
  • + + + #received_command ⇒ Object + + + + + + + + + + + + + +

    *args, id: nil, name :nil, description: nil, tag: nil, tags: nil, on_load: false, **kwargs, &block).

    +
    + +
  • + + +
  • + + + #thing_added ⇒ Object + + + + + + + + + + + + + +

    *args, id: nil, name :nil, description: nil, tag: nil, tags: nil, on_load: false, **kwargs, &block).

    +
    + +
  • + + +
  • + + + #thing_removed ⇒ Object + + + + + + + + + + + + + +

    *args, id: nil, name :nil, description: nil, tag: nil, tags: nil, on_load: false, **kwargs, &block).

    +
    + +
  • + + +
  • + + + #thing_updated ⇒ Object + + + + + + + + + + + + + +

    *args, id: nil, name :nil, description: nil, tag: nil, tags: nil, on_load: false, **kwargs, &block).

    +
    + +
  • + + +
  • + + + #updated ⇒ Object + + + + + + + + + + + + + +

    *args, id: nil, name :nil, description: nil, tag: nil, tags: nil, on_load: false, **kwargs, &block).

    +
    + +
  • + + +
+ + + + + +
+

Instance Method Details

+ + +
+

+ + #changedObject + + + + + +

+
+

*args, +id: nil, +name :nil, +description: nil, +tag: nil, +tags: nil, +on_load: false, +**kwargs, +&block)

+ + +
+
+
+ + +
+ + + + +
+
+
+
+72
+
+
# File 'lib/openhab/dsl/rules/terse.rb', line 72
+
+def_terse_rule(:changed)
+
+
+ +
+

+ + #channelObject + + + + + +

+
+

*args, +id: nil, +name :nil, +description: nil, +tag: nil, +tags: nil, +on_load: false, +**kwargs, +&block)

+ + +
+
+
+ + +
+ + + + +
+
+
+
+73
+
+
# File 'lib/openhab/dsl/rules/terse.rb', line 73
+
+def_terse_rule(:channel)
+
+
+ +
+

+ + #channel_linkedObject + + + + + +

+
+

*args, +id: nil, +name :nil, +description: nil, +tag: nil, +tags: nil, +on_load: false, +**kwargs, +&block)

+ + +
+
+
+ + +
+ + + + +
+
+
+
+74
+
+
# File 'lib/openhab/dsl/rules/terse.rb', line 74
+
+def_terse_rule(:channel_linked)
+
+
+ +
+

+ + #channel_unlinkedObject + + + + + +

+
+

*args, +id: nil, +name :nil, +description: nil, +tag: nil, +tags: nil, +on_load: false, +**kwargs, +&block)

+ + +
+
+
+ + +
+ + + + +
+
+
+
+75
+
+
# File 'lib/openhab/dsl/rules/terse.rb', line 75
+
+def_terse_rule(:channel_unlinked)
+
+
+ +
+

+ + #cronObject + + + + + +

+
+

*args, +id: nil, +name :nil, +description: nil, +tag: nil, +tags: nil, +on_load: false, +**kwargs, +&block)

+ + +
+
+
+ + +
+ + + + +
+
+
+
+76
+
+
# File 'lib/openhab/dsl/rules/terse.rb', line 76
+
+def_terse_rule(:cron)
+
+
+ +
+

+ + #everyObject + + + + + +

+
+

*args, +id: nil, +name :nil, +description: nil, +tag: nil, +tags: nil, +on_load: false, +**kwargs, +&block)

+ + +
+
+
+ + +
+ + + + +
+
+
+
+77
+
+
# File 'lib/openhab/dsl/rules/terse.rb', line 77
+
+def_terse_rule(:every)
+
+
+ +
+

+ + #item_addedObject + + + + + +

+
+

*args, +id: nil, +name :nil, +description: nil, +tag: nil, +tags: nil, +on_load: false, +**kwargs, +&block)

+ + +
+
+
+ + +
+ + + + +
+
+
+
+78
+
+
# File 'lib/openhab/dsl/rules/terse.rb', line 78
+
+def_terse_rule(:item_added)
+
+
+ +
+

+ + #item_removedObject + + + + + +

+
+

*args, +id: nil, +name :nil, +description: nil, +tag: nil, +tags: nil, +on_load: false, +**kwargs, +&block)

+ + +
+
+
+ + +
+ + + + +
+
+
+
+80
+
+
# File 'lib/openhab/dsl/rules/terse.rb', line 80
+
+def_terse_rule(:item_removed)
+
+
+ +
+

+ + #item_updatedObject + + + + + +

+
+

*args, +id: nil, +name :nil, +description: nil, +tag: nil, +tags: nil, +on_load: false, +**kwargs, +&block)

+ + +
+
+
+ + +
+ + + + +
+
+
+
+79
+
+
# File 'lib/openhab/dsl/rules/terse.rb', line 79
+
+def_terse_rule(:item_updated)
+
+
+ +
+

+ + #on_startObject + + + + + +

+
+

*args, +id: nil, +name :nil, +description: nil, +tag: nil, +tags: nil, +on_load: false, +**kwargs, +&block)

+ + +
+
+
+ + +
+ + + + +
+
+
+
+81
+
+
# File 'lib/openhab/dsl/rules/terse.rb', line 81
+
+def_terse_rule(:on_start)
+
+
+ +
+

+ + #received_commandObject + + + + + +

+
+

*args, +id: nil, +name :nil, +description: nil, +tag: nil, +tags: nil, +on_load: false, +**kwargs, +&block)

+ + +
+
+
+ + +
+ + + + +
+
+
+
+82
+
+
# File 'lib/openhab/dsl/rules/terse.rb', line 82
+
+def_terse_rule(:received_command)
+
+
+ +
+

+ + #thing_addedObject + + + + + +

+
+

*args, +id: nil, +name :nil, +description: nil, +tag: nil, +tags: nil, +on_load: false, +**kwargs, +&block)

+ + +
+
+
+ + +
+ + + + +
+
+
+
+83
+
+
# File 'lib/openhab/dsl/rules/terse.rb', line 83
+
+def_terse_rule(:thing_added)
+
+
+ +
+

+ + #thing_removedObject + + + + + +

+
+

*args, +id: nil, +name :nil, +description: nil, +tag: nil, +tags: nil, +on_load: false, +**kwargs, +&block)

+ + +
+
+
+ + +
+ + + + +
+
+
+
+85
+
+
# File 'lib/openhab/dsl/rules/terse.rb', line 85
+
+def_terse_rule(:thing_removed)
+
+
+ +
+

+ + #thing_updatedObject + + + + + +

+
+

*args, +id: nil, +name :nil, +description: nil, +tag: nil, +tags: nil, +on_load: false, +**kwargs, +&block)

+ + +
+
+
+ + +
+ + + + +
+
+
+
+84
+
+
# File 'lib/openhab/dsl/rules/terse.rb', line 84
+
+def_terse_rule(:thing_updated)
+
+
+ +
+

+ + #updatedObject + + + + + +

+
+

*args, +id: nil, +name :nil, +description: nil, +tag: nil, +tags: nil, +on_load: false, +**kwargs, +&block)

+ + +
+
+
+ + +
+ + + + +
+
+
+
+86
+
+
# File 'lib/openhab/dsl/rules/terse.rb', line 86
+
+def_terse_rule(:updated)
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Rules/Triggers/Conditions/Duration.html b/5.33/OpenHAB/DSL/Rules/Triggers/Conditions/Duration.html new file mode 100644 index 0000000000..26a86e4c40 --- /dev/null +++ b/5.33/OpenHAB/DSL/Rules/Triggers/Conditions/Duration.html @@ -0,0 +1,4009 @@ + + + + + + + Class: OpenHAB::DSL::Rules::Triggers::Conditions::Duration + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Rules::Triggers::Conditions::Duration + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/rules/triggers/conditions/duration.rb
+
+ +
+ +

Overview

+
+

Struct capturing data necessary for a conditional trigger

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #rule ⇒ Object + + + + + + + + + + + + + + + + +

    Returns the value of attribute rule.

    +
    + +
  • + + +
+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + +
+

Constructor Details

+ +
+

+ + #initialize(to:, from:, duration:) ⇒ Duration + + + + + +

+
+

Create a new duration condition

+ + +
+
+
+

Parameters:

+
    + +
  • + + to + + + (Object) + + + + — +

    optional condition on to state

    +
    + +
  • + +
  • + + from + + + (Object) + + + + — +

    optional condition on from state

    +
    + +
  • + +
  • + + duration + + + (java.time.temporal.TemporalAmount) + + + + — +

    to state must stay at specific value before triggering

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+21
+22
+23
+24
+25
+26
+27
+28
+29
+
+
# File 'lib/openhab/dsl/rules/triggers/conditions/duration.rb', line 21
+
+def initialize(to:, from:, duration:)
+  @conditions = Generic.new(to: to, from: from)
+  @duration = duration
+  @timers = {}
+  logger.trace do
+    "Created Duration Condition To(#{to}) From(#{from}) " \
+      "Conditions(#{@conditions}) Duration(#{@duration})"
+  end
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #ruleObject + + + + + +

+
+

Returns the value of attribute rule.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+13
+14
+15
+
+
# File 'lib/openhab/dsl/rules/triggers/conditions/duration.rb', line 13
+
+def rule
+  @rule
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #cleanupObject + + + + + +

+
+

Cleanup any resources from the condition

+

Cancels the timer, if it's active

+ + +
+
+
+ + +
+ + + + +
+
+
+
+52
+53
+54
+
+
# File 'lib/openhab/dsl/rules/triggers/conditions/duration.rb', line 52
+
+def cleanup
+  @timers.each_value(&:cancel)
+end
+
+
+ +
+

+ + #process(mod:, inputs:, &block) ⇒ Object + + + + + +

+
+

Process rule

+ + +
+
+
+

Parameters:

+
    + +
  • + + inputs + + + (Hash) + + + + — +

    inputs from trigger

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+
+
# File 'lib/openhab/dsl/rules/triggers/conditions/duration.rb', line 34
+
+def process(mod:, inputs:, &block)
+  timer = @timers[inputs["triggeringItem"]&.name]
+  if timer&.active?
+    process_active_timer(timer, inputs, mod, &block)
+  elsif @conditions.process(mod: mod, inputs: inputs)
+    logger.trace { "Trigger Guards Matched for #{self}, delaying rule execution" }
+    # Add timer and attach timer to delay object, and also state being tracked to so
+    # timer can be cancelled if state changes
+    # Also another timer should not be created if changed to same value again but instead rescheduled
+    create_trigger_delay_timer(inputs, mod, &block)
+  else
+    logger.trace { "Trigger Guards did not match for #{self}, ignoring trigger." }
+  end
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Rules/Triggers/Conditions/Generic.html b/5.33/OpenHAB/DSL/Rules/Triggers/Conditions/Generic.html new file mode 100644 index 0000000000..237b2a421e --- /dev/null +++ b/5.33/OpenHAB/DSL/Rules/Triggers/Conditions/Generic.html @@ -0,0 +1,3978 @@ + + + + + + + Class: OpenHAB::DSL::Rules::Triggers::Conditions::Generic + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Rules::Triggers::Conditions::Generic + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/rules/triggers/conditions/generic.rb
+
+ +
+ +

Overview

+
+

This creates trigger conditions that work on procs

+ + +
+
+
+ + +
+ +

+ Constant Summary + collapse +

+ +
+ +
ANY = +
+
+

this needs to be defined after initialize so its instance variables are set

+ + +
+
+
+ + +
+
+
Generic.new.freeze
+ +
+ + + + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + +
+

Constructor Details

+ +
+

+ + #initialize(from: nil, to: nil, command: nil) ⇒ Generic + + + + + +

+
+

Create a new Condition that executes only if procs return true

+ + +
+
+
+

Parameters:

+
    + +
  • + + from + + + (#===, nil) + + + (defaults to: nil) + + + — +

    Value to check against from state

    +
    + +
  • + +
  • + + to + + + (#===, nil) + + + (defaults to: nil) + + + — +

    Value to check against to state

    +
    + +
  • + +
  • + + command + + + (#===, nil) + + + (defaults to: nil) + + + — +

    Value to check against received command

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+19
+20
+21
+22
+23
+
+
# File 'lib/openhab/dsl/rules/triggers/conditions/generic.rb', line 19
+
+def initialize(from: nil, to: nil, command: nil)
+  @from = from
+  @to = to
+  @command = command
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #from?Boolean + + + + + +

+
+

Returns true if a from condition was specified

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+47
+48
+49
+
+
# File 'lib/openhab/dsl/rules/triggers/conditions/generic.rb', line 47
+
+def from?
+  !@from.nil?
+end
+
+
+ +
+

+ + #process(mod:, inputs:) ⇒ true, false + + + + + +

+
+

Process rule

+ + +
+
+
+

Parameters:

+
    + +
  • + + inputs + + + (Hash) + + + + — +

    inputs from trigger

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    if the conditions passed (and therefore the block was run)

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+
+
# File 'lib/openhab/dsl/rules/triggers/conditions/generic.rb', line 32
+
+def process(mod:, inputs:)
+  logger.trace { "Checking #{inputs} against condition trigger #{self}" }
+  unless check_value(Conditions.old_state_from(inputs), @from) &&
+         check_value(Conditions.new_state_from(inputs), @to) &&
+         check_value(inputs["command"], @command)
+    return false
+  end
+
+  yield if block_given?
+  true
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Rules/Triggers/CronHandler/CronTriggerHandler.html b/5.33/OpenHAB/DSL/Rules/Triggers/CronHandler/CronTriggerHandler.html new file mode 100644 index 0000000000..ccfa89eed0 --- /dev/null +++ b/5.33/OpenHAB/DSL/Rules/Triggers/CronHandler/CronTriggerHandler.html @@ -0,0 +1,4060 @@ + + + + + + + Class: OpenHAB::DSL::Rules::Triggers::CronHandler::CronTriggerHandler + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Rules::Triggers::CronHandler::CronTriggerHandler + + + +

+
+ +
+
Inherits:
+
+ org.openhab.core.automation.handler.BaseTriggerModuleHandler + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/rules/triggers/cron/cron_handler.rb
+
+ +
+ +

Overview

+
+

Cron Trigger Handler that provides trigger IDs +Unfortunatly because the CronTriggerHandler in openHAB core is marked internal +the entire thing must be recreated here

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+

Constructor Details

+ +
+

+ + #initialize(trigger) ⇒ CronTriggerHandler + + + + + +

+
+

Creates a new CronTriggerHandler

+ + +
+
+
+

Parameters:

+ + + +
+ + + + +
+
+
+
+32
+33
+34
+35
+36
+37
+38
+
+
# File 'lib/openhab/dsl/rules/triggers/cron/cron_handler.rb', line 32
+
+def initialize(trigger)
+  @trigger = trigger
+  @scheduler = OSGi.service("org.openhab.core.scheduler.CronScheduler")
+  @schedule = nil
+  @expression = trigger.configuration.get("cronExpression")
+  super(trigger)
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #disposeObject + + + + + +

+
+

Dispose of the handler +cancel the cron scheduled task

+ + +
+
+
+ + +
+ + + + +
+
+
+
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+
+
# File 'lib/openhab/dsl/rules/triggers/cron/cron_handler.rb', line 71
+
+def dispose
+  synchronized do
+    super
+    return unless @schedule
+
+    @schedule.cancel(true)
+    @schedule = nil
+  end
+  logger.trace { "cancelled job for trigger '#{@trigger.id}'." }
+end
+
+
+ +
+

+ + #getTemporalAdjusterCronAdjuster + + + + + +

+
+

Get the temporal adjuster

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (CronAdjuster) + + + +
  • + +
+ +
+ + + + +
+
+
+
+56
+57
+58
+
+
# File 'lib/openhab/dsl/rules/triggers/cron/cron_handler.rb', line 56
+
+def getTemporalAdjuster # rubocop:disable Naming/MethodName
+  org.openhab.core.scheduler.CronAdjuster.new(@expression)
+end
+
+
+ +
+

+ + #runObject + + + + + +

+
+

Execute the callback

+ + +
+
+
+ + +
+ + + + +
+
+
+
+63
+64
+65
+
+
# File 'lib/openhab/dsl/rules/triggers/cron/cron_handler.rb', line 63
+
+def run
+  callback&.triggered(@trigger, { "module" => @trigger.id })
+end
+
+
+ +
+

+ + #setCallback(callback) ⇒ Object + + + + + +

+
+

Set the callback to execute when cron trigger fires

+ + +
+
+
+

Parameters:

+
    + +
  • + + callback + + + (Object) + + + + — +

    to run

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+44
+45
+46
+47
+48
+49
+50
+
+
# File 'lib/openhab/dsl/rules/triggers/cron/cron_handler.rb', line 44
+
+def setCallback(callback) # rubocop:disable Naming/MethodName
+  synchronized do
+    super(callback)
+    @schedule = @scheduler.schedule(self, @expression)
+    logger.trace { "Scheduled cron job '#{@expression}' for trigger '#{@trigger.id}'." }
+  end
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Rules/Triggers/CronHandler/CronTriggerHandlerFactory.html b/5.33/OpenHAB/DSL/Rules/Triggers/CronHandler/CronTriggerHandlerFactory.html new file mode 100644 index 0000000000..bcd4763819 --- /dev/null +++ b/5.33/OpenHAB/DSL/Rules/Triggers/CronHandler/CronTriggerHandlerFactory.html @@ -0,0 +1,3837 @@ + + + + + + + Class: OpenHAB::DSL::Rules::Triggers::CronHandler::CronTriggerHandlerFactory + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Rules::Triggers::CronHandler::CronTriggerHandlerFactory + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/rules/triggers/cron/cron_handler.rb
+
+ +
+ +

Overview

+
+

Implements the ScriptedTriggerHandlerFactory interface to create a new Cron Trigger Handler

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + +
+

Constructor Details

+ +
+

+ + #initializeCronTriggerHandlerFactory + + + + + +

+
+

Returns a new instance of CronTriggerHandlerFactory.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+
+
# File 'lib/openhab/dsl/rules/triggers/cron/cron_handler.rb', line 88
+
+def initialize
+  Core.automation_manager.add_trigger_handler(
+    Cron::CRON_TRIGGER_MODULE_ID,
+    self
+  )
+
+  Core.automation_manager.add_trigger_type(org.openhab.core.automation.type.TriggerType.new(
+                                             Cron::CRON_TRIGGER_MODULE_ID,
+                                             nil,
+                                             "A specific instant occurs",
+                                             "Triggers when the specified instant occurs",
+                                             nil,
+                                             org.openhab.core.automation.Visibility::VISIBLE,
+                                             nil
+                                           ))
+  logger.trace("Added script cron trigger handler")
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #get(trigger) ⇒ CronTriggerHandler + + + + + +

+
+

Invoked by openHAB core to get a trigger handler for the supplied trigger

+ + +
+
+
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (CronTriggerHandler) + + + + — +

    trigger handler for supplied trigger

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+110
+111
+112
+
+
# File 'lib/openhab/dsl/rules/triggers/cron/cron_handler.rb', line 110
+
+def get(trigger)
+  CronTriggerHandler.new(trigger)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Rules/Triggers/WatchHandler/WatchTriggerHandler.html b/5.33/OpenHAB/DSL/Rules/Triggers/WatchHandler/WatchTriggerHandler.html new file mode 100644 index 0000000000..e2b43a31e6 --- /dev/null +++ b/5.33/OpenHAB/DSL/Rules/Triggers/WatchHandler/WatchTriggerHandler.html @@ -0,0 +1,4451 @@ + + + + + + + Class: OpenHAB::DSL::Rules::Triggers::WatchHandler::WatchTriggerHandler + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Rules::Triggers::WatchHandler::WatchTriggerHandler + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/rules/triggers/watch/watch_handler.rb
+
+ +
+ +

Overview

+
+

Implements the openHAB TriggerHandler interface to process Watch Triggers

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + +
+

Constructor Details

+ +
+

+ + #initialize(trigger) ⇒ WatchTriggerHandler + + + + + +

+
+

Creates a new WatchTriggerHandler

+ + +
+
+
+

Parameters:

+ + + +
+ + + + +
+
+
+
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+
+
# File 'lib/openhab/dsl/rules/triggers/watch/watch_handler.rb', line 242
+
+def initialize(trigger)
+  @trigger = trigger
+  config = trigger.configuration.properties.to_hash.transform_keys(&:to_sym)
+  @path, subdirs, glob = self.class.dir_subdir_glob(config[:path], config[:glob])
+  logger.trace { "WatchTriggerHandler#initialize path: #{@path}, subdirs: #{subdirs}, glob: #{glob}" }
+  unless @path
+    logger.warn("Watch error: the given path doesn't exist: '#{@path}'")
+    return
+  end
+  @watcher = Watcher.new(@path, subdirs, config[:types], &watch_event_handler(glob))
+  @watcher.activate
+  logger.trace { "Created watcher for #{@path} subdirs: #{subdirs}" }
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .dir_subdir_glob(path, glob) ⇒ Array<String,Boolean,String>? + + + + + +

+
+

Returns the directory to watch, subdir flag, and glob pattern to use

+ + +
+
+
+

Parameters:

+
    + +
  • + + path + + + (String) + + + + — +

    The path provided to the watch trigger which may include glob patterns

    +
    + +
  • + +
  • + + glob + + + (String) + + + + — +

    The glob pattern provided by the user

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Array<String,Boolean,String>, nil) + + + + — +

    An array of directory to watch, +whether to watch in subdirectories, and the glob pattern to use. +Returns nil if the given path doesn't exist all the way to root, e.g. /nonexistent

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+
+
# File 'lib/openhab/dsl/rules/triggers/watch/watch_handler.rb', line 173
+
+def dir_subdir_glob(path, glob)
+  pathname = Pathname.new(path)
+  return [pathname.dirname.to_s, false, path] if pathname.file?
+
+  dir = find_parent(pathname)
+  return unless dir
+
+  # we were given the exact existing directory to watch
+  if dir == pathname
+    glob_pathname = Pathname.new(glob)
+    subdirs = recursive_glob?(glob)
+    unless glob_pathname.absolute? || glob.start_with?("**")
+      glob = subdirs ? "**/#{glob}" : "#{path}/#{glob}"
+    end
+    return [path, subdirs, glob]
+  end
+
+  if glob != "*" # if it isn't the default glob
+    logger.warn("The provided glob '#{glob}' is ignored because " \
+                "the given path (#{path}) isn't an existing directory, " \
+                "so it is used as the glob pattern")
+  end
+
+  relative_glob = pathname.relative_path_from(dir).to_s
+  subdir_flag = dir != pathname.dirname || recursive_glob?(relative_glob)
+  [dir.to_s, subdir_flag, path]
+end
+
+
+ +
+

+ + .find_parent(pathname) ⇒ Pathname? + + + + + +

+
+

Find the part of the path that exists on disk.

+

/a/b/c//d/.e -> /a/b/c if it exists +/a/b/c/d/e/f -> /a/b/c if /a/b/c directory exists, but /a/b/c/d doesn't exist +/a/b/c -> nil if /a doesn't exist +/ -> /

+ + +
+
+
+

Parameters:

+
    + +
  • + + pathname + + + (Pathname) + + + + — +

    The pathname to check

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Pathname, nil) + + + + — +

    The leading part of the path name that corresponds to +an existing directory. nil if none was found up until the root directory

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+232
+233
+234
+235
+236
+
+
# File 'lib/openhab/dsl/rules/triggers/watch/watch_handler.rb', line 232
+
+def find_parent(pathname)
+  return pathname if pathname.root?
+
+  pathname.ascend { |part| return part if part.directory? && !part.root? }
+end
+
+
+ +
+

+ + .glob?(string) ⇒ Boolean + + + + + +

+
+

Returns true if string contains glob characters

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+
+
# File 'lib/openhab/dsl/rules/triggers/watch/watch_handler.rb', line 202
+
+def glob?(string)
+  unless @regexp
+    # (?<!X) is a negative lookbehind pattern: only match the pattern if it wasn't
+    # preceded with X. In this case we want to match only non escaped glob chars
+    glob_pattern = %w[** * ? [ ] { }].map { |char| Regexp.escape(char) }
+                                     .join("|")
+                                     .then { |pattern| "(?<!\\\\)(#{pattern})" }
+
+    @regexp = Regexp.new(glob_pattern)
+  end
+  @regexp.match?(string)
+end
+
+
+ +
+

+ + .recursive_glob?(string) ⇒ Boolean + + + + + +

+
+

Returns true if string contains a recursive glob pattern (** or x/y)

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+216
+217
+218
+
+
# File 'lib/openhab/dsl/rules/triggers/watch/watch_handler.rb', line 216
+
+def recursive_glob?(string)
+  /(?<!\\\\)\*\*/.match?(string) || Pathname.new(string).each_filename.to_a.size > 1
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #disposeObject + + + + + +

+
+

Dispose of handler which deactivates watcher

+ + +
+
+
+ + +
+ + + + +
+
+
+
+284
+285
+286
+287
+
+
# File 'lib/openhab/dsl/rules/triggers/watch/watch_handler.rb', line 284
+
+def dispose
+  logger.trace { "Deactivating watcher for #{@path}" }
+  @watcher.deactivate
+end
+
+
+ +
+

+ + #setCallback(callback) ⇒ Object + + + + + +

+
+

Called by openHAB to set the rule engine to invoke when triggered

+ + +
+
+
+ + +
+ + + + +
+
+
+
+277
+278
+279
+
+
# File 'lib/openhab/dsl/rules/triggers/watch/watch_handler.rb', line 277
+
+def setCallback(callback) # rubocop:disable Naming/MethodName
+  @rule_engine_callback = callback
+end
+
+
+ +
+

+ + #watch_event_handler(glob) ⇒ Proc + + + + + +

+
+

Create a lambda to use to invoke rule engine when file watch notification happens

+ + +
+
+
+

Parameters:

+
    + +
  • + + glob + + + (String) + + + + — +

    to match for notification events

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Proc) + + + + — +

    lambda to execute on notification events

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+
+
# File 'lib/openhab/dsl/rules/triggers/watch/watch_handler.rb', line 261
+
+def watch_event_handler(glob)
+  default_fs = java.nio.file.FileSystems.default
+  path_matcher = default_fs.get_path_matcher("glob:#{glob}")
+  lambda do |watch_event|
+    if path_matcher.matches(default_fs.get_path(watch_event.path.to_s))
+      logger.trace do
+        "Received event(#{watch_event}) glob: #{glob}, rule_engine_callback = #{@rule_engine_callback}"
+      end
+      @rule_engine_callback&.triggered(@trigger, { "event" => watch_event })
+    else
+      logger.trace { "Event #{watch_event} did not match glob(#{glob})" }
+    end
+  end
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Rules/Triggers/WatchHandler/WatchTriggerHandlerFactory.html b/5.33/OpenHAB/DSL/Rules/Triggers/WatchHandler/WatchTriggerHandlerFactory.html new file mode 100644 index 0000000000..6c078e19c0 --- /dev/null +++ b/5.33/OpenHAB/DSL/Rules/Triggers/WatchHandler/WatchTriggerHandlerFactory.html @@ -0,0 +1,3837 @@ + + + + + + + Class: OpenHAB::DSL::Rules::Triggers::WatchHandler::WatchTriggerHandlerFactory + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Rules::Triggers::WatchHandler::WatchTriggerHandlerFactory + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/rules/triggers/watch/watch_handler.rb
+
+ +
+ +

Overview

+
+

Implements the ScriptedTriggerHandlerFactory interface to create a new Trigger Handler

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + +
+

Constructor Details

+ +
+

+ + #initializeWatchTriggerHandlerFactory + + + + + +

+
+

Returns a new instance of WatchTriggerHandlerFactory.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+
+
# File 'lib/openhab/dsl/rules/triggers/watch/watch_handler.rb', line 295
+
+def initialize
+  Core.automation_manager.add_trigger_handler(
+    WATCH_TRIGGER_MODULE_ID,
+    self
+  )
+
+  Core.automation_manager.add_trigger_type(org.openhab.core.automation.type.TriggerType.new(
+                                             WATCH_TRIGGER_MODULE_ID,
+                                             nil,
+                                             "a path change event is detected",
+                                             "Triggers when a path change event is detected",
+                                             nil,
+                                             org.openhab.core.automation.Visibility::VISIBLE,
+                                             nil
+                                           ))
+  logger.trace("Added watch trigger handler")
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #get(trigger) ⇒ WatchTriggerHandler + + + + + +

+
+

Invoked by openHAB core to get a trigger handler for the supplied trigger

+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+317
+318
+319
+
+
# File 'lib/openhab/dsl/rules/triggers/watch/watch_handler.rb', line 317
+
+def get(trigger)
+  WatchTriggerHandler.new(trigger)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Rules/Triggers/WatchHandler/Watcher.html b/5.33/OpenHAB/DSL/Rules/Triggers/WatchHandler/Watcher.html new file mode 100644 index 0000000000..53974ac806 --- /dev/null +++ b/5.33/OpenHAB/DSL/Rules/Triggers/WatchHandler/Watcher.html @@ -0,0 +1,4276 @@ + + + + + + + Class: OpenHAB::DSL::Rules::Triggers::WatchHandler::Watcher + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Rules::Triggers::WatchHandler::Watcher + + Deprecated + +

+
+ +
+
Inherits:
+
+ org.openhab.core.service.AbstractWatchService + + + show all + +
+
+ + + + + + +
+
Includes:
+
org.openhab.core.service.WatchService::WatchEventListener
+
+ + + + + + +
+
Defined in:
+
lib/openhab/dsl/rules/triggers/watch/watch_handler.rb,
+ lib/openhab/dsl/rules/triggers/watch/watch_handler.rb
+
+
+ +
+ +

Overview

+
+
Deprecated.

OH3.4

+
+

Extends the openHAB3 watch service to watch directories

+

Must match java method name style +rubocop:disable Naming/MethodName

+ + +
+
+
+ + +
+ +

+ Constant Summary + collapse +

+ +
+ +
WatchService = + +
+
org.openhab.core.service.WatchService
+ +
STRING_TO_EVENT = +
+
+

Hash of event symbols as strings to map to NIO events

+ + +
+
+
+ + +
+
+
{
+  created: StandardWatchEventKinds::ENTRY_CREATE,
+  deleted: StandardWatchEventKinds::ENTRY_DELETE,
+  modified: StandardWatchEventKinds::ENTRY_MODIFY
+}.transform_keys(&:to_s).freeze
+ +
EVENT_TO_SYMBOL = +
+
+

Hash of NIO event kinds to ruby symbols

+ + +
+
+
+ + +
+
+
STRING_TO_EVENT.invert.transform_values(&:to_sym).freeze
+ +
StandardWatchEventKinds = + +
+
java.nio.file.StandardWatchEventKinds
+ +
+ + + + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + +
+

Constructor Details

+ +
+

+ + #initialize(path, subdirs, types, &block) ⇒ Watcher + + + + + +

+
+

Creates a new Watch Service

+ + +
+
+
+ + +
+ + + + +
+
+
+
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+
+
# File 'lib/openhab/dsl/rules/triggers/watch/watch_handler.rb', line 44
+
+def initialize(path, subdirs, types, &block)
+  @types = types.map { |type| STRING_TO_EVENT[type] }
+  @block = block
+  @subdirs = subdirs
+  @path = Pathname.new(path)
+  @custom_watcher = nil
+  return if path.to_s.start_with?(OpenHAB::Core.config_folder.to_s)
+
+  @custom_watcher = "jrubyscripting-#{SecureRandom.uuid}"
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #activateObject + + + + + +

+
+

Creates a new Watch Service and registers ourself as a listener +This isn't an OSGi service, but it's called by OpenHAB::DSL::Rules::Triggers::WatchHandler::WatchTriggerHandler below.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+
+
# File 'lib/openhab/dsl/rules/triggers/watch/watch_handler.rb', line 57
+
+def activate
+  java_path = java.nio.file.Path.of(@path.to_s)
+
+  service_name = WatchService::SERVICE_PID
+  filter = if @custom_watcher
+             WatchHandler.factory.create_watch_service(@custom_watcher, java_path)
+             logger.trace { "Created a watch service #{@custom_watcher} for #{@path}" }
+             "(name=#{@custom_watcher})"
+           else
+             logger.trace { "Using configWatcher service for #{@path}" }
+             WatchService::CONFIG_WATCHER_FILTER
+           end
+
+  start = Time.now
+  sleep 0.1 until (@watch_service = OSGi.service(service_name, filter: filter)) || Time.now - start > 2
+
+  unless @watch_service
+    logger.warn("Watch service is not ready in time. #{@path} will not be monitored!")
+    return
+  end
+
+  @watch_service.register_listener(self, java_path, @subdirs)
+  logger.trace { "Registered watch service listener for #{@path} including subdirs: #{@subdirs}" }
+end
+
+
+ +
+

+ + #deactivateObject + + + + + +

+
+

Unregister ourself as a listener and remove the watch service

+ + +
+
+
+ + +
+ + + + +
+
+
+
+83
+84
+85
+86
+87
+88
+89
+
+
# File 'lib/openhab/dsl/rules/triggers/watch/watch_handler.rb', line 83
+
+def deactivate
+  @watch_service&.unregister_listener(self)
+  return unless @custom_watcher
+
+  WatchHandler.factory.remove_watch_service(@custom_watcher)
+  logger.trace { "Removed watch service #{@custom_watcher} for #{@path}" }
+end
+
+
+ +
+

+ + #getWatchEventKinds(_path) ⇒ Array + + + + + +

+
+

Invoked by java super class to get type of events to watch for

+ + +
+
+
+

Parameters:

+
    + +
  • + + _path + + + (String) + + + + — +

    ignored

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Array) + + + + — +

    array of NIO event kinds

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+136
+137
+138
+
+
# File 'lib/openhab/dsl/rules/triggers/watch/watch_handler.rb', line 136
+
+def getWatchEventKinds(_path)
+  @types
+end
+
+
+ +
+

+ + #processWatchEvent(_event, kind, path) ⇒ Object + + + + + +

+
+

Invoked by java super class when a watch event occurs

+ + +
+
+
+

Parameters:

+
    + +
  • + + _event + + + (String) + + + + — +

    ignored

    +
    + +
  • + +
  • + + kind + + + (StandardWatchEventKind) + + + + — +

    NIO watch event kind

    +
    + +
  • + +
  • + + path + + + (java.nio.file.Path) + + + + — +

    that had an event

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+94
+95
+96
+97
+98
+99
+100
+101
+102
+
+
# File 'lib/openhab/dsl/rules/triggers/watch/watch_handler.rb', line 94
+
+def processWatchEvent(kind, path) # rubocop:disable Naming/MethodName
+  logger.trace { "processWatchEvent triggered #{path} #{kind} #{@types}" }
+  return unless @types.include?(kind)
+
+  # OH4 WatchService feeds us a relative path,
+  # but just in case its implementation changes in the future
+  path = path.absolute? ? Pathname.new(path.to_s) : @path + path.to_s
+  @block.call(Events::WatchEvent.new(EVENT_TO_SYMBOL[kind], path))
+end
+
+
+ +
+

+ + #watchSubDirectoriesfalse + + + + + +

+
+

Invoked by java super class to check if sub directories should be watched

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (false) + + + + — +

    false

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+142
+143
+144
+145
+
+
# File 'lib/openhab/dsl/rules/triggers/watch/watch_handler.rb', line 142
+
+def watchSubDirectories
+  logger.trace { "watchSubDirectories returning #{@subdirs}" }
+  @subdirs
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps.html b/5.33/OpenHAB/DSL/Sitemaps.html new file mode 100644 index 0000000000..0931c8dcd9 --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps.html @@ -0,0 +1,3608 @@ + + + + + + + Module: OpenHAB::DSL::Sitemaps + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::DSL::Sitemaps + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Contains the various builders for sitemap elements.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + + + Classes: Builder, ButtonBuilder, ButtongridBuilder, ChartBuilder, ColorpickerBuilder, ColortemperaturepickerBuilder, DefaultBuilder, FrameBuilder, GroupBuilder, ImageBuilder, InputBuilder, LinkableWidgetBuilder, MapviewBuilder, SelectionBuilder, SetpointBuilder, SitemapBuilder, SliderBuilder, SwitchBuilder, TextBuilder, VideoBuilder, WebviewBuilder, WidgetBuilder + + +

+ + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/Builder.html b/5.33/OpenHAB/DSL/Sitemaps/Builder.html new file mode 100644 index 0000000000..f7fc8f0a86 --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/Builder.html @@ -0,0 +1,3812 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::Builder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::Builder + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

A sitemap builder allows you to dynamically create openHAB sitemaps at runtime.

+ + +
+
+
+ +
+

Examples:

+ + +
sitemaps.build do
+  sitemap "demo", label: "My home automation" do
+    frame label: "Date" do
+      text item: Date
+    end
+    frame label: "Demo" do
+      switch item: Lights, icon: "light"
+      text item: LR_Temperature, label: "Livingroom [%.1f °C]"
+      group item: Heating
+      text item: LR_Multimedia_Summary, label: "Multimedia [%s]", static_icon: "video" do
+        selection item: LR_TV_Channel,
+                  mappings: { 0 => "off", 1 => "DasErste", 2 => "BBC One", 3 => "Cartoon Network" }
+        slider item: LR_TV_Volume
+      end
+    end
+  end
+end
+ +
+ + +

See Also:

+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #sitemap(name, label: nil, icon: nil) { ... } ⇒ SitemapBuilder + + + + + +

+
+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String) + + + +
  • + +
  • + + label + + + (String, nil) + + + (defaults to: nil) + + +
  • + +
  • + + icon + + + (String, nil) + + + (defaults to: nil) + + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block executed in the context of a SitemapBuilder

    +
    + +
  • + +
+

Returns:

+ + +
+ + + + +
+
+
+
+51
+52
+53
+54
+55
+56
+57
+58
+59
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 51
+
+def sitemap(name, label: nil, icon: nil, &block)
+  sitemap = SitemapBuilder.new(name, @builder_proxy, label: label, icon: icon, &block)
+  sitemap = sitemap.build
+  if @update && @provider.get(sitemap.uid)
+    @provider.update(sitemap)
+  else
+    @provider.add(sitemap)
+  end
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/ButtonBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/ButtonBuilder.html new file mode 100644 index 0000000000..5ab96e487e --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/ButtonBuilder.html @@ -0,0 +1,4282 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::ButtonBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::ButtonBuilder + + + +

+
+ +
+
Inherits:
+
+ WidgetBuilder + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Builds a Button element

+

This element can only exist within a Buttongrid element.

+ + +
+
+
+ + +

See Also:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #click ⇒ String, Command + + + + + + + + + + + + + + + + +

    The command to send when the button is pressed.

    +
    + +
  • + + +
  • + + + #column ⇒ Integer + + + + + + + + + + + + + + + + +

    The column in which the button is placed.

    +
    + +
  • + + +
  • + + + #release ⇒ String, ... + + + + + + + + + + + + + + + + +

    The command to send when the button is released.

    +
    + +
  • + + +
  • + + + #row ⇒ Integer + + + + + + + + + + + + + + + + +

    The row in which the button is placed.

    +
    + +
  • + + +
  • + + + #stateless ⇒ true, ... + + + + + + + + + + writeonly + + + + + + + + +

    Whether the button is stateless.

    +
    + +
  • + + +
+ + + + + +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #clickString, Command + + + + + +

+
+

The command to send when the button is pressed

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, Command) + + + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+780
+781
+782
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 780
+
+def click
+  @click
+end
+
+
+ + + +
+

+ + #columnInteger + + + + + +

+
+

The column in which the button is placed

+ + +
+
+
+ +

Returns:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+776
+777
+778
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 776
+
+def column
+  @column
+end
+
+
+ + + +
+

+ + #releaseString, ... + + + + + +

+
+

The command to send when the button is released

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, Command, nil) + + + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+784
+785
+786
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 784
+
+def release
+  @release
+end
+
+
+ + + +
+

+ + #rowInteger + + + + + +

+
+

The row in which the button is placed

+ + +
+
+
+ +

Returns:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+772
+773
+774
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 772
+
+def row
+  @row
+end
+
+
+ + + +
+

+ + #stateless=(value) ⇒ true, ... (writeonly) + + + + + +

+
+

Whether the button is stateless

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false, nil) + + + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+788
+789
+790
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 788
+
+def stateless=(value)
+  @stateless = value
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #stateless?true, ... + + + + + +

+
+

Whether the button is stateless

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false, nil) + + + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.2

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+823
+824
+825
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 823
+
+def stateless?
+  @stateless
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/ButtongridBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/ButtongridBuilder.html new file mode 100644 index 0000000000..1a67b76f80 --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/ButtongridBuilder.html @@ -0,0 +1,4169 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::ButtongridBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::ButtongridBuilder + + + +

+
+ +
+
Inherits:
+
+ LinkableWidgetBuilder + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Builds a Buttongrid element

+ + +
+
+
+ + +

See Also:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.1

    +
    + +
  • + +
+ +

Defined Under Namespace

+

+ + + Modules: Buttongrid + + + + +

+ + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods inherited from LinkableWidgetBuilder

+

#buttongrid, #chart, #colorpicker, #colortemperaturepicker, #default, #frame, #group, #image, #input, #mapview, #selection, #setpoint, #slider, #switch, #text, #video, #webview

+ + + + + + + + + +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #button(row = nil, column = nil, click = nil, label = nil, icon = nil, item: nil, label: nil, icon: nil, static_icon: nil, row: , column: , click: , release: nil, stateless: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil) ⇒ ButtonBuilder + + + + + +

+
+

Adds a button inside the buttongrid

+
    +
  • +

    In openHAB 4.1, buttons are direct properties of the buttongrid. +Only row, column, click, label (optional), and icon (optional) are used. +All the other parameters are ignored. +All the buttons will send commands to the same item assigned to the buttongrid.

    +
  • +
  • +

    In openHAB 4.2+, buttons are widgets within the containing buttongrid, and they +support all the parameters listed in the method signature such as +release, label_color, visibility, etc. +Each Button element has an item associated with that button. +When an item is not specified for the button, it will default to the containing buttongrid's item.

    +
  • +
+

This method supports positional arguments and/or keyword arguments. +Their use can be mixed, however, the keyword arguments will override the positional arguments +when both are specified.

+ + +
+
+
+ +
+

Examples:

+ + +

Adding buttons to a buttongrid with positional arguments

+

+ +
sitemaps.build do
+  sitemap "remote" do
+    buttongrid item: RCButton do
+      button 1, 1, "BACK", "Back", "f7:return"
+      button 1, 2, "HOME", "Menu", "material:apps"
+      button 1, 3, "YELLOW", "Search", "f7:search"
+      button 2, 2, "UP", "Up", "f7:arrowtriangle_up"
+      button 4, 2, "DOWN", "Down", "f7:arrowtriangle_down"
+      button 3, 1, "LEFT", "Left", "f7:arrowtriangle_left"
+      button 3, 3, "RIGHT", "Right", "f7:arrowtriangle_right"
+      button 3, 2, "ENTER", "Enter", "material:adjust"
+    end
+  end
+end
+ + +

Adding buttons to a buttongrid with keyword arguments

+

+ +
sitemaps.build do
+  sitemap "remote" do
+    buttongrid item: RCButton do
+      # These buttons will use the default item assigned to the buttongrid (RCButton)
+      button row: 1, column: 1, click: "BACK", icon: "f7:return"
+      button row: 1, column: 2, click: "HOME", icon: "material:apps"
+      button row: 1, column: 3, click: "YELLOW", icon: "f7:search"
+      button row: 2, column: 2, click: "UP", icon: "f7:arrowtriangle_up"
+      button row: 4, column: 2, click: "DOWN", icon: "f7:arrowtriangle_down"
+      button row: 3, column: 1, click: "LEFT", icon: "f7:arrowtriangle_left"
+      button row: 3, column: 3, click: "RIGHT", icon: "f7:arrowtriangle_right"
+      button row: 3, column: 2, click: "ENTER", icon: "material:adjust"
+    end
+  end
+end
+ + +

Mixing positional and keyword arguments

+

+ +
sitemaps.build do
+  sitemap "remote" do
+    buttongrid item: RCButton do
+      button 1, 1, click: "BACK", icon: "f7:return"
+      button 1, 2, click: "HOME", icon: "material:apps"
+      button 1, 3, click: "YELLOW", icon: "f7:search"
+      button 2, 2, click: "UP", icon: "f7:arrowtriangle_up"
+      button 4, 2, click: "DOWN", icon: "f7:arrowtriangle_down"
+      button 3, 1, click: "LEFT", icon: "f7:arrowtriangle_left"
+      button 3, 3, click: "RIGHT", icon: "f7:arrowtriangle_right"
+      button 3, 2, click: "ENTER", icon: "material:adjust"
+    end
+  end
+end
+ + +

openHAB 4.2+ supports assigning different items to buttons, along with additional features

+

+ +
sitemaps.build do
+  sitemap "remote" do
+    buttongrid item: RCButton do
+      button 1, 1, click: "BACK", icon: "f7:return"
+      button 1, 2, click: "HOME", icon: "material:apps"
+      button 1, 3, click: "YELLOW", icon: "f7:search", icon_color: "yellow"
+      button 2, 2, click: "UP", icon: "f7:arrowtriangle_up"
+      button 4, 2, click: "DOWN", icon: "f7:arrowtriangle_down"
+      button 3, 1, click: "LEFT", icon: "f7:arrowtriangle_left"
+      button 3, 3, click: "RIGHT", icon: "f7:arrowtriangle_right"
+      button 3, 2, click: "ENTER", icon: "material:adjust", icon_color: "red"
+
+      # These buttons will use the specified item, only supported in openHAB 4.2+
+      button 4, 3, click: ON, static_icon: "switch-off", visibility: "TVPower!=ON", item: TVPower
+      button 4, 3, click: OFF, static_icon: "switch-on", visibility: "TVPower==ON", item: TVPower
+    end
+  end
+end
+ +
+

Parameters:

+ + +

Returns:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.1

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1436
+1437
+1438
+1439
+1440
+1441
+1442
+1443
+1444
+1445
+1446
+1447
+1448
+1449
+1450
+1451
+1452
+1453
+1454
+1455
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 1436
+
+def button(row = nil, column = nil, click = nil, label = nil, icon = nil, **kwargs, &block)
+  args = [row, column, click, label, icon].compact
+
+  args = args.first if args.first.is_a?(Array)
+  kwargs = %i[row column click label icon].zip(args).to_h.compact.merge(kwargs)
+
+  missing_args = (REQUIRED_BUTTON_ARGS - kwargs.keys).compact
+  unless missing_args.empty?
+    args = kwargs.map { |k, v| "#{k}: #{v.inspect}" }.join(", ")
+    missing_args = missing_args.map(&:to_s).join(", ")
+    raise ArgumentError, "button(#{args}) missing required parameters: #{missing_args}"
+  end
+
+  kwargs[:item] ||= item if item # default to the buttongrid's item
+  kwargs[:label] ||= kwargs[:click].to_s
+
+  ButtonBuilder.new(@builder_proxy, **kwargs, &block).tap do |b|
+    children << b
+  end
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/ButtongridBuilder/Buttongrid.html b/5.33/OpenHAB/DSL/Sitemaps/ButtongridBuilder/Buttongrid.html new file mode 100644 index 0000000000..c4e30b349d --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/ButtongridBuilder/Buttongrid.html @@ -0,0 +1,3707 @@ + + + + + + + Module: OpenHAB::DSL::Sitemaps::ButtongridBuilder::Buttongrid + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::DSL::Sitemaps::ButtongridBuilder::Buttongrid + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+ + +
+
+
+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.1

    +
    + +
  • + +
+ +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #childrenObject + + + + + +

+
+ + +
+
+
+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.1

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1268
+1269
+1270
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 1268
+
+def children
+  buttons
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/ChartBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/ChartBuilder.html new file mode 100644 index 0000000000..c108042766 --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/ChartBuilder.html @@ -0,0 +1,4378 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::ChartBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::ChartBuilder + + + +

+
+ +
+
Inherits:
+
+ WidgetBuilder + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+ + +

See Also:

+ + +
+ +

+ Constant Summary + collapse +

+ +
+ +
VALID_PERIODS = +
+
+

Valid #period values

+ + +
+
+
+ + +
+
+
%i[h 4h 8h 12h D 2D 3D W 2W M 2M 4M Y].freeze
+ +
+ + + + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #group ⇒ true, ... + + + + + + + + + + writeonly + + + + + + + + +

    Show the value of a GroupItem instead of showing a graph for each member (which is the default).

    +
    + +
  • + + +
  • + + + #legend ⇒ true, ... + + + + + + + + + + writeonly + + + + + + + + +

    Always show the legend, never show the legend, or automatically show the legend if there is more than one series in the chart.

    +
    + +
  • + + +
  • + + + #period ⇒ :h, ... + + + + + + + + + + + + + + + + +

    Time axis scale.

    +
    + +
  • + + +
  • + + + #refresh ⇒ Numeric? + + + + + + + + + + + + + + + + +

    How often to refresh the chart (in seconds).

    +
    + +
  • + + +
  • + + + #service ⇒ String? + + + + + + + + + + + + + + + + +

    The persistence service to use.

    +
    + +
  • + + +
  • + + + #y_axis_pattern ⇒ String? + + + + + + + + + + + + + + + + +

    Formatting string for values on the y axis.

    +
    + +
  • + + +
+ + + + + +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + +

+ Instance Method Summary + collapse +

+ + + +
    + +
  • + + + #group? ⇒ true, ... + + + + + + + + + + + + + +

    Show the value of a GroupItem instead of showing a graph for each member (which is the default).

    +
    + +
  • + + +
  • + + + #legend? ⇒ true, ... + + + + + + + + + + + + + +

    Always show the legend, never show the legend, or automatically show the legend if there is more than one series in the chart.

    +
    + +
  • + + +
+ + + + + + + + + + + + +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #group=(value) ⇒ true, ... (writeonly) + + + + + +

+
+

Show the value of a GroupItem instead of +showing a graph for each member (which is the default).

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+544
+545
+546
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 544
+
+def group=(value)
+  @group = value
+end
+
+
+ + + +
+

+ + #legend=(value) ⇒ true, ... (writeonly) + + + + + +

+
+

Always show the legend, never show the legend, or automatically show +the legend if there is more than one series in the chart.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+540
+541
+542
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 540
+
+def legend=(value)
+  @legend = value
+end
+
+
+ + + +
+

+ + #period:h, ... + + + + + +

+
+

Time axis scale

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (:h, :"4h", :"8h", :"12h", :D, :"2D", :"3D", :W, :"2W", :M, :"2M", :"4M", :Y, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+536
+537
+538
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 536
+
+def period
+  @period
+end
+
+
+ + + +
+

+ + #refreshNumeric? + + + + + +

+
+

How often to refresh the chart (in seconds)

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Numeric, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+533
+534
+535
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 533
+
+def refresh
+  @refresh
+end
+
+
+ + + +
+

+ + #serviceString? + + + + + +

+
+

The persistence service to use

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+530
+531
+532
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 530
+
+def service
+  @service
+end
+
+
+ + + +
+

+ + #y_axis_patternString? + + + + + +

+
+

Formatting string for values on the y axis.

+ + +
+
+
+ +
+

Examples:

+ + +
"#.##" # => formats a number with two decimals.
+ +
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+550
+551
+552
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 550
+
+def y_axis_pattern
+  @y_axis_pattern
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #group?true, ... + + + + + +

+
+

Show the value of a GroupItem instead of +showing a graph for each member (which is the default).

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+600
+601
+602
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 600
+
+def group?
+  @group
+end
+
+
+ +
+

+ + #legend?true, ... + + + + + +

+
+

Always show the legend, never show the legend, or automatically show +the legend if there is more than one series in the chart.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+595
+596
+597
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 595
+
+def legend?
+  @legend
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/ColorpickerBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/ColorpickerBuilder.html new file mode 100644 index 0000000000..1478e663d3 --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/ColorpickerBuilder.html @@ -0,0 +1,3757 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::ColorpickerBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::ColorpickerBuilder + + + +

+
+ +
+
Inherits:
+
+ WidgetBuilder + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Builds a Colorpicker element

+ + +
+
+ + + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #frequency ⇒ Numeric? + + + + + + + + + + + + + + + + +

    How often to send requests (in seconds).

    +
    + +
  • + + +
+ + + + + +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #frequencyNumeric? + + + + + +

+
+

Returns How often to send requests (in seconds).

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Numeric, nil) + + + + — +

    How often to send requests (in seconds)

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+672
+673
+674
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 672
+
+def frequency
+  @frequency
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/ColortemperaturepickerBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/ColortemperaturepickerBuilder.html new file mode 100644 index 0000000000..c1d7e9985d --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/ColortemperaturepickerBuilder.html @@ -0,0 +1,3781 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::ColortemperaturepickerBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::ColortemperaturepickerBuilder + + + +

+
+ +
+
Inherits:
+
+ WidgetBuilder + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Builds a Colortemperaturepicker element

+ + +
+
+
+ + +

See Also:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.3

    +
    + +
  • + +
+ +
+ + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #range ⇒ Range? + + + + + + + + + + + + + + + + +

    Allowed range of the value.

    +
    + +
  • + + +
+ + + + + +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #rangeRange? + + + + + +

+
+

Allowed range of the value

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Range, nil) + + + +
  • + +
+

Since:

+
    + +
  • + + + + + +

    openHAB 4.3

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+698
+699
+700
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 698
+
+def range
+  @range
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/DefaultBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/DefaultBuilder.html new file mode 100644 index 0000000000..ae0f736c67 --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/DefaultBuilder.html @@ -0,0 +1,3761 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::DefaultBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::DefaultBuilder + + + +

+
+ +
+
Inherits:
+
+ WidgetBuilder + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Builds a Default element

+ + +
+
+
+

Direct Known Subclasses

+

MapviewBuilder, WebviewBuilder

+
+ + + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #height ⇒ Integer + + + + + + + + + + + + + + + + +

    The number of element rows to fill.

    +
    + +
  • + + +
+ + + + + +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #heightInteger + + + + + +

+
+

Returns The number of element rows to fill.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +

    The number of element rows to fill

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+621
+622
+623
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 621
+
+def height
+  @height
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/FrameBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/FrameBuilder.html new file mode 100644 index 0000000000..3c5a729eb3 --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/FrameBuilder.html @@ -0,0 +1,3675 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::FrameBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::FrameBuilder + + + +

+
+ +
+
Inherits:
+
+ LinkableWidgetBuilder + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Builds a Frame element

+ + +
+
+ + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from LinkableWidgetBuilder

+

#buttongrid, #chart, #colorpicker, #colortemperaturepicker, #default, #frame, #group, #image, #input, #mapview, #selection, #setpoint, #slider, #switch, #text, #video, #webview

+ + + + + + + + + +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/GroupBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/GroupBuilder.html new file mode 100644 index 0000000000..9185254d68 --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/GroupBuilder.html @@ -0,0 +1,3675 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::GroupBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::GroupBuilder + + + +

+
+ +
+
Inherits:
+
+ LinkableWidgetBuilder + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Builds a Group element

+ + +
+
+ + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from LinkableWidgetBuilder

+

#buttongrid, #chart, #colorpicker, #colortemperaturepicker, #default, #frame, #group, #image, #input, #mapview, #selection, #setpoint, #slider, #switch, #text, #video, #webview

+ + + + + + + + + +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/ImageBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/ImageBuilder.html new file mode 100644 index 0000000000..492285deba --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/ImageBuilder.html @@ -0,0 +1,3866 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::ImageBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::ImageBuilder + + + +

+
+ +
+
Inherits:
+
+ LinkableWidgetBuilder + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Builds an Image element

+

item can refer to either an +ImageItem whose state is the raw data of the +image, or a StringItem whose state is a URL +that points to an image.

+ + +
+
+ + + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #refresh ⇒ Numeric? + + + + + + + + + + + + + + + + +

    How often to refresh the image (in seconds).

    +
    + +
  • + + +
  • + + + #url ⇒ String? + + + + + + + + + + + + + + + + +

    The default URL for the image, if there is no associated item, or if the associated item's state is not a URL.

    +
    + +
  • + + +
+ + + + + +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from LinkableWidgetBuilder

+

#buttongrid, #chart, #colorpicker, #colortemperaturepicker, #default, #frame, #group, #image, #input, #mapview, #selection, #setpoint, #slider, #switch, #text, #video, #webview

+ + + + + + + + + +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #refreshNumeric? + + + + + +

+
+

Returns How often to refresh the image (in seconds).

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Numeric, nil) + + + + — +

    How often to refresh the image (in seconds)

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1226
+1227
+1228
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 1226
+
+def refresh
+  @refresh
+end
+
+
+ + + +
+

+ + #urlString? + + + + + +

+
+

Returns The default URL for the image, if there is no associated item, or +if the associated item's state is not a URL.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + + — +

    The default URL for the image, if there is no associated item, or +if the associated item's state is not a URL

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1224
+1225
+1226
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 1224
+
+def url
+  @url
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/InputBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/InputBuilder.html new file mode 100644 index 0000000000..c4c405d8a7 --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/InputBuilder.html @@ -0,0 +1,3783 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::InputBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::InputBuilder + + + +

+
+ +
+
Inherits:
+
+ WidgetBuilder + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Builds an Input element

+ + +
+
+ + +

+ Constant Summary + collapse +

+ +
+ +
VALID_HINTS = +
+
+

Valid #hint values

+ + +
+
+
+ + +
+
+
%i[text number date time datetime].freeze
+ +
+ + + + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #hint ⇒ :text, ... + + + + + + + + + + + + + + + + +

    Gives a hint to the user interface to use a widget adapted to a specific use.

    +
    + +
  • + + +
+ + + + + +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #hint:text, ... + + + + + +

+
+

Returns Gives a hint to the user interface to use a widget adapted to a specific use.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (:text, :number, :date, :time, :datetime, nil) + + + + — +

    Gives a hint to the user interface to use a widget adapted to a specific use

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+734
+735
+736
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 734
+
+def hint
+  @hint
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html new file mode 100644 index 0000000000..b7edaadffd --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html @@ -0,0 +1,8116 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder + + + +

+
+ +
+
Inherits:
+
+ WidgetBuilder + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Parent class for builders of widgets that can contain other widgets.

+ + +
+
+ + + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #buttongrid(item: nil, label: nil, icon: nil, static_icon: nil, buttons: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil) { ... } ⇒ ButtongridBuilder + + + + + +

+
+

One or more visibility rules (see WidgetBuilder#visibility) +Create a new Buttongrid element.

+ + +
+
+
+ +
+

Examples:

+ + +

Create a buttongrid with buttons as an argument

+

+ +
# This creates a buttongrid to emulate a TV remote control
+sitemaps.build do
+  sitemap "remote", label: "TV Remote Control" do
+    buttongrid item: LivingRoom_TV_RCButton, buttons: [
+      [1, 1, "BACK", "Back", "f7:return"],
+      [1, 2, "HOME", "Menu", "material:apps"],
+      [1, 3, "YELLOW", "Search", "f7:search"],
+      [2, 2, "UP", "Up", "f7:arrowtriangle_up"],
+      [4, 2, "DOWN", "Down", "f7:arrowtriangle_down"],
+      [3, 1, "LEFT", "Left", "f7:arrowtriangle_left"],
+      [3, 3, "RIGHT", "Right", "f7:arrowtriangle_right"],
+
+      # Using keyword arguments:
+      {row: 3, column: 2, click: "ENTER", label: "Enter", icon: "material:adjust" }
+    ]
+  end
+end
+ + +

Create a buttongrid with button widgets

+

+ +
sitemaps.build do
+  sitemap "remote", label: "TV Remote Control" do
+    buttongrid item: LivingRoom_TV_RCButton do
+      button 1, 1, click: "BACK", icon: "f7:return"
+      button 1, 2, click: "HOME", icon: "material:apps"
+      button 1, 3, click: "YELLOW", icon: "f7:search"
+      button 2, 2, click: "UP", icon: "f7:arrowtriangle_up"
+      button 4, 2, click: "DOWN", icon: "f7:arrowtriangle_down"
+      button 3, 1, click: "LEFT", icon: "f7:arrowtriangle_left"
+      button 3, 3, click: "RIGHT", icon: "f7:arrowtriangle_right"
+      button 3, 2, click: "ENTER", icon: "material:adjust"
+    end
+
+    # The following buttons use widget features introduced in openHAB 4.2+
+    buttongrid item: LivingRoom_Curtain do
+      button 1, 1, click: "up", release: "stop", icon: "f7:arrowtriangle_up"
+      button 2, 1, click: "down", release: "stop", icon: "f7:arrowtriangle_up"
+    end
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + item + + + (String, Core::Items::Item, nil) + + + (defaults to: nil) + + + — +

    The item whose state to show (see WidgetBuilder#item)

    +
    + +
  • + +
  • + + label + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + icon + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + static_icon + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + label_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more label color rules (see WidgetBuilder#label_color)

    +
    + +
  • + +
  • + + value_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more value color rules (see WidgetBuilder#value_color)

    +
    + +
  • + +
  • + + icon_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more icon color rules (see WidgetBuilder#icon_color)

    +
    + +
  • + +
  • + + visibility + + + (String, Core::Types::State, Array<String>, Array<Core::Types::State>, Array<Array<String>>, nil) + + + (defaults to: nil) + + +
  • + +
  • + + buttons + + + (Array<Array<int, int, Command, String, String>>) + + + (defaults to: nil) + + + — +

    An array of buttons to display. +Each element can be a hash with keyword arguments (see ButtongridBuilder#button), +or an array with the following elements:

    +
      +
    • row: 1-12
    • +
    • column: 1-12
    • +
    • click: The command to send when the button is pressed
    • +
    • label: The label to display on the button (optional)
    • +
    • icon: The icon to display on the button (optional)
    • +
    +
    + +
  • + +
+ +

Yields:

+ +

Returns:

+ + +

See Also:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.1

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 209
+
+def buttongrid(item: nil,
+               label: nil,
+               icon: nil,
+               static_icon: nil,
+               buttons: nil,
+               label_color: nil,
+               value_color: nil,
+               icon_color: nil,
+               visibility: nil)
+end
+
+
+ +
+

+ + #chart(item: nil, label: nil, icon: nil, static_icon: nil, service: nil, refresh: nil, period: nil, legend: nil, group: nil, y_axis_pattern: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil) { ... } ⇒ ChartBuilder + + + + + +

+
+

One or more visibility rules (see WidgetBuilder#visibility) +Create a new Chart element.

+ + +
+
+
+

Parameters:

+
    + +
  • + + item + + + (String, Core::Items::Item, nil) + + + (defaults to: nil) + + + — +

    The item whose state to show (see WidgetBuilder#item)

    +
    + +
  • + +
  • + + label + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + icon + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + static_icon + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + label_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more label color rules (see WidgetBuilder#label_color)

    +
    + +
  • + +
  • + + value_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more value color rules (see WidgetBuilder#value_color)

    +
    + +
  • + +
  • + + icon_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more icon color rules (see WidgetBuilder#icon_color)

    +
    + +
  • + +
  • + + visibility + + + (String, Core::Types::State, Array<String>, Array<Core::Types::State>, Array<Array<String>>, nil) + + + (defaults to: nil) + + +
  • + +
  • + + service + + + (String, nil) + + + (defaults to: nil) + + + — +

    The persistence service to use (see ChartBuilder#service)

    +
    + +
  • + +
  • + + refresh + + + (Numeric, nil) + + + (defaults to: nil) + + + — +

    ] +How often to refresh the chart (in seconds) (see ChartBuilder#refresh)

    +
    + +
  • + +
  • + + period + + + (:h, :"4h", :"8h", :"12h", :D, :"2D", :"3D", :W, :"2W", :M, :"2M", :"4M", :Y, nil) + + + (defaults to: nil) + + + — +

    Time axis scale (see ChartBuilder#period)

    +
    + +
  • + +
  • + + legend + + + (true, false, nil) + + + (defaults to: nil) + + + — +

    Always show the legend (see ChartBuilder#legend=)

    +
    + +
  • + +
  • + + group + + + (true, false, nil) + + + (defaults to: nil) + + + — +

    Show the value of a group item, instead of its members (see ChartBuilder#group=)

    +
    + +
  • + +
  • + + y_axis_pattern + + + (String, nil) + + + (defaults to: nil) + + + — +

    Formatting string for values on the y axis (see ChartBuilder#y_axis_pattern)

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block executed in the context of a ChartBuilder

    +
    + +
  • + +
+

Returns:

+ + +
+ + + + +
+
+
+
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 85
+
+def chart(item: nil,
+          label: nil,
+          icon: nil,
+          static_icon: nil,
+          service: nil,
+          refresh: nil,
+          period: nil,
+          legend: nil,
+          group: nil,
+          y_axis_pattern: nil,
+          label_color: nil,
+          value_color: nil,
+          icon_color: nil,
+          visibility: nil)
+end
+
+
+ +
+

+ + #colorpicker(item: nil, label: nil, icon: nil, static_icon: nil, frequency: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil) { ... } ⇒ ColorpickerBuilder + + + + + +

+
+

One or more visibility rules (see WidgetBuilder#visibility) +Create a new Colorpicker element.

+ + +
+
+
+

Parameters:

+ + +

Yields:

+ +

Returns:

+ + +
+ + + + +
+
+
+
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 242
+
+def colorpicker(item: nil,
+                label: nil,
+                icon: nil,
+                static_icon: nil,
+                frequency: nil,
+                label_color: nil,
+                value_color: nil,
+                icon_color: nil,
+                visibility: nil)
+end
+
+
+ +
+

+ + #colortemperaturepicker(item: nil, label: nil, icon: nil, static_icon: nil, range: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil) { ... } ⇒ ColortemperaturepickerBuilder + + + + + +

+
+

One or more visibility rules (see WidgetBuilder#visibility) +Create a new Colortemperaturepicker element.

+ + +
+
+
+

Parameters:

+ + +

Yields:

+ +

Returns:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.3

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 259
+
+def colortemperaturepicker(item: nil,
+                           label: nil,
+                           icon: nil,
+                           static_icon: nil,
+                           range: nil,
+                           label_color: nil,
+                           value_color: nil,
+                           icon_color: nil,
+                           visibility: nil)
+end
+
+
+ +
+

+ + #default(item: nil, label: nil, icon: nil, static_icon: nil, height: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil) { ... } ⇒ DefaultBuilder + + + + + +

+
+

One or more visibility rules (see WidgetBuilder#visibility) +Create a new Default element.

+ + +
+
+
+

Parameters:

+
    + +
  • + + item + + + (String, Core::Items::Item, nil) + + + (defaults to: nil) + + + — +

    The item whose state to show (see WidgetBuilder#item)

    +
    + +
  • + +
  • + + label + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + icon + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + static_icon + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + label_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more label color rules (see WidgetBuilder#label_color)

    +
    + +
  • + +
  • + + value_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more value color rules (see WidgetBuilder#value_color)

    +
    + +
  • + +
  • + + icon_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more icon color rules (see WidgetBuilder#icon_color)

    +
    + +
  • + +
  • + + visibility + + + (String, Core::Types::State, Array<String>, Array<Core::Types::State>, Array<Array<String>>, nil) + + + (defaults to: nil) + + +
  • + +
  • + + height + + + (Integer) + + + (defaults to: nil) + + + — +

    The number of element rows to fill (see DefaultBuilder#height)

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block executed in the context of a DefaultBuilder

    +
    + +
  • + +
+

Returns:

+ + +
+ + + + +
+
+
+
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 275
+
+def default(item: nil,
+           label: nil,
+           icon: nil,
+           static_icon: nil,
+           height: nil,
+           label_color: nil,
+           value_color: nil,
+           icon_color: nil,
+           visibility: nil)
+end
+
+
+ +
+

+ + #frame(item: nil, label: nil, icon: nil, static_icon: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil) { ... } ⇒ FrameBuilder + + + + + +

+
+

One or more visibility rules (see WidgetBuilder#visibility) +Create a new Frame element.

+ + +
+
+
+

Parameters:

+
    + +
  • + + item + + + (String, Core::Items::Item, nil) + + + (defaults to: nil) + + + — +

    The item whose state to show (see WidgetBuilder#item)

    +
    + +
  • + +
  • + + label + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + icon + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + static_icon + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + label_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more label color rules (see WidgetBuilder#label_color)

    +
    + +
  • + +
  • + + value_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more value color rules (see WidgetBuilder#value_color)

    +
    + +
  • + +
  • + + icon_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more icon color rules (see WidgetBuilder#icon_color)

    +
    + +
  • + +
  • + + visibility + + + (String, Core::Types::State, Array<String>, Array<Core::Types::State>, Array<Array<String>>, nil) + + + (defaults to: nil) + + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block executed in the context of a FrameBuilder

    +
    + +
  • + +
+

Returns:

+ + +
+ + + + +
+
+
+
+6
+7
+8
+9
+10
+11
+12
+13
+14
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 6
+
+def frame(item: nil,
+          label: nil,
+          icon: nil,
+          static_icon: nil,
+          label_color: nil,
+          value_color: nil,
+          icon_color: nil,
+          visibility: nil)
+end
+
+
+ +
+

+ + #group(item: nil, label: nil, icon: nil, static_icon: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil) { ... } ⇒ GroupBuilder + + + + + +

+
+

One or more visibility rules (see WidgetBuilder#visibility) +Create a new Group element.

+ + +
+
+
+

Parameters:

+
    + +
  • + + item + + + (String, Core::Items::Item, nil) + + + (defaults to: nil) + + + — +

    The item whose state to show (see WidgetBuilder#item)

    +
    + +
  • + +
  • + + label + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + icon + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + static_icon + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + label_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more label color rules (see WidgetBuilder#label_color)

    +
    + +
  • + +
  • + + value_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more value color rules (see WidgetBuilder#value_color)

    +
    + +
  • + +
  • + + icon_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more icon color rules (see WidgetBuilder#icon_color)

    +
    + +
  • + +
  • + + visibility + + + (String, Core::Types::State, Array<String>, Array<Core::Types::State>, Array<Array<String>>, nil) + + + (defaults to: nil) + + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block executed in the context of a GroupBuilder

    +
    + +
  • + +
+

Returns:

+ + +
+ + + + +
+
+
+
+36
+37
+38
+39
+40
+41
+42
+43
+44
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 36
+
+def group(item: nil,
+          label: nil,
+          icon: nil,
+          static_icon: nil,
+          label_color: nil,
+          value_color: nil,
+          icon_color: nil,
+          visibility: nil)
+end
+
+
+ +
+

+ + #image(item: nil, label: nil, icon: nil, static_icon: nil, url: nil, refresh: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil) { ... } ⇒ ImageBuilder + + + + + +

+
+

One or more visibility rules (see WidgetBuilder#visibility) +Create a new Image element.

+ + +
+
+
+

Parameters:

+
    + +
  • + + item + + + (String, Core::Items::Item, nil) + + + (defaults to: nil) + + + — +

    The item whose state to show (see WidgetBuilder#item)

    +
    + +
  • + +
  • + + label + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + icon + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + static_icon + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + label_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more label color rules (see WidgetBuilder#label_color)

    +
    + +
  • + +
  • + + value_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more value color rules (see WidgetBuilder#value_color)

    +
    + +
  • + +
  • + + icon_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more icon color rules (see WidgetBuilder#icon_color)

    +
    + +
  • + +
  • + + visibility + + + (String, Core::Types::State, Array<String>, Array<Core::Types::State>, Array<Array<String>>, nil) + + + (defaults to: nil) + + +
  • + +
  • + + url + + + (String, nil) + + + (defaults to: nil) + + + — +

    The URL for the image (see ImageBuilder#url)

    +
    + +
  • + +
  • + + refresh + + + (Numeric, nil) + + + (defaults to: nil) + + + — +

    How often to refresh the image (see ImageBuilder#refresh)

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block executed in the context of an ImageBuilder

    +
    + +
  • + +
+

Returns:

+ + +
+ + + + +
+
+
+
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 51
+
+def image(item: nil,
+          label: nil,
+          icon: nil,
+          static_icon: nil,
+          url: nil,
+          refresh: nil,
+          label_color: nil,
+          value_color: nil,
+          icon_color: nil,
+          visibility: nil)
+end
+
+
+ +
+

+ + #input(item: nil, label: nil, icon: nil, static_icon: nil, hint: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil) { ... } ⇒ InputBuilder + + + + + +

+
+

One or more visibility rules (see WidgetBuilder#visibility) +Create a new Input element.

+ + +
+
+
+

Parameters:

+
    + +
  • + + item + + + (String, Core::Items::Item, nil) + + + (defaults to: nil) + + + — +

    The item whose state to show (see WidgetBuilder#item)

    +
    + +
  • + +
  • + + label + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + icon + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + static_icon + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + label_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more label color rules (see WidgetBuilder#label_color)

    +
    + +
  • + +
  • + + value_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more value color rules (see WidgetBuilder#value_color)

    +
    + +
  • + +
  • + + icon_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more icon color rules (see WidgetBuilder#icon_color)

    +
    + +
  • + +
  • + + visibility + + + (String, Core::Types::State, Array<String>, Array<Core::Types::State>, Array<Array<String>>, nil) + + + (defaults to: nil) + + +
  • + +
  • + + hint + + + (:text, :number, :date, :time, :datetime, nil) + + + (defaults to: nil) + + + — +

    Gives a hint to the user interface to use a widget adapted to a specific use (see InputBuilder#hint)

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block executed in the context of an InputBuilder

    +
    + +
  • + +
+

Returns:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.0

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 192
+
+def input(item: nil,
+          label: nil,
+          icon: nil,
+          static_icon: nil,
+          hint: nil,
+          label_color: nil,
+          value_color: nil,
+          icon_color: nil,
+          visibility: nil)
+end
+
+
+ +
+

+ + #mapview(item: nil, label: nil, icon: nil, static_icon: nil, height: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil) { ... } ⇒ MapviewBuilder + + + + + +

+
+

Create a new Mapview element.

+ + +
+
+
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block executed in the context of a MapviewBuilder

    +
    + +
  • + +
+

Returns:

+ + +
+ + + + +
+
+
+
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 139
+
+def mapview(item: nil,
+            label: nil,
+            icon: nil,
+            static_icon: nil,
+            height: nil,
+            label_color: nil,
+            value_color: nil,
+            icon_color: nil,
+            visibility: nil)
+end
+
+
+ +
+

+ + #selection(item: nil, label: nil, icon: nil, static_icon: nil, mappings: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil) { ... } ⇒ SelectionBuilder + + + + + +

+
+

Create a new Selection element.

+ + +
+
+
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block executed in the context of a SelectionBuilder

    +
    + +
  • + +
+

Returns:

+ + +
+ + + + +
+
+
+
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 175
+
+def selection(item: nil,
+              label: nil,
+              icon: nil,
+              static_icon: nil,
+              mappings: nil,
+              label_color: nil,
+              value_color: nil,
+              icon_color: nil,
+              visibility: nil)
+end
+
+
+ +
+

+ + #setpoint(item: nil, label: nil, icon: nil, static_icon: nil, range: nil, step: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil) { ... } ⇒ SetpointBuilder + + + + + +

+
+

One or more visibility rules (see WidgetBuilder#visibility) +Create a new Setpoint element.

+ + +
+
+
+

Parameters:

+
    + +
  • + + item + + + (String, Core::Items::Item, nil) + + + (defaults to: nil) + + + — +

    The item whose state to show (see WidgetBuilder#item)

    +
    + +
  • + +
  • + + label + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + icon + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + static_icon + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + label_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more label color rules (see WidgetBuilder#label_color)

    +
    + +
  • + +
  • + + value_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more value color rules (see WidgetBuilder#value_color)

    +
    + +
  • + +
  • + + icon_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more icon color rules (see WidgetBuilder#icon_color)

    +
    + +
  • + +
  • + + visibility + + + (String, Core::Types::State, Array<String>, Array<Core::Types::State>, Array<Array<String>>, nil) + + + (defaults to: nil) + + +
  • + +
  • + + range + + + (Range, nil) + + + (defaults to: nil) + + + — +

    Allowed range of the value (see SetpointBuilder#range)

    +
    + +
  • + +
  • + + step + + + (Numeric, nil) + + + (defaults to: nil) + + + — +

    How far the value will change with each button press (see SetpointBuilder#step)

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block executed in the context of a SetpointBuilder

    +
    + +
  • + +
+

Returns:

+ + +
+ + + + +
+
+
+
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 225
+
+def setpoint(item: nil,
+            label: nil,
+            icon: nil,
+            static_icon: nil,
+            range: nil,
+            step: nil,
+            label_color: nil,
+            value_color: nil,
+            icon_color: nil,
+            visibility: nil)
+end
+
+
+ +
+

+ + #slider(item: nil, label: nil, icon: nil, static_icon: nil, range: nil, step: nil, switch: nil, frequency: nil, release_only: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil) { ... } ⇒ SliderBuilder + + + + + +

+
+

One or more visibility rules (see WidgetBuilder#visibility) +Create a new Slider element.

+ + +
+
+
+

Parameters:

+
    + +
  • + + item + + + (String, Core::Items::Item, nil) + + + (defaults to: nil) + + + — +

    The item whose state to show (see WidgetBuilder#item)

    +
    + +
  • + +
  • + + label + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + icon + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + static_icon + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + label_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more label color rules (see WidgetBuilder#label_color)

    +
    + +
  • + +
  • + + value_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more value color rules (see WidgetBuilder#value_color)

    +
    + +
  • + +
  • + + icon_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more icon color rules (see WidgetBuilder#icon_color)

    +
    + +
  • + +
  • + + visibility + + + (String, Core::Types::State, Array<String>, Array<Core::Types::State>, Array<Array<String>>, nil) + + + (defaults to: nil) + + +
  • + +
  • + + range + + + (Range, nil) + + + (defaults to: nil) + + + — +

    Allowed range of the value (see SetpointBuilder#range)

    +
    + +
  • + +
  • + + step + + + (Numeric, nil) + + + (defaults to: nil) + + + — +

    How far the value will change with each button press (see SetpointBuilder#step)

    +
    + +
  • + +
  • + + switch + + + (true, false, nil) + + + (defaults to: nil) + + + — +

    A short press on the item toggles the item on or off (see SliderBuilder#switch=)

    +
    + +
  • + +
  • + + frequency + + + (Numeric, nil) + + + (defaults to: nil) + + + — +

    How often to send requests (in seconds) (see SliderBuilder#frequency)

    +
    + +
  • + +
  • + + release_only + + + (true, false, nil) + + + (defaults to: nil) + + + — +

    Only send the command when the slider is released (see SliderBuilder#release_only=)

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block executed in the context of a SliderBuilder

    +
    + +
  • + +
+

Returns:

+ + +
+ + + + +
+
+
+
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 155
+
+def slider(item: nil,
+           label: nil,
+           icon: nil,
+           static_icon: nil,
+           range: nil,
+           step: nil,
+           switch: nil,
+           frequency: nil,
+           release_only: nil,
+           label_color: nil,
+           value_color: nil,
+           icon_color: nil,
+           visibility: nil)
+end
+
+
+ +
+

+ + #switch(item: nil, label: nil, icon: nil, static_icon: nil, mappings: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil) { ... } ⇒ SwitchBuilder + + + + + +

+
+

One or more visibility rules (see WidgetBuilder#visibility) +Create a new Switch element.

+ + +
+
+
+

Parameters:

+
    + +
  • + + item + + + (String, Core::Items::Item, nil) + + + (defaults to: nil) + + + — +

    The item whose state to show (see WidgetBuilder#item)

    +
    + +
  • + +
  • + + label + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + icon + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + static_icon + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + label_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more label color rules (see WidgetBuilder#label_color)

    +
    + +
  • + +
  • + + value_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more value color rules (see WidgetBuilder#value_color)

    +
    + +
  • + +
  • + + icon_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more icon color rules (see WidgetBuilder#icon_color)

    +
    + +
  • + +
  • + + visibility + + + (String, Core::Types::State, Array<String>, Array<Core::Types::State>, Array<Array<String>>, nil) + + + (defaults to: nil) + + +
  • + +
  • + + mappings + + + (Hash, Array, nil) + + + (defaults to: nil) + + + — +

    Mappings from command to label (see SwitchBuilder#mappings)

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block executed in the context of a SwitchBuilder

    +
    + +
  • + +
+

Returns:

+ + +
+ + + + +
+
+
+
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 123
+
+def switch(item: nil,
+           label: nil,
+           icon: nil,
+           static_icon: nil,
+           mappings: nil,
+           label_color: nil,
+           value_color: nil,
+           icon_color: nil,
+           visibility: nil)
+end
+
+
+ +
+

+ + #text(item: nil, label: nil, icon: nil, static_icon: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil) { ... } ⇒ TextBuilder + + + + + +

+
+

One or more visibility rules (see WidgetBuilder#visibility) +Create a new Text element.

+ + +
+
+
+

Parameters:

+
    + +
  • + + item + + + (String, Core::Items::Item, nil) + + + (defaults to: nil) + + + — +

    The item whose state to show (see WidgetBuilder#item)

    +
    + +
  • + +
  • + + label + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + icon + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + static_icon + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + label_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more label color rules (see WidgetBuilder#label_color)

    +
    + +
  • + +
  • + + value_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more value color rules (see WidgetBuilder#value_color)

    +
    + +
  • + +
  • + + icon_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more icon color rules (see WidgetBuilder#icon_color)

    +
    + +
  • + +
  • + + visibility + + + (String, Core::Types::State, Array<String>, Array<Core::Types::State>, Array<Array<String>>, nil) + + + (defaults to: nil) + + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block executed in the context of a TextBuilder

    +
    + +
  • + +
+

Returns:

+ + +
+ + + + +
+
+
+
+21
+22
+23
+24
+25
+26
+27
+28
+29
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 21
+
+def text(item: nil,
+         label: nil,
+         icon: nil,
+         static_icon: nil,
+         label_color: nil,
+         value_color: nil,
+         icon_color: nil,
+         visibility: nil)
+end
+
+
+ +
+

+ + #video(item: nil, label: nil, icon: nil, static_icon: nil, url: nil, encoding: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil) { ... } ⇒ VideoBuilder + + + + + +

+
+

One or more visibility rules (see WidgetBuilder#visibility) +Create a new Video element.

+ + +
+
+
+

Parameters:

+
    + +
  • + + item + + + (String, Core::Items::Item, nil) + + + (defaults to: nil) + + + — +

    The item whose state to show (see WidgetBuilder#item)

    +
    + +
  • + +
  • + + label + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + icon + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + static_icon + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + label_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more label color rules (see WidgetBuilder#label_color)

    +
    + +
  • + +
  • + + value_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more value color rules (see WidgetBuilder#value_color)

    +
    + +
  • + +
  • + + icon_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more icon color rules (see WidgetBuilder#icon_color)

    +
    + +
  • + +
  • + + visibility + + + (String, Core::Types::State, Array<String>, Array<Core::Types::State>, Array<Array<String>>, nil) + + + (defaults to: nil) + + +
  • + +
  • + + url + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + encoding + + + (:mjpeg, :hls, nil) + + + (defaults to: nil) + + + — + + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block executed in the context of a VideoBuilder

    +
    + +
  • + +
+

Returns:

+ + +
+ + + + +
+
+
+
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 68
+
+def video(item: nil,
+          label: nil,
+          icon: nil,
+          static_icon: nil,
+          url: nil,
+          encoding: nil,
+          label_color: nil,
+          value_color: nil,
+          icon_color: nil,
+          visibility: nil)
+end
+
+
+ +
+

+ + #webview(item: nil, label: nil, icon: nil, static_icon: nil, url: nil, height: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil) { ... } ⇒ WebviewBuilder + + + + + +

+
+

One or more visibility rules (see WidgetBuilder#visibility) +Create a new Webview element.

+ + +
+
+
+

Parameters:

+
    + +
  • + + item + + + (String, Core::Items::Item, nil) + + + (defaults to: nil) + + + — +

    The item whose state to show (see WidgetBuilder#item)

    +
    + +
  • + +
  • + + label + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + icon + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + static_icon + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
  • + + label_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more label color rules (see WidgetBuilder#label_color)

    +
    + +
  • + +
  • + + value_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more value color rules (see WidgetBuilder#value_color)

    +
    + +
  • + +
  • + + icon_color + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + (defaults to: nil) + + + — +

    One or more icon color rules (see WidgetBuilder#icon_color)

    +
    + +
  • + +
  • + + visibility + + + (String, Core::Types::State, Array<String>, Array<Core::Types::State>, Array<Array<String>>, nil) + + + (defaults to: nil) + + +
  • + +
  • + + height + + + (Integer) + + + (defaults to: nil) + + + — +

    The number of element rows to fill (see DefaultBuilder#height)

    +
    + +
  • + +
  • + + url + + + (String, nil) + + + (defaults to: nil) + + + — + + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Block executed in the context of a WebviewBuilder

    +
    + +
  • + +
+

Returns:

+ + +
+ + + + +
+
+
+
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 106
+
+def webview(item: nil,
+            label: nil,
+            icon: nil,
+            static_icon: nil,
+            url: nil,
+            height: nil,
+            label_color: nil,
+            value_color: nil,
+            icon_color: nil,
+            visibility: nil)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/MapviewBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/MapviewBuilder.html new file mode 100644 index 0000000000..81cee79e3b --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/MapviewBuilder.html @@ -0,0 +1,3675 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::MapviewBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::MapviewBuilder + + + +

+
+ +
+
Inherits:
+
+ DefaultBuilder + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Builds a Mapview element

+ + +
+
+ + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from DefaultBuilder

+

#height

+ + + +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/SelectionBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/SelectionBuilder.html new file mode 100644 index 0000000000..349a299e99 --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/SelectionBuilder.html @@ -0,0 +1,3675 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::SelectionBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::SelectionBuilder + + + +

+
+ +
+
Inherits:
+
+ SwitchBuilder + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Builds a Selection element

+ + +
+
+ + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from SwitchBuilder

+

#mappings

+ + + +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/SetpointBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/SetpointBuilder.html new file mode 100644 index 0000000000..9292406897 --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/SetpointBuilder.html @@ -0,0 +1,3838 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::SetpointBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::SetpointBuilder + + + +

+
+ +
+
Inherits:
+
+ WidgetBuilder + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Builds a Setpoint element

+ + +
+
+
+

Direct Known Subclasses

+

SliderBuilder

+
+ + + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #range ⇒ Range? + + + + + + + + + + + + + + + + +

    Allowed range of the value.

    +
    + +
  • + + +
  • + + + #step ⇒ Numeric? + + + + + + + + + + + + + + + + +

    How far the value will change with each button press.

    +
    + +
  • + + +
+ + + + + +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #rangeRange? + + + + + +

+
+

Allowed range of the value

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Range, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+402
+403
+404
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 402
+
+def range
+  @range
+end
+
+
+ + + +
+

+ + #stepNumeric? + + + + + +

+
+

How far the value will change with each button press

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Numeric, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+405
+406
+407
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 405
+
+def step
+  @step
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/SitemapBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/SitemapBuilder.html new file mode 100644 index 0000000000..1a7f8afc3a --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/SitemapBuilder.html @@ -0,0 +1,3764 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::SitemapBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::SitemapBuilder + + + +

+
+ +
+
Inherits:
+
+ LinkableWidgetBuilder + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Builds a Sitemap

+ + +
+
+ + + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from LinkableWidgetBuilder

+

#buttongrid, #chart, #colorpicker, #colortemperaturepicker, #default, #frame, #group, #image, #input, #mapview, #selection, #setpoint, #slider, #switch, #text, #video, #webview

+ + + + + + + + + +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #nameString + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+1470
+1471
+1472
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 1470
+
+def name
+  @name
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/SliderBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/SliderBuilder.html new file mode 100644 index 0000000000..7bfcd4fcf5 --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/SliderBuilder.html @@ -0,0 +1,4117 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::SliderBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::SliderBuilder + + + +

+
+ +
+
Inherits:
+
+ SetpointBuilder + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Builds a Slider element

+ + +
+
+ + + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #frequency ⇒ Numeric? + + + + + + + + + + + + + + + + +

    How often to send requests (in seconds).

    +
    + +
  • + + +
  • + + + #release_only ⇒ true, ... + + + + + + + + + + writeonly + + + + + + + + +

    Only send the command when the slider is released.

    +
    + +
  • + + +
  • + + + #switch ⇒ true, ... + + + + + + + + + + writeonly + + + + + + + + +

    A short press on the item toggles the item on or off.

    +
    + +
  • + + +
+ + + + + +

Attributes inherited from SetpointBuilder

+

#range, #step

+ + + +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #frequencyNumeric? + + + + + +

+
+

How often to send requests (in seconds)

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Numeric, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+435
+436
+437
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 435
+
+def frequency
+  @frequency
+end
+
+
+ + + +
+

+ + #release_only=(value) ⇒ true, ... (writeonly) + + + + + +

+
+

Only send the command when the slider is released

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+442
+443
+444
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 442
+
+def release_only=(value)
+  @release_only = value
+end
+
+
+ + + +
+

+ + #switch=(value) ⇒ true, ... (writeonly) + + + + + +

+
+ +
+ Note: +

This parameter only works on Android

+
+
+ +

A short press on the item toggles the item on or off

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+439
+440
+441
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 439
+
+def switch=(value)
+  @switch = value
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #release_only?true, ... + + + + + +

+
+

Only send the command when the slider is released

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+467
+468
+469
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 467
+
+def release_only?
+  @release_only
+end
+
+
+ +
+

+ + #switch?true, ... + + + + + +

+
+ +
+ Note: +

This parameter only works on Android

+
+
+ +

A short press on the item toggles the item on or off

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+462
+463
+464
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 462
+
+def switch?
+  @switch
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/SwitchBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/SwitchBuilder.html new file mode 100644 index 0000000000..92912b652f --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/SwitchBuilder.html @@ -0,0 +1,3839 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::SwitchBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::SwitchBuilder + + + +

+
+ +
+
Inherits:
+
+ WidgetBuilder + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Builds a Switch element

+ + +
+
+
+

Direct Known Subclasses

+

SelectionBuilder

+
+ + + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #mappingsHash, ... + + + + + +

+
+

Mappings from command to label

+

If a hash is given, the keys are the commands and the values are the labels. +The keys can be any command, string or symbol. +They will be converted to strings.

+

If an array is given:

+
    +
  • Scalar elements define the command, and the label is the same as the command.
  • +
  • Array elements contain the command, label, and optional third element for the icon.
  • +
  • Hash elements contain the command, release (optional), label, and icon (optional) +defined by the corresponding keys.
  • +
+ + +
+
+
+ +
+

Examples:

+ + +

A Hash to specify different command and label

+

+ +
switch mappings: { off: "Off", cool: "Cool", heat: "Heat" }
+ + +

A simple array with the same command and label

+

+ +
switch mappings: %w[off cool heat]
+ + +

An array of arrays containing the command, label, and icon

+

+ +
switch mappings: [
+  %w[off Off f7:power],
+  %w[cool Cool f7:snow],
+  %w[heat Heat f7:flame],
+  %w[auto Auto] # no icon
+]
+ + +

An array of hashes for the command, label, and icon

+

+ +
switch mappings: [
+  {command: "off", label: "Off", icon: "f7:power"},
+  {command: "cool", label: "Cool", icon: "f7:snow"},
+  {command: "heat", label: "Heat", icon: "f7:flame"},
+  {command: "auto", label: "Auto"} # no icon
+]
+ + +

Since openHAB 4.2, release is also supported in the array of hashes

+

+ +
# when `release` is specified, `command` will be sent on press and `release` on release
+switch mappings: [
+  {label: "On", command: ON, release: OFF, icon: "f7:power"}
+]
+ +
+ +

Returns:

+
    + +
  • + + + (Hash, Array, nil) + + + +
  • + +
+ +

See Also:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.1 added support for icons

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+361
+362
+363
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 361
+
+def mappings
+  @mappings
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/TextBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/TextBuilder.html new file mode 100644 index 0000000000..73da580f95 --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/TextBuilder.html @@ -0,0 +1,3675 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::TextBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::TextBuilder + + + +

+
+ +
+
Inherits:
+
+ LinkableWidgetBuilder + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Builds a Text element

+ + +
+
+ + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from LinkableWidgetBuilder

+

#buttongrid, #chart, #colorpicker, #colortemperaturepicker, #default, #frame, #group, #image, #input, #mapview, #selection, #setpoint, #slider, #switch, #text, #video, #webview

+ + + + + + + + + +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/VideoBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/VideoBuilder.html new file mode 100644 index 0000000000..fd24369d9a --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/VideoBuilder.html @@ -0,0 +1,3856 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::VideoBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::VideoBuilder + + + +

+
+ +
+
Inherits:
+
+ WidgetBuilder + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Builds a Video element

+ + +
+
+ + +

+ Constant Summary + collapse +

+ +
+ +
VALID_ENCODINGS = +
+
+

Valid #encoding values

+ + +
+
+
+ + +
+
+
%i[mjpeg hls].freeze
+ +
+ + + + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + + + + + + + + +

Method Summary

+ +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #encoding:mjpeg, ... + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (:mjpeg, :hls, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+492
+493
+494
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 492
+
+def encoding
+  @encoding
+end
+
+
+ + + +
+

+ + #urlString? + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+490
+491
+492
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 490
+
+def url
+  @url
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/WebviewBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/WebviewBuilder.html new file mode 100644 index 0000000000..9ef27234e6 --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/WebviewBuilder.html @@ -0,0 +1,3764 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::WebviewBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::WebviewBuilder + + + +

+
+ +
+
Inherits:
+
+ DefaultBuilder + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Builds a Webview element

+ + +
+
+ + + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from DefaultBuilder

+

#height

+ + + +

Attributes inherited from WidgetBuilder

+

#icon, #icon_colors, #item, #label, #label_colors, #static_icon, #value_colors, #visibilities

+ + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods inherited from WidgetBuilder

+

#icon_color, #label_color, #value_color, #visibility

+ + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #urlString? + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+646
+647
+648
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 646
+
+def url
+  @url
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Sitemaps/WidgetBuilder.html b/5.33/OpenHAB/DSL/Sitemaps/WidgetBuilder.html new file mode 100644 index 0000000000..cc98c378d2 --- /dev/null +++ b/5.33/OpenHAB/DSL/Sitemaps/WidgetBuilder.html @@ -0,0 +1,4742 @@ + + + + + + + Class: OpenHAB::DSL::Sitemaps::WidgetBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Sitemaps::WidgetBuilder + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
Core::EntityLookup
+
+ + + + + + +
+
Defined in:
+
lib/openhab/dsl/sitemaps/builder.rb
+
+ +
+ +

Overview

+
+

Base class for all widgets

+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods included from Core::EntityLookup

+

#items, #method_missing, #things

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + + in the class OpenHAB::Core::EntityLookup + +

+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #iconString, ... + + + + + +

+
+

The icon to show +It can be a string, or a hash of conditions and icons.

+ + +
+
+
+ +
+

Examples:

+ + +

A simple icon

+

+ +
sitemaps.build { text icon: "f7:house" }
+ + +

A dynamic icon with conditions

+

+ +
sitemaps.build do
+  text item: Wifi_Status, icon: {
+    "ON" => "f7:wifi",
+    "OFF" => "f7:wifi_slash",
+    default: "f7:wifi_exclamationmark"
+  }
+end
+ +
+ +

Returns:

+
    + +
  • + + + (String, Hash<String, String>, Hash<Array<String>, String>, nil) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+96
+97
+98
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 96
+
+def icon
+  @icon
+end
+
+
+ + + +
+

+ + #icon_colorsHash<String, String>, Hash<Array<String>, String> (readonly) + + + + + +

+
+

Icon color rules

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash<String, String>, Hash<Array<String>, String>) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+114
+115
+116
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 114
+
+def icon_colors
+  @icon_colors
+end
+
+
+ + + +
+

+ + #itemString, ... + + + + + +

+
+

The item whose state to show

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+79
+80
+81
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 79
+
+def item
+  @item
+end
+
+
+ + + +
+

+ + #labelString? + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+76
+77
+78
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 76
+
+def label
+  @label
+end
+
+
+ + + +
+

+ + #label_colorsHash<String, String>, Hash<Array<String>, String> (readonly) + + + + + +

+
+

Label color rules

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash<String, String>, Hash<Array<String>, String>) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+106
+107
+108
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 106
+
+def label_colors
+  @label_colors
+end
+
+
+ + + +
+

+ + #static_iconString? + + + + + +

+
+

The static icon to show +This is mutually exclusive with #icon

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +

See Also:

+ +

Since:

+
    + +
  • + + + + + +

    openHAB 4.1

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+102
+103
+104
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 102
+
+def static_icon
+  @static_icon
+end
+
+
+ + + +
+

+ + #value_colorsHash<String, String>, Hash<Array<String>, String> (readonly) + + + + + +

+
+

Value color rules

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash<String, String>, Hash<Array<String>, String>) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+110
+111
+112
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 110
+
+def value_colors
+  @value_colors
+end
+
+
+ + + +
+

+ + #visibilitiesArray<String> (readonly) + + + + + +

+
+

Visibility rules

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array<String>) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+118
+119
+120
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 118
+
+def visibilities
+  @visibilities
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #icon_color(rules) ⇒ Hash<String, String> + + + + + +

+
+

Adds one or more new rules for setting the icon color

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash<String, String>) + + + + — +

    the current rules

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+203
+204
+205
+206
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 203
+
+def icon_color(rules)
+  rules = { default: rules } if rules.is_a?(String)
+  @icon_colors.merge!(rules)
+end
+
+
+ +
+

+ + #label_color(rules) ⇒ Hash<String, String> + + + + + +

+
+

Adds one or more new rules for setting the label color

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash<String, String>) + + + + — +

    the current rules

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+189
+190
+191
+192
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 189
+
+def label_color(rules)
+  rules = { default: rules } if rules.is_a?(String)
+  @label_colors.merge!(rules)
+end
+
+
+ +
+

+ + #value_color(rules) ⇒ Hash<String, String> + + + + + +

+
+

Adds one or more new rules for setting the value color

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash<String, String>) + + + + — +

    the current rules

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+196
+197
+198
+199
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 196
+
+def value_color(rules)
+  rules = { default: rules } if rules.is_a?(String)
+  @value_colors.merge!(rules)
+end
+
+
+ +
+

+ + #visibility(*rules) ⇒ Array<String> + + + + + +

+
+

Adds one or more new visibility rules

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array<String>) + + + + — +

    the current rules

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+210
+211
+212
+
+
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 210
+
+def visibility(*rules)
+  @visibilities.concat(rules)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Things.html b/5.33/OpenHAB/DSL/Things.html new file mode 100644 index 0000000000..8b3dcb799c --- /dev/null +++ b/5.33/OpenHAB/DSL/Things.html @@ -0,0 +1,3608 @@ + + + + + + + Module: OpenHAB::DSL::Things + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::DSL::Things + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/things/builder.rb
+
+ +
+ +

Overview

+
+

Contains extensions to simplify working with Things.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + + + Classes: BridgeBuilder, Builder, ChannelBuilder, ThingBuilder + + +

+ + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Things/BridgeBuilder.html b/5.33/OpenHAB/DSL/Things/BridgeBuilder.html new file mode 100644 index 0000000000..2d0f52124e --- /dev/null +++ b/5.33/OpenHAB/DSL/Things/BridgeBuilder.html @@ -0,0 +1,3869 @@ + + + + + + + Class: OpenHAB::DSL::Things::BridgeBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Things::BridgeBuilder + + + +

+
+ +
+
Inherits:
+
+ ThingBuilder + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/things/builder.rb
+
+ +
+ +

Overview

+
+

The BridgeBuilder DSL allows you to customize a thing

+ + +
+
+
+ + +
+ + + + + +

Instance Attribute Summary

+ +

Attributes inherited from ThingBuilder

+

#bridge_uid, #channels, #config, #enabled, #label, #location, #thing_type_uid, #uid

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + +

Methods inherited from ThingBuilder

+

#channel

+
+

Constructor Details

+ +
+

+ + #initialize(uid, label = nil, binding: nil, type: nil, bridge: nil, location: nil, config: {}, enabled: nil) ⇒ BridgeBuilder + + + + + +

+
+

Constructor for BridgeBuilder

+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+283
+284
+285
+286
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 283
+
+def initialize(uid, label = nil, binding: nil, type: nil, bridge: nil, location: nil, config: {}, enabled: nil)
+  @builder = org.openhab.core.thing.binding.builder.BridgeBuilder
+  super
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #bridge(*args, **kwargs, &block) ⇒ Object + + + + + +

+
+

Create a new Bridge with this Bridge as its Bridge

+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+290
+291
+292
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 290
+
+def bridge(*args, **kwargs, &block)
+  parent_builder.bridge(*args, bridge: self, **kwargs, &block)
+end
+
+
+ +
+

+ + #thing(*args, **kwargs, &block) ⇒ Object + + + + + +

+
+

Create a new Thing with this Bridge as its Bridge

+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+296
+297
+298
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 296
+
+def thing(*args, **kwargs, &block)
+  parent_builder.thing(*args, bridge: self, **kwargs, &block)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Things/Builder.html b/5.33/OpenHAB/DSL/Things/Builder.html new file mode 100644 index 0000000000..c2e2084831 --- /dev/null +++ b/5.33/OpenHAB/DSL/Things/Builder.html @@ -0,0 +1,4019 @@ + + + + + + + Class: OpenHAB::DSL::Things::Builder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Things::Builder + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/things/builder.rb
+
+ +
+ +

Overview

+
+

A thing builder allows you to dynamically create openHAB things at runtime. +This can be useful either to create things as soon as the script loads, +or even later based on a rule executing.

+ + +
+
+
+ +
+

Examples:

+ + +

Create a Thing from the Astro Binding

+

+ +
things.build do
+  thing "astro:sun:home", "Astro Sun Data", config: { "geolocation" => "0,0" }
+end
+ + +

Create a Thing with Channels

+

+ +
thing_config = {
+  availabilityTopic: "my-switch/status",
+  payloadAvailable: "online",
+  payloadNotAvailable: "offline"
+}
+things.build do
+  thing("mqtt:topic:my-switch", "My Switch", bridge: "mqtt:broker:mosquitto", config: thing_config) do
+    channel("switch1", "switch", config: {
+      stateTopic: "stat/my-switch/switch1/state", commandTopic: "cmnd/my-switch/switch1/command"
+    })
+    channel("button1", "string", config: {
+      stateTopic: "stat/my-switch/button1/state", commandTopic: "cmnd/my-switch/button1/command"
+    })
+  end
+end
+ + +

Create a Thing within a Bridge

+

+ +
things.build do
+  bridge "mqtt:broker:mosquitto", config: { host: "127.0.0.1", enableDiscovery: false } do
+    thing "mqtt:topic:window1", "My Window Sensor" do
+      channel "contact1", "contact", config: {
+        stateTopic: "zigbee2mqtt/window1/contact",
+        on: "false",
+        off: "true"
+      }
+    end
+  end
+end
+
+items.build do
+  contact_item Window1_Contact, channel: "mqtt:topic:window1:contact1"
+end
+ + +

Create a Thing separately from the Bridge

+

+ +
things.build do
+  bridge = bridge "mqtt:broker:mosquitto", config: { host: "127.0.0.1", enableDiscovery: false }
+
+  thing "mqtt:topic:window1", "My Window Sensor", bridge: bridge do
+    channel "contact1", "contact", config: {
+      stateTopic: "zigbee2mqtt/window1/contact",
+      on: "false",
+      off: "true"
+    }
+  end
+end
+ +
+ + +

See Also:

+ + +
+ + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + +
+

Constructor Details

+ +
+

+ + #initialize(provider, update: false) ⇒ Builder + + + + + +

+
+

Returns a new instance of Builder.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+73
+74
+75
+76
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 73
+
+def initialize(provider, update: false)
+  @provider = Core::Things::Provider.current(provider)
+  @update = update
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #providerorg.openhab.core.thing.ManagedThingProvider (readonly) + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+71
+72
+73
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 71
+
+def provider
+  @provider
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #bridge(*args, **kwargs, &block) ⇒ Object + + + + + +

+
+

Create a new Bridge

+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+80
+81
+82
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 80
+
+def bridge(*args, **kwargs, &block)
+  build(BridgeBuilder, *args, **kwargs, &block)
+end
+
+
+ +
+

+ + #thing(*args, **kwargs, &block) ⇒ Object + + + + + +

+
+

Create a new Thing

+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+86
+87
+88
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 86
+
+def thing(*args, **kwargs, &block)
+  build(ThingBuilder, *args, **kwargs, &block)
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Things/ChannelBuilder.html b/5.33/OpenHAB/DSL/Things/ChannelBuilder.html new file mode 100644 index 0000000000..0a4a6c053b --- /dev/null +++ b/5.33/OpenHAB/DSL/Things/ChannelBuilder.html @@ -0,0 +1,4610 @@ + + + + + + + Class: OpenHAB::DSL::Things::ChannelBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Things::ChannelBuilder + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/things/builder.rb
+
+ +
+ +

Overview

+
+

The ChannelBuilder DSL allows you to customize a channel

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #accepted_item_type ⇒ String + + + + + + + + + readonly + + + + + + + + + +

    The accepted item type.

    +
    + +
  • + + +
  • + + + #auto_update_policy ⇒ Object + + + + + + + + + readonly + + + + + + + + + +

    Returns the value of attribute auto_update_policy.

    +
    + +
  • + + +
  • + + + #config ⇒ Object + + + + + + + + + readonly + + + + + + + + + +

    Returns the value of attribute config.

    +
    + +
  • + + +
  • + + + #default_tags ⇒ Object + + + + + + + + + readonly + + + + + + + + + +

    Returns the value of attribute default_tags.

    +
    + +
  • + + +
  • + + + #description ⇒ Object + + + + + + + + + readonly + + + + + + + + + +

    Returns the value of attribute description.

    +
    + +
  • + + +
  • + + + #label ⇒ Object + + + + + + + + + + + + + + + + +

    Returns the value of attribute label.

    +
    + +
  • + + +
  • + + + #properties ⇒ Object + + + + + + + + + readonly + + + + + + + + + +

    Returns the value of attribute properties.

    +
    + +
  • + + +
  • + + + #type ⇒ Object + + + + + + + + + readonly + + + + + + + + + +

    Returns the value of attribute type.

    +
    + +
  • + + +
  • + + + #uid ⇒ Object + + + + + + + + + readonly + + + + + + + + + +

    Returns the value of attribute uid.

    +
    + +
  • + + +
+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + +
+

Constructor Details

+ +
+

+ + #initialize(uid, type, label = nil, thing:, description: nil, group: nil, config: nil, properties: nil, default_tags: nil, auto_update_policy: nil, accepted_item_type: nil) ⇒ ChannelBuilder + + + + + +

+
+

Constructor for ChannelBuilder

+

This class is instantiated by the #channel method inside a Builder#thing block.

+ + +
+
+
+

Parameters:

+
    + +
  • + + uid + + + (String) + + + + — +

    The channel's ID.

    +
    + +
  • + +
  • + + type + + + (String, ChannelTypeUID, :trigger) + + + + — +

    The concrete type of the channel.

    +
    + +
  • + +
  • + + label + + + (String) + + + (defaults to: nil) + + + — +

    The channel label.

    +
    + +
  • + +
  • + + thing + + + (Thing) + + + + — +

    The thing associated with this channel. +This parameter is not needed for the ThingBuilder#channel method.

    +
    + +
  • + +
  • + + description + + + (String) + + + (defaults to: nil) + + + — +

    The channel description.

    +
    + +
  • + +
  • + + group + + + (String) + + + (defaults to: nil) + + + — +

    The group name.

    +
    + +
  • + +
  • + + config + + + (Hash) + + + (defaults to: nil) + + + — +

    Channel configuration. The keys can be strings or symbols.

    +
    + +
  • + +
  • + + properties + + + (Hash) + + + (defaults to: nil) + + + — +

    The channel properties.

    +
    + +
  • + +
  • + + default_tags + + + (String, Symbol, Semantics::Tag, Array<String,Symbol,Semantics::Tag>) + + + (defaults to: nil) + + + — +

    The default tags for this channel.

    +
    + +
  • + +
  • + + auto_update_policy + + + (:default, :recommend, :veto, org.openhab.core.thing.type.AutoUpdatePolicy) + + + (defaults to: nil) + + + — +

    The channel's auto update policy.

    +
    + +
  • + +
  • + + accepted_item_type + + + (String) + + + (defaults to: nil) + + + — +

    The accepted item type. If nil, infer the item type from the channel type.

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 332
+
+def initialize(uid,
+               type,
+               label = nil,
+               thing:,
+               description: nil,
+               group: nil,
+               config: nil,
+               properties: nil,
+               default_tags: nil,
+               auto_update_policy: nil,
+               accepted_item_type: nil)
+  @thing = thing
+
+  uid = uid.to_s
+  uid_segments = uid.split(org.openhab.core.common.AbstractUID::SEPARATOR)
+  group_segments = uid_segments.last.split(org.openhab.core.thing.ChannelUID::CHANNEL_GROUP_SEPARATOR)
+  if group
+    if group_segments.length == 2
+      group_segments[0] = group
+    else
+      group_segments.unshift(group)
+    end
+    uid_segments[-1] = group_segments.join(org.openhab.core.thing.ChannelUID::CHANNEL_GROUP_SEPARATOR)
+  end
+  @uid = org.openhab.core.thing.ChannelUID.new(thing.uid, uid_segments.last)
+  unless type.is_a?(org.openhab.core.thing.type.ChannelTypeUID)
+    type = org.openhab.core.thing.type.ChannelTypeUID.new(thing.uid.binding_id, type)
+  end
+  @type = type
+  @label = label
+  @config = config&.transform_keys(&:to_s)
+  @default_tags = Items::ItemBuilder.normalize_tags(*Array.wrap(default_tags))
+  @properties = properties&.transform_keys(&:to_s)
+  @description = description
+  @accepted_item_type = accepted_item_type
+  return unless auto_update_policy
+
+  @auto_update_policy = org.openhab.core.thing.type.AutoUpdatePolicy.value_of(auto_update_policy.to_s.upcase)
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #accepted_item_typeString (readonly) + + + + + +

+
+

Returns The accepted item type.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    The accepted item type.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+391
+392
+393
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 391
+
+def accepted_item_type
+  @accepted_item_type ||= type.channel_type&.item_type
+end
+
+
+ + + +
+

+ + #auto_update_policyObject (readonly) + + + + + +

+
+

Returns the value of attribute auto_update_policy.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+304
+305
+306
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 304
+
+def auto_update_policy
+  @auto_update_policy
+end
+
+
+ + + +
+

+ + #configObject (readonly) + + + + + +

+
+

Returns the value of attribute config.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+304
+305
+306
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 304
+
+def config
+  @config
+end
+
+
+ + + +
+

+ + #default_tagsObject (readonly) + + + + + +

+
+

Returns the value of attribute default_tags.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+304
+305
+306
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 304
+
+def default_tags
+  @default_tags
+end
+
+
+ + + +
+

+ + #descriptionObject (readonly) + + + + + +

+
+

Returns the value of attribute description.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+304
+305
+306
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 304
+
+def description
+  @description
+end
+
+
+ + + +
+

+ + #labelObject + + + + + +

+
+

Returns the value of attribute label.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+303
+304
+305
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 303
+
+def label
+  @label
+end
+
+
+ + + +
+

+ + #propertiesObject (readonly) + + + + + +

+
+

Returns the value of attribute properties.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+304
+305
+306
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 304
+
+def properties
+  @properties
+end
+
+
+ + + +
+

+ + #typeObject (readonly) + + + + + +

+
+

Returns the value of attribute type.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+304
+305
+306
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 304
+
+def type
+  @type
+end
+
+
+ + + +
+

+ + #uidObject (readonly) + + + + + +

+
+

Returns the value of attribute uid.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+304
+305
+306
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 304
+
+def uid
+  @uid
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/Things/ThingBuilder.html b/5.33/OpenHAB/DSL/Things/ThingBuilder.html new file mode 100644 index 0000000000..ce355b1895 --- /dev/null +++ b/5.33/OpenHAB/DSL/Things/ThingBuilder.html @@ -0,0 +1,4677 @@ + + + + + + + Class: OpenHAB::DSL::Things::ThingBuilder + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::Things::ThingBuilder + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/things/builder.rb
+
+ +
+ +

Overview

+
+

The ThingBuilder DSL allows you to customize a thing

+ + +
+
+
+ + +
+

Direct Known Subclasses

+

BridgeBuilder

+
+ + + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + +
+

Constructor Details

+ +
+

+ + #initialize(uid, label = nil, binding: nil, type: nil, bridge: nil, location: nil, config: {}, enabled: nil) ⇒ ThingBuilder + + + + + +

+
+

Constructor for ThingBuilder

+ + +
+
+
+

Parameters:

+
    + +
  • + + uid + + + (String) + + + + — +

    The ThingUID for the created Thing. +This can consist one or more segments separated by a colon. When the uid contains:

    +
      +
    • One segment: When the uid contains one segment, binding or bridge id must be provided.
    • +
    • Two segments: typeid:thingid The binding or bridge id must be provided.
    • +
    • Three or more segments: bindingid:typeid:[bridgeid...]:thingid. The type and bridge can be omitted
    • +
    +
    + +
  • + +
  • + + label + + + (String) + + + (defaults to: nil) + + + — +

    The Thing's label.

    +
    + +
  • + +
  • + + binding + + + (String) + + + (defaults to: nil) + + + — +

    The binding id. When this argument is not provided, +the binding id must be deducible from the uid, type, or bridge.

    +
    + +
  • + +
  • + + type + + + (String) + + + (defaults to: nil) + + + — +

    The type id. When this argument is not provided, +it will be deducible from the uid if it contains two or more segments. +To create a Thing with a blank type id, use one segment for uid and provide the binding id.

    +
    + +
  • + +
  • + + bridge + + + (String, BridgeBuilder) + + + (defaults to: nil) + + + — +

    The bridge uid, if the Thing should belong to a bridge.

    +
    + +
  • + +
  • + + location + + + (String, Item) + + + (defaults to: nil) + + + — +

    The location of this Thing. +When given an Item, use the item's label as the location.

    +
    + +
  • + +
  • + + config + + + (Hash) + + + (defaults to: {}) + + + — +

    The Thing's configuration, as required by the binding. The key can be strings or symbols.

    +
    + +
  • + +
  • + + enabled + + + (true, false) + + + (defaults to: nil) + + + — +

    Whether the Thing should be enabled or disabled.

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 190
+
+def initialize(uid, label = nil, binding: nil, type: nil, bridge: nil, location: nil, config: {}, enabled: nil)
+  @channels = []
+  uid = uid.to_s
+  uid_segments = uid.split(org.openhab.core.common.AbstractUID::SEPARATOR)
+  @bridge_uid = nil
+  bridge = bridge.uid if bridge.is_a?(org.openhab.core.thing.Bridge) || bridge.is_a?(BridgeBuilder)
+  bridge = bridge&.to_s
+  bridge_segments = bridge&.split(org.openhab.core.common.AbstractUID::SEPARATOR) || []
+  type = type&.to_s
+
+  # infer missing components
+  type ||= uid_segments[0] if uid_segments.length == 2
+  type ||= uid_segments[1] if uid_segments.length > 2
+  binding ||= uid_segments[0] if uid_segments.length > 2
+  binding ||= bridge_segments[0] if bridge_segments && bridge_segments.length > 2
+
+  if bridge
+    bridge_segments.unshift(binding) if bridge_segments.length < 3
+    @bridge_uid = org.openhab.core.thing.ThingUID.new(*bridge_segments)
+  end
+
+  thinguid = if uid_segments.length > 2
+               [binding, type, uid_segments.last].compact
+             else
+               [binding, type, @bridge_uid&.id, uid_segments.last].compact
+             end
+
+  @uid = org.openhab.core.thing.ThingUID.new(*thinguid)
+  @thing_type_uid = org.openhab.core.thing.ThingTypeUID.new(*@uid.all_segments[0..1])
+  @label = label
+  @location = location
+  @location = location.label if location.is_a?(Item)
+  @config = config.transform_keys(&:to_s)
+  @enabled = enabled
+  @builder = org.openhab.core.thing.binding.builder.ThingBuilder unless instance_variable_defined?(:@builder)
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #bridge_uidCore::Things::ThingUID? (readonly) + + + + + +

+
+

The bridge of this thing

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+136
+137
+138
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 136
+
+def bridge_uid
+  @bridge_uid
+end
+
+
+ + + +
+

+ + #channelsArray<ChannelBuilder> (readonly) + + + + + +

+
+

Explicitly configured channels on this thing

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+145
+146
+147
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 145
+
+def channels
+  @channels
+end
+
+
+ + + +
+

+ + #configHash? (readonly) + + + + + +

+
+

The config for this thing

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+139
+140
+141
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 139
+
+def config
+  @config
+end
+
+
+ + + +
+

+ + #enabledtrue, ... (readonly) + + + + + +

+
+

If the thing should be enabled after it is created

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+142
+143
+144
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 142
+
+def enabled
+  @enabled
+end
+
+
+ + + +
+

+ + #labelString? + + + + + +

+
+

The label for this thing

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+124
+125
+126
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 124
+
+def label
+  @label
+end
+
+
+ + + +
+

+ + #locationString? + + + + + +

+
+

The location for this thing

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+127
+128
+129
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 127
+
+def location
+  @location
+end
+
+
+ + + +
+

+ + #thing_type_uidThingTypeUID (readonly) + + + + + +

+
+

The type of this thing

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (ThingTypeUID) + + + +
  • + +
+ +
+ + + + +
+
+
+
+133
+134
+135
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 133
+
+def thing_type_uid
+  @thing_type_uid
+end
+
+
+ + + +
+

+ + #uidCore::Things::ThingUID (readonly) + + + + + +

+
+

The id for this thing

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+130
+131
+132
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 130
+
+def uid
+  @uid
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #channel(*args, **kwargs, &block) ⇒ Core::Things::Channel + + + + + +

+
+

Add an explicitly configured channel to this item

+ + +
+
+
+ +

Returns:

+ + +

See Also:

+ + +
+ + + + +
+
+
+
+230
+231
+232
+233
+234
+
+
# File 'lib/openhab/dsl/things/builder.rb', line 230
+
+def channel(*args, **kwargs, &block)
+  channel = ChannelBuilder.new(*args, thing: self, **kwargs)
+  channel.instance_eval(&block) if block
+  channel.build.tap { |c| @channels << c }
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/DSL/TimerManager.html b/5.33/OpenHAB/DSL/TimerManager.html new file mode 100644 index 0000000000..7334a898cf --- /dev/null +++ b/5.33/OpenHAB/DSL/TimerManager.html @@ -0,0 +1,4277 @@ + + + + + + + Class: OpenHAB::DSL::TimerManager + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::DSL::TimerManager + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/dsl/timer_manager.rb
+
+ +
+ +

Overview

+
+

Manages timers created by after, or #schedule.

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + #cancel(id) ⇒ true, false + + + + + +

+
+

Cancel a single timer by id

+ + +
+
+
+

Parameters:

+
    + +
  • + + id + + + (Object) + + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + + — +

    if the timer was able to be cancelled

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+
+
# File 'lib/openhab/dsl/timer_manager.rb', line 69
+
+def cancel(id)
+  result = false
+  @timers_by_id.compute_if_present(id) do |_key, timer|
+    result = timer.cancel!
+    @timers.remove(timer)
+
+    nil
+  end
+  result
+end
+
+
+ +
+

+ + #cancel_allvoid + + + + + +

+
+

This method returns an undefined value.

Cancels all active timers in the current script/UI rule

+

Including timers with or without an id.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+
+
# File 'lib/openhab/dsl/timer_manager.rb', line 192
+
+def cancel_all
+  logged = false
+  # don't use #each, in case timers are scheduling more timers
+  until @timers.empty?
+    logger.trace { "Canceling #{@timers.length} timers" } unless logged
+    logged = true
+    timer = @timers.keys.first
+    timer.cancel
+  end
+end
+
+
+ +
+

+ + #include?(id) ⇒ true, false + + + + Also known as: + key?, member? + + + + +

+
+ +
+ Note: +

This method is not recommended for normal use in rules. +Timers are prone to race conditions if accessed from multiple rules, +or from timers themselves. Rescheduling, canceling, or scheduling +a new timer based on the results of this method may cause problems, +since the state may have changed in the meantime. Instead, use +after with an id, #cancel, #reschedule, or +#schedule to perform those actions atomically.

+
+
+ +

Checks if a timer exists by id

+ + +
+
+
+

Parameters:

+
    + +
  • + + id + + + (Object) + + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+179
+180
+181
+
+
# File 'lib/openhab/dsl/timer_manager.rb', line 179
+
+def include?(id)
+  @timers_by_id.key?(id)
+end
+
+
+ +
+

+ + #reschedule(id, duration = nil) ⇒ Core::Timer? + + + + + +

+
+ +
+ Note: +

Only timers that are still active can be rescheduled by their id. +Once a timer is finished executing or cancelled, it is no longer maintained by TimerManager, +and calling this method will do nothing. +To reschedule a possibly expired or cancelled timer, either call the Core::Timer#reschedule +method of the timer object, or use #schedule.

+
+
+ +

Reschedule a single timer by id.

+ + +
+
+
+

Parameters:

+
    + +
  • + + id + + + (Object) + + + +
  • + +
  • + + duration + + + (java.time.temporal.TemporalAmount, #to_zoned_date_time, Proc, nil) + + + (defaults to: nil) + + + — +

    When to reschedule the timer for. nil to retain its current interval.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Core::Timer, nil) + + + + — +

    the timer if it was rescheduled, otherwise nil

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+94
+95
+96
+97
+98
+
+
# File 'lib/openhab/dsl/timer_manager.rb', line 94
+
+def reschedule(id, duration = nil)
+  @timers_by_id.compute_if_present(id) do |_key, timer|
+    timer.reschedule(duration)
+  end
+end
+
+
+ +
+

+ + #schedule(id) {|timer| ... } ⇒ Core::Timer? + + + + + +

+
+

Schedule a timer by id

+

Schedules a timer by id, but passes the current timer -- if it exists -- +to the block so that you can decide how you want to proceed based on that +state. The timer is created in a thread-safe manner.

+ + +
+
+
+ +
+

Examples:

+ + +

Extend an existing timer, or schedule a new one

+

+ +
# This is technically the same functionality as just calling `after()` with an `id`,
+# but allows you to perform extra steps if the timer is actually scheduled.
+timers.schedule(item) do |timer|
+  next timer.tap(&:reschedule) if timer
+
+  Notification.send("The lights were turned on")
+
+  after(30.seconds) { item.off }
+end
+ + +

Keep trying to turn something on, up to 5 times

+

+ +
timers.schedule(item) do |timer|
+  next if timer # don't interrupt a retry cycle if it already exists
+
+  retries = 5
+  after(2.seconds) do |inner_timer|
+    next if (retries -= 1).zero?
+    next inner_timer.reschedule unless item.on?
+
+    item.on
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + id + + + (Object) + + + +
  • + +
+ +

Yield Parameters:

+
    + +
  • + + timer + + + (Core::Timer, nil) + + + + — +

    The existing timer with this id, if one exists.

    +
    + +
  • + +
+

Yield Returns:

+
    + +
  • + + + (Core::Timer, nil) + + + + — +

    A new timer to associate with this id, the existing +timer, or nil. If nil, any existing timer will be cancelled.

    +
    + +
  • + +
+

Returns:

+ + +
+ + + + +
+
+
+
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+
+
# File 'lib/openhab/dsl/timer_manager.rb', line 137
+
+def schedule(id)
+  @timers_by_id.compute(id) do |_key, timer|
+    new_timer = yield timer
+    raise ArgumentError, "Block must return a timer or nil" unless new_timer.is_a?(Core::Timer) || new_timer.nil?
+
+    if !new_timer.equal?(timer) && new_timer&.id
+      raise ArgumentError,
+            "Do not schedule a new timer with an ID inside a #schedule block"
+    end
+
+    if new_timer&.cancelled?
+      new_timer = nil
+    elsif new_timer.nil? && timer && !timer.cancelled?
+      timer.cancel!
+      @timers.remove(timer)
+    end
+    next unless new_timer
+
+    new_timer.id ||= id
+    if new_timer.id != id
+      raise ArgumentError,
+            "The new timer cannot have a different ID than what you're attempting to schedule"
+    end
+
+    new_timer
+  end
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Log.html b/5.33/OpenHAB/Log.html new file mode 100644 index 0000000000..143bf4d557 --- /dev/null +++ b/5.33/OpenHAB/Log.html @@ -0,0 +1,3915 @@ + + + + + + + Module: OpenHAB::Log + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Log + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/log.rb,
+ lib/openhab/log.rb
+
+
+ +
+ +

Overview

+
+

Provides access to the openHAB logging facilities using Ruby logging methods

+

Logging is available everywhere through the #logger object.

+

The logging prefix is org.openhab.automation.jrubyscripting.

+

Logging within file-based rules will have the name of the file appended to +the logger name. Logging inside of a rule will have the id of the rule +appended to the logger name. Any classes will have the full class name +appended to the logger name.

+

Logging within UI-based rules will have the rule UID appended to the logger.

+ + +
+
+
+ +
+

Examples:

+ + +

The following entries are in a file named 'log_test.rb'

+

+ +
logger.trace('Test logging at trace') # 2020-12-03 18:05:20.903 [TRACE] [org.openhab.automation.jrubyscripting.log_test] - Test logging at trace
+logger.debug('Test logging at debug') # 2020-12-03 18:05:32.020 [DEBUG] [org.openhab.automation.jrubyscripting.log_test] - Test logging at debug
+logger.warn('Test logging at warn')   # 2020-12-03 18:05:41.817 [WARN ] [org.openhab.automation.jrubyscripting.log_test] - Test logging at warn
+logger.info('Test logging at info')   # 2020-12-03 18:05:41.817 [INFO ] [org.openhab.automation.jrubyscripting.log_test] - Test logging at info
+logger.error('Test logging at error') # 2020-12-03 18:06:02.021 [ERROR] [org.openhab.automation.jrubyscripting.log_test] - Test logging at error
+ + +

From a UI-based rule with UID 'rule_uid'

+

+ +
logger.info('Test logging at info')   # 2020-12-03 18:05:41.817 [INFO ] [org.openhab.automation.jrubyscripting.script.rule_uid] - Test logging at info
+ + +

The following entries are in a file named 'log_test.rb'

+

+ +
# Enable trace log level for all the rules in this file
+logger.level = :trace
+
+rule 'foo' do
+  run { logger.trace('Test logging at trace') } # 2020-12-03 18:05:20.903 [TRACE] [org.openhab.automation.jrubyscripting.log_test.rule.log_test:1] - Test logging at trace
+  on_load
+end
+
+rule 'foo with id', id: "foo_id" do
+  run { logger.trace('Test logging at trace') } # 2020-12-03 18:05:20.903 [TRACE] [org.openhab.automation.jrubyscripting.log_test.rule.foo_id] - Test logging at trace
+  on_load
+end
+ + +

A log entry from inside a class

+

+ +
class MyClass
+  def initialize
+    logger.trace("hi!") # 2020-12-03 18:05:20.903 [TRACE] [org.openhab.automation.jrubyscripting.MyClass] - hi!
+  end
+end
+ +
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + +
+

Class Method Details

+ + +
+

+ + .logger(object) ⇒ Logger + + + + + +

+
+

Retrieve a OpenHAB::Logger for a particular object.

+ + +
+
+
+

Parameters:

+
    + +
  • + + object + + + (Module, String) + + + + — +

    Object the logger is for, or explicit name of the logger.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Logger) + + + +
  • + +
+ +
+ + + + +
+
+
+
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+
+
# File 'lib/openhab/log.rb', line 92
+
+def logger(object)
+  case object
+  when Module
+    name = Logger::PREFIX
+    klass = java_klass(object)
+    name += ".#{klass.name.gsub("::", ".")}" if klass.name
+  when String
+    name = object
+  when :main
+    name = "#{Logger::PREFIX}.#{current_file}"
+    name = "#{name}.#{$ctx["ruleUID"]}" if $ctx&.key?("ruleUID")
+    return @loggers[name] ||= BiLogger.new(Logger.new(name))
+  end
+
+  @loggers[name] ||= Logger.new(name)
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #loggerLogger (protected) + + + + + +

+
+

Retrieve the OpenHAB::Logger for this class.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Logger) + + + +
  • + +
+ +
+ + + + +
+
+
+
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+
+
# File 'lib/openhab/log.rb', line 72
+
+def logger
+  # no caching on `main`
+  if (instance_of?(Object) && !singleton_methods.empty?) ||
+     # also pretend loggers in example groups are in the top-level
+     (defined?(::RSpec::Core::ExampleGroup) && is_a?(Module) && self < ::RSpec::Core::ExampleGroup)
+    return Log.logger(:main)
+  end
+  return @logger ||= Log.logger(self) if equal?(self.class) || is_a?(Module)
+
+  self.class.logger
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Logger.html b/5.33/OpenHAB/Logger.html new file mode 100644 index 0000000000..9b2e53e618 --- /dev/null +++ b/5.33/OpenHAB/Logger.html @@ -0,0 +1,5296 @@ + + + + + + + Class: OpenHAB::Logger + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: OpenHAB::Logger + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/log.rb
+
+ +
+ +

Overview

+
+

Ruby Logger that forwards messages at appropriate levels to openHAB Logger

+ + +
+
+
+ + +
+ +

+ Constant Summary + collapse +

+ +
+ +
PREFIX = +
+
+

The base prefix for all loggers from this gem.

+ + +
+
+
+ + +
+
+
"org.openhab.automation.jrubyscripting"
+ +
LEVELS = +
+
+

Returns Supported logging levels.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array<symbol>) + + + + — +

    Supported logging levels

    +
    + +
  • + +
+ +
+
+
%i[trace debug warn info error].freeze
+ +
+ + + + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Class Method Summary + collapse +

+ + + +
    + +
  • + + + .events ⇒ Logger + + + + + + + + + + + + + +

    The events logger (events.log).

    +
    + +
  • + + +
  • + + + .gem_root ⇒ Logger + + + + + + + + + + + + + +

    The root logger for this gem.

    +
    + +
  • + + +
  • + + + .root ⇒ Logger + + + + + + + + + + + + + +

    The root logger (all of openHAB).

    +
    + +
  • + + +
+ +

+ Instance Method Summary + collapse +

+ + + + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #level:error, ... + + + + + +

+
+ +
+ Note: +

When a logger's level is modified, the logging infrastructure has +to reload, and logging may be completely unavailable for a short time.

+
+
+ +

Returns The current log level.

+ + +
+
+
+ +
+

Examples:

+ + +

Retrieve the current log level

+

+ +
level = OpenHAB::Log.logger("openhab.event.ItemStateChangedEvent").level
+logger.info "The log level for 'openhab.event.ItemStateChangedEvent' is #{level}"
+ + +

Set the log level

+

+ +
OpenHAB::Log.logger("openhab.event.ItemStateChangedEvent").level = :warn
+ +
+ +

Returns:

+
    + +
  • + + + (:error, :warn, :info, :debug, :trace) + + + + — +

    The current log level

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+283
+284
+285
+
+
# File 'lib/openhab/log.rb', line 283
+
+def level
+  Logger.log_service.get_level(name)[name]&.downcase&.to_sym
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .eventsLogger + + + + + +

+
+

The events logger (events.log)

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Logger) + + + +
  • + +
+ +
+ + + + +
+
+
+
+199
+200
+201
+
+
# File 'lib/openhab/log.rb', line 199
+
+def events
+  Log.logger("openhab.event")
+end
+
+
+ +
+

+ + .gem_rootLogger + + + + + +

+
+

The root logger for this gem

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Logger) + + + +
  • + +
+ +
+ + + + +
+
+
+
+193
+194
+195
+
+
# File 'lib/openhab/log.rb', line 193
+
+def gem_root
+  Log.logger(PREFIX)
+end
+
+
+ +
+

+ + .rootLogger + + + + + +

+
+

The root logger (all of openHAB)

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Logger) + + + +
  • + +
+ +
+ + + + +
+
+
+
+187
+188
+189
+
+
# File 'lib/openhab/log.rb', line 187
+
+def root
+  Log.logger(org.slf4j.Logger::ROOT_LOGGER_NAME)
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #debug(msg = nil) { ... } ⇒ void + + + + + +

+
+

This method returns an undefined value.

Log a message at debug level.

+ + +
+
+
+ +
+

Examples:

+ + +
logger.debug do
+  total = Item1.state + Item2.state
+  average = total / 2
+"Total: #{total}, Average: #{average}"
+end
+ +
+

Parameters:

+
    + +
  • + + msg + + + (Object, nil) + + + (defaults to: nil) + + + — +

    The log message

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Pass a block to delay generating the log message until it's +confirmed that logging is enabled at debug level.

    +
    + +
  • + +
+

Yield Returns:

+
    + +
  • + + + (Object, nil) + + + + — +

    The log message

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+299
+
+
# File 'lib/openhab/log.rb', line 299
+
+def_level_method(:debug)
+
+
+ +
+

+ + #debug?true, false + + + + + +

+
+

If the logger is enabled at debug level.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+300
+
+
# File 'lib/openhab/log.rb', line 300
+
+def_level_predicate(:debug)
+
+
+ +
+

+ + #error(msg = nil) { ... } ⇒ void + + + + + +

+
+

This method returns an undefined value.

Log a message at error level.

+ + +
+
+
+ +
+

Examples:

+ + +
logger.error do
+  total = Item1.state + Item2.state
+  average = total / 2
+"Total: #{total}, Average: #{average}"
+end
+ +
+

Parameters:

+
    + +
  • + + msg + + + (Object, nil) + + + (defaults to: nil) + + + — +

    The log message

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Pass a block to delay generating the log message until it's +confirmed that logging is enabled at error level.

    +
    + +
  • + +
+

Yield Returns:

+
    + +
  • + + + (Object, nil) + + + + — +

    The log message

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+293
+
+
# File 'lib/openhab/log.rb', line 293
+
+def_level_method(:error)
+
+
+ +
+

+ + #error?true, false + + + + + +

+
+

If the logger is enabled at error level.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+294
+
+
# File 'lib/openhab/log.rb', line 294
+
+def_level_predicate(:error)
+
+
+ +
+

+ + #info(msg = nil) { ... } ⇒ void + + + + + +

+
+

This method returns an undefined value.

Log a message at info level.

+ + +
+
+
+ +
+

Examples:

+ + +
logger.info do
+  total = Item1.state + Item2.state
+  average = total / 2
+"Total: #{total}, Average: #{average}"
+end
+ +
+

Parameters:

+
    + +
  • + + msg + + + (Object, nil) + + + (defaults to: nil) + + + — +

    The log message

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Pass a block to delay generating the log message until it's +confirmed that logging is enabled at info level.

    +
    + +
  • + +
+

Yield Returns:

+
    + +
  • + + + (Object, nil) + + + + — +

    The log message

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+297
+
+
# File 'lib/openhab/log.rb', line 297
+
+def_level_method(:info)
+
+
+ +
+

+ + #info?true, false + + + + + +

+
+

If the logger is enabled at info level.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+298
+
+
# File 'lib/openhab/log.rb', line 298
+
+def_level_predicate(:info)
+
+
+ +
+

+ + #inspectString + + + + Also known as: + to_s + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+264
+265
+266
+
+
# File 'lib/openhab/log.rb', line 264
+
+def inspect
+  "#<OpenHAB::Logger #{name}>"
+end
+
+
+ +
+

+ + #log_exception(exception) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Print error and stack trace without calls to internal classes

+ + +
+
+
+

Parameters:

+
    + +
  • + + exception + + + (Exception) + + + + — +

    A rescued error

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+310
+311
+312
+313
+314
+315
+
+
# File 'lib/openhab/log.rb', line 310
+
+def log_exception(exception)
+  exception = clean_backtrace(exception)
+  error do
+    "#{exception.message} (#{exception.class})\n#{exception.backtrace&.join("\n")}"
+  end
+end
+
+
+ +
+

+ + #nameString + + + + + +

+
+

The logger name

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+259
+260
+261
+
+
# File 'lib/openhab/log.rb', line 259
+
+def name
+  @slf4j_logger.name
+end
+
+
+ +
+

+ + #trace(msg = nil) { ... } ⇒ void + + + + + +

+
+

This method returns an undefined value.

Log a message at trace level.

+ + +
+
+
+ +
+

Examples:

+ + +
logger.trace do
+  total = Item1.state + Item2.state
+  average = total / 2
+"Total: #{total}, Average: #{average}"
+end
+ +
+

Parameters:

+
    + +
  • + + msg + + + (Object, nil) + + + (defaults to: nil) + + + — +

    The log message

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Pass a block to delay generating the log message until it's +confirmed that logging is enabled at trace level.

    +
    + +
  • + +
+

Yield Returns:

+
    + +
  • + + + (Object, nil) + + + + — +

    The log message

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+301
+
+
# File 'lib/openhab/log.rb', line 301
+
+def_level_method(:trace)
+
+
+ +
+

+ + #trace?true, false + + + + + +

+
+

If the logger is enabled at trace level.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+302
+
+
# File 'lib/openhab/log.rb', line 302
+
+def_level_predicate(:trace)
+
+
+ +
+

+ + #warn(msg = nil) { ... } ⇒ void + + + + + +

+
+

This method returns an undefined value.

Log a message at warn level.

+ + +
+
+
+ +
+

Examples:

+ + +
logger.warn do
+  total = Item1.state + Item2.state
+  average = total / 2
+"Total: #{total}, Average: #{average}"
+end
+ +
+

Parameters:

+
    + +
  • + + msg + + + (Object, nil) + + + (defaults to: nil) + + + — +

    The log message

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + + +

    Pass a block to delay generating the log message until it's +confirmed that logging is enabled at warn level.

    +
    + +
  • + +
+

Yield Returns:

+
    + +
  • + + + (Object, nil) + + + + — +

    The log message

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+295
+
+
# File 'lib/openhab/log.rb', line 295
+
+def_level_method(:warn)
+
+
+ +
+

+ + #warn?true, false + + + + + +

+
+

If the logger is enabled at warn level.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+296
+
+
# File 'lib/openhab/log.rb', line 296
+
+def_level_predicate(:warn)
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/OSGi.html b/5.33/OpenHAB/OSGi.html new file mode 100644 index 0000000000..9052d1ce76 --- /dev/null +++ b/5.33/OpenHAB/OSGi.html @@ -0,0 +1,4201 @@ + + + + + + + Module: OpenHAB::OSGi + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::OSGi + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/osgi.rb
+
+ +
+ +

Overview

+
+

OSGi services interface

+ + +
+
+
+ + +
+ + + +

Class Attribute Summary collapse

+ + + + + + +

+ Class Method Summary + collapse +

+ + + + + + + + +
+

Class Attribute Details

+ + + +
+

+ + .bundleorg.osgi.framework.Bundle (readonly) + + + + + +

+
+

Returns The OSGi Bundle for ScriptExtension Class.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (org.osgi.framework.Bundle) + + + + — +

    The OSGi Bundle for ScriptExtension Class

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+68
+69
+70
+
+
# File 'lib/openhab/osgi.rb', line 68
+
+def bundle
+  @bundle ||= org.osgi.framework.FrameworkUtil.getBundle($scriptExtension.java_class)
+end
+
+
+ + + +
+

+ + .bundle_contextorg.osgi.framework.BundleContext (readonly) + + + + + +

+
+

Returns OSGi bundle context for ScriptExtension Class.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (org.osgi.framework.BundleContext) + + + + — +

    OSGi bundle context for ScriptExtension Class

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+62
+63
+64
+
+
# File 'lib/openhab/osgi.rb', line 62
+
+def bundle_context
+  @bundle_context ||= bundle.bundle_context
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .register_service(instance, *interfaces, bundle: nil, **properties) ⇒ org.osgi.framework.ServiceRegistration + + + + + +

+
+

Register a new service instance with OSGi

+ + +
+
+
+

Parameters:

+
    + +
  • + + instance + + + (Object) + + + + — +

    The service instance

    +
    + +
  • + +
  • + + interfaces + + + (Module, String) + + + + — +

    The interfaces to register this service for. +If not provided, it will default to all Java interfaces the instance +implements.

    +
    + +
  • + +
  • + + bundle + + + (org.osgi.framework.Bundle, nil) + + + (defaults to: nil) + + + — +

    The bundle to register +the service from. If not provided, it will default to the bundle of the first +interface.

    +
    + +
  • + +
  • + + properties + + + (Hash) + + + + — +

    The service registration properties.

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (org.osgi.framework.ServiceRegistration) + + + +
  • + +
+ +
+ + + + +
+
+
+
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+
+
# File 'lib/openhab/osgi.rb', line 45
+
+def register_service(instance, *interfaces, bundle: nil, **properties)
+  if interfaces.empty?
+    interfaces = instance.class.ancestors.select { |k| k.respond_to?(:java_class) && k.java_class&.interface? }
+  end
+
+  bundle_class = interfaces.first.is_a?(Module) ? interfaces.first : instance
+  bundle ||= org.osgi.framework.FrameworkUtil.get_bundle(bundle_class.java_class)
+  interfaces.map! { |i| i.is_a?(String) ? i : i.java_class.name }
+  bundle.bundle_context.register_service(
+    interfaces.to_java(java.lang.String),
+    instance,
+    java.util.Hashtable.new(properties)
+  )
+end
+
+
+ +
+

+ + .service(name, filter: nil) ⇒ Object + + + + + +

+
+ + +
+
+
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (Object) + + + +
  • + +
+ +
+ + + + +
+
+
+
+15
+16
+17
+
+
# File 'lib/openhab/osgi.rb', line 15
+
+def service(name, filter: nil)
+  services(name, filter: filter).first
+end
+
+
+ +
+

+ + .services(name, filter: nil) ⇒ Array<Object> + + + + + +

+
+

Returns An array of services.

+ + +
+
+
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (Array<Object>) + + + + — +

    An array of services

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+25
+26
+27
+28
+29
+30
+
+
# File 'lib/openhab/osgi.rb', line 25
+
+def services(name, filter: nil)
+  (bundle_context.get_service_references(name, filter) || []).map do |reference|
+    logger.trace { "OSGi service found for '#{name}' using OSGi Service Reference #{reference}" }
+    bundle_context.get_service(reference)
+  end
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/RSpec.html b/5.33/OpenHAB/RSpec.html new file mode 100644 index 0000000000..6daa9cb69c --- /dev/null +++ b/5.33/OpenHAB/RSpec.html @@ -0,0 +1,3621 @@ + + + + + + + Module: OpenHAB::RSpec + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::RSpec + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/rspec/hooks.rb,
+ lib/openhab/rspec/shell.rb,
lib/openhab/rspec/helpers.rb,
lib/openhab/rspec/configuration.rb,
lib/openhab/rspec/example_group.rb
+
+
+ +
+ +

Overview

+
+

This module contains helper methods, hooks, and infrastracture to +boot openHAB inside of JRuby, and run RSpec (or other Ruby processes) +in that context.

+ + +
+
+
+ + +

See Also:

+ + +

Defined Under Namespace

+

+ + + Modules: Configuration, ExampleGroup, Helpers + + + + +

+ + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/RSpec/Configuration.html b/5.33/OpenHAB/RSpec/Configuration.html new file mode 100644 index 0000000000..83b7e7386e --- /dev/null +++ b/5.33/OpenHAB/RSpec/Configuration.html @@ -0,0 +1,3941 @@ + + + + + + + Module: OpenHAB::RSpec::Configuration + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::RSpec::Configuration + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/rspec/configuration.rb
+
+ +
+ +

Overview

+
+

Contains configuration for how the openHAB instance should be set +up for the testing environment.

+ + +
+
+
+ + +
+ + + +

Class Attribute Summary collapse

+
    + +
  • + + + .include_bindings ⇒ true, false + + + + + + + + + + + + + + + + +

    Copy binding configuration from the root openHAB instance.

    +
    + +
  • + + +
  • + + + .include_jsondb ⇒ true, false + + + + + + + + + + + + + + + + +

    Copy the JSONDB (managed thing and item configuration) from the root openHAB instance.

    +
    + +
  • + + +
  • + + + .private_confdir ⇒ true, false + + + + + + + + + + + + + + + + +

    Use a private (empty) confdir (scripts, rules, items, and things files), instead of sharing with the root openHAB instance.

    +
    + +
  • + + +
  • + + + .use_root_instance ⇒ true, false + + + + + + + + + + + + + + + + +

    Use the root openHAB instance directly, rather than creating a private (but linked) instance.

    +
    + +
  • + + +
+ + + + + + +
+

Class Attribute Details

+ + + +
+

+ + .include_bindingstrue, false + + + + + +

+
+

Copy binding configuration from the root openHAB instance.

+

Default true.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+17
+18
+19
+
+
# File 'lib/openhab/rspec/configuration.rb', line 17
+
+def include_bindings
+  @include_bindings
+end
+
+
+ + + +
+

+ + .include_jsondbtrue, false + + + + + +

+
+

Copy the JSONDB (managed thing and item configuration) from the root +openHAB instance.

+

Default true.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+27
+28
+29
+
+
# File 'lib/openhab/rspec/configuration.rb', line 27
+
+def include_jsondb
+  @include_jsondb
+end
+
+
+ + + +
+

+ + .private_confdirtrue, false + + + + + +

+
+

Use a private (empty) confdir (scripts, rules, items, and things +files), instead of sharing with the root openHAB instance.

+

Default false.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+37
+38
+39
+
+
# File 'lib/openhab/rspec/configuration.rb', line 37
+
+def private_confdir
+  @private_confdir
+end
+
+
+ + + +
+

+ + .use_root_instancetrue, false + + + + + +

+
+

Use the root openHAB instance directly, rather than creating a +private (but linked) instance.

+

Default false.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+47
+48
+49
+
+
# File 'lib/openhab/rspec/configuration.rb', line 47
+
+def use_root_instance
+  @use_root_instance
+end
+
+
+ +
+ + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/RSpec/ExampleGroup.html b/5.33/OpenHAB/RSpec/ExampleGroup.html new file mode 100644 index 0000000000..5a72f94c43 --- /dev/null +++ b/5.33/OpenHAB/RSpec/ExampleGroup.html @@ -0,0 +1,3608 @@ + + + + + + + Module: OpenHAB::RSpec::ExampleGroup + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::RSpec::ExampleGroup + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/rspec/example_group.rb
+
+ +
+ +

Overview

+
+

::RSpec::ExampleGroup extensions

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: ClassMethods + + + + +

+ + + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/RSpec/ExampleGroup/ClassMethods.html b/5.33/OpenHAB/RSpec/ExampleGroup/ClassMethods.html new file mode 100644 index 0000000000..be0cf9b222 --- /dev/null +++ b/5.33/OpenHAB/RSpec/ExampleGroup/ClassMethods.html @@ -0,0 +1,4232 @@ + + + + + + + Module: OpenHAB::RSpec::ExampleGroup::ClassMethods + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::RSpec::ExampleGroup::ClassMethods + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/rspec/example_group.rb
+
+ +
+ +

Overview

+
+

Extensions for ::RSpec::ExampleGroup's singleton class.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #consistent_proxies ⇒ true, ... + + + + + + + + + + writeonly + + + + + + + + +

    Set if Items and Thing proxies should return consistent objects.

    +
    + +
  • + + +
  • + + + #mock_timers ⇒ true, ... + + + + + + + + + + writeonly + + + + + + + + +

    Set if timers should be mocked for this example group.

    +
    + +
  • + + +
  • + + + #propagate_exceptions ⇒ true, ... + + + + + + + + + + writeonly + + + + + + + + +

    Set if exceptions in rules should be propagated in specs, instead of just logged.

    +
    + +
  • + + +
+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #consistent_proxies=(value) ⇒ true, ... (writeonly) + + + + + +

+
+

Set if Items and Thing proxies should return consistent objects.

+ + +
+
+
+ +
+

Examples:

+ + +
describe "my_rule" do
+  self.consistent_proxies = false
+
+  it "does something" do
+    expect(self.class.consistent_proxies?).to be false
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + value + + + (true, false, nil) + + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false, nil) + + + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+62
+63
+64
+
+
# File 'lib/openhab/rspec/example_group.rb', line 62
+
+def consistent_proxies=(value)
+  @consistent_proxies = value
+end
+
+
+ + + +
+

+ + #mock_timers=(value) ⇒ true, ... (writeonly) + + + + + +

+
+

Set if timers should be mocked for this example group.

+ + +
+
+
+ +
+

Examples:

+ + +
describe "my_rule" do
+  self.mock_timers = false
+
+  it "runs a timer" do
+    expect(self.class.mock_timers?).to be false
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + value + + + (true, false, nil) + + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+25
+26
+27
+
+
# File 'lib/openhab/rspec/example_group.rb', line 25
+
+def mock_timers=(value)
+  @mock_timers = value
+end
+
+
+ + + +
+

+ + #propagate_exceptions=(value) ⇒ true, ... (writeonly) + + + + + +

+
+

Set if exceptions in rules should be propagated in specs, instead of just logged.

+ + +
+
+
+ +
+

Examples:

+ + +
describe "my_rule" do
+  self.propagate_exceptions = false
+
+  it "logs exceptions in rule execution" do
+    expect(self.class.propagate_exceptions?).to be false
+    rule do
+      on_load
+      run { raise "exception is logged" }
+    end
+    expect(spec_log_lines).to include(match(/exception is logged/))
+  end
+end
+ +
+

Parameters:

+
    + +
  • + + value + + + (true, false, nil) + + + +
  • + +
+ +

Returns:

+
    + +
  • + + + (true, false, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+104
+105
+106
+
+
# File 'lib/openhab/rspec/example_group.rb', line 104
+
+def propagate_exceptions=(value)
+  @propagate_exceptions = value
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #consistent_proxies?true, false + + + + + +

+
+

If Item and Thing proxies will consistently return the same object.

+

Useful for mocking and using the be matcher.

+

It will search through parent groups until it finds one where it's +explicitly defined, or defaults to true if none are.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+76
+77
+78
+79
+80
+81
+
+
# File 'lib/openhab/rspec/example_group.rb', line 76
+
+def consistent_proxies?
+  return @consistent_proxies if instance_variable_defined?(:@consistent_proxies) && !@consistent_proxies.nil?
+  return superclass.consistent_proxies? if superclass.is_a?(ClassMethods)
+
+  true
+end
+
+
+ +
+

+ + #mock_timers?true, false + + + + + +

+
+

If timers are mocked for this example group

+

It will search through parent groups until it finds one where it's +explicitly defined, or defaults to true if none are.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+37
+38
+39
+40
+41
+42
+
+
# File 'lib/openhab/rspec/example_group.rb', line 37
+
+def mock_timers?
+  return @mock_timers if instance_variable_defined?(:@mock_timers) && !@mock_timers.nil?
+  return superclass.mock_timers? if superclass.is_a?(ClassMethods)
+
+  true
+end
+
+
+ +
+

+ + #propagate_exceptions?true, false + + + + + +

+
+

If timers are mocked for this example group

+

It will search through parent groups until it finds one where it's +explicitly defined, or defaults to true if none are.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+116
+117
+118
+119
+120
+121
+122
+123
+
+
# File 'lib/openhab/rspec/example_group.rb', line 116
+
+def propagate_exceptions?
+  if instance_variable_defined?(:@propagate_exceptions) && !@propagate_exceptions.nil?
+    return @propagate_exceptions
+  end
+  return superclass.propagate_exceptions? if superclass.is_a?(ClassMethods)
+
+  true
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/RSpec/Helpers.html b/5.33/OpenHAB/RSpec/Helpers.html new file mode 100644 index 0000000000..bf23cdbfeb --- /dev/null +++ b/5.33/OpenHAB/RSpec/Helpers.html @@ -0,0 +1,5096 @@ + + + + + + + Module: OpenHAB::RSpec::Helpers + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::RSpec::Helpers + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/rspec/helpers.rb
+
+ +
+ +

Overview

+
+

Provides helper methods for use in specs, to easily work with and adjust +the openHAB environment.

+

These methods are automatically available in RSpec spec blocks, as well +as other per-spec hooks like before and after. You can also call them +explicitly.

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + + + + +
+

Class Method Details

+ + +
+

+ + .autorequiresvoid + + + + + +

+
+

This method returns an undefined value.

Require all files configured to be autorequired with the jrubyscripting addon in openHAB.

+

This method is normally called by RSpec hooks.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+
+
# File 'lib/openhab/rspec/helpers.rb', line 195
+
+def autorequires
+  ENV["RUBYLIB"] ||= ""
+  ENV["RUBYLIB"] += ":" unless ENV["RUBYLIB"].empty?
+  ENV["RUBYLIB"] += rubylib_dirs.join(":")
+
+  $LOAD_PATH.unshift(*ENV["RUBYLIB"]
+    .split(File::PATH_SEPARATOR)
+      .reject(&:empty?)
+      .reject do |path|
+                       $LOAD_PATH.include?(path)
+                     end)
+
+  requires = jrubyscripting_config&.get("require") || ""
+  requires.split(",").each do |f|
+    require f.strip
+  end
+end
+
+
+ +
+

+ + .autoupdate_all_itemsvoid + + + + + +

+
+
Deprecated.
+

This method returns an undefined value.

Reconfigure all items to autoupdate

+

To bypass any items configured to not autoupdate, waiting for the binding to update them.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+81
+82
+83
+
+
# File 'lib/openhab/rspec/helpers.rb', line 81
+
+def autoupdate_all_items
+  # no-op
+end
+
+
+ +
+

+ + .execute_timersvoid + + + + + +

+
+

This method returns an undefined value.

Execute all pending timers

+ + +
+
+
+ + +
+ + + + +
+
+
+
+119
+120
+121
+122
+123
+124
+125
+126
+
+
# File 'lib/openhab/rspec/helpers.rb', line 119
+
+def execute_timers
+  raise "Cannot execute timers when timers aren't mocked" unless self.class.mock_timers?
+
+  now = ZonedDateTime.now
+  DSL::TimerManager.instance.instance_variable_get(:@timers).each_key do |t|
+    t.execute if t.active? && t.execution_time <= now
+  end
+end
+
+
+ +
+

+ + .initialize_missing_thing_typesvoid + + + + + +

+
+

This method returns an undefined value.

Force things to come online that are missing their thing type

+

As of openHAB 4.0, things that are missing their thing type will not +come online immediately. This especially impacts bindings that +dynamically generate their thing types, but don't persist those +thing types. You can use this method to force them to come online +immediately.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+
+
# File 'lib/openhab/rspec/helpers.rb', line 96
+
+def initialize_missing_thing_types
+  thing_manager = OpenHAB::OSGi.service("org.openhab.core.thing.ThingManager")
+  thing_manager.class.field_reader :missingPrerequisites
+  first = true
+  thing_manager.missingPrerequisites.each_value do |prereq|
+    if first
+      prereq.class.field_accessor :timesChecked
+      first = false
+    end
+    prereq.timesChecked = 60
+  end
+  m = thing_manager.class.java_class.get_declared_method(:checkMissingPrerequisites)
+  m.accessible = true
+  suspend_rules do
+    m.invoke(thing_manager)
+  end
+end
+
+
+ +
+

+ + .install_addon(addon_id, wait: true, ready_markers: nil) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Install an openHAB addon

+ + +
+
+
+

Parameters:

+
    + +
  • + + addon_id + + + (String) + + + + — +

    The addon id, such as "binding-mqtt"

    +
    + +
  • + +
  • + + wait + + + (true, false) + + + (defaults to: true) + + + — +

    Wait until OSGi has confirmed the bundle is installed and running before returning.

    +
    + +
  • + +
  • + + ready_markers + + + (String, Array<String>) + + + (defaults to: nil) + + + — +

    Array of ready marker types to wait for. +The addon's bundle id is used as the identifier.

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+
+
# File 'lib/openhab/rspec/helpers.rb', line 365
+
+def install_addon(addon_id, wait: true, ready_markers: nil)
+  service_filter = "(component.name=org.openhab.core.karafaddons)"
+  addon_service = OSGi.service("org.openhab.core.addon.AddonService", filter: service_filter)
+  addon_service.install(addon_id)
+  return unless wait
+
+  addon = nil
+  loop do
+    addon = addon_service.get_addon(addon_id, nil)
+    break if addon.installed?
+
+    sleep 0.25
+  end
+
+  return unless ready_markers
+
+  package_id = addon.logger_packages.first
+
+  ready_markers = Array(ready_markers).map do |marker|
+    case marker
+    when String
+      org.openhab.core.service.ReadyMarker.new(marker, package_id)
+    else
+      marker
+    end
+  end
+
+  rs = OSGi.service("org.openhab.core.service.ReadyService")
+  loop do
+    break if ready_markers.all? { |rm| rs.ready?(rm) }
+
+    sleep 0.25
+  end
+end
+
+
+ +
+

+ + .launch_karaf(include_bindings: true, include_jsondb: true, private_confdir: false, use_root_instance: false) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Launch the karaf instance

+

This method is normally called by RSpec hooks.

+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+
+
# File 'lib/openhab/rspec/helpers.rb', line 221
+
+def launch_karaf(include_bindings: true,
+                 include_jsondb: true,
+                 private_confdir: false,
+                 use_root_instance: false)
+  karaf = Karaf.new("#{Dir.pwd}/.karaf")
+  karaf.include_bindings = include_bindings
+  karaf.include_jsondb = include_jsondb
+  karaf.private_confdir = private_confdir
+  karaf.use_root_instance = use_root_instance
+  main = karaf.launch
+
+  require "openhab/dsl"
+
+  require_relative "mocks/persistence_service"
+  require_relative "mocks/timer"
+
+  # override several DSL methods
+  require_relative "openhab/core/items/proxy"
+  require_relative "openhab/core/things/proxy"
+  require_relative "openhab/core/actions"
+
+  ps = Mocks::PersistenceService.instance
+  persistence_bundle = org.osgi.framework.FrameworkUtil
+                          .get_bundle(org.openhab.core.persistence.PersistenceService.java_class)
+  persistence_bundle.bundle_context.register_service(org.openhab.core.persistence.PersistenceService.java_class,
+                                                     ps,
+                                                     nil)
+
+  rs = OSGi.service("org.openhab.core.service.ReadyService")
+
+  # wait for the rule engine
+  filter = org.openhab.core.service.ReadyMarkerFilter.new
+              .with_type(org.openhab.core.service.StartLevelService::STARTLEVEL_MARKER_TYPE)
+              .with_identifier(org.openhab.core.service.StartLevelService::STARTLEVEL_RULEENGINE.to_s)
+
+  karaf.send(:wait) do |continue|
+    rs.register_tracker(org.openhab.core.service.ReadyService::ReadyTracker.impl { continue.call }, filter)
+  end
+
+  begin
+    # load storage based type providers
+    ast = org.openhab.core.thing.binding.AbstractStorageBasedTypeProvider
+    ast_bundle = org.osgi.framework.FrameworkUtil.get_bundle(ast.java_class)
+    storage_service = OSGi.service("org.openhab.core.storage.StorageService")
+    require_relative "mocks/abstract_storage_based_type_provider_wrapped_storage_service"
+
+    OSGi.bundle_context.bundles.each do |bundle|
+      OSGi.service_component_classes(bundle)
+          .select { |klass, _services| klass.ancestors.include?(ast.java_class) }
+          .each do |klass, services|
+        new_ast_klass = Class.new(ast)
+        new_ast_klass.become_java!
+        wrapped_storage_service = Mocks::AbstractStorageBasedTypeProviderWrappedStorageService
+                                  .new(storage_service,
+                                       new_ast_klass.java_class,
+                                       klass)
+        new_ast = new_ast_klass.new(wrapped_storage_service)
+
+        services -= [klass.name]
+        OSGi.register_service(new_ast, *services, bundle: ast_bundle)
+      end
+    end
+  rescue NameError
+    # @deprecated OH 4.0
+  end
+
+  # RSpec additions
+  require_relative "suspend_rules"
+
+  if defined?(::RSpec)
+    ::RSpec.configure do |config|
+      config.include OpenHAB::DSL
+    end
+  end
+  main
+rescue Exception => e
+  puts e.inspect
+  puts e.backtrace
+  raise
+end
+
+
+ +
+

+ + .load_rulesvoid + + + + + +

+
+

This method returns an undefined value.

Load all Ruby rules in the config/automation directory

+

This method is normally called by RSpec hooks.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+
+
# File 'lib/openhab/rspec/helpers.rb', line 309
+
+def load_rules
+  automation_paths = Array(::RSpec.configuration.openhab_automation_search_paths)
+
+  lib_dirs = rubylib_dirs.map { |d| File.join(d, "") }
+  lib_dirs << File.join(gem_home, "")
+
+  SuspendRules.suspend_rules do
+    files = automation_paths.map { |p| Dir["#{p}/**/*.rb"] }.flatten
+    files.reject! do |f|
+      lib_dirs.any? { |l| f.start_with?(l) }
+    end
+    files.sort_by { |f| [get_start_level(f), f] }.each do |f|
+      load f
+    rescue Exception => e
+      warn "Failed loading #{f}: #{e.inspect}"
+      warn e.backtrace
+    end
+  end
+end
+
+
+ +
+

+ + .load_transformsvoid + + + + + +

+
+

This method returns an undefined value.

Load all Ruby transformations in the config/transform directory

+

Since Ruby transformations must end with the .script extension, you must include +an Emacs modeline comment (# -*- mode: ruby -*-) in your script for it to be +recognized.

+

This method is normally called by RSpec hooks.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+
+
# File 'lib/openhab/rspec/helpers.rb', line 340
+
+def load_transforms
+  transform_path = "#{org.openhab.core.OpenHAB.config_folder}/transform"
+  Dir["#{transform_path}/**/*.script"].each do |filename|
+    script = File.read(filename)
+    next unless ruby_file?(script)
+
+    filename.slice!(0..transform_path.length)
+    dir = File.dirname(filename)
+    modules = (dir == ".") ? [] : moduleize(dir)
+    basename = File.basename(filename)
+    method = basename[0...-7]
+    modules << method
+    Transform.add_script(modules, script)
+  end
+end
+
+
+ +
+

+ + .log_fileString + + + + + +

+
+

Returns The filename of the openHAB log.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +

    The filename of the openHAB log.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+401
+402
+403
+
+
# File 'lib/openhab/rspec/helpers.rb', line 401
+
+def log_file
+  "#{java.lang.System.get_property("openhab.logdir", nil)}/openhab.log"
+end
+
+
+ +
+

+ + .spec_log_linesArray<String> + + + + + +

+
+

Returns The log lines since this spec started.

+ + +
+
+
+ +
+

Examples:

+ + +
it "logs" do
+  logger.trace("log line")
+  expect(spec_log_lines).to include(match(/TRACE.*log line/))
+end
+ +
+ +

Returns:

+
    + +
  • + + + (Array<String>) + + + + — +

    The log lines since this spec started.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+414
+415
+416
+417
+418
+419
+
+
# File 'lib/openhab/rspec/helpers.rb', line 414
+
+def spec_log_lines
+  File.open(log_file, "rb") do |f|
+    f.seek(@log_index) if @log_index
+    f.read.split("\n")
+  end
+end
+
+
+ +
+

+ + .suspend_rules(&block) ⇒ Object + + + + + +

+
+

Suspend rules for the duration of the block

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +

    The return value from the block.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+150
+151
+152
+
+
# File 'lib/openhab/rspec/helpers.rb', line 150
+
+def suspend_rules(&block)
+  SuspendRules.suspend_rules(&block)
+end
+
+
+ +
+

+ + .time_travel_and_execute_timers(duration) ⇒ void + + + + + +

+
+

This method returns an undefined value.

Wait duration seconds, then execute any pending timers

+

If timers are mocked, it will use Timecop. If they're not mocked, it +will just sleep for duration

+ + +
+
+
+ + +
+ + + + +
+
+
+
+136
+137
+138
+139
+140
+141
+142
+143
+
+
# File 'lib/openhab/rspec/helpers.rb', line 136
+
+def time_travel_and_execute_timers(duration)
+  if self.class.mock_timers?
+    Timecop.frozen? ? Timecop.freeze(duration) : Timecop.travel(duration)
+    execute_timers
+  else
+    sleep duration
+  end
+end
+
+
+ +
+

+ + .trigger_channel(channel, event = "") ⇒ void + + + + + +

+
+

This method returns an undefined value.

Manually send an event to a trigger channel

+ + +
+
+
+

Parameters:

+
    + +
  • + + channel + + + (String, Core::Things::Channel, Core::Things::ChannelUID) + + + + — +

    The channel to trigger.

    +
    + +
  • + +
  • + + event + + + (String) + + + (defaults to: "") + + + — +

    The event data to send to the channel.

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+181
+182
+183
+184
+185
+186
+
+
# File 'lib/openhab/rspec/helpers.rb', line 181
+
+def trigger_channel(channel, event = "")
+  channel = org.openhab.core.thing.ChannelUID.new(channel) if channel.is_a?(String)
+  channel = channel.uid if channel.is_a?(org.openhab.core.thing.Channel)
+  thing = channel.thing
+  thing.handler.callback.channel_triggered(nil, channel, event)
+end
+
+
+ +
+

+ + .wait(how_long = 2.seconds) { ... } ⇒ void + + + + + +

+
+

This method returns an undefined value.

Calls the block repeatedly until the expectations inside pass.

+ + +
+
+
+

Parameters:

+
    + +
  • + + how_long + + + (Duration) + + + (defaults to: 2.seconds) + + + — +

    how long to keep trying before giving up

    +
    + +
  • + +
+ +

Yields:

+
    + +
  • + + + + + + +
  • + +
+ +
+ + + + +
+
+
+
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+
+
# File 'lib/openhab/rspec/helpers.rb', line 160
+
+def wait(how_long = 2.seconds)
+  start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
+
+  begin
+    yield
+  rescue ::RSpec::Expectations::ExpectationNotMetError,
+         ::RSpec::Mocks::MockExpectationError
+    raise if Process.clock_gettime(Process::CLOCK_MONOTONIC) > start + how_long.to_f
+
+    sleep 0.1
+    retry
+  end
+end
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/OpenHAB/Transform.html b/5.33/OpenHAB/Transform.html new file mode 100644 index 0000000000..2b7d20532c --- /dev/null +++ b/5.33/OpenHAB/Transform.html @@ -0,0 +1,3618 @@ + + + + + + + Module: OpenHAB::Transform + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Module: OpenHAB::Transform + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/rspec/helpers.rb
+
+ +
+ +

Overview

+
+

Contains loaded Ruby transformations as class methods

+

Only during testing.

+ + +
+
+
+ +
+

Examples:

+ + +

Corresponds to transform/compass.script

+

+ +
OpenHAB::Transform.compass("59 °")
+ + +

Corresponds to transform/compass.script

+

+ +
OpenHAB::Transform.compass("30", param: "7")
+ +
+ + +
+ + + + + + + + + +
+ + + +
+
+ + diff --git a/5.33/Range.html b/5.33/Range.html new file mode 100644 index 0000000000..04e38a0b7f --- /dev/null +++ b/5.33/Range.html @@ -0,0 +1,3630 @@ + + + + + + + Class: Range + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: Range + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
OpenHAB::CoreExt::Ruby::Range
+
+ + + + + + +
+
Defined in:
+
lib/openhab/yard.rb
+
+ +
+ +

Overview

+
+

Extensions to Ruby Range

+ + +
+
+
+ + +
+ + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from OpenHAB::CoreExt::Ruby::Range

+

#circular?, #cover?, #each

+ + +
+ + + +
+
+ + diff --git a/5.33/Symbol.html b/5.33/Symbol.html new file mode 100644 index 0000000000..f25a008b92 --- /dev/null +++ b/5.33/Symbol.html @@ -0,0 +1,3692 @@ + + + + + + + Class: Symbol + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: Symbol + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/openhab/core_ext/ruby/symbol.rb
+
+ +
+ +

Overview

+
+

Extensions to Symbol

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + +
    + +
  • + + + #name ⇒ Object + + + + + + + + + + + + + +

    Ruby 3.0 already has #name.

    +
    + +
  • + + +
+ + + + + +
+

Instance Method Details

+ + +
+

+ + #nameObject + + + + + +

+
+

Ruby 3.0 already has #name

+ + +
+
+
+ + +
+ + + + +
+
+
+
+6
+
+
# File 'lib/openhab/core_ext/ruby/symbol.rb', line 6
+
+alias_method :name, :to_s
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/Time.html b/5.33/Time.html new file mode 100644 index 0000000000..7cda00b3a8 --- /dev/null +++ b/5.33/Time.html @@ -0,0 +1,4750 @@ + + + + + + + Class: Time + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Class: Time + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
OpenHAB::CoreExt::Between, OpenHAB::CoreExt::Ephemeris
+
+ + + + + + +
+
Defined in:
+
lib/openhab/core_ext/ruby/time.rb
+
+ +
+ +

Overview

+
+

Extensions to Time

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + + + + + + + + + +

Methods included from OpenHAB::CoreExt::Ephemeris

+

#days_until, #holiday, #holiday?, #in_dayset?, #next_holiday, #weekend?

+ + + + + + + + + +

Methods included from OpenHAB::CoreExt::Between

+

#between?

+ + +
+

Instance Method Details

+ + +
+

+ + #coerce(other) ⇒ Array? + + + + + +

+
+

Converts to a ZonedDateTime if other +is also convertible to a ZonedDateTime.

+ + +
+
+
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (Array, nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+115
+116
+117
+118
+119
+120
+121
+
+
# File 'lib/openhab/core_ext/ruby/time.rb', line 115
+
+def coerce(other)
+  logger.trace { "Coercing #{self} as a request from #{other.class}" }
+  return unless other.respond_to?(:to_zoned_date_time)
+
+  zdt = to_zoned_date_time
+  [other.to_zoned_date_time(zdt), zdt]
+end
+
+
+ +
+

+ + #minus_with_temporal(other) ⇒ ZonedDateTime, ... + + + + Also known as: + - + + + + +

+
+

Extends #- to allow subtracting a TemporalAmount +or any other date/time class that responds to #to_zoned_date_time.

+

Subtractions with another object of the same class (e.g. Time - Other Time, or DateTime - Other DateTime) +remains unchanged from its original behavior.

+ + +
+
+
+ +
+

Examples:

+ + +

Time - Duration -> ZonedDateTime

+

+ +
zdt_one_hour_ago = Time.now - 1.hour
+ + +

Time - ZonedDateTime -> Duration

+

+ +
java_duration = Time.now - 1.hour.ago
+ + +

Time - Numeric -> Time

+

+ +
time_one_hour_ago = Time - 3600
+ + +

Time - Time -> Float

+

+ +
one_day_in_secs = Time.new(2002, 10, 31) - Time.new(2002, 10, 30)
+ +
+

Parameters:

+ + +

Returns:

+
    + +
  • + + + (ZonedDateTime) + + + + — +

    If other is a TemporalAmount

    +
    + +
  • + +
  • + + + (Duration) + + + + — +

    If other responds to #to_zoned_date_time

    +
    + +
  • + +
  • + + + (Time) + + + + — +

    If other is a Numeric

    +
    + +
  • + +
  • + + + (Float) + + + + — +

    If other is a Time

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+
+
# File 'lib/openhab/core_ext/ruby/time.rb', line 55
+
+def minus_with_temporal(other)
+  return to_zoned_date_time - other if other.is_a?(java.time.temporal.TemporalAmount)
+
+  # Exclude subtracting against the same class
+  if other.respond_to?(:to_zoned_date_time) && !other.is_a?(self.class)
+    return to_zoned_date_time - other.to_zoned_date_time
+  end
+
+  minus_without_temporal(other)
+end
+
+
+ +
+

+ + #plus_with_temporal(other) ⇒ ZonedDateTime, Time + + + + Also known as: + + + + + + +

+
+

Extends #+ to allow adding a TemporalAmount

+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+20
+21
+22
+23
+24
+
+
# File 'lib/openhab/core_ext/ruby/time.rb', line 20
+
+def plus_with_temporal(other)
+  return to_zoned_date_time + other if other.is_a?(java.time.temporal.TemporalAmount)
+
+  plus_without_temporal(other)
+end
+
+
+ +
+

+ + #to_instant(_context = nil) ⇒ Instant + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+104
+105
+106
+
+
# File 'lib/openhab/core_ext/ruby/time.rb', line 104
+
+def to_instant(_context = nil)
+  to_java(java.time.Instant)
+end
+
+
+ +
+

+ + #to_local_date(_context = nil) ⇒ LocalDate + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+69
+70
+71
+
+
# File 'lib/openhab/core_ext/ruby/time.rb', line 69
+
+def to_local_date(_context = nil)
+  java.time.LocalDate.of(year, month, day)
+end
+
+
+ +
+

+ + #to_local_timeLocalTime + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+75
+
+
# File 'lib/openhab/core_ext/ruby/time.rb', line 75
+
+def_delegator :to_zoned_date_time, :to_local_time
+
+
+ +
+

+ + #to_monthMonth + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Month) + + + +
  • + +
+ +
+ + + + +
+
+
+
+78
+79
+80
+
+
# File 'lib/openhab/core_ext/ruby/time.rb', line 78
+
+def to_month
+  java.time.Month.of(month)
+end
+
+
+ +
+

+ + #to_month_dayMonthDay + + + + + +

+
+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+83
+84
+85
+
+
# File 'lib/openhab/core_ext/ruby/time.rb', line 83
+
+def to_month_day
+  java.time.MonthDay.of(month, day)
+end
+
+
+ +
+

+ + #to_zoned_date_time(context = nil) ⇒ ZonedDateTime + + + + + +

+
+ + +
+
+
+

Parameters:

+
    + +
  • + + context + + + (ZonedDateTime, nil) + + + (defaults to: nil) + + + — +

    A ZonedDateTime used to fill in missing fields +during conversion. Not used in this class.

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+99
+100
+101
+
+
# File 'lib/openhab/core_ext/ruby/time.rb', line 99
+
+def to_zoned_date_time(context = nil) # rubocop:disable Lint/UnusedMethodArgument
+  to_java(java.time.ZonedDateTime)
+end
+
+
+ +
+

+ + #today?true, false + + + + + +

+
+

Returns true if the date, converted to the system time zone, is today.

+

This is the equivalent of checking if the current datetime is between midnight and end of the day +of the system time zone.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+93
+
+
# File 'lib/openhab/core_ext/ruby/time.rb', line 93
+
+def_delegators :to_zoned_date_time, :yesterday?, :today?, :tomorrow?
+
+
+ +
+

+ + #tomorrow?true, false + + + + + +

+
+

Returns true if the date, converted to the system time zone, is tomorrow.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+93
+
+
# File 'lib/openhab/core_ext/ruby/time.rb', line 93
+
+def_delegators :to_zoned_date_time, :yesterday?, :today?, :tomorrow?
+
+
+ +
+

+ + #yesterday?true, false + + + + + +

+
+

Returns true if the date, converted to the system time zone, is yesterday.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (true, false) + + + +
  • + +
+ +
+ + + + +
+
+
+
+93
+
+
# File 'lib/openhab/core_ext/ruby/time.rb', line 93
+
+def_delegators :to_zoned_date_time, :yesterday?, :today?, :tomorrow?
+
+
+ +
+ +
+ + + +
+
+ + diff --git a/5.33/css/coderay.css b/5.33/css/coderay.css new file mode 100644 index 0000000000..bd4b20f573 --- /dev/null +++ b/5.33/css/coderay.css @@ -0,0 +1,116 @@ +:root { + --bg: hsl(220, 13%, 18%); + --comment: #999; + --fg: hsl(220, 14%, 71%); + --line-number: hsl(218, 5%, 37%); + --yellow: #f8c555; + --orange: hsl(29, 54%, 61%); + --red: hsl(5, 48%, 51%); + --magenta: hsl(355, 65%, 65%); + --purple: #cc99cd; + --blue: hsl(207, 82%, 66%); + --cyan: hsl(187, 47%, 55%); + --green: #7ec699; + --border: hsl(221, 9%, 26%); +} + +span.code { white-space: pre; border: 0px; padding: 2px; } + +table.code { border-collapse: collapse; width: 100%; padding: 2px; } +table.code td { padding: 2px 4px; vertical-align: top; } + +pre.code { background-color: var(--bg); border: 1px solid var(--border); border-radius: 5px; color: var(--fg); margin: 5px 0; } +pre.code pre { margin: 0px; background-color: var(--bg); color: var(--fg); border: 0px solid var(--border); } +pre.code .line-numbers { background-color: var(--line-number); color: var(--comment); text-align: right; -webkit-user-select: none; -moz-user-select: none; user-select: none; } +pre.code .line-numbers a { background-color: var(--line-number) !important; color: var(--comment) !important; text-decoration: none !important; } +pre.code .line-numbers a:target { color: var(--blue) !important; } +pre.code .line-numbers pre { word-break: normal; } +pre.code .line-numbers .highlighted { color: var(--red) !important; } +pre.code .line-numbers .highlighted a { color: var(--red) !important; } +pre.code span.line-numbers { padding: 0px 4px; } +pre.code .line { display: block; float: left; width: 100%; } +pre.code .code { width: 100%; } +pre.code .debug { color: var(--bg) !important; background: var(--blue) !important; } +pre.code .annotation { color: var(--blue); } +pre.code .attribute-name { color: var(--orange); } +pre.code .attribute-value { color: var(--green); } +pre.code .binary { color: var(--purple); } +pre.code .binary .char { color: var(--purple); } +pre.code .binary .delimiter { color: var(--purple); } +pre.code .char { color: var(--red); } +pre.code .char .content { color: var(--red); } +pre.code .char .delimiter { color: var(--red); } +pre.code .class { color: var(--yellow); } +pre.code .class-variable { color: var(--red); } +pre.code .color { color: var(--green); } +pre.code .comment { color: var(--comment); font-style: italic; } +pre.code .comment .char { color: var(--fg); } +pre.code .comment .delimiter { color: var(--fg); } +pre.code .constant { color: var(--yellow); } +pre.code .decorator { color: var(--magenta); } +pre.code .definition { color: var(--cyan); } +pre.code .delimiter { color: var(--comment); } +pre.code .directive { color: var(--cyan); } +pre.code .docstring { color: var(--orange); } +pre.code .doctype { color: var(--blue); } +pre.code .done { text-decoration: line-through; color: var(--comment); } +pre.code .entity { color: var(--red); } +pre.code .error { color: var(--bg); background-color: var(--red); } +pre.code .escape { color: var(--comment); } +pre.code .exception { color: var(--red); } +pre.code .float { color: var(--orange); } +pre.code .function { color: var(--blue); } +pre.code .function .delimiter { color: var(--blue); } +pre.code .global-variable { color: var(--orange); } +pre.code .hex { color: var(--blue); } +pre.code .id { color: var(--blue); } +pre.code .include { color: var(--magenta); } +pre.code .inline { color: var(--green); } +pre.code .inline-delimiter { color: var(--magenta); } +pre.code .instance-variable { color: var(--magenta); } +pre.code .integer { color: var(--orange); } +pre.code .imaginary { color: var(--red); } +pre.code .important { color: var(--red); } +pre.code .key { color: var(--cyan); } +pre.code .key .char { color: var(--cyan); } +pre.code .key .delimiter { color: var(--cyan); } +pre.code .keyword { color: var(--purple); } +pre.code .label { color: var(--yellow); } +pre.code .local-variable { color: var(--fg); } +pre.code .map .content { color: var(--purple); } +pre.code .map .delimiter { color: var(--purple); } +pre.code .namespace { color: var(--purple); } +pre.code .octal { color: var(--purple); } +pre.code .predefined { color: var(--blue); } +pre.code .predefined-constant { color: var(--orange); } +pre.code .predefined-type { color: var(--green); } +pre.code .preprocessor { color: var(--purple); } +pre.code .pseudo-class { color: var(--blue); } +pre.code .regexp .content { color: var(--purple); } +pre.code .regexp .delimiter { color: var(--purple); } +pre.code .regexp .modifier { color: var(--purple); } +pre.code .reserved { color: var(--green); } +pre.code .shell .content { color: var(--green); } +pre.code .shell .delimiter { color: var(--green); } +pre.code .string .char { color: var(--green); } +pre.code .string .content { color: var(--green); } +pre.code .string .delimiter { color: var(--green); } +pre.code .string .modifier { color: var(--orange); } +pre.code .symbol { color: var(--cyan); } +pre.code .symbol .content { color: var(--cyan); } +pre.code .symbol .delimiter { color: var(--cyan); } +pre.code .tag { color: var(--red); } +pre.code .type { color: var(--purple); } +pre.code .value { color: var(--orange); } +pre.code .variable { color: var(--blue); } +pre.code .insert { background-color: rgba(0, 255, 0, 0.2); } +pre.code .insert .insert { color: var(--green); } +pre.code .insert .eyecatcher { background-color: rgba(0, 255, 0, 0.2); border: 1px solid rgba(0, 128, 0, 0.5); margin: -1px; border-top: none; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; } +pre.code .delete { background: rgba(255, 0, 0, 0.12); } +pre.code .delete .delete { color: var(--red); background: transparent; } +pre.code .delete .eyecatcher { background-color: rgba(255, 0, 0, 0.2); border: 1px solid rgba(230, 0, 0, 0.5); margin: -1px; border-bottom: none; border-top-left-radius: 5px; border-top-right-radius: 5px; } +pre.code .change { color: var(--purple); background: var(--blue); } +pre.code .change .change { color: var(--purple); } +pre.code .head { color: var(--purple); } +pre.code .head .head { color: var(--purple); } +pre.code .head .filename { color: var(--purple); } diff --git a/5.33/css/common.css b/5.33/css/common.css new file mode 100644 index 0000000000..12b3dcc300 --- /dev/null +++ b/5.33/css/common.css @@ -0,0 +1,240 @@ +@media (min-width: 860px) { + html { + font-size: .938em; + } +} + +body { + font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-size: 16px; + color: #2c3e50; + overflow: auto; +} + +#filecontents { + font-size: 16px; + line-height: 1.7; +} + +h1, h2, h3, h4, h5, h6 { + font-weight: 600; + line-height: 1.25; +} + +h1 { + font-size: 2.2rem; + border-top: none; +} + +a { + font-weight: 500; + color: #f60; + text-decoration: none; +} + +ol, p, ul { + line-height: 1.7; +} + +a.header-anchor { + font-size: .85em; + float: left; + margin-left: -.87em; + padding-right: .23em; + margin-top: .125em; + opacity: 0; +} + +a.header-anchor:hover { + text-decoration: none +} + +h1:hover .header-anchor, h2:hover .header-anchor, h3:hover .header-anchor, h4:hover .header-anchor, h5:hover .header-anchor, h6:hover .header-anchor { + opacity: 1 +} + +.navbar, .sidebar-mask { + position: fixed; + top: 0; + left: 0; +} + +.page { + padding-bottom: 2rem; + padding-left: 20rem; + display: block; +} + +@media (max-width: 859px) { + .page { + padding-left: 0; + } +} + +.content { + min-height: 85vh !important; + max-width: 1280px !important; + margin: 0 auto; + padding: 2rem 3rem; +} + +@media (max-width: 1023px) { + .content { + padding: 2rem; + } +} + +.content a:hover { + text-decoration: underline; +} + +.content> :first-child { + margin-top: 3.6rem; +} + +.content>h1 { + margin-top: -3.1rem; + padding-top: 4.6rem; + margin-bottom: 0; +} + +.content>h1:first-child { + margin-top: -1.5rem; + margin-bottom: 1rem; +} + +.content>h1:first-child { + font-family: Open Sans, sans-serif; + font-weight: 400; +} + +.content #filecontents>h1:first-child { + font-family: Open Sans, sans-serif; + font-weight: 400; +} + +footer { + border-top: 1px solid #eaecef; + margin-bottom: -2rem; + background: #fafafc; + padding: 3rem 2.5rem; + text-align: center; + color: #404040; +} + +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; +} + +.icon.outbound { + color: #aaa; + display: inline-block; + vertical-align: middle; + position: relative; + top: -1px; +} + +small .summary_toggle, small .constants_summary_toggle { + padding: 5px 7px; +} + +img { + max-width: 100%; +} + +*:not(pre) > code, +#filecontents pre.code, .docstring pre.code, +.tags pre.example { + color: #f7f7f7; + background: #2f353c; + border: none; +} + +@media (prefers-color-scheme: dark) { + body, html { + background-color: #111; + color: #ddd; + } + + #filecontents pre.code, .docstring pre.code, + .tags pre.example { + line-height: 1.4em; + } + + .summary_desc .object_link a, .docstring .object_link a { + color: #f60; + background: #2f353c; + } + .summary_signature, h2 small a { background: #2f353c; border-color: #444; } + .summary_signature:hover { background: #2f353c; border-color: #444; } + .summary_signature.deprecated { background: #2f353c; border-color: #444; } + + p.signature, h3.signature { background: #2f353c; border-color: #444; } + + .tags .overload .overload_item .signature { background: #2f353c; border-color: #444; } + + p.signature .aliases, + h3.signature .aliases { color: #f7f7f767; } + p.signature .aliases .names, + h3.signature .aliases .names { color: #f7f7f767; } + + p.signature .extras, + h3.signature .extras { color: #f7f7f767; } + + .docstring .note { border-left-color: #444; } + .note { color: #ccc; border-color: #444; } + .note.todo { background: #2f353c; border-color: #444; } + .note.returns_void { background: #2f353c; } + .note.deprecated { background: #2f353c; border-color: #444; } + .note.title.deprecated { background: #2f353c; border-color: #444; } + .note.private { background: #2f353c; border-color: #444; } + .note.title { background: #2f353c; } + + /* .note.title.constructor { color: #fff; background: #6a98d6; border-color: #6689d6; } + .note.title.writeonly { color: #fff; background: #45a638; border-color: #2da31d; } + .note.title.readonly { color: #fff; background: #6a98d6; border-color: #6689d6; } */ + + .docstring p > code, .docstring p > tt, .tags p > code, .tags p > tt { color: #f7f7f7; background: #2f353c; } + + .box_info dl dt, .box_info dl dd { border-color: #444!important; } + .box_info dl:nth-child(odd) > * { background: #111; } + .box_info dl:nth-child(even) > * { background: #000; } + + .inheritanceTree, .toggleDefines { background: #000; } + + #filecontents table th, #filecontents table td, + .docstring table th, .docstring table td { border-color: #444!important; background: #111!important; } + #filecontents table tr:nth-child(odd), + .docstring table tr:nth-child(odd) { background: #111; } + #filecontents table tr:nth-child(even), + .docstring table tr:nth-child(even) { background: #000; } + #filecontents table th, .docstring table th { background: #111; } + + /* style for
*/ + #filecontents dl, .docstring dl { border: #444; } + #filecontents dt, .docstring dt { background: #111; } + + footer { + border-top-color: #000; + background: #111; + color: #ccc; + } +} + +pre.code { + white-space: pre-wrap; + overflow-wrap: anywhere; +} + +/* override for coderay */ +.code .content { padding: 0; } diff --git a/5.33/css/fonts.css b/5.33/css/fonts.css new file mode 100644 index 0000000000..de793a905f --- /dev/null +++ b/5.33/css/fonts.css @@ -0,0 +1,36 @@ +/* from openhab-docs:.vuepress/public/fonts/fonts.css, with links adjusted + +/* Open Sans font weights 300-400 */ +/* latin-ext */ +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 300; + src: local('Open Sans Light'), local('OpenSans-Light'), url(https://www.openhab.org/fonts/mem5YaGs126MiZpBA-UN_r8OXOhpOqc.woff2) format('woff2'); + unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; + } + /* latin */ + @font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 300; + src: local('Open Sans Light'), local('OpenSans-Light'), url(https://www.openhab.org/fonts/mem5YaGs126MiZpBA-UN_r8OUuhp.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; + } + /* latin-ext */ + @font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 400; + src: local('Open Sans Regular'), local('OpenSans-Regular'), url(https://www.openhab.org/fonts/mem8YaGs126MiZpBA-UFW50bbck.woff2) format('woff2'); + unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; + } + /* latin */ + @font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 400; + src: local('Open Sans Regular'), local('OpenSans-Regular'), url(https://www.openhab.org/fonts/mem8YaGs126MiZpBA-UFVZ0b.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; + } + \ No newline at end of file diff --git a/5.33/css/full_list.css b/5.33/css/full_list.css new file mode 100644 index 0000000000..fa35982429 --- /dev/null +++ b/5.33/css/full_list.css @@ -0,0 +1,58 @@ +body { + margin: 0; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + height: 101%; + overflow-x: hidden; + background: #fafafa; +} + +h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; } +.clear { clear: both; } +.fixed_header { position: fixed; background: #fff; width: 100%; padding-bottom: 10px; margin-top: 0; top: 0; z-index: 9999; height: 70px; } +#search { position: absolute; right: 5px; top: 9px; padding-left: 24px; } +#content.insearch #search, #content.insearch #noresults { background: url(data:image/gif;base64,R0lGODlhEAAQAPYAAP///wAAAPr6+pKSkoiIiO7u7sjIyNjY2J6engAAAI6OjsbGxjIyMlJSUuzs7KamppSUlPLy8oKCghwcHLKysqSkpJqamvT09Pj4+KioqM7OzkRERAwMDGBgYN7e3ujo6Ly8vCoqKjY2NkZGRtTU1MTExDw8PE5OTj4+PkhISNDQ0MrKylpaWrS0tOrq6nBwcKysrLi4uLq6ul5eXlxcXGJiYoaGhuDg4H5+fvz8/KKiohgYGCwsLFZWVgQEBFBQUMzMzDg4OFhYWBoaGvDw8NbW1pycnOLi4ubm5kBAQKqqqiQkJCAgIK6urnJyckpKSjQ0NGpqatLS0sDAwCYmJnx8fEJCQlRUVAoKCggICLCwsOTk5ExMTPb29ra2tmZmZmhoaNzc3KCgoBISEiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCAAAACwAAAAAEAAQAAAHaIAAgoMgIiYlg4kACxIaACEJCSiKggYMCRselwkpghGJBJEcFgsjJyoAGBmfggcNEx0flBiKDhQFlIoCCA+5lAORFb4AJIihCRbDxQAFChAXw9HSqb60iREZ1omqrIPdJCTe0SWI09GBACH5BAkIAAAALAAAAAAQABAAAAdrgACCgwc0NTeDiYozCQkvOTo9GTmDKy8aFy+NOBA7CTswgywJDTIuEjYFIY0JNYMtKTEFiRU8Pjwygy4ws4owPyCKwsMAJSTEgiQlgsbIAMrO0dKDGMTViREZ14kYGRGK38nHguHEJcvTyIEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDAggPg4iJAAMJCRUAJRIqiRGCBI0WQEEJJkWDERkYAAUKEBc4Po1GiKKJHkJDNEeKig4URLS0ICImJZAkuQAhjSi/wQyNKcGDCyMnk8u5rYrTgqDVghgZlYjcACTA1sslvtHRgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCQARAtOUoQRGRiFD0kJUYWZhUhKT1OLhR8wBaaFBzQ1NwAlkIszCQkvsbOHL7Y4q4IuEjaqq0ZQD5+GEEsJTDCMmIUhtgk1lo6QFUwJVDKLiYJNUd6/hoEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4uen4ICCA+IkIsDCQkVACWmhwSpFqAABQoQF6ALTkWFnYMrVlhWvIKTlSAiJiVVPqlGhJkhqShHV1lCW4cMqSkAR1ofiwsjJyqGgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCSMhREZGIYYGY2ElYebi56fhyWQniSKAKKfpaCLFlAPhl0gXYNGEwkhGYREUywag1wJwSkHNDU3D0kJYIMZQwk8MjPBLx9eXwuETVEyAC/BOKsuEjYFhoEAIfkECQgAAAAsAAAAABAAEAAAB2eAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4ueICImip6CIQkJKJ4kigynKaqKCyMnKqSEK05StgAGQRxPYZaENqccFgIID4KXmQBhXFkzDgOnFYLNgltaSAAEpxa7BQoQF4aBACH5BAkIAAAALAAAAAAQABAAAAdogACCg4SFggJiPUqCJSWGgkZjCUwZACQkgxGEXAmdT4UYGZqCGWQ+IjKGGIUwPzGPhAc0NTewhDOdL7Ykji+dOLuOLhI2BbaFETICx4MlQitdqoUsCQ2vhKGjglNfU0SWmILaj43M5oEAOwAAAAAAAAAAAA==) no-repeat center left; } +#full_list { padding: 0; list-style: none; margin-left: 0; margin-top: 80px; font-size: 1.1em; } +#full_list ul { padding: 0; } +#full_list li { padding: 0; margin: 0; list-style: none; } +#full_list li .item { padding: 5px 5px 5px 12px; } +#noresults { padding: 7px 12px; background: #fff; } +#content.insearch #noresults { margin-left: 7px; } +li.collapsed ul { display: none; } +li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuGzKKnKSzpCxXJM8fwNXda3df5RZETlIt6YUzSQDs93sl8w3wBZxCCE10GM1OcWbWjB2mWgEH4Mfdyxm3PSepBHibgQE2wLe7r4HjEidpnXMYdQPKEMJcsZ4zs2POYQOcaPfwMVOo58zsAdMt18BuoVDPxUJRacELbXv3hUIX2vYmOUvi8C8ydz/ThjXrqKqqLbDIAdsCKBd+Wo7GWa7o9qzOQHVVVXeAbs+yHHCH4aTsaCOQqunmUy1yBUAXkdMIfMlgF5EXLo2OpV/c/Up7jG4hhHcYLgWzAZXUc2b2ixsfvc/RmNNfOXD3Q/oeL9axJE1yT9IOoUu6MGUkAAAAAElFTkSuQmCC) no-repeat bottom left; } +li.collapsed a.toggle { opacity: 0.5; cursor: default; background-position: top left; } +li { color: #888; cursor: pointer; } +li.deprecated { text-decoration: line-through; font-style: italic; } +li.odd { background: #f0f0f0; } +li.even { background: #fafafa; } +.item:hover { background: #ddd; } +li small:before { content: "("; } +li small:after { content: ")"; } +li small.search_info { display: none; } +a, a:visited { text-decoration: none; color: #05a; } +li.clicked > .item { background: #05a; color: #ccc; } +li.clicked > .item a, li.clicked > .item a:visited { color: #eee; } +li.clicked > .item a.toggle { opacity: 0.5; background-position: bottom right; } +li.collapsed.clicked a.toggle { background-position: top right; } +#search input { border: 1px solid #bbb; border-radius: 3px; } +#full_list_nav { margin-left: 10px; font-size: 0.9em; display: block; color: #aaa; } +#full_list_nav a, #nav a:visited { color: #358; } +#full_list_nav a:hover { background: transparent; color: #5af; } +#full_list_nav span:after { content: ' | '; } +#full_list_nav span:last-child:after { content: ''; } + +#content h1 { margin-top: 0; } +li { white-space: nowrap; cursor: normal; } +li small { display: block; font-size: 0.8em; } +li small:before { content: ""; } +li small:after { content: ""; } +li small.search_info { display: none; } +#search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #888; padding-left: 0; padding-right: 24px; } +#content.insearch #search { background-position: center right; } +#search input { width: 110px; } + +#full_list.insearch ul { display: block; } +#full_list.insearch .item { display: none; } +#full_list.insearch .found { display: block; padding-left: 11px !important; } +#full_list.insearch li a.toggle { display: none; } +#full_list.insearch li small.search_info { display: block; } diff --git a/5.33/css/navbar.css b/5.33/css/navbar.css new file mode 100644 index 0000000000..42e978ca62 --- /dev/null +++ b/5.33/css/navbar.css @@ -0,0 +1,261 @@ +.navbar { + z-index: 20; + right: 0; + height: 3.6rem; + background-color: #fff; + box-sizing: border-box; + border-bottom: 1px solid #eaecef; + padding: .7rem 1.5rem; + line-height: 2.2rem; +} + +html { + scroll-padding-top: 4.4rem; +} + +.navbar .logo { + height: 2.2rem; + min-width: 2.2rem; + margin-right: .8rem; + vertical-align: top; +} + +.navbar .site-name { + display: none; +} + +.sidebar .nav-links { + display: none; + border-bottom: 1px solid #eaecef; + padding: .5rem 0 .75rem; +} + +@media (max-width: 859px) { + .navbar { + padding-left: 4rem; + } + + .navbar .links { + padding-left: 1.5rem; + } + + .navbar .can-hide { + display: none; + } + + .search-box { + margin-right: 0; + } + + .sidebar .nav-links { + display: block; + } +} + +@media (min-width: 860px) { + .navbar { + padding: .8rem 1.71429rem !important; + line-height: 2.51429rem !important; + height: 4.11429rem !important; + } + + .navbar .logo { + height: 2.51429rem !important; + min-width: 2.51429rem !important; + margin-right: .91429rem !important; + width: inherit; + } +} + +@media (prefers-color-scheme: light) { + .navbar:not(.headroom--top):not(.transparent) { + background-color: rgba(250, 250, 252, .9) !important; + } +} + +@media (prefers-color-scheme: dark) { + .navbar { + background-color: rgba(0, 0, 0, .9) !important; + border-bottom: 1px solid #444; + } + + .navbar .logo { + filter: invert(1) grayscale(1) brightness(100); + } + + .navbar .search-box input, .search-results { + border-color: #444 !important; + background: #333 !important; + color: #ddd; + } + + .search-results li:hover { + background-color: #111 !important; + } + + .navbar .search-box input { + background: #333 url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHhtbG5z PSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEyIiBoZWlnaHQ9 IjEzIj48ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0iI2FhYSIgZmlsbD0ibm9u ZSI+PHBhdGggZD0iTTExLjI5IDExLjcxbC00LTQiLz48Y2lyY2xlIGN4PSI1IiBj eT0iNSIgcj0iNCIvPjwvZz48L3N2Zz4K') .6rem .5rem no-repeat !important; + } + + .version-switcher .version-button { + border: 1px solid #a6a6a6 !important; + color: #a6a6a6 !important; + } + + .version-switcher .version-button.current { + background: #a6a6a6 !important; + color: #fff !important; + } +} + +.navbar:not(.headroom--top):not(.transparent) { + box-shadow: 0 0 10px rgba(26, 26, 26, .25); +} + +.navbar .links { + padding-left: 1.5rem; + box-sizing: border-box; + background-color: transparent !important; + white-space: nowrap; + font-size: .9rem; + position: absolute; + right: 1.5rem; + top: .7rem; + display: flex; +} + +.nav-item>a.external:hover { + border-bottom: 2px solid #ff7214; +} + +.nav-links a { + line-height: 1.4rem; + color: inherit; +} + +.nav-links .nav-item { + position: relative; + display: inline-block; + margin-left: 1.5rem; + line-height: 2rem; +} + +.navbar .nav-item a { + font-weight: 400; + font-size: 1rem; +} + +.navbar .links .search-box { + flex: 0 0 auto; + vertical-align: top; +} + +.search-box { + display: inline-block; + position: relative; + margin-right: 1rem; + min-width: 20rem; +} + +.search-box input { + cursor: text; + width: 90%; + height: 2rem; + color: #4e6e8e; + display: inline-block; + border: 1px solid #cfd4db; + border-radius: 2rem; + font-size: .9rem; + line-height: 2rem; + padding: 0 .5rem 0 2rem; + outline: none; + transition: all .2s ease; + background: #fff url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHhtbG5z PSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEyIiBoZWlnaHQ9 IjEzIj48ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0iI2FhYSIgZmlsbD0ibm9u ZSI+PHBhdGggZD0iTTExLjI5IDExLjcxbC00LTQiLz48Y2lyY2xlIGN4PSI1IiBj eT0iNSIgcj0iNCIvPjwvZz48L3N2Zz4K') .6rem .5rem no-repeat; + background-size: 1rem; +} + +@media (min-width: 1024px) and (max-width: 1280px) { + .search-box input { + width: 5.7rem !important; + } +} + +.search-results>ul { + list-style: none; + padding: 0; + margin: 0; +} + +.search-results { + box-sizing: border-box; + overflow-y: auto; + top: 100%; + right: 0; + background-color: #fff; + text-align: left; + white-space: nowrap; + margin: 0; + top: 0; + display: none; + padding: 0; +} + +@media (min-width: 859px) { + .search-results { + height: auto !important; + box-sizing: border-box; + max-height: calc(100vh - 2.7rem); + overflow-y: auto; + top: 100%; + right: 0; + background-color: #fff; + border: 1px solid; + border-color: #ddd #ddd #ccc; + text-align: left; + border-radius: .25rem; + white-space: nowrap; + margin: 0; + line-height: 1.4rem; + } +} + +.search-results li { + border-bottom: 1px solid; + border-color: #ccc; + padding-left: 10px; + padding-right: 10px; +} + +.search-results li:hover { + background-color: #ddd; +} + +@media screen { + .search-results li small.search_info { + display: block; + padding: 0; + } +} + +.sidebar-button .icon { + display: block; + width: 1.25rem; + height: 1.25rem; +} + +.sidebar-button { + cursor: pointer; + display: none; + width: 1.25rem; + height: 1.25rem; + position: absolute; + padding: .6rem; + top: .6rem; + left: 1rem; +} + +@media (max-width: 859px) { + .sidebar-button { + display: block; + } +} \ No newline at end of file diff --git a/5.33/css/sidebar.css b/5.33/css/sidebar.css new file mode 100644 index 0000000000..eb186d5d26 --- /dev/null +++ b/5.33/css/sidebar.css @@ -0,0 +1,323 @@ +.sidebar { + font-size: 16px; + background-color: #f7f7f7 !important; + width: 22rem; + position: fixed; + z-index: 15; + margin: 0; + top: 3.6rem; + left: 0; + bottom: 0; + box-sizing: border-box; + border-right: 1px solid #eaecef; + overflow-y: auto; + overflow-x: scroll; +} + +.archived-versions .nav-dropdown a { + color: #2c3e50; +} + +@media (min-width: 860px) { + .sidebar { + top: 4.11429rem!important; + } +} + +@media (max-width: 859px) { + .sidebar { + top: 0; + padding-top: 3.6rem; + transform: translateX(-100%); + transition: transform .2s ease; + } + + .sidebar-open .sidebar { + transform: translateX(0); + } +} + +@media (max-width: 1023px) { + .sidebar { + font-size: 15px; + width: 16.4rem; + } +} + +.sidebar-heading a { + color: #2c3e50; + font-weight: 700; +} + +@media (prefers-color-scheme: dark) { + .sidebar { + background-color: #000!important; + border-right: 1px solid #444!important; + } + + .sidebar-heading a { + color: #ddd; + } + + .sidebar .sidebar-heading, .sidebar .sidebar-link { + color: #a6a6a6; + } + + .dropdown-wrapper .nav-dropdown { + background-color: rgba(0,0,0,.9)!important; + border-color: #444!important; + } + + .dropdown-item, .dropdown-wrapper .arrow, .dropdown-wrapper .title, .nav-item a, .nav-link { + color: #ddd!important; + } + + .archived-versions .nav-dropdown a { + color: #a6a6a6!important; + } +} + +.sidebar-mask { + z-index: 9; + width: 100vw; + height: 100vh; + display: none; +} + +.sidebar-heading { + color: #2c3e50; + transition: color .15s ease; + cursor: pointer; + font-size: 1.1em; + font-weight: 700; + padding: .35rem 1.5rem .35rem 1.25rem; + width: 100%; + box-sizing: border-box; + margin: 0; + border-left: .25rem solid transparent; +} + +.sidebar ul { + padding: 0; + margin: 0; + list-style-type: none; +} + +.sidebar > .sidebar-links { + padding: 1.5rem 0; +} + +.sidebar > .sidebar-links > li:not(:first-child) { + margin-top: .75rem; +} + +.sidebar-group a.sidebar-link { + padding-left: 2rem; +} + +.sidebar-group a.sidebar-link-depth-1 { + padding-left: 3rem; +} + +.sidebar-group a.sidebar-link-depth-2 { + padding-left: 4rem; +} + +.sidebar-group a.sidebar-link-depth-3 { + padding-left: 5rem; +} + +.sidebar-group a.sidebar-link-depth-4 { + padding-left: 6rem; +} + +.sidebar-group-items { + transition: height .1s ease-out; + font-size: .95em; + overflow: hidden; +} + +span.sidebar-link { + font-size: 1em; + font-weight: 400; + display: inline-block; + color: #2c3e50; + border-left: .25rem solid transparent; + padding: .35rem 1rem .35rem 1.25rem; + line-height: 1.4; + width: 100%; + box-sizing: border-box; + white-space: nowrap; +} + +span.sidebar-link a { + color: #2c3e50; +} + +a.sidebar-link:hover { + color: #f60; +} + +span.sidebar-link.active { + font-weight: 600; + border-left-color: #f60; +} + +span.sidebar-link.active a { + color: #f60; +} + +.sidebar-links .arrow { + position: relative; + top: -.12em; + left: .5em; +} + +.arrow { + display: inline-block; + width: 0; + height: 0; + cursor: pointer; +} + +.arrow.down, .arrow.up { + border-left: 4px solid transparent; + border-right: 4px solid transparent; +} + +.arrow.down { + border-top: 6px solid #ccc; +} + +.arrow.left, .arrow.right { + border-top: 4px solid transparent; + border-bottom: 4px solid transparent; +} + +.arrow.right { + border-left: 6px solid #ccc; +} + +.page-versions { + margin-top: 1rem; +} + +.version-switcher { + list-style-type: none; + padding: .5rem; + display: flex; + flex-direction: row; + justify-content: center; +} + +.version-switcher .version-button { + width: 6.5rem; + border: 1px solid #2c3e50; + color: #2c3e50; + background: transparent; + font-family: Open Sans,sans-serif; + font-weight: 300; + font-size: 14px; + padding: 8px; + cursor: pointer; + text-align: center; +} + +.version-switcher .version-button.current { + background: #2c3e50; + color: #fff; + cursor: not-allowed; +} + +.archived-versions { + white-space: nowrap; + font-size: 9pt; + height: 14px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + display: flex; + flex-direction: row; + justify-content: center; +} + +.archived-versions .dropdown-wrapper { + height: 1.8rem!important; +} + +.sidebar .page-versions .dropdown-wrapper { + z-index: 9999; +} + +.archived-versions .dropdown-title { + display: block; + font-size: 13px; + font-weight: 400; + color: #000; + cursor: pointer; +} + +.dropdown-wrapper .dropdown-title { + display: block; + font-size: .9rem; + font-family: inherit; + cursor: inherit; + padding: inherit; + line-height: 1.4rem; + background: transparent; + border: none; + font-weight: 500; + color: #2c3e50; +} + +.archived-versions .nav-dropdown { + box-sizing: border-box; + overflow-y: auto; + top: 100%; + right: 0; + background-color: #fff; + padding: 10px 0; + text-align: left; + white-space: nowrap; + margin: 0; + top: 0; +} + +@media (min-width: 859px) { + .dropdown-wrapper .nav-dropdown { + display: none; + height: auto!important; + box-sizing: border-box; + max-height: calc(100vh - 2.7rem); + overflow-y: auto; + top: 100%; + right: 0; + background-color: #fff; + padding: .6rem 0; + border: 1px solid; + border-color: #ddd #ddd #ccc; + text-align: left; + border-radius: .25rem; + white-space: nowrap; + margin: 0; + } +} + +.dropdown-wrapper .nav-dropdown .dropdown-item a { + display: block; + line-height: 1.7rem; + position: relative; + border-bottom: none; + font-weight: 400; + margin-bottom: 0; + padding: 0 1.5rem 0 1.25rem; +} + +.dropdown-wrapper .nav-dropdown .dropdown-item a:hover { + color: #f60; +} + +.collapsed > ul { + display: none; +} diff --git a/5.33/css/style.css b/5.33/css/style.css new file mode 100644 index 0000000000..eb0dbc86f6 --- /dev/null +++ b/5.33/css/style.css @@ -0,0 +1,497 @@ +html { + width: 100%; + height: 100%; +} +body { + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + width: 100%; + margin: 0; + padding: 0; + display: flex; + display: -webkit-flex; + display: -ms-flexbox; +} + +#nav { + position: relative; + width: 100%; + height: 100%; + border: 0; + border-right: 1px dotted #eee; + overflow: auto; +} +.nav_wrap { + margin: 0; + padding: 0; + width: 20%; + height: 100%; + position: relative; + display: flex; + display: -webkit-flex; + display: -ms-flexbox; + flex-shrink: 0; + -webkit-flex-shrink: 0; + -ms-flex: 1 0; +} +#resizer { + position: absolute; + right: -5px; + top: 0; + width: 10px; + height: 100%; + cursor: col-resize; + z-index: 9999; +} +#main { + flex: 5 1; + -webkit-flex: 5 1; + -ms-flex: 5 1; + outline: none; + position: relative; + background: #fff; + padding: 1.2em; + padding-top: 0.2em; + box-sizing: border-box; +} + +@media (max-width: 920px) { + .nav_wrap { width: 100%; top: 0; right: 0; overflow: visible; position: absolute; } + #resizer { display: none; } + #nav { + z-index: 9999; + background: #fff; + display: none; + position: absolute; + top: 40px; + right: 12px; + width: 500px; + max-width: 80%; + height: 80%; + overflow-y: scroll; + border: 1px solid #999; + border-collapse: collapse; + box-shadow: -7px 5px 25px #aaa; + border-radius: 2px; + } +} + +@media (min-width: 920px) { + body { height: 100%; overflow: hidden; } + #main { height: 100%; overflow: auto; } + #search { display: none; } +} + +#main img { max-width: 100%; } +h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; } +h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; } +h1.title { margin-bottom: 10px; } +h1.alphaindex { margin-top: 0; font-size: 22px; } +h2 { + padding: 0; + padding-bottom: 3px; + border-bottom: 1px #aaa solid; + font-size: 1.4em; + margin: 1.8em 0 0.5em; + position: relative; +} +h2 small { font-weight: normal; font-size: 0.7em; display: inline; position: absolute; right: 0; } +h2 small a { + display: block; + height: 20px; + border: 1px solid #aaa; + border-bottom: 0; + border-top-left-radius: 5px; + background: #f8f8f8; + position: relative; + padding: 2px 7px; +} +.clear { clear: both; } +.inline { display: inline; } +.inline p:first-child { display: inline; } +.docstring, .tags, #filecontents { font-size: 15px; line-height: 1.5145em; } +.docstring p > code, .docstring p > tt, .tags p > code, .tags p > tt { + color: #c7254e; background: #f9f2f4; padding: 2px 4px; font-size: 1em; + border-radius: 4px; +} +.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; } +.docstring h1 { font-size: 1.2em; } +.docstring h2 { font-size: 1.1em; } +.docstring h3, .docstring h4 { font-size: 1em; border-bottom: 0; padding-top: 10px; } +.summary_desc .object_link a, .docstring .object_link a { + font-family: monospace; font-size: 1.05em; + color: #05a; background: #EDF4FA; padding: 2px 4px; font-size: 1em; + border-radius: 4px; +} +.rdoc-term { padding-right: 25px; font-weight: bold; } +.rdoc-list p { margin: 0; padding: 0; margin-bottom: 4px; } +.summary_desc pre.code .object_link a, .docstring pre.code .object_link a { + padding: 0px; background: inherit; color: inherit; border-radius: inherit; +} + +/* style for */ +#filecontents table, .docstring table { border-collapse: collapse; } +#filecontents table th, #filecontents table td, +.docstring table th, .docstring table td { border: 1px solid #ccc; padding: 8px; padding-right: 17px; } +#filecontents table tr:nth-child(odd), +.docstring table tr:nth-child(odd) { background: #eee; } +#filecontents table tr:nth-child(even), +.docstring table tr:nth-child(even) { background: #fff; } +#filecontents table th, .docstring table th { background: #fff; } + +/* style for
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterDescription
gem_homeThe path to store Ruby Gems. Default: $OPENHAB_CONF/automation/ruby/.gem/{RUBY_ENGINE_VERSION}
gemsA list of gems to install. Default: openhab-scripting=~>5.0
check_updateCheck for updated version of gems on start up or settings change. Default: true
requireList of scripts to be required automatically. Default: openhab/dsl
rubylibSearch path for user libraries. Default: $OPENHAB_CONF/automation/ruby/lib
dependency_trackingEnable dependency tracking. Default: true
local_contextSee notes below. Default: singlethread
local_variablesSee notes below. Default: transient
+

When using file-based configuration, these parameters must be prefixed with org.openhab.automation.jrubyscripting:, for example:

+
org.openhab.automation.jrubyscripting:gems=openhab-scripting=~>5.0
+org.openhab.automation.jrubyscripting:require=openhab/dsl
+
+

#gem_home

+

Path to where Ruby Gems will be installed to and loaded from. +The directory will be created if necessary. +You can use {RUBY_ENGINE_VERSION}, {RUBY_ENGINE} and/or {RUBY_VERSION} replacements in this value to automatically point to a new directory when the addon is updated with a new version of JRuby.

+

#gems

+

A comma separated list of Ruby Gems to install.

+

The default installs the version of the helper for this version of openHAB. +When overriding the default, be sure to still include the openhab-scripting gem in the list of gems to install.

+

Each gem can have version specifiers which uses pessimistic versioning. +Multiple version specifiers can be added by separating them with a semicolon.

+

Examples:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
gem settingDescription
openhab-scriptinginstall the latest version of openhab-scripting gem
openhab-scripting=~>5.0.0install the latest version 5.0.x but not 5.1.x
openhab-scripting=~>5.0install the latest version 5.x but not 6.x
openhab-scripting=~>5.0, faraday=~>2.7;>=2.7.4install openhab-scripting gem version 5.x and faraday gem version 2.7.4 or higher, but less than 3.0
gem1= >= 2.2.1; <= 2.2.5install gem1 gem version 2.2.1 or above, but less than or equal to version 2.2.5
+

#check_update

+

Check RubyGems for updates to the above gems when openHAB starts or JRuby settings are changed. +Otherwise it will try to fulfil the requirements with locally installed gems, and you can manage them yourself with an external Ruby by setting the same GEM_HOME.

+

#require

+

A comma separated list of script names to be required by the JRuby Scripting Engine at the beginning of user scripts. +The default is to require the helper library.

+

#rubylib

+

Search path for user libraries. +Separate each path with a colon (semicolon in Windows).

+

#dependency_tracking

+

Dependency tracking allows your scripts to automatically reload when one of its dependencies is updated. +You may want to disable dependency tracking if you plan on editing or updating a shared library, but don't want all your scripts to reload until you can test it.

+

#local_context

+

The local context holds Ruby runtime, name-value pairs for sharing variables between Java and Ruby. +Valid values are: singleton, threadsafe, singlethread, or concurrent. +See this for options and details.

+

#local_variables

+

Defines how variables are shared between Ruby and Java. +Valid values are: transient, persistent, or global. +See the JRuby documentation for options and details.

+

#Usage

+

#UI Based Scripts

+

The quickest way to add rules is through the openHAB Web UI.

+

Advanced users, or users migrating scripts from existing systems may want to use File Based Scripts for managing rules using files in the user configuration directory.

+

#Adding Triggers

+

Using the openHAB UI, first create a new rule and set a trigger condition.

+

openHAB Rule Configuration

+

#Adding Actions

+

Select "Add Action" and then select "Run Script" with "Ruby". +This will bring up an empty script editor where you can enter your JavaScript.

+

openHAB Rule Engines

+

You can now write rules using standard Ruby along with the included openHAB library.

+

openHAB Rule Script

+

For example, turning a light on:

+
KitchenLight.on
+logger.info("Kitchen Light State: #{KitchenLight.state}")
+
+

Sending a notification:

+
Notification.send("romeo@montague.org", "Balcony door is open")
+
+

Querying the status of a thing:

+
logger.info("Thing status: #{things["zwave:serial_zstick:512"].status}")"
+
+

Theoretically you could even use a system start trigger with a UI rule, and then use the syntax mostly developed for file based rules to create multiple rules.

+

#File Based Scripts

+

The JRuby Scripting addon will load scripts from automation/ruby in the user configuration directory. +The system will automatically reload scripts when changes are detected to files. +Local variable state is not persisted among reloads, see using the cache for a convenient way to persist objects. +See File Based Rules for examples of creating rules within your scripts.

+

#Event Object

+

When you use "Item event" as trigger (i.e. "[item] received a command", "[item] was updated", "[item] changed"), there is additional context available for the action in a variable called event.

+

This tables gives an overview of the event object for most common trigger types. +For full details, explore OpenHAB::Core::Events.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Property NameTypeTrigger TypesDescriptionRules DSL Equivalent
stateState or nil[item] changed, [item] was updatedState that triggered eventtriggeringItem.state
wasState or nil[item] changedPrevious state of Item or Group that triggered eventpreviousState
commandCommand[item] received a commandCommand that triggered eventreceivedCommand
itemItemAll item related triggersItem that triggered eventtriggeringItem
groupGroupItemMember of [group] changed, Member of [group] was updated, Member of [group] received a commandGroup whose member triggered the eventtriggeringGroup
+
logger.info(event.state == ON)
+
+
event.item
+
+

Get the Triggering Item's Name:

+
event.item.name
+
+

Get the Triggering Item's Label:

+
event.item.label
+
+

Get the Triggering Item's State:

+
event.state # this version retrieves the item's state when the event was generated
+
+

or

+
event.item.state # this version will re-query the item for its state
+
+
if event.item.state == ON
+  # do something
+end
+# or (preferable)
+if event.item.on?
+  # do something
+end
+
+

Get the Triggering Item's Previous State:

+
event.was
+
+
if event.was.on?
+  # do something
+end
+
+

Compare Triggering Item's State Against Previous State:

+
event.state > event.was
+
+

Get the Received Command:

+
event.command
+
+
if event.command.on?
+  # do something
+end
+
+

#Library Details

+

The openHAB JRuby Scripting runtime attempts to provide a familiar environment to Ruby developers.

+

#Items

+

The items object allows interactions with openHAB items. +However, most items can be referred to directly by name:

+
My_Item
+gWindowBlinds
+
+

Items can be retrieved dynamically:

+
the_item = items['My_Item'] # This returns an Item object, not just its state
+# For all intents and purposes, the_item variable is the same as My_Item in the previous example
+
+

Get the Item's Name as a String:

+
My_Item.name
+
+

Get the Item's Label:

+
My_Item.label
+
+

Get a Related Item:

+
my_light_item = items[My_Switch.name.sub('_Switch', '_Light')]
+
+

#Groups

+

Groups are regular items, but can also contain other items.

+
# direct members
+gTest.members
+
+# direct members and all their descendents
+gTest.all_members
+
+

Group members work like a Ruby array +so you can use & for intersection, | for union, and - for difference.

+
curtains_in_family_room = gFamilyRoom.members & gCurtains.members
+
+

You can iterate over group members with Ruby's ubiquitous #each method:

+
gTest.members.each do |item|
+  # process item
+end
+
+# Iterate over all members, including members of members
+gTest.all_members.each do |item|
+  # process item
+end
+
+

Group members are also Enumerable, so can use any of tthose included methods:

+
members_that_are_on = gTest.members.select(&:on?)
+
+# exclude state
+members_that_are_not_on = gTest.members.reject(&:on?)
+
+# Filter with code:
+high_temperatures = gTemperatures.members.select(&:state?).select { |item| item.state > 30 | '°C' }
+
+

See also Accessing elements in a Ruby array.

+

Get a sorted list of Group members matching a condition:

+
sorted_items_by_battery_level = gBattery.members
+                                        .select(&:state?) # only include non NULL / UNDEF members
+                                        .select { |item| item.state < 20 } # select only those with low battery
+                                        .sort_by(&:state)
+
+

Get a list of values mapped from the members of a group:

+
battery_levels = gBattery.select(&:state?) # only include non NULL / UNDEF members
+                         .sort_by(&:state)
+                         .map { |item| "#{item.label}: #{item.state}" } # Use item state default formatting
+
+

Perform arithmetic on values from members of a group:

+
weekly_rainfall = gRainWeeklyForecast.members.sum(&:state)
+
+

#Commands

+

These three variants do the same thing:

+
My_Item.on
+My_Item.command ON
+My_Item << ON
+
+

Note: all possible commands are supported on the corresponding item types, e.g. on, off, up, down, play, pause, stop, etc. +For more details, see the individual item classes under OpenHAB::Core::Items.

+
#Sending Commands to an Item Only When Its State is Different
+
My_Item.ensure.on
+My_Item.ensure.command ON
+My_Item.ensure << ON
+
+# ensure causes the command to return nil if the item is already in the same state
+logger.info("Turning off the light") if My_Item.ensure.off
+
+

See ensure_states, ensure_states!, +ensure.

+
#Timed Commands
+

A Timed Command is similar to the openHAB Item's expire parameter but it offers more flexibility. +It removes the need to manually create a timer. +The command is sent to the item, then after the duration has elapsed, reverted. +It also handles automatically canceling the timer if the item changes states before it reverts.

+
My_Switch.on for: 5.minutes
+
+

#Updates

+

Post an update to an item:

+
My_Switch.update ON
+
+

#State

+

The Item's state is accessible through Item#state:

+
if My_Item.state == ON
+  # do something
+end
+
+# This syntax is equivalent and preferred:
+if My_Item.on?
+  # do something
+end
+
+if Indoor_Temperature.state > 20 | '°C' || Indoor_Temperature.state > Outdoor_Temperature.state
+  # do something
+end
+
+

Note: Boolean helper methods are available depending on the item / state type. +For example up?, down?, closed?, open?, etc.

+

Check if an Item's state is NULL of UNDEF:

+
if My_Item.state?
+  logger.info 'My_Item is not NULL nor UNDEF'
+end
+
+
#Comparing Item's State
+
String_Item.state == 'test string'
+Number_Item.state > 5.3
+items['Number_Item'].state == 10
+
+# Compare Quantity Types
+Temperature_Item.state > 24 | '°C'
+Indoor_Temperature.state > Outdoor_Temperature.state
+Indoor_Temperature.state > Outdoor_Temperature.state + 5 | '°C'
+Indoor_Temperature.state - Outdoor_Temperature.state > 5 | '°C'
+
+

See unit block

+
#Range checking
+

Types that are comparable, such as StringType, DateTimeType, DecimalType, PercentType, include Ruby's Comparable module which provides the handy between? method.

+
String_Item.update("Freddy")
+String_Item.state.between?("E", "G") # => true
+
+Number_Item.update(10)
+if Number_Item.state.between?(5, 20)
+  logger.info "Number_Item falls within the expected range"
+end
+
+Temperature_Item.update(16 | "°C")
+Temperature_Item.state.between?(20 | "°C", 24 | "°C") # => false
+
+

Alternatively, a Ruby range can be used. +This can be handy for excluding the end of the range with the ... operator.

+
if (5..10).cover?(Number_Item.state)
+  logger.info "Number_Item is in the expected range"
+end
+
+((20|"°C")..(24|"°C")).cover?(Temperature_Item.state)
+
+
#Loose Type Comparisons
+

Some openHAB item types can accept different command types. +For example, a DimmerItem can accept a command with an OnOffType, IncreaseDecreaseType or a PercentType. +However, ultimately an item only stores its state in its native type, e.g. a DimmerItems's native type is PercentType. +In some contexts, you don't care about the precise value of a particular state, and just want to know if it fits the general definition of ON, etc. +You can either explicitly convert to the general type, or all of the state predicate methods available on Item, ItemStateEvent, ItemStateChangedEvent, ItemCommandEvent, as well as specific types such as PercentType and HSBType, will do the conversion internally.

+
DimmerItem1.update(10)
+sleep 1
+DimmerItem1.state == 10 # => true
+DimmerItem1.state == ON # => false
+DimmerItem1.state.as(OnOffType) == ON # => true
+DimmerItem1.state.on? # => true
+DimmerItem1.on? # => true
+DimmerItem1.off? # => false
+
+rule 'command' do
+  received_command DimmerItem1
+  run do |event|
+    if event.on?
+      # This will be executed even when the command is a positive PercentType
+      # instead of an actual ON command
+      logger.info("DimmerItem1 is being turned on")
+    end
+  end
+end
+
+DimmerItem1 << 100 # => This will trigger the logger.info above
+
+

#Metadata

+

Metadata is accessed through Item#metadata.

+
metadata = My_Item.metadata['namespace'].value
+
+

#Persistence

+

Persistence methods are available directly on Items.

+
logger.info("KitchenDimmer average_since #{KitchenDimmer.average_since(1.day.ago)}")
+daily_max = My_Item.maximum_since(24.hours.ago)
+
+

#Semantic Model

+

Many helper methods are available to make it easy to navigate the semantic model to get related items.

+
LivingRoom_Motion.location                            # Location of the motion sensor
+                 .equipments(Semantics::Lightbulb)    # Get all Lightbulb Equipments in the location
+                 .members                             # Get all the member items of the equipments
+                 .points(Semantics::Switch)           # Select only items that are Switch Points
+                 .on                                  # Send an ON command to the items
+
+

#Linked Things

+

If an Item is linked to a Thing, you can easily retrieve it.

+
linked_thing = My_Item.thing
+thing_uid = My_Item.thing.uid
+
+

An item can be linked to multiple things:

+
My_Item.things.each do |thing|
+  logger.info("Thing: #{thing.uid}")
+end
+
+

#Item Builder

+

New items can be created via items.build. +Note that by default items are not persisted to storage, and will be removed when the script unloads.

+
items.build do
+  switch_item MySwitch, "My Switch"
+  switch_item NotAutoupdating, autoupdate: false, channel: "mqtt:topic:1#light"
+  group_item MyGroup do
+    contact_item ItemInGroup, channel: "binding:thing#channel"
+  end
+  # passing `thing` to a group item will automatically use it as the base
+  # for item channels
+  group_item Equipment, tags: Semantics::HVAC, thing: "binding:thing"
+    string_item Mode, tags: Semantics::Control, channel: "mode"
+  end
+
+  # dimension Temperature inferred
+  number_item OutdoorTemp, format: "%.1f %unit%", unit: "°F"
+    
+  # unit lx, dimension Illuminance, format "%s %unit%" inferred
+  number_item OutdoorBrightness, state: 10_000 | "lx"
+end
+
+

#Things

+

The things object allows interactions with openHAB things.

+

Get Thing Status:

+
things['lgwebos:WebOSTV:main-tv'].status
+
+

Check if Thing is Online:

+
things['lgwebos:WebOSTV:main-tv'].online?
+
+

or

+
things['lgwebos:WebOSTV:main-tv'].status == ThingStatus::ONLINE
+
+

Enable/Disable a Thing:

+
thing = things['lgwebos:WebOSTV:main-tv']
+
+thing.disable
+logger.info "TV enabled: #{thing.enabled?}"
+
+thing.enable
+logger.info "TV enabled: #{thing.enabled?}"
+
+

Get Thing's configurations:

+
server = things["smtp:mail:local"].configuration["hostname"]
+logger.info "Configured SMTP Server: #{server}"
+
+frontporch_cam_ip = things["ipcamera:dahua:frontporch"].configuration["ipAddress"]
+logger.info "Front Porch Camera's IP Address: #{frontporch_cam_ip}"
+
+

Get Thing's property:

+
model_id = things["fronius:meter:mybridge:mymeter"].properties["modelId"]
+logger.info "Fronius Smart Meter model: #{model_id}"
+
+

#Actions

+

openHAB built-in actions are available as children of the Actions module. +Action classes are also imported into the top-level namespace. +Thing actions can be called directly on the Thing.

+

Publish an MQTT Message:

+
things['mqtt:broker:mybroker'].publish_mqtt('topic/name', 'payload')
+
+

Send an Email:

+
things['mail:smtp:mymailthing'].send_mail('me@example.com', 'Subject', 'message body')
+
+

Play Sound Through the Default Audio Sink:

+
Audio.play_sound 'sound_file.mp3'
+
+

Execute a Command:

+
Exec.execute_command_line('/path/to/program')
+
+

#Logging

+

The JRuby Scripting addon has a global logger object for logging. +To log a message on INFO log level:

+
logger.info("The current time is #{Time.now}")
+
+

The main logger prefix is org.openhab.automation.jrubyscripting. +The default logger name for UI rules includes the rule ID: org.openhab.automation.jrubyscripting.script.<RULE_ID>. +The logger name for file-based rules includes the rule's filename and the rule ID: org.openhab.automation.jrubyscripting.<filename>.rule.<RULE_ID>.

+

To use a custom logger name:

+
logger = OpenHAB::Log.logger("org.openhab.custom")
+
+

Please be aware that messages might not appear in the logs if the logger name does not start with org.openhab. +This behavior is due to log4j2 requiring definition for each logger prefix.

+

The logger is similar to a standard Ruby Logger. +Supported logging functions include:

+ +

obj is any Ruby (or Java) object. +#to_s (or toString() if it's a Java object) is called on obj, and the result is output to the openHAB log. +Additionally, all of these methods can take a Ruby block instead, which will only be called if logging is enabled at the given level, and the result of the block will be treated as the log message.

+

#Timers

+
sleep 1.5 # sleep for 1.5 seconds
+
+

See Ruby docs on sleep.

+

sleep should be avoided if possible. +A delay can be inserted in between two execution blocks to achieve the same result. +This delay is implemented with a timer. +This is available only on file-based rules.

+
rule "delay something" do
+  on_load
+  run { logger.info "This will run immediately" }
+  delay 10.seconds
+  run { logger.info "This will run 10 seconds after" }
+end
+
+

Alternatively a timer can be used in either a file-based rule or in a UI based rule using after. +After takes a Duration relative to now, e.g. 10.minutes, or an absolute time with ZonedDateTime or Time.

+
rule "simple timer" do
+  changed Watering_System, to: ON
+  run do
+    after(5.minutes) { Watering_System.off }
+  end
+end
+
+

When a script is unloaded, all created timers are automatically cancelled.

+

#Accessing Variables

+

You can access all variables of the current context in the created timers.

+

Note: Variables can be mutated (changed) after the timer has been created. +Be aware that this can lead to unintentional side effects, e.g. when you change the variable after timer creation, which can make debugging quite difficult!

+
my_var = "Hello world!";
+
+# Schedule a timer that expires in ten seconds
+after(10.seconds) do
+  logger.info("Timer expired with my_var = '#{my_var}'")
+end
+
+my_var = "Hello mutation!" # When the timer runs, it will log "Hello mutation!" instead of "Hello world!"
+
+

#Reschedule a Timer

+

A timer can be rescheduled inside the timer body

+
after(3.minutes) do |timer|
+  My_Light.on
+  timer.reschedule # This will reschedule it for the same initial duration, i.e. 3 minutes in this case
+end
+
+

Or it can be rescheduled from outside the timer

+
my_timer = after(3.minutes) do
+  My_Light.on
+end
+
+my_timer.reschedule # Use the same initial duration
+
+

It can be rescheduled to a different duration

+
after(3.minutes) do |timer|
+  My_Light.on
+  timer.reschedule(1.minute)
+end
+
+

It can also be canceled:

+
rule 'cancel timer' do
+  changed Light_Item, to: OFF
+  run { my_timer&.cancel }
+end
+
+

#Manage Multiple Timers

+

Multiple timers can be managed in the traditional way by storing the timer objects in a Hash:

+
@timers ||= {}
+
+if @timers[event.item]
+  @timers[event.item].reschedule
+else
+  @timers[event.item] = after 3.minutes do # Use the triggering item as the timer ID
+    event.item.off
+    @timers.delete(event.item)
+  end
+end
+
+

However, a built in mechanism is available to help manage multiple timers, and is done in a thread-safe manner. +This is done using timer IDs. +The following rule automatically finds and reschedules the timer matching the same ID, which corresponds to each group member.

+
after 3.minutes, id: event.item do # Use the triggering item as the timer ID
+  event.item.off
+end
+
+

Furthermore, you can manipulate the managed timers using the built-in timers object.

+
# timers is a special object to access the timers created with an id
+rule "cancel all timers" do
+  received_command Cancel_All_Timers, command: ON # Send a command to this item to cancel all timers
+  run do
+    gOutdoorLights.members.each do |item_as_timer_id|
+      timers.cancel(item_as_timer_id)
+    end
+  end
+end
+
+rule "reschedule all timers" do
+  received_command Reschedule_All_Timers, command: ON # Send a command to this item to restart all timers
+  run do
+    gOutdoorLights.members.each do |item_as_timer_id|
+      timers.reschedule(item_as_timer_id)
+    end
+  end
+end
+
+

#Cache

+

The shared_cache object provides a cache that can be used to set and retrieve objects that will be persisted between reloads of scripts, and available between different rules. +It acts similarly to a regular Ruby Hash. +Just be wary of Ruby-only data types (such as Symbols) that won't be accessible between different scripts.

+

Get a previously set object with a default value:

+
shared_cache.compute_if_absent(:counter) { 0 } # Initialize with 0 if it didn't exist
+logger.info("Count: #{shared_cache[:counter] += 1}")
+
+

Get a previously set object, or assign it (this version is subject to race conditions with other scripts):

+
shared_cache[:counter] ||= 0
+logger.info("Count: #{shared_cache[:counter] += 1}")
+
+

Get a previously set object with a default value, without assigning it (this version has an even longer amount of time between fetching the value and assigning it):

+
count = shared_cache.fetch(:counter) { 0 }
+shared_cache[:counter] = count + 1
+
+

#Time

+

Several options are available for time related code, including but not limited to:

+ +

#Durations

+

Ruby integers and floats are extended with several methods to support durations. +These methods create a new Duration or Period object that is used by the every trigger, delay block, the for option of changed triggers, and timers.

+
rule "run every 30 seconds" do
+  every 30.seconds
+  run { logger.info("Hello") }
+end
+
+
rule "Warn about open door" do
+  changed FrontDoor, to: OPEN, for: 10.minutes
+  run { |event| logger.info("#{event.item.name} has been open for 10 minutes") }
+end
+
+
rule "Timer example" do
+  on_load
+  run do
+    after(3.hours) { logger.info("3 hours have passed") }
+  end
+end
+
+

#Time Comparisons, Conversions, and Arithmetic

+

Comparisons, conversions and arithmetic are automatic between Java and Ruby types. +Note that anytime you do a comparison between a type with more specific data, and a type missing specific data, the comparison is done as if the more specific data is at the beginning of its period. +I.e. comparing a time to a month, the month will be treated as 00:00:00 on the first day of the month. +When comparing with a type that's missing more generic data, it will be filled in from the other object. +I.e. comparing a time to a month, the month will be assumed to be in the same year as the time.

+
# Get current date/time
+now = ZonedDateTime.now
+one_hour_from_now = ZonedDateTime.now + 60.minutes
+one_hour_from_now = 1.hour.from_now # or use the simpler helper method that also returns a ZonedDateTime
+# Or use Ruby time
+ruby_now = Time.now
+
+# Compare them
+if one_hour_from_now > now
+  logger.info "As it should be"
+end
+
+# Comparing Ruby Time and ZonedDateTime works just fine
+if one_hour_from_now > ruby_now
+  logger.info "It works too"
+end
+
+if Time.now > LocalTime.parse('7am')
+  logger.info 'Wake up!'
+end
+
+if MonthDay.now == MonthDay.parse('02-14')
+  logger.info "Happy Valentine's Day!"
+end
+
+# Ranges can cross midnight
+if Time.now.between?('10pm'..'5am')
+  logger.info 'Sleep time'
+end
+
+# Explicit conversions
+ZonedDateTime.now.to_time
+Time.now.to_zoned_date_time
+
+# You can parse string as time
+wake_up_time = LocalTime.parse("6:00 am")
+
+# Compare now against LocalTime
+if ZonedDateTime.now >= wake_up_time
+  Wake_Up_Alarm.on
+end
+
+# Even compare against Ruby Time
+if Time.now >= wake_up_time
+  Wake_Up_Alarm.on
+end
+
+# Get today's start of the day (midnight)
+start_of_day = ZonedDateTime.now.with(LocalTime::MIDNIGHT)
+# or
+start_of_day = LocalTime::MIDNIGHT.to_zoned_date_time
+
+# Comparing ZonedDateTime against LocalTime with `<`
+max = Solar_Power.maximum_since(24.hours.ago)
+if max.timestamp < LocalTime::NOON
+  logger.info "Max solar power #{max} happened before noon, at: #{max.timestamp}"
+end
+
+# Comparing Time against ZonedDateTime with `>`
+sunset = things["astro:sun:home"].get_event_time("SUN_SET", nil, nil)
+if Time.now > sunset
+  logger.info "it is after sunset"
+end
+
+# Subtracting Duration from Time and comparing Time against ZonedDateTime
+Motion_Sensor.last_update < Time.now - 10.minutes
+# Alternatively:
+Motion_Sensor.last_update < 10.minutes.ago
+
+# Finding The Duration Between Two Times
+elapsed_time = Time.now - Motion_Sensor.last_update
+# Alternatively:
+elapsed_time = ZonedDateTime.now - Motion_Sensor.last_update
+
+# Using `-` operator with ZonedDateTime
+# Comparing two ZonedDateTime using `<`
+Motion_Sensor.last_update < Light_Item.last_update - 10.minutes
+# is the same as:
+Motion_Sensor.last_update.before?(Light_Item.last_update.minus_minutes(10))
+
+# Getting Epoch Second
+Time.now.to_i
+ZonedDateTime.now.to_i
+ZonedDateTime.now.to_epoch_second
+
+# Convert Epoch second to time
+Time.at(1669684403)
+
+# Convert Epoch second to ZonedDateTime
+Time.at(1669684403).to_zoned_date_time
+# or
+java.time.Instant.of_epoch_second(1669684403).at_zone(ZoneId.system_default)
+
+

#Ranges

+

Ranges of date time objects work as expected. +Make sure to use #cover? instead of #include? to do a simple comparison, instead of generating an array and searching it linearly. +Ranges of non-absolute, "circular" types (LocalTime, Month, MonthDay) are smart enough to automatically handle boundary issues. +Coarse types (like LocalDate, Month, MonthDay) will also work correctly when checking against a more specific type. +To easily parse strings into date-time ranges, use the OpenHAB::DSL.between helper. +Duration, ZonedDateTime, LocalTime, LocalDate, MonthDay, Month, Time, Date, and DateTime classes include between? method that accepts a range of string or any of the date/time objects.

+
between("10:00".."14:00").cover?(Time.now)
+between("11pm".."1am").cover?(Time.now)
+
+# Or use the alternative syntax:
+Time.now.between?("10:00".."14:00")
+Time.now.between?("11pm".."1am")
+
+case Time.now
+when between("6:00"..."12:00")
+  logger.info("Morning Time")
+when between('12:00'..'15:00')
+  logger.info("Afternoon")
+else
+  logger.info("Not in time range")
+end
+
+# Compare against Month
+Time.now.between?(Month::NOVEMBER..Month::DECEMBER)
+Date.today.between?(Month::NOVEMBER..Month::DECEMBER)
+ZonedDateTime.now.between?(Month::NOVEMBER..Month::DECEMBER)
+
+# Compare against MonthDay
+Time.now.between?("05-01".."12-01")
+
+# Compare against time of day
+Time.now.between?("5am".."11pm")
+
+

#Ephemeris

+

Helper methods to easily access openHAB's Ephemeris action are provided on all date-like objects:

+
Time.now.holiday? # => false
+MonthDay.parse("12-25").holiday # => :christmas
+1.day.from_now.next_holiday # => :thanksgiving
+Notification.send("It's #{Ephemeris.holiday_name(Date.today)}!") if Date.today.holiday?
+
+Date.today.weekend? # => true
+Date.today.in_dayset?(:school) # => false
+
+

#Rules, Scripts, and Scenes

+

Rules, Scenes and Scripts can be accessed using the rules object. +For example, to execute/trigger a rule:

+
rules[rule_uid].trigger
+
+

Scenes are rules with a Scene tag, and Scripts are rules with a Script tag. +They can be found using their uid just like normal rules, i.e. rules[uid]. +For convenience, a list of all Scenes are available through the enumerable rules.scenes, and a list of all Scripts through rules.scripts.

+

Example: All scenes tagged sunrise will be triggered at sunrise, and all scenes tagged sunset will be triggered at sunset. +Note: these use the Terse Rule syntax.

+
channel("astro:sun:home:rise#event") { rules.scenes.tagged("sunrise").each(&:trigger) }
+channel("astro:sun:home:set#event") { rules.scenes.tagged("sunset").each(&:trigger) }
+
+

Or it can be written as one rule with the help of trigger attachments.

+
rule "Activate scenes at sunset/sunrise" do
+  channel "astro:sun:home:rise#event", attach: "sunrise"
+  channel "astro:sun:home:set#event", attach: "sunset"
+  run { |event| rules.scenes.tagged(event.attachment).each(&:trigger) }
+end
+
+

Get the UID of a Rule

+
rule_obj = rule 'my rule name' do
+  received_command My_Item
+  run do
+    # rule code here
+  end
+end
+
+rule_uid = rule_obj.uid
+
+

A rule's UID can also be specified at rule creation

+
rule "my rule name", id: "my_unique_rule_uid" do
+  # ...
+end
+
+# or
+rule "my rule name" do
+  uid "my_unique_rule_uid"
+  # ...
+end
+
+

Get the UID of a Rule by Name

+
rule_uid = rules.find { |rule| rule.name == 'This is the name of my rule' }.uid
+
+

Enable or Disable a Rule by UID

+
rules[rule_uid].enable
+rules[rule_uid].disable
+
+

#Passing Values to Rules

+

A rule/script may be given additional context/data by the caller. +This additional data is available within the rule by referring to the names of the context variable. +This is applicable to both UI rules and file-based rules.

+

Within the script/rule body (either UI or file rule)

+
script id: "check_temp" do
+  if CPU_Temperature.state > maxTemperature
+    logger.warn "The CPU is overheating!"
+  end
+end
+
+

The above script can be executed, passing it the maxTemperature argument from any supported scripting language, e.g.:

+
rules["check_temp"].trigger(maxTemperature: 80 | "°C")
+
+

#Gems

+

Bundler is integrated, enabling any Ruby gem compatible with JRuby to be used within rules. +This permits easy access to the vast ecosystem of libraries within the Ruby community. +Gems are available using the inline bundler syntax. +The require statement can be omitted.

+
gemfile do
+  source 'https://rubygems.org'
+  gem 'json', require: false
+  gem 'nap', '1.1.0', require: 'rest'
+end
+
+logger.info("The nap gem is at version #{REST::VERSION}")
+
+

#Shared Code

+

If you would like to easily share code among multiple scripts, you can place it in <OPENHAB_CONF>/automation/ruby/lib. +You can then simply require the file from your rules files. +Files located in $RUBYLIB won't be automatically loaded individually by openHAB, only when you require them.

+

automation/ruby/myrule.rb OR a UI Rule's script:

+
require "my_lib"
+
+logger.info(my_lib_version)
+
+

automation/ruby/lib/my_lib.rb

+
def my_lib_version
+  "1.0"
+end
+
+

#Transformations

+

#Using openHAB Transformations

+

Existing openHAB transformations can also be used by calling the transform method. +This enables the use of any transformations from the /transform folder or managed through the UI, such as MAP, JSONPATH, Jinja Transformation, etc.

+
# Convert OPEN/CLOSED to Online/Offline using availability.map
+# OPEN=Online
+# CLOSED=OFFLINE
+logger.info transform(:map, "availability.map", LivingRoom_Switch_Availability.state)
+
+

#Writing Custom Transformations in Ruby

+

This add-on also provides the necessary infrastructure to use Ruby for writing transformations.

+

The main value to be transformed is given to the script in a variable called input. +Note that the values are passed to the transformation as Strings even for numeric items and data types.

+

Note: In openHAB 3.4, due to an issue in the current version of JRuby, you will need to begin your script with input ||= nil (and a ||= nil etc. for additional query variables) so that JRuby will recognize the variables as variables--rather than method calls--when it's parsing the script. +Otherwise you will get errors like (NameError) undefined local variable or method 'input' for main:Object. +This is not necessary in openHAB 4.0+.

+

#File Based Transformations

+

Once the addon is installed, you can create a Ruby file in the $OPENHAB_CONF/transform directory, with the extension .rb. +When referencing the file, you need to specify the RB transform: RB(mytransform.rb):%s.

+

You can also specify additional variables to be set in the script using a URI-like query syntax: RB(mytransform.rb?a=1&b=c):%s in order to share a single script with slightly different parameters for different items.

+
#Example: Display the wind direction in degrees and cardinal direction
+

weather.items

+
Number:Angle Exterior_WindDirection "Wind Direction [RB(compass.rb):%s]" <wind>
+
+

compass.rb

+
DIRECTIONS = %w[N NE E SE S SW W NW N].freeze
+
+if input.nil? || input == "NULL" || input == "UNDEF"
+  "-"
+else
+  cardinal = DIRECTIONS[(input.to_f / 45).round]
+  "#{cardinal} (#{input.to_f.round}°)"
+end
+
+

Given a state of 82 °, this will produce a formatted state of E (82°).

+
#Example: Display the number of lights that are on/off within a group
+
Group gIndoorLights "Indoor Lights [RB(group_count.rb?group=gIndoorLights):%s]"
+Group gOutdoorLights "Outdoor Lights [RB(group_count.rb?group=gOutdoorLights):%s]"
+
+

group_count.rb

+
items[group].all_members.then { |all| "#{all.select(&:on?).size}/#{all.size}" }
+
+

When 3 lights out of 10 lights are on, this will produce a formatted state of 3/10

+

#Inline Transformations

+

Inline transformations are supported too. +For example, to display the temperature in both °C and °F:

+
Number:Temperature Outside_Temperature "Outside Temperature [RB(|  input.to_f.|('°C').then { |t| %(#{t.format('%d °C')} / #{t.to_unit('°F').format('%d °F')}) }   ):%s]"
+
+

When the item contains 0 °C, this will produce a formatted state of 0 °C / 32 °F.

+

#Profile

+

You can create an openHAB profile in JRuby that can be applied to item channel links. +For more details, see #profile.

+

#Sitemaps

+

Sitemaps can be created via sitemaps.build.

+
sitemaps.build do
+  sitemap "default", "My Residence" do
+    frame label: "Control" do
+      text label: "Climate", icon: "if:mdi:home-thermometer-outline" do
+        frame label: "Main Floor" do
+          text item: MainFloor_AmbTemp
+          switch item: MainFloorThermostat_TargetMode, label: "Mode", mappings: %w[off auto cool heat]
+          setpoint item: MainFloorThermostat_SetPoint, label: "Set Point", visibility: "MainFloorThermostat_TargetMode!=off"
+        end
+        frame label: "Basement" do
+          text item: Basement_AmbTemp
+          switch item: BasementThermostat_TargetMode, label: "Mode", mappings: { OFF: "off", COOL: "cool", HEAT: "heat" }
+          setpoint item: BasementThermostat_SetPoint, label: "Set Point", visibility: "BasementThermostat_TargetMode!=off"
+        end
+      end
+    end
+  end
+end
+
+

#File Based Rules

+

#Basic Rule Structure

+

See OpenHAB::DSL::Rules::Builder for full details.

+
rule "name" do
+  <one or more triggers>
+  <one or more execution blocks>
+  <zero or more guards or conditions>
+end
+
+

Jump to: Rule Triggers, Rule Executions, Rule Conditions

+

#Rule Triggers

+

#Item or Thing Changed

+
rule "Log (or notify) when the secret door is open" do
+  changed SecretDoor, to: OPEN
+  run { |event| logger.info("#{event.item} is opened") }
+end
+
+
rule "Log when Fronius Inverter goes offline" do
+  changed things["fronius:bridge:mybridge"], from: :online, to: :offline
+  run { |event| logger.info("Thing #{event.uid} went #{event.status}!") }
+end
+
+

See #changed

+
#Detecting Change Duration
+

Only execute a rule when an item state changed and stayed the same for a period of time. +This method can only be done using a file-based rule.

+
rule "Garage Door Alert" do
+  changed GarageDoor, to: OPEN, for: 20.minutes
+  run { Voice.say "The garage door has been open for 20 minutes!" }
+end
+
+

#Item Updated

+
rule "Calculate" do
+  updated Camera_Event_Data
+  run do |event|
+    logger.info "Camera event: #{event.state}"
+  end
+end
+
+

See #updated

+

#Item Received a Command

+
rule "Received a command" do
+  received_command DoorBell, command: ON
+  run do |event|
+    Notification.send "Someone pressed the door bell"
+    play_sound "doorbell.mp3"
+  end
+end
+
+

See #received_command

+

#Member-of-Group Trigger

+

Add .members to the GroupItem in order to trigger on its members.

+
rule "Trigger by Member of" do
+  changed gGroupName.members
+  run do |event|
+    logger.info "Triggered item: #{event.item.name}"
+  end
+end
+
+

#Script is Loaded

+
rule "initialize things" do
+  on_load # This triggers whenever the script (re)loads
+  run { logger.info "Here we go!" }
+end
+
+

See #on_load

+

#openHAB System Started

+
rule "System startup rule" do
+  on_start at_level: 80
+  run { logger.info "I'm glad to be alive!" }
+end
+
+

See #on_start

+

#Cron Trigger

+

Traditional cron trigger:

+
rule "cron rule" do
+  cron "0 0,15 15-19 L * ?""
+  run { logger.info "Cron run" }
+end
+
+

Or an easier syntax:

+
rule "cron rule" do
+  cron second: 0, minute: "0,15", hour: "15-19", dom: "L"
+  run { logger.info "Cron run" }
+end
+
+

See #cron

+
#every Trigger
+
rule "run every day" do
+  every :day, at: "2:35pm"
+  run { Amazon_Echo_TTS << "It's time to pick up the kids!" }
+end
+
+
rule "run every 5 mins" do
+  every 5.minutes
+  run { logger.info "openHAB is awesome" }
+end
+
+
rule "Anniversary Reminder" do
+  every "10-15" # This takes a MM-DD syntax to trigger on 15th of October at midnight
+  run do
+    things["mail:smtp:mymailthing"].send_mail("me@example.com", "Anniversary Reminder!", "Today is your anniversary!")
+  end
+end
+
+

See #every

+

#DateTimeItem Trigger

+

To trigger based on the date and time stored in a DateTime item, use at ItemName:

+
rule "DateTime Trigger" do
+  at My_DateTimeItem
+  run do |event|
+    logger.info "Triggered by #{event.item} at #{event.item.state}"
+  end
+end
+
+

To trigger based on only the time part of a DateTime item, use every :day, at: ItemName:

+
rule "TimeOnly Trigger" do
+  every :day, at: My_DateTimeItem
+  run do |event|
+    logger.info "Triggered by #{event.item} at #{event.item.state}"
+  end
+end
+
+

#Other Triggers

+

There are more triggers supported by this library. +See the full list of supported triggers.

+

#Combining Multiple Triggers

+
rule "multiple triggers" do
+  changed Switch1, to: ON
+  changed Switch2, to: ON
+  run { |event| logger.info "Switch: #{event.item.name} changed to: #{event.state}" }
+end
+
+

When the trigger conditions are the same, the triggers can be combined.

+
rule "multiple triggers" do
+  changed Switch1, Switch2, to: ON
+  run { |event| logger.info "Switch: #{event.item.name} changed to: #{event.state}" }
+end
+
+

#Combining Multiple Conditions

+
rule "multiple conditions" do
+  changed Button_Action, to: ["single", "double"]
+  run { |event| logger.info "Action: #{event.state}" }
+end
+
+

#Rule Conditions

+
rule "motion sensor" do
+  updated Motion_Sensor, to: ON
+  only_if { Sensor_Enable.on? } # Run rule only if Sensor_Enable item is ON
+  not_if { Sun_Elevation.positive? } # and not while the sun is up
+  run { LightItem.on }
+end
+
+

Restrict Rule Executions to Certain Time of Day:

+
rule "doorbell" do
+  updated DoorBell_Button, to: "single"
+  between "6am".."8:30pm"
+  run { play_sound "doorbell_chime.mp3" }
+end
+
+

See Rule Guards

+

#Rule Executions

+

Execution blocks are executed when a rule is triggered and all the rule conditions are met. +Multiple execution blocks can be specified. +This can be useful especially when using a delay execution block inbetween two run or triggered blocks.

+

#Run Execution Block

+

A run execution block is the most commonly used execution block. +It provides the full event object to the block.

+
rule "Rule with a run block" do
+  received_command SwitchItem1
+  run do |event|
+    logger.info "#{event.item} received this command: #{event.command}"
+  end
+end
+
+

#Triggered Execution Block

+

A triggered execution block passes the TriggeringItem object directly to the block. +It is handy when combined with Ruby's pretzel-colon operator to act directly on the object.

+
rule "Limit the duration of TV watching" do
+  changed gTVPower.members, to: ON, for: 2.hours
+  triggered(&:off)
+end
+
+

#Delay Execution Block

+

A delay exection block is useful for adding a delay inbetween rule executions or even at the beginning of the trigger event without having to manually create a timer. +Unlike sleep, a delay block does not block the current executing thread. +It actually sets a timer for you behind the scenes.

+
rule "Check for offline things 15 minutes after openHAB had started" do
+  on_start
+  delay 15.minutes
+  run do
+    offline_things = things.select(&:offline?).map(&:uid).join(", ")
+    Notification.send("Things that are still offline: #{offline_things}")
+  end
+end
+
+

See Execution Blocks

+

#Terse Rules

+

A rule with a trigger and an execution block can be created with just one line.

+
received_command(My_Switch, command: ON) { My_Light.on }
+
+

See Terse Rules for full details.

+

#Early Exit From a Rule

+

You can use next within a file-based rule, because it's in a block:

+
rule "doorbell" do
+  updated DoorBell_Button, to: "single"
+  run do
+    next unless Time.now.between?("6am".."8:30pm")
+
+    play_sound "doorbell_chime.mp3"
+  end
+end
+
+
+

Use return within a UI rule:

+
return unless Time.now.between?("6am".."8:30pm")
+
+play_sound "doorbell_chime.mp3"
+
+

#Dynamic Generation of Rules

+

The rule definition itself is just Ruby code, which means you can use code to generate your rules. +Take care when doing this as the the items/groups are processed when the rules file is processed, meaning that new items/groups will not automatically generate new rules.

+
rule "Log whenever a Virtual Switch Changes" do
+  items.grep(SwitchItem)
+       .select { |item| item.label&.include?("Virtual") }
+       .each do |item|
+         changed item
+       end
+
+  run { |event| logger.info "#{event.item.name} changed from #{event.was} to #{event.state}" }
+end
+
+

This rule is effectively the same:

+
virtual_switches = items.grep(SwitchItem)
+                        .select { |item| item.label&.include?("Virtual") }
+
+rule "Log whenever a Virtual Switch Changes 2" do
+  changed(*virtual_switches)
+  run { |event| logger.info "#{event.item.name} changed from #{event.was} to #{event.state} 2" }
+end
+
+

This will accomplish the same thing, but create a new rule for each virtual switch:

+
virtual_switches = items.grep(SwitchItem)
+                        .select { |item| item.label&.include?("Virtual") }
+
+virtual_switches.each do |switch|
+  rule "Log whenever a #{switch.label} Changes" do
+    changed switch
+    run { |event| logger.info "#{event.item.name} changed from #{event.was} to #{event.state} 2" }
+  end
+end
+
+

#Scenes and Scripts

+

A scene can be created using the .scene method.

+
scene "Movie", id: "movie", description: "Set up the theatre for movie watching" do
+  Theatre_Window_Blinds.down
+  Theatre_Screen_Curtain.up
+  Theatre_Mood_Light.on
+  Theatre_Light.off
+  Theatre_Projector.on
+  Theatre_Receiver.on
+end
+
+

To create a script, use the .script method. +Note that scripts can be executed with additional contexts.

+

#Hooks

+

File based scripts can also register hooks that will be called when the script has completed loading (script_loaded) and when it gets unloaded (script_unloaded).

+
x = 1
+
+script_loaded do
+  logger.info("script loaded!")
+  logger.info(x) # this will log 2, since it won't execute until the entire script loads.
+end
+
+x = 2
+
+script_unloaded do
+  logger.info("script unloaded")
+end
+
+

#Calling Java From JRuby

+

JRuby can access almost any Java object that's available in the current JVM. +This is how the library is implemented internally.

+
# you can `java_import` classes and interfaces, which will become Ruby constants
+java_import java.time.format.DateTimeFormatter
+
+formatter = DateTimeFormatter.of_pattern("yyyy MM dd")
+
+# or you can just reference them directly to avoid polluting the global namespace
+formatter = java.time.format.DateTimeFormatter.of_pattern("yyyy MM dd")
+
+

#Full Documentation

+

Visit https://openhab.github.io/openhab-jruby/ for the full documentation of the openHAB JRuby Helper Library.

+ + + + + + + + diff --git a/5.33/file.conversions.html b/5.33/file.conversions.html new file mode 100644 index 0000000000..addc1f9b48 --- /dev/null +++ b/5.33/file.conversions.html @@ -0,0 +1,3738 @@ + + + + + + + File: Rule Conversions + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

#Conversion Examples

+

#JSScripting

+
var email = "juliet@capulet.org"
+
+rules.JSRule({
+  name: "Balcony Lights ON at 5pm",
+  description: "Light will turn on when it's 5:00pm",
+  triggers: [triggers.GenericCronTrigger("0 0 17 * * ?")],
+  execute: (event) => {
+    items.getItem("BalconyLights").sendCommand("ON");
+    actions.NotificationAction.sendNotification(email, "Balcony lights are ON");
+  },
+  tags: ["Balcony", "Lights"],
+  id: "BalconyLightsOn"
+});
+
+

Ruby

+
EMAIL = "juliet@capulet.org"
+
+rule "Balcony Lights ON at 5pm" do
+  description "Light will turn on when it's 5:00pm"
+  every :day, at: '5pm' # This can be written as: `cron "0 0 17 * * ?"` if preferred
+  tags %w[Balcony Lights]
+  uid "BalconyLightsOn"
+  run do |event|
+    BalconyLights.on
+    NotificationAction.send_notification(EMAIL, "Balcony lights are ON")
+  end
+end
+
+

Terse rules

+

JRubyScripting supports Terse syntax as well as the normal, +more traditional syntax.

+
+

JS:

+
// Basic rule, when the BedroomLight1 is changed, run a custom function
+rules.when().item('BedroomLight1').changed().then(e => {
+    console.log("BedroomLight1 state", e.newState)
+}).build();
+
+

Ruby:

+
# Basic rule, when the BedroomLight1 is changed, run a custom function
+changed(BedromLight1) { |event| logger.info "#{event.item.name} state #{event.state}" }
+
+
+

JS:

+
// Turn on the kitchen light at SUNSET
+rules.when().timeOfDay("SUNSET").then().sendOn().toItem("KitchenLight").build("Sunset Rule","turn on the kitchen light at SUNSET");
+
+

Ruby:

+
# Turn on the kitchen light at SUNSET
+channel("astro:sun:home:set#event", name: "Sunset Rule", description: "turn on the kitchen light at SUNSET") { KitchenLight.on }
+
+
+

JS:

+
// Turn off the kitchen light at 9PM and tag rule
+rules.when().cron("0 0 21 * * ?").then().sendOff().toItem("KitchenLight").build("9PM Rule", "turn off the kitchen light at 9PM", ["Tag1", "Tag2"]);
+
+

Ruby:

+
# Turn off the kitchen light at 9PM
+every(:day, at: '9pm', name: "9PM Rule", description: "turn off the kitchen light at 9PM", tags: %w[Tag1 Tag2]) { KitchenLight.off }
+
+
+

JS:

+
// Set the colour of the hall light to pink at 9PM, tag rule and use a custom ID
+rules.when().cron("0 0 21 * * ?").then().send("300,100,100").toItem("HallLight").build("Pink Rule", "set the colour of the hall light to pink at 9PM", ["Tag1", "Tag2"], "MyCustomID");
+
+

Ruby:

+
# Set the colour of the hall light to pink at 9PM and use a custom ID
+every(:day, at: '9pm', id: "MyCustomID", name: "Pink Rule", description: "set the colour of the hall light to pink at 9PM", tags: %w[Tag1 Tag2]) { HallLight << "300,100,100" }
+
+
+

JS:

+
// When the switch S1 status changes to ON, then turn on the HallLight
+rules.when().item('S1').changed().toOn().then(sendOn().toItem('HallLight')).build("S1 Rule");
+
+

Ruby:

+
# When the switch S1 status changes to ON, then turn on the HallLight
+changed(S1, to: ON, name: "S1 Rule") { HallLight.on }
+
+
+

JS:

+
// When the HallLight colour changes pink, if the function fn returns true, then toggle the state of the OutsideLight
+rules.when().item('HallLight').changed().to("300,100,100").if(fn).then().sendToggle().toItem('OutsideLight').build();
+
+

Ruby:

+
# When the HallLight colour changes pink, if the function fn returns true, then toggle the state of the OutsideLight
+changed(HallLight, to: "300,100,100") { OutsideLight.toggle if fn }
+
+
+

JS:

+
// When the HallLight receives a command, send the same command to the KitchenLight
+rules.when().item('HallLight').receivedCommand().then().sendIt().toItem('KitchenLight').build("Hall Light", "");
+
+

Ruby:

+
# When the HallLight receives a command, send the same command to the KitchenLight
+received_command(HallLight) { |event| KitchenLight << event.command }
+
+
+

JS:

+
// When the HallLight is updated to ON, make sure that BedroomLight1 is set to the same state as the BedroomLight2
+rules.when().item('HallLight').receivedUpdate().then().copyState().fromItem('BedroomLight1').toItem('BedroomLight2').build();
+
+

Ruby:

+
# When the HallLight is updated to ON, make sure that BedroomLight1 is set to the same state as the BedroomLight2
+updated(HallLight) { BedroomLight2 << BedroomLight1.state }
+
+

#DSL

+
rule "Snap Fan to preset percentages"
+when Member of CeilingFans changed
+then
+  val fan = triggeringItem
+  switch fan {
+    case fan.state > 0 && fan.state < 25 : {
+      logInfo("Fan", "Snapping {} to 25%", fan.name)
+      sendCommand(fan, 25)
+    }
+    case fan.state > 25 && fan.state < 66 : {
+      logInfo("Fan", "Snapping {} to 66%", fan.name)
+      sendCommand(fan, 66)
+    }
+    case fan.state > 66 && fan.state < 100 : {
+      logInfo("Fan", "Snapping {} to 100%", fan.name)
+      sendCommand(fan, 100)
+    }
+    default: {
+      logInfo("Fan", "{} set to snapped percentage, no action taken", fan.name)
+    }
+  }
+end
+
+

Ruby

+
rule 'Snap Fan to preset percentages' do
+  changed CeilingFans.members
+  run do |event|
+    snapped = case event.state
+              when 0..25 then 25
+              when 25..66 then 66
+              when 66..100 then 100
+              else next # perhaps it changed to NULL/UNDEF
+              end
+
+    if event.item.ensure.command(snapped) # returns false if already in the same state
+      logger.info("Snapping #{event.item.name} to #{snapped}")
+    else
+      logger.info("#{event.item.name} set to snapped percentage, no action taken.")
+    end
+  end
+end
+
+

#Python

+
@rule("Use Supplemental Heat In Office")
+@when("Item Office_Temperature changed")
+@when("Item Thermostats_Upstairs_Temp changed")
+@when("Item Office_Occupied changed")
+@when("Item OfficeDoor changed")
+def office_heater(event):
+  office_temp = ir.getItem("Office_Temperature").getStateAs(QuantityType).toUnit(ImperialUnits.FAHRENHEIT).floatValue()
+  hall_temp = items["Thermostats_Upstairs_Temp"].floatValue()
+  therm_status = items["Thermostats_Upstairs_Status"].intValue()
+  heat_set = items["Thermostats_Upstairs_Heat_Set"].intValue()
+  occupied = items["Office_Occupied"]
+  door = items["OfficeDoor"]
+  difference = hall_temp - office_temp
+  degree_difference = 2.0
+  trigger = occupied == ON and door == CLOSED and heat_set > office_temp and difference > degree_difference
+
+  if trigger:
+    events.sendCommand("Lights_Office_Outlet","ON")
+  else:
+    events.sendCommand("Lights_Office_Outlet","OFF")
+
+

Ruby

+
rule "Use supplemental heat in office" do
+  changed Office_Temperature, Thermostats_Upstairs_Temp, Office_Occupied, OfficeDoor
+  run do
+    trigger = Office_Occupied.on? &&
+              OfficeDoor.closed? &&
+              Thermostat_Upstairs_Heat_Set.state > Office_Temperature.state &&
+              Thermostat_Upstairs_Temp.state - Office_Temperature.state > 2 | "°F"
+    Lights_Office_Outlet.ensure << trigger # send a boolean command to a SwitchItem, but only if it's different
+  end
+end
+
+
+ +
+ Generated on Sat Dec 14 15:06:34 2024 by + yard + 0.9.28 (ruby-3.1.3). +
+ +
+
+ + diff --git a/5.33/file.examples.html b/5.33/file.examples.html new file mode 100644 index 0000000000..0f189e6fcd --- /dev/null +++ b/5.33/file.examples.html @@ -0,0 +1,3782 @@ + + + + + + + File: Examples + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

#Examples

+

The following examples are for file-based rules but most of them are applicable to UI rules as well.

+ +

#Trigger when an item changed state

+
rule 'Turn on light when sensor changed to open' do
+  changed Door_Sensor, to: OPEN
+  run { Cupboard_Light.on }
+end
+
+

Use multiple triggers

+
rule 'Control light based on multiple doors' do
+  changed Door_Sensor1, to: OPEN
+  changed Door_Sensor2, to: OPEN
+  run { Cupboard_Light.on }
+end
+
+# Which is the same as:
+rule 'Control light based on multiple doors' do
+  changed Door_Sensor1, Door_Sensor2, to: OPEN
+  run { Cupboard_Light.on }
+end
+
+

Check against multiple states

+
rule 'Control light based on door state' do
+  changed Door_Sensor, to: [OPEN, CLOSED]
+  run { Cupboard_Light << Door_Sensor.open? } # Send a boolean command to a Switch Item
+end
+
+

#Trigger when a group member changed state

+
# Assumption: Motion sensor items are named using the pattern RoomName_Motion
+# and Light switch items are named with the pattern RoomName_Light
+rule 'Generic motion rule' do
+  changed Motion_Sensors.members, to: ON
+  run do |event|
+    light = items[event.item.name.sub('_Motion', '_Light')] # Lookup item name from a string
+    light&.on
+  end
+end
+
+

See also: Triggers

+

#Various ways of sending a command to an item

+
# Using the shovel operator
+Light1 << ON
+DimmerItem1 << 100
+Set_Temperature << '24 °C'
+
+# Using command predicates
+Light1.on
+Rollershutter1.up
+Player1.play
+
+# Using .command
+ColorItem1.command '#ffff00'
+ColorItem1.command {r: 255, g: 0xFF, b: 0}
+
+# Send a command to all the array members
+# Note The << operator doesn't send a command here because it's for appending to the array
+[SwitchItem1, SwitchItem2, SwitchItem3].on
+[RollerItem1, RollerItem2, RollerItem3].down
+[NumberItem1, NumberItem2, NumberItem3].command 100
+
+

Each item type supports command helpers relevant to the type. +For example, a SwitchItem supports on and off. +See specific item types under OpenHAB::Core::Items

+

#Dealing with Item States

+
# Items:
+# Number:Temperature Outside_Temperature e.g. 28 °C
+# Number:Temperature Inside_Temperature e.g. 22 °C
+temperature_difference = Outside_Temperature.state - Inside_Temperature.state
+logger.info("Temperature difference: #{temperature_difference}") # "Temperature difference: 6 °C"
+
+

Items have predicates to query its state.

+
Switch1.on?    # => true if Switch1.state == ON
+Shutter1.up?   # => true if Shutter1.state == UP
+
+

#Detect change duration without creating an explicit timer

+
rule 'Warn when garage door is open a long time' do
+  changed Garage_Door, to: OPEN, for: 15.minutes
+  run { Voice.say "Warning, the garage door is open" } # call TTS to the default audio sink
+end
+
+

#Automatic activation of exhaust fan based on humidity sensor

+

This uses the evolution_rate persistence feature, coupled with an easy way to specify duration. +It is accessed simply through ItemName.persistence_function.

+
# Note: don't activate the exhaust fan if the bathroom light is off at night
+# Sun_Elevation is an Astro item. Its state is positive during daylight
+rule "Humidity: Control ExhaustFan" do
+  updated BathRoom_Humidity
+  triggered do |humidity|
+    evo_rate = humidity.evolution_rate(4.minutes.ago, :influxdb)
+    logger.info("#{humidity.name} #{humidity.state} evolution_rate: #{evo_rate}")
+
+    if (humidity.state > 70 && evo_rate > 15) || humidity.state > 85
+      BathRoom_ExhaustFan.ensure.on if Sun_Elevation.state.positive? || BathRoom_Light.state.nil? || BathRoom_Light.on?
+    elsif humidity.state < 70 || evo_rate < -5
+      BathRoom_ExhaustFan.ensure.off
+    end
+  end
+end
+
+

#Executing an External Command

+

OpenHAB offers execute_command_line to execute +an external command. However, in Ruby it is also possible to use, amongst others:

+
    +
  • system: waits for the execution to finish, +then returns true (zero exit status), false (non-zero exit status), or nil if the execution fails.
  • +
  • backtick operator: waits for the execution to finish, +then returns the stdout output of the command as a String.
  • +
  • spawn: executes the command and immediately +returns control to the caller, leaving the command running in the background. This method returns +the pid of the spawned process which must be waited out or detached to avoid creating zombie processes.
  • +
  • IO#popen: a more advanced method of executing an external process.
  • +
+

Unlike execute_command_line which expects each command +argument to be split up, Ruby's execution methods can accept a single string containing the full command which +also allows IO redirections / pipe because it spawns a subshell.

+
system("ls -l #{OpenHAB::Core.config_folder} > #{OpenHAB::Core.config_folder / "misc" / "directory_listing.txt"}")
+
+# Get the remote Raspberry Pi's core temperature
+core_temperature = `ssh pi@192.168.1.20 vcgencmd measure_temp`
+logger.info "Raspberry Pi's core #{core_temperature}"
+
+# Reboot a remote Raspberry Pi
+pid = spawn("ssh pi@192.168.1.20 sudo reboot")
+Process.detach(pid)
+
+

#Gem Cleanup

+

The openHAB JRuby add-on will automatically download and install the latest version of the library according to the settings in jruby.cfg. +Over time, the older versions of the library will accumulate in the gem_home directory. +The following code saved as gem_cleanup.rb or another name of your choice can be placed in the automation/ruby directory to perform uninstallation of the older gem versions every time openHAB starts up.

+
require "rubygems/commands/uninstall_command"
+require "pathname"
+
+after(3.minutes) do
+  cmd = Gem::Commands::UninstallCommand.new
+
+  # uninstall all the older versions of the openhab-scripting gems
+  Gem::Specification.find_all
+                    .select { |gem| gem.name == "openhab-scripting" }
+                    .sort_by(&:version)
+                    .tap(&:pop) # don't include the latest version
+                    .each do |gem|
+    cmd.handle_options ["-x", "-I", gem.name, "--version", gem.version.to_s]
+    cmd.execute
+  end
+
+  # Delete gems in other ruby versions
+  next unless (gem_home = ENV.fetch("GEM_HOME", nil))
+
+  gem_home = Pathname.new(gem_home)
+  next unless gem_home.parent.basename.to_s == ".gem"
+
+  gem_home.parent.children.reject { |p| p == gem_home }.each(&:rmtree)
+end
+
+

#UI rules

+

#Reset the switch that triggered the rule after 5 seconds

+

Trigger defined as:

+
    +
  • When: a member of an item group receives a command
  • +
  • Group: Reset_5Seconds
  • +
  • Command: ON
  • +
+
logger.info("#{event.item.name} Triggered the rule")
+after 5.seconds do
+  event.item.off
+end
+
+

#Update a DateTime Item with the current time when a motion sensor is triggered

+

Given the following group and items:

+
Group MotionSensors
+Switch Sensor1 (MotionSensors)
+Switch Sensor2 (MotionSensors)
+
+DateTime Sensor1_LastMotion
+DateTime Sensor2_LastMotion
+
+

Trigger defined as:

+
    +
  • When: the state of a member of an item group is updated
  • +
  • Group: MotionSensors
  • +
  • State: ON
  • +
+
logger.info("#{event.item.name} Triggered")
+items["#{event.item_name}_LastMotion"].update Time.now
+
+

#Trigger a Scene with an ON OFF Switch

+

Use Scenes in combination with +Semantic Model

+

Trigger defined as:

+
    +
  • When: the state of a member of an item group is updated
  • +
  • Group: LightSwitches
  • +
+
# Find scenes for the specific room by matching the scene's tags against the
+# Location item name of the room, e.g. "BedRoom1", "Downstairs_BedRoom", etc.
+# This is when you have multiple locations/rooms with the same semantic location e.g. (Bedroom)
+scenes = rules.scenes.tagged(event.item.location.name)
+
+# If none were defined, try finding scenes assigned to the same semantic location as the motion sensor
+# You can have scenes for LivingRoom, LaundryRoom, Garage, etc. provided that they are unique
+scenes = rules.scenes.tagged(event.item.location.location_type) if scenes.empty?
+
+# the Active_Scene item can be set to the Scene tag that we wish to activate when motion is detected
+# e.g. ACTIVE/RELAXING/MOVIE/READING
+# To do nothing when motion was detected, just set the Active_Scene to blank so no scenes would match
+active_scene = event.state.on ? Active_Scene.state.to_s : "OFF" # Get the active scene name
+scenes.tagged(active_scene).each(&:trigger) # Execute the scenes
+
+
+ +
+ Generated on Sat Dec 14 15:06:34 2024 by + yard + 0.9.28 (ruby-3.1.3). +
+ +
+
+ + diff --git a/5.33/file.ruby-basics.html b/5.33/file.ruby-basics.html new file mode 100644 index 0000000000..cc984fb61a --- /dev/null +++ b/5.33/file.ruby-basics.html @@ -0,0 +1,3775 @@ + + + + + + + File: Ruby Basics + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

#Ruby Basics

+

The openHAB JRuby scripting automation is based on the JRuby implementation of the +Ruby language. This page offers a quick overview of Ruby to help you get started +writing rules. However, it is by no means comprehensive. A wealth of information can be found on +Ruby's web site.

+

#Data Types

+

In Ruby, everything is an object, even primitive types such as numbers and strings. For example, 1 as a number is an object +and has all the methods for the Integer class.

+

It is useful to get to know the basic data types that we will often encounter:

+
    +
  • Integer - e.g. 1, -3, etc.
  • +
  • Floating Point - e.g. 3.5
  • +
  • String - +String literals in Ruby can be enclosed with double quotes, or single quotes. Strings enclosed by double quotes can +contain variables and expressions that are enclosed with #{}. For example: "Hi my name is #{name_variable}". The String class offers a plethora of useful methods to operate on and manipulate strings.
  • +
  • Array - example: [1, 2, 'foo', AnotherObject]
  • +
  • Hash - example: { 'key1' => 'value', 'key2' => 'value' }
  • +
  • Symbol - example: :iamasymbol
  • +
  • Range - example: 1..5
  • +
+

#Variables

+
    +
  • In Ruby, variables start with a lower case and by convention use snake_case.
  • +
  • Uppercase identifiers are constants, e.g. NAMES
  • +
  • Variable whose names start with $ are global variables, e.g. $i_am_global.
  • +
  • Variable whose names start with @ are instance variables, e.g. @instance_variable. +Instance variables are similar to member variables or fields in other languages.
  • +
  • Local variables are just plain names that starts with a lower case, e.g. local_var.
  • +
+

#Examples

+

Instance variables are created as soon as they are referenced. +They are persisted on whatever self is. +In most simple file-based rules, and in UI based rules, self is simply a top level Object named main, and instance variables will be persisted between multiple executions of the same rule:

+
rule "light turned on" do
+  changed Light_Switch, to: ON
+  run do
+    @turned_on_count ||= 0
+    @turned_on_count += 1
+    logger.info("The light has been turned on #{@turned_on_count} times")
+  end
+end
+
+

#String Interpolation

+

String interpolation is done by enclosing a variable or an expression with #{ and } inside a double quoted string. +The variable doesn't have to be a string. Ruby will automatically call #to_s for you.

+

Although string concatenation with + is possible, using string interpolation is preferred.

+

An example of string interpolation is included above.

+

#Control Expressions

+

Ruby supports various control expressions such as if/else, ternary operator, case, etc.

+

Example:

+
if a
+  # do something here
+elsif b
+  # something else
+else 
+  # something here
+end
+
+# modifier if form
+a = b if c == 5
+
+# ternary operator
+a = b == 5 ? 'five' : 'other'
+
+# case/when similar to the switch() { case... } in c / java.
+rule 'x' do
+  received_command DimmerItem1
+  run do |event|
+    case event.command
+    when OFF
+      Light1.off
+      Light2.off
+    when 0...50
+      Light1.on
+      Light2.off
+    when 50..100, ON
+      Light1.on
+      Light2.on
+    end
+  end
+end
+
+

#Loops

+

While Ruby supports the traditional for and while loop, they are rarely used. +Ruby objects such as Array, Hash, Set, etc. provide a plethora of methods to +achieve the same thing in a more "Ruby" way.

+

#Examples

+
array = [1, 2, 3]
+array.each do |elem|
+  logger.info("Element: #{elem}")
+end
+
+array.each_with_index do |elem, index|
+  logger.info("Element #{index}: #{elem}")
+end
+
+SWITCH_TO_LIGHT_HASH = { Switch1 => Light1, Switch2 => Light2 }
+
+SWITCH_TO_LIGHT_HASH.each do |switch, light|
+  logger.info "#{switch.name} => #{light.name}"
+end
+
+rule 'turn light on' do
+  changed Switches.members
+  triggered do |item|
+    SWITCH_TO_LIGHT_HASH[item]&.command item.state
+  end
+end
+
+

Note: next is similar to continue in C/Java. break in Ruby is the same as in C/Java.

+

#Methods

+

Methods are defined like this:

+
def one_plus_one # It can also be defined as def one_plus_one()
+  1 + 1
+end
+
+

With parameters:

+
def one_plus(arg1) 
+  1 + arg1
+end
+
+

With a keyword argument:

+
def one_minus(another:)
+  1 - another
+end
+
+

Note the last value in a method execution becomes its return value, so a return keyword is optional.

+

To call a method:

+
# Calling a method without passing any arguments, no parentheses needed.
+one_plus_one
+# This works too:
+one_plus_one()
+
+# Calling a method with an argument:
+one_plus(2)
+# The parentheses can also be omitted here:
+one_plus 2
+
+# Calling a method with a keyword argument:
+one_minus(another: 1)
+# Guess what, the parentheses can also be omitted here:
+one_minus another: 1
+
+

#Blocks

+

Multi-line blocks in Ruby are enclosed in a do .. end pair and single line blocks are enclosed with braces { .. }. You have encountered blocks in the examples above. +Rules are implemented in a block:

+
rule 'rulename' do
+  ...
+end
+
+

The execution part is also in a block for the run method, nested inside the rule block:

+
rule 'rulename' do
+  changed Item1
+  run do 
+    ...
+  end
+end
+
+

#Block arguments

+

Blocks can receive arguments which are passed by its caller. We will often encounter this in run and triggered blocks.

+
rule 'name' do
+  changed Switches.members
+  run do |event|
+    # do something based on the event argument
+  end
+end
+
+

#Ruby's Safe Navigation Operator

+

Ruby has a safe navigation operator +&. which is similar to ?. in C#, Groovy, Kotlin, etc.

+
# Instead of:
+if items['My_Item']
+  items['My_Item'].on
+end
+
+# We can write it as:
+items['My_Item']&.on
+
+

#Some Gotchas

+

#Exiting early

+

To exit early from a block, use next instead of return.

+
rule 'rule name' do
+  changed Item1
+  run do 
+    next if Item1.off? # exit early
+
+    Item2.on # Turn on Item2 if Item1 turned on
+    # Do other things
+  end
+end
+
+

Note: To exit early from a UI rule, use return.

+

#Parentheses

+

In Ruby, parentheses are optional when calling a method. However, when calling a method with arguments and a single-line block, +the parentheses must be used. Example:

+
after(5.seconds) {  }
+
+after(5.seconds) do
+  # ...
+end
+
+after 5.seconds do
+  # parentheses aren't a must before a do..end block
+end
+
+# the following example will cause an error
+after 5.seconds { }
+
+

#Zero is "truthy" in Ruby

+
if 0
+  logger.info "This will always be executed"
+else
+  logger.info "This will never be executed"
+end
+
+

#Source Code Formatting

+

The ruby style guide offers the generally accepted standards for Ruby source code formatting.

+

When working with file based rules in a source code editor (e.g. VSCode), it is highly recommended to integrate +Rubocop (or rubocop-daemon) +as the source code formatter and linter for Ruby.

+

Happy coding!

+
+ +
+ Generated on Sat Dec 14 15:06:34 2024 by + yard + 0.9.28 (ruby-3.1.3). +
+ +
+
+ + diff --git a/5.33/file.testing.html b/5.33/file.testing.html new file mode 100644 index 0000000000..4067212d91 --- /dev/null +++ b/5.33/file.testing.html @@ -0,0 +1,3742 @@ + + + + + + + File: Testing Your Rules + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

#Testing

+

openhab-scripting includes framework classes to allow you to write unit tests +for your openHAB rules written in JRuby. It loads up a limited actual openHAB runtime +environment. Because it is a limited environment, with no actual bindings or things, +you may need to stub out those actions in your tests. The autoupdate manager is +running, so any commands sent to items that aren't marked as autoupdate="false" will +update automatically.

+

#Usage

+

You must run tests on a system with an actual openHAB instance installed, with your +configuration. JRuby >= 9.3.8.0 must also be installed.

+
    +
  • Install and activate JRuby (by your method of choice - chruby, rbenv, etc.).
  • +
  • Either create an empty directory, or use $OPENHAB_CONF itself (the former +is untested)
  • +
  • Create a Gemfile with the following contents (or add to an existing one):
  • +
+
source "https://rubygems.org"
+
+group(:test) do
+  gem "rspec", "~> 3.11"
+  gem "openhab-scripting", "~> 5.0"
+  gem "timecop"
+end
+
+group(:rules) do
+  # include any gems you reference from `gemfile` calls in your rules so that
+  # they'll already be available in the rules, and won't need to be
+  # re-installed on every run, slowing down spec runs considerably
+end
+
+
    +
  • Run gem install bundler
  • +
  • Run bundle install
  • +
  • Run bundle exec rspec --init
  • +
  • Edit the generated spec/spec_helper.rb to satisfy your preferences, and +add:
  • +
+
require "rubygems"
+require "bundler"
+
+Bundler.require(:default, :test)
+
+require "openhab/rspec"
+
+# if you have any automatic requires setup in jrubyscripting's config,
+# (besides `openhab`), you need to manually require them here
+
+
    +
  • Create some specs! An example of spec/switches_spec.rb:
  • +
+
RSpec.describe "switches.rb" do
+  describe "gFullOn" do
+    it "works" do
+      GuestDownlights_Dimmer.update(0)
+      GuestDownlights_Scene.update(1.3)
+      expect(GuestDownlights_Dimmer.state).to eq 100
+    end
+
+    it "sets some state" do
+      rules["my rule"].trigger
+      expect(GuestDownlights_Scene.state).to be_nil
+    end
+
+    it "triggers a rule expecting an event" do
+      rules["my rule 2"].trigger(Struct.new(:item).new(GuestDownlights_Scene))
+      expect(GuestDownlights_Scene.state).to be_nil
+    end
+  end
+end
+
+
    +
  • Run your specs: bundle exec rspec
  • +
+

#Spec Writing Tips

+
    +
  • By default ruby files are looked for in $OPENHAB_CONF/automation/ruby and in $OPENHAB_CONF/automation/jsr223. You can override and/or append to this by setting the openhab_automation_search_paths RSpec configuration setting in your spec_helper.rb. This can be useful to add staging directory for testing your rules.
  • +
+
RSpec.configure do |config|
+ config.openhab_automation_search_paths += "/my/staging/directory"
+end
+
+
    +
  • See OpenHAB::RSpec::Helpers for all helper methods available in specs.
  • +
  • All items are reset to NULL before each spec.
  • +
  • on_load triggers are not honored. Items will be reset to NULL before +the next spec anyway, so just don't waste the energy running them. You +can still trigger rules manually.
  • +
  • Rule triggers besides item related triggers (such as cron or watchers) +are not triggered. You can test them with trigger.
  • +
  • You can trigger channels directly with OpenHAB::RSpec::Helpers#trigger_channel.
  • +
  • Timers aren't triggered automatically. Use the OpenHAB::RSpec::Helpers#execute_timers +helper to execute any timers that are ready to run. The timecop gem is +automatically included, so use Timecop.travel(5.seconds) (for example) +to travel forward in time and have timers ready to execute. Note that this +includes implicit timers created by rules that use the for: feature.
  • +
  • Logging levels can be changed in your code. Setting a log level for a logger +further up the chain (separated by dots) applies to all loggers underneath +it.
  • +
+
OpenHAB::Log.logger("org.openhab.core.automation.internal.RuleEngineImpl").level = :debug
+OpenHAB::Log.gem_root.level = :debug
+OpenHAB::Log.root.level = :debug
+OpenHAB::Log.events.level = :info
+
+
    +
  • Differing from when openHAB loads rules, all rules are loaded into a single +JRuby execution context, so changes to globals in one file will affect other +files. In particular, this applies to ids for reentrant timers will now share +a single namespace among all files.
  • +
  • Some actions may not be available; you should stub them out if you use them. +Core actions like OpenHAB::Core::Actions#notify, OpenHAB::Core::Actions::Voice.say, +and OpenHAB::Core::Actions::Audio.play_sound are stubbed to only log a message +(at debug level).
  • +
  • You may want to avoid rules from firing while setting up the proper state for +a test. In that case, use the OpenHAB::RSpec::Helpers#suspend_rules helper.
  • +
  • Item persistence is enabled by default using an in-memory store that only +tracks changes to items.
  • +
  • The OpenHAB::RSpec::Helpers#install_addon helper can be used to install an +addon like binding-astro if you need to be able to create things from your +rules. Note that the addon isn't actually allowed to start, just be installed to +make type metadata from XML available.
  • +
  • If you have any Things in your openHAB instance that take two minutes to come +online due to missing type metadata, you can force them to initialize +immediately by calling OpenHAB::RSpec::Helpers#initialize_missing_thing_types.
  • +
  • You can add a binding.irb call in to a spec (or your rule file) to break +execution at that point and allow you to explore the current state of things +with a REPL.
  • +
+

#Configuration

+

There are a few environment variables you can set to help the gem find the +necessary dependencies. The default should work for an OpenHABian install +or installation on Ubuntu or Debian with .debs. You may need to customize them +if your installation is laid out differently. Additional openHAB or Karaf +specific system properties will be set the same as openHAB would.

+ + + + + + + + + + + + + + + + + + + + +
VariableDefaultDescription
$OPENHAB_HOME/usr/share/openhabLocation for the openHAB installation
$OPENHAB_RUNTIME$OPENHAB_HOME/runtimeLocation for openHAB's private Maven repository containing its JARs
+

#Transformations

+

Ruby transformations must have a magic comment # -*- mode: ruby -*- in them to be loaded. +Then they can be accessed as a method on OpenHAB::Transform based on the filename:

+
OpenHAB::Transform.compass("59 °")
+OpenHAB::Transform.compass("30", param: "7")
+OpenHAB::Transform::Ruby.compass("59 °")
+
+

They're loaded into a sub-JRuby engine, just like they run in openHAB.

+

#IRB

+

If you would like to use a REPL sandbox to play with your items, +create bin/console with the following contents, and then run it:

+
#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+require "bundler/setup"
+
+Bundler.require
+
+require "irb"
+
+begin
+  require "openhab/rspec"
+
+  autorequires
+  load_rules
+  load_transforms
+rescue => e
+  puts e.backtrace
+  raise
+end
+
+IRB.start(__FILE__)
+
+
+ +
+ Generated on Sat Dec 14 15:06:34 2024 by + yard + 0.9.28 (ruby-3.1.3). +
+ +
+
+ + diff --git a/5.33/index.html b/5.33/index.html new file mode 100644 index 0000000000..dc145352af --- /dev/null +++ b/5.33/index.html @@ -0,0 +1,4990 @@ + + + + + + + File: USAGE + + — openHAB JRuby + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+ +

#JRuby Scripting

+

This add-on provides JRuby scripting language for automation rules. +Also included is openhab-scripting, a fairly high-level Ruby gem to support automation in openHAB. +It provides native Ruby access to common openHAB functionality within rules including items, things, actions, logging and more. +If you're new to Ruby, you may want to check out Ruby Basics.

+ +

Additional example rules are available, as well as examples of conversions from DSL and Python rules.

+

#Why Ruby?

+
    +
  • Ruby is designed for programmers' productivity with the idea that programming should be fun for programmers.
  • +
  • Ruby emphasizes the necessity for software to be understood by humans first and computers second.
  • +
  • Ruby makes writing automation enjoyable without having to fight with compilers and interpreters.
  • +
  • Rich ecosystem of tools, including things like Rubocop to help developers write clean code and RSpec to test the libraries.
  • +
  • Ruby is really good at letting one express intent and create a DSL to make that expression easier.
  • +
+

#Design points

+
    +
  • Create an intuitive method of defining rules and automation +
      +
    • Rule language should "flow" in a way that you can read the rules out loud
    • +
    +
  • +
  • Abstract away complexities of openHAB
  • +
  • Enable all the power of Ruby and openHAB
  • +
  • Create a Frictionless experience for building automation
  • +
  • The common, yet tricky tasks are abstracted and made easy, e.g. creating a timer that automatically reschedules itself.
  • +
  • Tested + +
  • +
  • Extensible. +
      +
    • Anyone should be able to customize and add/remove core language features
    • +
    +
  • +
  • Easy access to the Ruby ecosystem in rules through Ruby gems.
  • +
+

#Installation

+

#Prerequisites

+
    +
  1. openHAB 3.4+
  2. +
  3. The JRuby Scripting Language Addon
  4. +
+

#From the User Interface

+
    +
  1. Go to Settings -> Add-ons -> Automation and install the jrubyscripting automation addon following the openHAB instructions. +In openHAB 4.0+ the defaults are set so the next step can be skipped.
  2. +
  3. Go to Settings -> Add-on Settings -> JRuby Scripting: +
      +
    • Ruby Gems: openhab-scripting=~>5.0
    • +
    • Require Scripts: openhab/dsl (not required, but recommended)
    • +
    +
  4. +
+

#Using Files

+
    +
  1. +

    Edit <OPENHAB_CONF>/services/addons.cfg and ensure that jrubyscripting is included in an uncommented automation= list of automations to install. +In openHAB 4.0+ the defaults are set so the next step can be skipped.

    +
  2. +
  3. +

    Configure JRuby openHAB services

    +

    Create a file called jruby.cfg in <OPENHAB_CONF>/services/ with the following content:

    +
    org.openhab.automation.jrubyscripting:gems=openhab-scripting=~>5.0
    +org.openhab.automation.jrubyscripting:require=openhab/dsl
    +
    +
  4. +
+

#Configuration

+

After installing this add-on, you will find configuration options in the openHAB portal under Settings -> Add-on Settings -> JRuby Scripting. +Alternatively, JRuby configuration parameters may be set by creating a jruby.cfg file in conf/services/.

+

By default this add-on includes the openhab-scripting Ruby gem and automatically requires it. +This allows the use of items, rules, shared_cache and other objects in your scripts. +This functionality can be disabled for users who prefer to manage their own gems and requires via the add-on configuration options. +Simply change the gems and require configuration settings.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterDescription
gem_homeThe path to store Ruby Gems. Default: $OPENHAB_CONF/automation/ruby/.gem/{RUBY_ENGINE_VERSION}
gemsA list of gems to install. Default: openhab-scripting=~>5.0
check_updateCheck for updated version of gems on start up or settings change. Default: true
requireList of scripts to be required automatically. Default: openhab/dsl
rubylibSearch path for user libraries. Default: $OPENHAB_CONF/automation/ruby/lib
dependency_trackingEnable dependency tracking. Default: true
local_contextSee notes below. Default: singlethread
local_variablesSee notes below. Default: transient
+

When using file-based configuration, these parameters must be prefixed with org.openhab.automation.jrubyscripting:, for example:

+
org.openhab.automation.jrubyscripting:gems=openhab-scripting=~>5.0
+org.openhab.automation.jrubyscripting:require=openhab/dsl
+
+

#gem_home

+

Path to where Ruby Gems will be installed to and loaded from. +The directory will be created if necessary. +You can use {RUBY_ENGINE_VERSION}, {RUBY_ENGINE} and/or {RUBY_VERSION} replacements in this value to automatically point to a new directory when the addon is updated with a new version of JRuby.

+

#gems

+

A comma separated list of Ruby Gems to install.

+

The default installs the version of the helper for this version of openHAB. +When overriding the default, be sure to still include the openhab-scripting gem in the list of gems to install.

+

Each gem can have version specifiers which uses pessimistic versioning. +Multiple version specifiers can be added by separating them with a semicolon.

+

Examples:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
gem settingDescription
openhab-scriptinginstall the latest version of openhab-scripting gem
openhab-scripting=~>5.0.0install the latest version 5.0.x but not 5.1.x
openhab-scripting=~>5.0install the latest version 5.x but not 6.x
openhab-scripting=~>5.0, faraday=~>2.7;>=2.7.4install openhab-scripting gem version 5.x and faraday gem version 2.7.4 or higher, but less than 3.0
gem1= >= 2.2.1; <= 2.2.5install gem1 gem version 2.2.1 or above, but less than or equal to version 2.2.5
+

#check_update

+

Check RubyGems for updates to the above gems when openHAB starts or JRuby settings are changed. +Otherwise it will try to fulfil the requirements with locally installed gems, and you can manage them yourself with an external Ruby by setting the same GEM_HOME.

+

#require

+

A comma separated list of script names to be required by the JRuby Scripting Engine at the beginning of user scripts. +The default is to require the helper library.

+

#rubylib

+

Search path for user libraries. +Separate each path with a colon (semicolon in Windows).

+

#dependency_tracking

+

Dependency tracking allows your scripts to automatically reload when one of its dependencies is updated. +You may want to disable dependency tracking if you plan on editing or updating a shared library, but don't want all your scripts to reload until you can test it.

+

#local_context

+

The local context holds Ruby runtime, name-value pairs for sharing variables between Java and Ruby. +Valid values are: singleton, threadsafe, singlethread, or concurrent. +See this for options and details.

+

#local_variables

+

Defines how variables are shared between Ruby and Java. +Valid values are: transient, persistent, or global. +See the JRuby documentation for options and details.

+

#Usage

+

#UI Based Scripts

+

The quickest way to add rules is through the openHAB Web UI.

+

Advanced users, or users migrating scripts from existing systems may want to use File Based Scripts for managing rules using files in the user configuration directory.

+

#Adding Triggers

+

Using the openHAB UI, first create a new rule and set a trigger condition.

+

openHAB Rule Configuration

+

#Adding Actions

+

Select "Add Action" and then select "Run Script" with "Ruby". +This will bring up an empty script editor where you can enter your JavaScript.

+

openHAB Rule Engines

+

You can now write rules using standard Ruby along with the included openHAB library.

+

openHAB Rule Script

+

For example, turning a light on:

+
KitchenLight.on
+logger.info("Kitchen Light State: #{KitchenLight.state}")
+
+

Sending a notification:

+
Notification.send("romeo@montague.org", "Balcony door is open")
+
+

Querying the status of a thing:

+
logger.info("Thing status: #{things["zwave:serial_zstick:512"].status}")"
+
+

Theoretically you could even use a system start trigger with a UI rule, and then use the syntax mostly developed for file based rules to create multiple rules.

+

#File Based Scripts

+

The JRuby Scripting addon will load scripts from automation/ruby in the user configuration directory. +The system will automatically reload scripts when changes are detected to files. +Local variable state is not persisted among reloads, see using the cache for a convenient way to persist objects. +See File Based Rules for examples of creating rules within your scripts.

+

#Event Object

+

When you use "Item event" as trigger (i.e. "[item] received a command", "[item] was updated", "[item] changed"), there is additional context available for the action in a variable called event.

+

This tables gives an overview of the event object for most common trigger types. +For full details, explore OpenHAB::Core::Events.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Property NameTypeTrigger TypesDescriptionRules DSL Equivalent
stateState or nil[item] changed, [item] was updatedState that triggered eventtriggeringItem.state
wasState or nil[item] changedPrevious state of Item or Group that triggered eventpreviousState
commandCommand[item] received a commandCommand that triggered eventreceivedCommand
itemItemAll item related triggersItem that triggered eventtriggeringItem
groupGroupItemMember of [group] changed, Member of [group] was updated, Member of [group] received a commandGroup whose member triggered the eventtriggeringGroup
+
logger.info(event.state == ON)
+
+
event.item
+
+

Get the Triggering Item's Name:

+
event.item.name
+
+

Get the Triggering Item's Label:

+
event.item.label
+
+

Get the Triggering Item's State:

+
event.state # this version retrieves the item's state when the event was generated
+
+

or

+
event.item.state # this version will re-query the item for its state
+
+
if event.item.state == ON
+  # do something
+end
+# or (preferable)
+if event.item.on?
+  # do something
+end
+
+

Get the Triggering Item's Previous State:

+
event.was
+
+
if event.was.on?
+  # do something
+end
+
+

Compare Triggering Item's State Against Previous State:

+
event.state > event.was
+
+

Get the Received Command:

+
event.command
+
+
if event.command.on?
+  # do something
+end
+
+

#Library Details

+

The openHAB JRuby Scripting runtime attempts to provide a familiar environment to Ruby developers.

+

#Items

+

The items object allows interactions with openHAB items. +However, most items can be referred to directly by name:

+
My_Item
+gWindowBlinds
+
+

Items can be retrieved dynamically:

+
the_item = items['My_Item'] # This returns an Item object, not just its state
+# For all intents and purposes, the_item variable is the same as My_Item in the previous example
+
+

Get the Item's Name as a String:

+
My_Item.name
+
+

Get the Item's Label:

+
My_Item.label
+
+

Get a Related Item:

+
my_light_item = items[My_Switch.name.sub('_Switch', '_Light')]
+
+

#Groups

+

Groups are regular items, but can also contain other items.

+
# direct members
+gTest.members
+
+# direct members and all their descendents
+gTest.all_members
+
+

Group members work like a Ruby array +so you can use & for intersection, | for union, and - for difference.

+
curtains_in_family_room = gFamilyRoom.members & gCurtains.members
+
+

You can iterate over group members with Ruby's ubiquitous #each method:

+
gTest.members.each do |item|
+  # process item
+end
+
+# Iterate over all members, including members of members
+gTest.all_members.each do |item|
+  # process item
+end
+
+

Group members are also Enumerable, so can use any of tthose included methods:

+
members_that_are_on = gTest.members.select(&:on?)
+
+# exclude state
+members_that_are_not_on = gTest.members.reject(&:on?)
+
+# Filter with code:
+high_temperatures = gTemperatures.members.select(&:state?).select { |item| item.state > 30 | '°C' }
+
+

See also Accessing elements in a Ruby array.

+

Get a sorted list of Group members matching a condition:

+
sorted_items_by_battery_level = gBattery.members
+                                        .select(&:state?) # only include non NULL / UNDEF members
+                                        .select { |item| item.state < 20 } # select only those with low battery
+                                        .sort_by(&:state)
+
+

Get a list of values mapped from the members of a group:

+
battery_levels = gBattery.select(&:state?) # only include non NULL / UNDEF members
+                         .sort_by(&:state)
+                         .map { |item| "#{item.label}: #{item.state}" } # Use item state default formatting
+
+

Perform arithmetic on values from members of a group:

+
weekly_rainfall = gRainWeeklyForecast.members.sum(&:state)
+
+

#Commands

+

These three variants do the same thing:

+
My_Item.on
+My_Item.command ON
+My_Item << ON
+
+

Note: all possible commands are supported on the corresponding item types, e.g. on, off, up, down, play, pause, stop, etc. +For more details, see the individual item classes under OpenHAB::Core::Items.

+
#Sending Commands to an Item Only When Its State is Different
+
My_Item.ensure.on
+My_Item.ensure.command ON
+My_Item.ensure << ON
+
+# ensure causes the command to return nil if the item is already in the same state
+logger.info("Turning off the light") if My_Item.ensure.off
+
+

See ensure_states, ensure_states!, +ensure.

+
#Timed Commands
+

A Timed Command is similar to the openHAB Item's expire parameter but it offers more flexibility. +It removes the need to manually create a timer. +The command is sent to the item, then after the duration has elapsed, reverted. +It also handles automatically canceling the timer if the item changes states before it reverts.

+
My_Switch.on for: 5.minutes
+
+

#Updates

+

Post an update to an item:

+
My_Switch.update ON
+
+

#State

+

The Item's state is accessible through Item#state:

+
if My_Item.state == ON
+  # do something
+end
+
+# This syntax is equivalent and preferred:
+if My_Item.on?
+  # do something
+end
+
+if Indoor_Temperature.state > 20 | '°C' || Indoor_Temperature.state > Outdoor_Temperature.state
+  # do something
+end
+
+

Note: Boolean helper methods are available depending on the item / state type. +For example up?, down?, closed?, open?, etc.

+

Check if an Item's state is NULL of UNDEF:

+
if My_Item.state?
+  logger.info 'My_Item is not NULL nor UNDEF'
+end
+
+
#Comparing Item's State
+
String_Item.state == 'test string'
+Number_Item.state > 5.3
+items['Number_Item'].state == 10
+
+# Compare Quantity Types
+Temperature_Item.state > 24 | '°C'
+Indoor_Temperature.state > Outdoor_Temperature.state
+Indoor_Temperature.state > Outdoor_Temperature.state + 5 | '°C'
+Indoor_Temperature.state - Outdoor_Temperature.state > 5 | '°C'
+
+

See unit block

+
#Range checking
+

Types that are comparable, such as StringType, DateTimeType, DecimalType, PercentType, include Ruby's Comparable module which provides the handy between? method.

+
String_Item.update("Freddy")
+String_Item.state.between?("E", "G") # => true
+
+Number_Item.update(10)
+if Number_Item.state.between?(5, 20)
+  logger.info "Number_Item falls within the expected range"
+end
+
+Temperature_Item.update(16 | "°C")
+Temperature_Item.state.between?(20 | "°C", 24 | "°C") # => false
+
+

Alternatively, a Ruby range can be used. +This can be handy for excluding the end of the range with the ... operator.

+
if (5..10).cover?(Number_Item.state)
+  logger.info "Number_Item is in the expected range"
+end
+
+((20|"°C")..(24|"°C")).cover?(Temperature_Item.state)
+
+
#Loose Type Comparisons
+

Some openHAB item types can accept different command types. +For example, a DimmerItem can accept a command with an OnOffType, IncreaseDecreaseType or a PercentType. +However, ultimately an item only stores its state in its native type, e.g. a DimmerItems's native type is PercentType. +In some contexts, you don't care about the precise value of a particular state, and just want to know if it fits the general definition of ON, etc. +You can either explicitly convert to the general type, or all of the state predicate methods available on Item, ItemStateEvent, ItemStateChangedEvent, ItemCommandEvent, as well as specific types such as PercentType and HSBType, will do the conversion internally.

+
DimmerItem1.update(10)
+sleep 1
+DimmerItem1.state == 10 # => true
+DimmerItem1.state == ON # => false
+DimmerItem1.state.as(OnOffType) == ON # => true
+DimmerItem1.state.on? # => true
+DimmerItem1.on? # => true
+DimmerItem1.off? # => false
+
+rule 'command' do
+  received_command DimmerItem1
+  run do |event|
+    if event.on?
+      # This will be executed even when the command is a positive PercentType
+      # instead of an actual ON command
+      logger.info("DimmerItem1 is being turned on")
+    end
+  end
+end
+
+DimmerItem1 << 100 # => This will trigger the logger.info above
+
+

#Metadata

+

Metadata is accessed through Item#metadata.

+
metadata = My_Item.metadata['namespace'].value
+
+

#Persistence

+

Persistence methods are available directly on Items.

+
logger.info("KitchenDimmer average_since #{KitchenDimmer.average_since(1.day.ago)}")
+daily_max = My_Item.maximum_since(24.hours.ago)
+
+

#Semantic Model

+

Many helper methods are available to make it easy to navigate the semantic model to get related items.

+
LivingRoom_Motion.location                            # Location of the motion sensor
+                 .equipments(Semantics::Lightbulb)    # Get all Lightbulb Equipments in the location
+                 .members                             # Get all the member items of the equipments
+                 .points(Semantics::Switch)           # Select only items that are Switch Points
+                 .on                                  # Send an ON command to the items
+
+

#Linked Things

+

If an Item is linked to a Thing, you can easily retrieve it.

+
linked_thing = My_Item.thing
+thing_uid = My_Item.thing.uid
+
+

An item can be linked to multiple things:

+
My_Item.things.each do |thing|
+  logger.info("Thing: #{thing.uid}")
+end
+
+

#Item Builder

+

New items can be created via items.build. +Note that by default items are not persisted to storage, and will be removed when the script unloads.

+
items.build do
+  switch_item MySwitch, "My Switch"
+  switch_item NotAutoupdating, autoupdate: false, channel: "mqtt:topic:1#light"
+  group_item MyGroup do
+    contact_item ItemInGroup, channel: "binding:thing#channel"
+  end
+  # passing `thing` to a group item will automatically use it as the base
+  # for item channels
+  group_item Equipment, tags: Semantics::HVAC, thing: "binding:thing"
+    string_item Mode, tags: Semantics::Control, channel: "mode"
+  end
+
+  # dimension Temperature inferred
+  number_item OutdoorTemp, format: "%.1f %unit%", unit: "°F"
+    
+  # unit lx, dimension Illuminance, format "%s %unit%" inferred
+  number_item OutdoorBrightness, state: 10_000 | "lx"
+end
+
+

#Things

+

The things object allows interactions with openHAB things.

+

Get Thing Status:

+
things['lgwebos:WebOSTV:main-tv'].status
+
+

Check if Thing is Online:

+
things['lgwebos:WebOSTV:main-tv'].online?
+
+

or

+
things['lgwebos:WebOSTV:main-tv'].status == ThingStatus::ONLINE
+
+

Enable/Disable a Thing:

+
thing = things['lgwebos:WebOSTV:main-tv']
+
+thing.disable
+logger.info "TV enabled: #{thing.enabled?}"
+
+thing.enable
+logger.info "TV enabled: #{thing.enabled?}"
+
+

Get Thing's configurations:

+
server = things["smtp:mail:local"].configuration["hostname"]
+logger.info "Configured SMTP Server: #{server}"
+
+frontporch_cam_ip = things["ipcamera:dahua:frontporch"].configuration["ipAddress"]
+logger.info "Front Porch Camera's IP Address: #{frontporch_cam_ip}"
+
+

Get Thing's property:

+
model_id = things["fronius:meter:mybridge:mymeter"].properties["modelId"]
+logger.info "Fronius Smart Meter model: #{model_id}"
+
+

#Actions

+

openHAB built-in actions are available as children of the Actions module. +Action classes are also imported into the top-level namespace. +Thing actions can be called directly on the Thing.

+

Publish an MQTT Message:

+
things['mqtt:broker:mybroker'].publish_mqtt('topic/name', 'payload')
+
+

Send an Email:

+
things['mail:smtp:mymailthing'].send_mail('me@example.com', 'Subject', 'message body')
+
+

Play Sound Through the Default Audio Sink:

+
Audio.play_sound 'sound_file.mp3'
+
+

Execute a Command:

+
Exec.execute_command_line('/path/to/program')
+
+

#Logging

+

The JRuby Scripting addon has a global logger object for logging. +To log a message on INFO log level:

+
logger.info("The current time is #{Time.now}")
+
+

The main logger prefix is org.openhab.automation.jrubyscripting. +The default logger name for UI rules includes the rule ID: org.openhab.automation.jrubyscripting.script.<RULE_ID>. +The logger name for file-based rules includes the rule's filename and the rule ID: org.openhab.automation.jrubyscripting.<filename>.rule.<RULE_ID>.

+

To use a custom logger name:

+
logger = OpenHAB::Log.logger("org.openhab.custom")
+
+

Please be aware that messages might not appear in the logs if the logger name does not start with org.openhab. +This behavior is due to log4j2 requiring definition for each logger prefix.

+

The logger is similar to a standard Ruby Logger. +Supported logging functions include:

+
    +
  • logger.log(severity, obj)
  • +
  • logger.info(obj)
  • +
  • logger.warn(obj)
  • +
  • logger.error(obj)
  • +
  • logger.debug(obj)
  • +
  • logger.trace(obj)
  • +
+

obj is any Ruby (or Java) object. +#to_s (or toString() if it's a Java object) is called on obj, and the result is output to the openHAB log. +Additionally, all of these methods can take a Ruby block instead, which will only be called if logging is enabled at the given level, and the result of the block will be treated as the log message.

+

#Timers

+
sleep 1.5 # sleep for 1.5 seconds
+
+

See Ruby docs on sleep.

+

sleep should be avoided if possible. +A delay can be inserted in between two execution blocks to achieve the same result. +This delay is implemented with a timer. +This is available only on file-based rules.

+
rule "delay something" do
+  on_load
+  run { logger.info "This will run immediately" }
+  delay 10.seconds
+  run { logger.info "This will run 10 seconds after" }
+end
+
+

Alternatively a timer can be used in either a file-based rule or in a UI based rule using after. +After takes a Duration relative to now, e.g. 10.minutes, or an absolute time with ZonedDateTime or Time.

+
rule "simple timer" do
+  changed Watering_System, to: ON
+  run do
+    after(5.minutes) { Watering_System.off }
+  end
+end
+
+

When a script is unloaded, all created timers are automatically cancelled.

+

#Accessing Variables

+

You can access all variables of the current context in the created timers.

+

Note: Variables can be mutated (changed) after the timer has been created. +Be aware that this can lead to unintentional side effects, e.g. when you change the variable after timer creation, which can make debugging quite difficult!

+
my_var = "Hello world!";
+
+# Schedule a timer that expires in ten seconds
+after(10.seconds) do
+  logger.info("Timer expired with my_var = '#{my_var}'")
+end
+
+my_var = "Hello mutation!" # When the timer runs, it will log "Hello mutation!" instead of "Hello world!"
+
+

#Reschedule a Timer

+

A timer can be rescheduled inside the timer body

+
after(3.minutes) do |timer|
+  My_Light.on
+  timer.reschedule # This will reschedule it for the same initial duration, i.e. 3 minutes in this case
+end
+
+

Or it can be rescheduled from outside the timer

+
my_timer = after(3.minutes) do
+  My_Light.on
+end
+
+my_timer.reschedule # Use the same initial duration
+
+

It can be rescheduled to a different duration

+
after(3.minutes) do |timer|
+  My_Light.on
+  timer.reschedule(1.minute)
+end
+
+

It can also be canceled:

+
rule 'cancel timer' do
+  changed Light_Item, to: OFF
+  run { my_timer&.cancel }
+end
+
+

#Manage Multiple Timers

+

Multiple timers can be managed in the traditional way by storing the timer objects in a Hash:

+
@timers ||= {}
+
+if @timers[event.item]
+  @timers[event.item].reschedule
+else
+  @timers[event.item] = after 3.minutes do # Use the triggering item as the timer ID
+    event.item.off
+    @timers.delete(event.item)
+  end
+end
+
+

However, a built in mechanism is available to help manage multiple timers, and is done in a thread-safe manner. +This is done using timer IDs. +The following rule automatically finds and reschedules the timer matching the same ID, which corresponds to each group member.

+
after 3.minutes, id: event.item do # Use the triggering item as the timer ID
+  event.item.off
+end
+
+

Furthermore, you can manipulate the managed timers using the built-in timers object.

+
# timers is a special object to access the timers created with an id
+rule "cancel all timers" do
+  received_command Cancel_All_Timers, command: ON # Send a command to this item to cancel all timers
+  run do
+    gOutdoorLights.members.each do |item_as_timer_id|
+      timers.cancel(item_as_timer_id)
+    end
+  end
+end
+
+rule "reschedule all timers" do
+  received_command Reschedule_All_Timers, command: ON # Send a command to this item to restart all timers
+  run do
+    gOutdoorLights.members.each do |item_as_timer_id|
+      timers.reschedule(item_as_timer_id)
+    end
+  end
+end
+
+

#Cache

+

The shared_cache object provides a cache that can be used to set and retrieve objects that will be persisted between reloads of scripts, and available between different rules. +It acts similarly to a regular Ruby Hash. +Just be wary of Ruby-only data types (such as Symbols) that won't be accessible between different scripts.

+

Get a previously set object with a default value:

+
shared_cache.compute_if_absent(:counter) { 0 } # Initialize with 0 if it didn't exist
+logger.info("Count: #{shared_cache[:counter] += 1}")
+
+

Get a previously set object, or assign it (this version is subject to race conditions with other scripts):

+
shared_cache[:counter] ||= 0
+logger.info("Count: #{shared_cache[:counter] += 1}")
+
+

Get a previously set object with a default value, without assigning it (this version has an even longer amount of time between fetching the value and assigning it):

+
count = shared_cache.fetch(:counter) { 0 }
+shared_cache[:counter] = count + 1
+
+

#Time

+

Several options are available for time related code, including but not limited to:

+
    +
  • Java LocalDate - represents a date with no time
  • +
  • Java LocalTime - represents a time with no date
  • +
  • Java Month
  • +
  • Java MonthDay - represents a date with no time or year
  • +
  • Java ZonedDateTime - represents a specific instance with a date and time
  • +
  • Java Duration
  • +
  • Java Period
  • +
  • Ruby Date - represents a date with no time
  • +
  • Ruby Time - represents a specific instant with a date and time
  • +
  • Ruby DateTime - represents a specific instant with a date and time
  • +
+

#Durations

+

Ruby integers and floats are extended with several methods to support durations. +These methods create a new Duration or Period object that is used by the every trigger, delay block, the for option of changed triggers, and timers.

+
rule "run every 30 seconds" do
+  every 30.seconds
+  run { logger.info("Hello") }
+end
+
+
rule "Warn about open door" do
+  changed FrontDoor, to: OPEN, for: 10.minutes
+  run { |event| logger.info("#{event.item.name} has been open for 10 minutes") }
+end
+
+
rule "Timer example" do
+  on_load
+  run do
+    after(3.hours) { logger.info("3 hours have passed") }
+  end
+end
+
+

#Time Comparisons, Conversions, and Arithmetic

+

Comparisons, conversions and arithmetic are automatic between Java and Ruby types. +Note that anytime you do a comparison between a type with more specific data, and a type missing specific data, the comparison is done as if the more specific data is at the beginning of its period. +I.e. comparing a time to a month, the month will be treated as 00:00:00 on the first day of the month. +When comparing with a type that's missing more generic data, it will be filled in from the other object. +I.e. comparing a time to a month, the month will be assumed to be in the same year as the time.

+
# Get current date/time
+now = ZonedDateTime.now
+one_hour_from_now = ZonedDateTime.now + 60.minutes
+one_hour_from_now = 1.hour.from_now # or use the simpler helper method that also returns a ZonedDateTime
+# Or use Ruby time
+ruby_now = Time.now
+
+# Compare them
+if one_hour_from_now > now
+  logger.info "As it should be"
+end
+
+# Comparing Ruby Time and ZonedDateTime works just fine
+if one_hour_from_now > ruby_now
+  logger.info "It works too"
+end
+
+if Time.now > LocalTime.parse('7am')
+  logger.info 'Wake up!'
+end
+
+if MonthDay.now == MonthDay.parse('02-14')
+  logger.info "Happy Valentine's Day!"
+end
+
+# Ranges can cross midnight
+if Time.now.between?('10pm'..'5am')
+  logger.info 'Sleep time'
+end
+
+# Explicit conversions
+ZonedDateTime.now.to_time
+Time.now.to_zoned_date_time
+
+# You can parse string as time
+wake_up_time = LocalTime.parse("6:00 am")
+
+# Compare now against LocalTime
+if ZonedDateTime.now >= wake_up_time
+  Wake_Up_Alarm.on
+end
+
+# Even compare against Ruby Time
+if Time.now >= wake_up_time
+  Wake_Up_Alarm.on
+end
+
+# Get today's start of the day (midnight)
+start_of_day = ZonedDateTime.now.with(LocalTime::MIDNIGHT)
+# or
+start_of_day = LocalTime::MIDNIGHT.to_zoned_date_time
+
+# Comparing ZonedDateTime against LocalTime with `<`
+max = Solar_Power.maximum_since(24.hours.ago)
+if max.timestamp < LocalTime::NOON
+  logger.info "Max solar power #{max} happened before noon, at: #{max.timestamp}"
+end
+
+# Comparing Time against ZonedDateTime with `>`
+sunset = things["astro:sun:home"].get_event_time("SUN_SET", nil, nil)
+if Time.now > sunset
+  logger.info "it is after sunset"
+end
+
+# Subtracting Duration from Time and comparing Time against ZonedDateTime
+Motion_Sensor.last_update < Time.now - 10.minutes
+# Alternatively:
+Motion_Sensor.last_update < 10.minutes.ago
+
+# Finding The Duration Between Two Times
+elapsed_time = Time.now - Motion_Sensor.last_update
+# Alternatively:
+elapsed_time = ZonedDateTime.now - Motion_Sensor.last_update
+
+# Using `-` operator with ZonedDateTime
+# Comparing two ZonedDateTime using `<`
+Motion_Sensor.last_update < Light_Item.last_update - 10.minutes
+# is the same as:
+Motion_Sensor.last_update.before?(Light_Item.last_update.minus_minutes(10))
+
+# Getting Epoch Second
+Time.now.to_i
+ZonedDateTime.now.to_i
+ZonedDateTime.now.to_epoch_second
+
+# Convert Epoch second to time
+Time.at(1669684403)
+
+# Convert Epoch second to ZonedDateTime
+Time.at(1669684403).to_zoned_date_time
+# or
+java.time.Instant.of_epoch_second(1669684403).at_zone(ZoneId.system_default)
+
+

#Ranges

+

Ranges of date time objects work as expected. +Make sure to use #cover? instead of #include? to do a simple comparison, instead of generating an array and searching it linearly. +Ranges of non-absolute, "circular" types (LocalTime, Month, MonthDay) are smart enough to automatically handle boundary issues. +Coarse types (like LocalDate, Month, MonthDay) will also work correctly when checking against a more specific type. +To easily parse strings into date-time ranges, use the OpenHAB::DSL.between helper. +Duration, ZonedDateTime, LocalTime, LocalDate, MonthDay, Month, Time, Date, and DateTime classes include between? method that accepts a range of string or any of the date/time objects.

+
between("10:00".."14:00").cover?(Time.now)
+between("11pm".."1am").cover?(Time.now)
+
+# Or use the alternative syntax:
+Time.now.between?("10:00".."14:00")
+Time.now.between?("11pm".."1am")
+
+case Time.now
+when between("6:00"..."12:00")
+  logger.info("Morning Time")
+when between('12:00'..'15:00')
+  logger.info("Afternoon")
+else
+  logger.info("Not in time range")
+end
+
+# Compare against Month
+Time.now.between?(Month::NOVEMBER..Month::DECEMBER)
+Date.today.between?(Month::NOVEMBER..Month::DECEMBER)
+ZonedDateTime.now.between?(Month::NOVEMBER..Month::DECEMBER)
+
+# Compare against MonthDay
+Time.now.between?("05-01".."12-01")
+
+# Compare against time of day
+Time.now.between?("5am".."11pm")
+
+

#Ephemeris

+

Helper methods to easily access openHAB's Ephemeris action are provided on all date-like objects:

+
Time.now.holiday? # => false
+MonthDay.parse("12-25").holiday # => :christmas
+1.day.from_now.next_holiday # => :thanksgiving
+Notification.send("It's #{Ephemeris.holiday_name(Date.today)}!") if Date.today.holiday?
+
+Date.today.weekend? # => true
+Date.today.in_dayset?(:school) # => false
+
+

#Rules, Scripts, and Scenes

+

Rules, Scenes and Scripts can be accessed using the rules object. +For example, to execute/trigger a rule:

+
rules[rule_uid].trigger
+
+

Scenes are rules with a Scene tag, and Scripts are rules with a Script tag. +They can be found using their uid just like normal rules, i.e. rules[uid]. +For convenience, a list of all Scenes are available through the enumerable rules.scenes, and a list of all Scripts through rules.scripts.

+

Example: All scenes tagged sunrise will be triggered at sunrise, and all scenes tagged sunset will be triggered at sunset. +Note: these use the Terse Rule syntax.

+
channel("astro:sun:home:rise#event") { rules.scenes.tagged("sunrise").each(&:trigger) }
+channel("astro:sun:home:set#event") { rules.scenes.tagged("sunset").each(&:trigger) }
+
+

Or it can be written as one rule with the help of trigger attachments.

+
rule "Activate scenes at sunset/sunrise" do
+  channel "astro:sun:home:rise#event", attach: "sunrise"
+  channel "astro:sun:home:set#event", attach: "sunset"
+  run { |event| rules.scenes.tagged(event.attachment).each(&:trigger) }
+end
+
+

Get the UID of a Rule

+
rule_obj = rule 'my rule name' do
+  received_command My_Item
+  run do
+    # rule code here
+  end
+end
+
+rule_uid = rule_obj.uid
+
+

A rule's UID can also be specified at rule creation

+
rule "my rule name", id: "my_unique_rule_uid" do
+  # ...
+end
+
+# or
+rule "my rule name" do
+  uid "my_unique_rule_uid"
+  # ...
+end
+
+

Get the UID of a Rule by Name

+
rule_uid = rules.find { |rule| rule.name == 'This is the name of my rule' }.uid
+
+

Enable or Disable a Rule by UID

+
rules[rule_uid].enable
+rules[rule_uid].disable
+
+

#Passing Values to Rules

+

A rule/script may be given additional context/data by the caller. +This additional data is available within the rule by referring to the names of the context variable. +This is applicable to both UI rules and file-based rules.

+

Within the script/rule body (either UI or file rule)

+
script id: "check_temp" do
+  if CPU_Temperature.state > maxTemperature
+    logger.warn "The CPU is overheating!"
+  end
+end
+
+

The above script can be executed, passing it the maxTemperature argument from any supported scripting language, e.g.:

+
rules["check_temp"].trigger(maxTemperature: 80 | "°C")
+
+

#Gems

+

Bundler is integrated, enabling any Ruby gem compatible with JRuby to be used within rules. +This permits easy access to the vast ecosystem of libraries within the Ruby community. +Gems are available using the inline bundler syntax. +The require statement can be omitted.

+
gemfile do
+  source 'https://rubygems.org'
+  gem 'json', require: false
+  gem 'nap', '1.1.0', require: 'rest'
+end
+
+logger.info("The nap gem is at version #{REST::VERSION}")
+
+

#Shared Code

+

If you would like to easily share code among multiple scripts, you can place it in <OPENHAB_CONF>/automation/ruby/lib. +You can then simply require the file from your rules files. +Files located in $RUBYLIB won't be automatically loaded individually by openHAB, only when you require them.

+

automation/ruby/myrule.rb OR a UI Rule's script:

+
require "my_lib"
+
+logger.info(my_lib_version)
+
+

automation/ruby/lib/my_lib.rb

+
def my_lib_version
+  "1.0"
+end
+
+

#Transformations

+

#Using openHAB Transformations

+

Existing openHAB transformations can also be used by calling the transform method. +This enables the use of any transformations from the /transform folder or managed through the UI, such as MAP, JSONPATH, Jinja Transformation, etc.

+
# Convert OPEN/CLOSED to Online/Offline using availability.map
+# OPEN=Online
+# CLOSED=OFFLINE
+logger.info transform(:map, "availability.map", LivingRoom_Switch_Availability.state)
+
+

#Writing Custom Transformations in Ruby

+

This add-on also provides the necessary infrastructure to use Ruby for writing transformations.

+

The main value to be transformed is given to the script in a variable called input. +Note that the values are passed to the transformation as Strings even for numeric items and data types.

+

Note: In openHAB 3.4, due to an issue in the current version of JRuby, you will need to begin your script with input ||= nil (and a ||= nil etc. for additional query variables) so that JRuby will recognize the variables as variables--rather than method calls--when it's parsing the script. +Otherwise you will get errors like (NameError) undefined local variable or method 'input' for main:Object. +This is not necessary in openHAB 4.0+.

+

#File Based Transformations

+

Once the addon is installed, you can create a Ruby file in the $OPENHAB_CONF/transform directory, with the extension .rb. +When referencing the file, you need to specify the RB transform: RB(mytransform.rb):%s.

+

You can also specify additional variables to be set in the script using a URI-like query syntax: RB(mytransform.rb?a=1&b=c):%s in order to share a single script with slightly different parameters for different items.

+
#Example: Display the wind direction in degrees and cardinal direction
+

weather.items

+
Number:Angle Exterior_WindDirection "Wind Direction [RB(compass.rb):%s]" <wind>
+
+

compass.rb

+
DIRECTIONS = %w[N NE E SE S SW W NW N].freeze
+
+if input.nil? || input == "NULL" || input == "UNDEF"
+  "-"
+else
+  cardinal = DIRECTIONS[(input.to_f / 45).round]
+  "#{cardinal} (#{input.to_f.round}°)"
+end
+
+

Given a state of 82 °, this will produce a formatted state of E (82°).

+
#Example: Display the number of lights that are on/off within a group
+
Group gIndoorLights "Indoor Lights [RB(group_count.rb?group=gIndoorLights):%s]"
+Group gOutdoorLights "Outdoor Lights [RB(group_count.rb?group=gOutdoorLights):%s]"
+
+

group_count.rb

+
items[group].all_members.then { |all| "#{all.select(&:on?).size}/#{all.size}" }
+
+

When 3 lights out of 10 lights are on, this will produce a formatted state of 3/10

+

#Inline Transformations

+

Inline transformations are supported too. +For example, to display the temperature in both °C and °F:

+
Number:Temperature Outside_Temperature "Outside Temperature [RB(|  input.to_f.|('°C').then { |t| %(#{t.format('%d °C')} / #{t.to_unit('°F').format('%d °F')}) }   ):%s]"
+
+

When the item contains 0 °C, this will produce a formatted state of 0 °C / 32 °F.

+

#Profile

+

You can create an openHAB profile in JRuby that can be applied to item channel links. +For more details, see #profile.

+

#Sitemaps

+

Sitemaps can be created via sitemaps.build.

+
sitemaps.build do
+  sitemap "default", "My Residence" do
+    frame label: "Control" do
+      text label: "Climate", icon: "if:mdi:home-thermometer-outline" do
+        frame label: "Main Floor" do
+          text item: MainFloor_AmbTemp
+          switch item: MainFloorThermostat_TargetMode, label: "Mode", mappings: %w[off auto cool heat]
+          setpoint item: MainFloorThermostat_SetPoint, label: "Set Point", visibility: "MainFloorThermostat_TargetMode!=off"
+        end
+        frame label: "Basement" do
+          text item: Basement_AmbTemp
+          switch item: BasementThermostat_TargetMode, label: "Mode", mappings: { OFF: "off", COOL: "cool", HEAT: "heat" }
+          setpoint item: BasementThermostat_SetPoint, label: "Set Point", visibility: "BasementThermostat_TargetMode!=off"
+        end
+      end
+    end
+  end
+end
+
+

#File Based Rules

+

#Basic Rule Structure

+

See OpenHAB::DSL::Rules::Builder for full details.

+
rule "name" do
+  <one or more triggers>
+  <one or more execution blocks>
+  <zero or more guards or conditions>
+end
+
+

Jump to: Rule Triggers, Rule Executions, Rule Conditions

+

#Rule Triggers

+

#Item or Thing Changed

+
rule "Log (or notify) when the secret door is open" do
+  changed SecretDoor, to: OPEN
+  run { |event| logger.info("#{event.item} is opened") }
+end
+
+
rule "Log when Fronius Inverter goes offline" do
+  changed things["fronius:bridge:mybridge"], from: :online, to: :offline
+  run { |event| logger.info("Thing #{event.uid} went #{event.status}!") }
+end
+
+

See #changed

+
#Detecting Change Duration
+

Only execute a rule when an item state changed and stayed the same for a period of time. +This method can only be done using a file-based rule.

+
rule "Garage Door Alert" do
+  changed GarageDoor, to: OPEN, for: 20.minutes
+  run { Voice.say "The garage door has been open for 20 minutes!" }
+end
+
+

#Item Updated

+
rule "Calculate" do
+  updated Camera_Event_Data
+  run do |event|
+    logger.info "Camera event: #{event.state}"
+  end
+end
+
+

See #updated

+

#Item Received a Command

+
rule "Received a command" do
+  received_command DoorBell, command: ON
+  run do |event|
+    Notification.send "Someone pressed the door bell"
+    play_sound "doorbell.mp3"
+  end
+end
+
+

See #received_command

+

#Member-of-Group Trigger

+

Add .members to the GroupItem in order to trigger on its members.

+
rule "Trigger by Member of" do
+  changed gGroupName.members
+  run do |event|
+    logger.info "Triggered item: #{event.item.name}"
+  end
+end
+
+

#Script is Loaded

+
rule "initialize things" do
+  on_load # This triggers whenever the script (re)loads
+  run { logger.info "Here we go!" }
+end
+
+

See #on_load

+

#openHAB System Started

+
rule "System startup rule" do
+  on_start at_level: 80
+  run { logger.info "I'm glad to be alive!" }
+end
+
+

See #on_start

+

#Cron Trigger

+

Traditional cron trigger:

+
rule "cron rule" do
+  cron "0 0,15 15-19 L * ?""
+  run { logger.info "Cron run" }
+end
+
+

Or an easier syntax:

+
rule "cron rule" do
+  cron second: 0, minute: "0,15", hour: "15-19", dom: "L"
+  run { logger.info "Cron run" }
+end
+
+

See #cron

+
#every Trigger
+
rule "run every day" do
+  every :day, at: "2:35pm"
+  run { Amazon_Echo_TTS << "It's time to pick up the kids!" }
+end
+
+
rule "run every 5 mins" do
+  every 5.minutes
+  run { logger.info "openHAB is awesome" }
+end
+
+
rule "Anniversary Reminder" do
+  every "10-15" # This takes a MM-DD syntax to trigger on 15th of October at midnight
+  run do
+    things["mail:smtp:mymailthing"].send_mail("me@example.com", "Anniversary Reminder!", "Today is your anniversary!")
+  end
+end
+
+

See #every

+

#DateTimeItem Trigger

+

To trigger based on the date and time stored in a DateTime item, use at ItemName:

+
rule "DateTime Trigger" do
+  at My_DateTimeItem
+  run do |event|
+    logger.info "Triggered by #{event.item} at #{event.item.state}"
+  end
+end
+
+

To trigger based on only the time part of a DateTime item, use every :day, at: ItemName:

+
rule "TimeOnly Trigger" do
+  every :day, at: My_DateTimeItem
+  run do |event|
+    logger.info "Triggered by #{event.item} at #{event.item.state}"
+  end
+end
+
+

#Other Triggers

+

There are more triggers supported by this library. +See the full list of supported triggers.

+

#Combining Multiple Triggers

+
rule "multiple triggers" do
+  changed Switch1, to: ON
+  changed Switch2, to: ON
+  run { |event| logger.info "Switch: #{event.item.name} changed to: #{event.state}" }
+end
+
+

When the trigger conditions are the same, the triggers can be combined.

+
rule "multiple triggers" do
+  changed Switch1, Switch2, to: ON
+  run { |event| logger.info "Switch: #{event.item.name} changed to: #{event.state}" }
+end
+
+

#Combining Multiple Conditions

+
rule "multiple conditions" do
+  changed Button_Action, to: ["single", "double"]
+  run { |event| logger.info "Action: #{event.state}" }
+end
+
+

#Rule Conditions

+
rule "motion sensor" do
+  updated Motion_Sensor, to: ON
+  only_if { Sensor_Enable.on? } # Run rule only if Sensor_Enable item is ON
+  not_if { Sun_Elevation.positive? } # and not while the sun is up
+  run { LightItem.on }
+end
+
+

Restrict Rule Executions to Certain Time of Day:

+
rule "doorbell" do
+  updated DoorBell_Button, to: "single"
+  between "6am".."8:30pm"
+  run { play_sound "doorbell_chime.mp3" }
+end
+
+

See Rule Guards

+

#Rule Executions

+

Execution blocks are executed when a rule is triggered and all the rule conditions are met. +Multiple execution blocks can be specified. +This can be useful especially when using a delay execution block inbetween two run or triggered blocks.

+

#Run Execution Block

+

A run execution block is the most commonly used execution block. +It provides the full event object to the block.

+
rule "Rule with a run block" do
+  received_command SwitchItem1
+  run do |event|
+    logger.info "#{event.item} received this command: #{event.command}"
+  end
+end
+
+

#Triggered Execution Block

+

A triggered execution block passes the TriggeringItem object directly to the block. +It is handy when combined with Ruby's pretzel-colon operator to act directly on the object.

+
rule "Limit the duration of TV watching" do
+  changed gTVPower.members, to: ON, for: 2.hours
+  triggered(&:off)
+end
+
+

#Delay Execution Block

+

A delay exection block is useful for adding a delay inbetween rule executions or even at the beginning of the trigger event without having to manually create a timer. +Unlike sleep, a delay block does not block the current executing thread. +It actually sets a timer for you behind the scenes.

+
rule "Check for offline things 15 minutes after openHAB had started" do
+  on_start
+  delay 15.minutes
+  run do
+    offline_things = things.select(&:offline?).map(&:uid).join(", ")
+    Notification.send("Things that are still offline: #{offline_things}")
+  end
+end
+
+

See Execution Blocks

+

#Terse Rules

+

A rule with a trigger and an execution block can be created with just one line.

+
received_command(My_Switch, command: ON) { My_Light.on }
+
+

See Terse Rules for full details.

+

#Early Exit From a Rule

+

You can use next within a file-based rule, because it's in a block:

+
rule "doorbell" do
+  updated DoorBell_Button, to: "single"
+  run do
+    next unless Time.now.between?("6am".."8:30pm")
+
+    play_sound "doorbell_chime.mp3"
+  end
+end
+
+
+

Use return within a UI rule:

+
return unless Time.now.between?("6am".."8:30pm")
+
+play_sound "doorbell_chime.mp3"
+
+

#Dynamic Generation of Rules

+

The rule definition itself is just Ruby code, which means you can use code to generate your rules. +Take care when doing this as the the items/groups are processed when the rules file is processed, meaning that new items/groups will not automatically generate new rules.

+
rule "Log whenever a Virtual Switch Changes" do
+  items.grep(SwitchItem)
+       .select { |item| item.label&.include?("Virtual") }
+       .each do |item|
+         changed item
+       end
+
+  run { |event| logger.info "#{event.item.name} changed from #{event.was} to #{event.state}" }
+end
+
+

This rule is effectively the same:

+
virtual_switches = items.grep(SwitchItem)
+                        .select { |item| item.label&.include?("Virtual") }
+
+rule "Log whenever a Virtual Switch Changes 2" do
+  changed(*virtual_switches)
+  run { |event| logger.info "#{event.item.name} changed from #{event.was} to #{event.state} 2" }
+end
+
+

This will accomplish the same thing, but create a new rule for each virtual switch:

+
virtual_switches = items.grep(SwitchItem)
+                        .select { |item| item.label&.include?("Virtual") }
+
+virtual_switches.each do |switch|
+  rule "Log whenever a #{switch.label} Changes" do
+    changed switch
+    run { |event| logger.info "#{event.item.name} changed from #{event.was} to #{event.state} 2" }
+  end
+end
+
+

#Scenes and Scripts

+

A scene can be created using the .scene method.

+
scene "Movie", id: "movie", description: "Set up the theatre for movie watching" do
+  Theatre_Window_Blinds.down
+  Theatre_Screen_Curtain.up
+  Theatre_Mood_Light.on
+  Theatre_Light.off
+  Theatre_Projector.on
+  Theatre_Receiver.on
+end
+
+

To create a script, use the .script method. +Note that scripts can be executed with additional contexts.

+

#Hooks

+

File based scripts can also register hooks that will be called when the script has completed loading (script_loaded) and when it gets unloaded (script_unloaded).

+
x = 1
+
+script_loaded do
+  logger.info("script loaded!")
+  logger.info(x) # this will log 2, since it won't execute until the entire script loads.
+end
+
+x = 2
+
+script_unloaded do
+  logger.info("script unloaded")
+end
+
+

#Calling Java From JRuby

+

JRuby can access almost any Java object that's available in the current JVM. +This is how the library is implemented internally.

+
# you can `java_import` classes and interfaces, which will become Ruby constants
+java_import java.time.format.DateTimeFormatter
+
+formatter = DateTimeFormatter.of_pattern("yyyy MM dd")
+
+# or you can just reference them directly to avoid polluting the global namespace
+formatter = java.time.format.DateTimeFormatter.of_pattern("yyyy MM dd")
+
+

#Full Documentation

+

Visit https://openhab.github.io/openhab-jruby/ for the full documentation of the openHAB JRuby Helper Library.

+
+ +
+ Generated on Sat Dec 14 15:06:33 2024 by + yard + 0.9.28 (ruby-3.1.3). +
+ +
+
+ + diff --git a/5.33/index.json b/5.33/index.json new file mode 100644 index 0000000000..0222827069 --- /dev/null +++ b/5.33/index.json @@ -0,0 +1 @@ +{"classes":[{"u":"OpenHAB.html","n":"OpenHAB","c":[{"u":"OpenHAB/DSL.html","n":"DSL","c":[{"u":"OpenHAB/DSL/Rules.html","n":"Rules","c":[{"u":"OpenHAB/DSL/Rules/Terse.html","n":"Terse"},{"u":"OpenHAB/DSL/Rules/Builder.html","n":"Builder","s":"Object"},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html","n":"BuilderDSL","s":"Object"}]},{"u":"OpenHAB/DSL/Events.html","n":"Events","c":[{"u":"OpenHAB/DSL/Events/WatchEvent.html","n":"WatchEvent","s":"Struct"}]},{"u":"OpenHAB/DSL/Debouncer.html","n":"Debouncer","s":"Object"},{"u":"OpenHAB/DSL/Items.html","n":"Items","c":[{"u":"OpenHAB/DSL/Items/Ensure.html","n":"Ensure","c":[{"u":"OpenHAB/DSL/Items/Ensure/Ensurable.html","n":"Ensurable"},{"u":"OpenHAB/DSL/Items/Ensure/Item.html","n":"Item"}]},{"u":"OpenHAB/DSL/Items/Builder.html","n":"Builder"},{"u":"OpenHAB/DSL/Items/ItemBuilder.html","n":"ItemBuilder","s":"Object"},{"u":"OpenHAB/DSL/Items/GroupItemBuilder.html","n":"GroupItemBuilder","s":"ItemBuilder"},{"u":"OpenHAB/DSL/Items/TimedCommand.html","n":"TimedCommand","c":[{"u":"OpenHAB/DSL/Items/TimedCommand/TimedCommandDetails.html","n":"TimedCommandDetails","s":"Struct"}]}]},{"u":"OpenHAB/DSL/TimerManager.html","n":"TimerManager","s":"Object"},{"u":"OpenHAB/DSL/Things.html","n":"Things","c":[{"u":"OpenHAB/DSL/Things/Builder.html","n":"Builder","s":"Object"},{"u":"OpenHAB/DSL/Things/ThingBuilder.html","n":"ThingBuilder","s":"Object"},{"u":"OpenHAB/DSL/Things/BridgeBuilder.html","n":"BridgeBuilder","s":"ThingBuilder"},{"u":"OpenHAB/DSL/Things/ChannelBuilder.html","n":"ChannelBuilder","s":"Object"}]},{"u":"OpenHAB/DSL/Sitemaps.html","n":"Sitemaps","c":[{"u":"OpenHAB/DSL/Sitemaps/Builder.html","n":"Builder","s":"Object"},{"u":"OpenHAB/DSL/Sitemaps/WidgetBuilder.html","n":"WidgetBuilder","s":"Object"},{"u":"OpenHAB/DSL/Sitemaps/SwitchBuilder.html","n":"SwitchBuilder","s":"WidgetBuilder"},{"u":"OpenHAB/DSL/Sitemaps/SelectionBuilder.html","n":"SelectionBuilder","s":"SwitchBuilder"},{"u":"OpenHAB/DSL/Sitemaps/SetpointBuilder.html","n":"SetpointBuilder","s":"WidgetBuilder"},{"u":"OpenHAB/DSL/Sitemaps/SliderBuilder.html","n":"SliderBuilder","s":"SetpointBuilder"},{"u":"OpenHAB/DSL/Sitemaps/VideoBuilder.html","n":"VideoBuilder","s":"WidgetBuilder"},{"u":"OpenHAB/DSL/Sitemaps/ChartBuilder.html","n":"ChartBuilder","s":"WidgetBuilder"},{"u":"OpenHAB/DSL/Sitemaps/DefaultBuilder.html","n":"DefaultBuilder","s":"WidgetBuilder"},{"u":"OpenHAB/DSL/Sitemaps/WebviewBuilder.html","n":"WebviewBuilder","s":"DefaultBuilder"},{"u":"OpenHAB/DSL/Sitemaps/ColorpickerBuilder.html","n":"ColorpickerBuilder","s":"WidgetBuilder"},{"u":"OpenHAB/DSL/Sitemaps/ColortemperaturepickerBuilder.html","n":"ColortemperaturepickerBuilder","s":"WidgetBuilder"},{"u":"OpenHAB/DSL/Sitemaps/MapviewBuilder.html","n":"MapviewBuilder","s":"DefaultBuilder"},{"u":"OpenHAB/DSL/Sitemaps/InputBuilder.html","n":"InputBuilder","s":"WidgetBuilder"},{"u":"OpenHAB/DSL/Sitemaps/ButtonBuilder.html","n":"ButtonBuilder","s":"WidgetBuilder"},{"u":"OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html","n":"LinkableWidgetBuilder","s":"WidgetBuilder"},{"u":"OpenHAB/DSL/Sitemaps/TextBuilder.html","n":"TextBuilder","s":"LinkableWidgetBuilder"},{"u":"OpenHAB/DSL/Sitemaps/GroupBuilder.html","n":"GroupBuilder","s":"LinkableWidgetBuilder"},{"u":"OpenHAB/DSL/Sitemaps/ImageBuilder.html","n":"ImageBuilder","s":"LinkableWidgetBuilder"},{"u":"OpenHAB/DSL/Sitemaps/FrameBuilder.html","n":"FrameBuilder","s":"LinkableWidgetBuilder"},{"u":"OpenHAB/DSL/Sitemaps/ButtongridBuilder.html","n":"ButtongridBuilder","s":"LinkableWidgetBuilder","c":[{"u":"OpenHAB/DSL/Sitemaps/ButtongridBuilder/Buttongrid.html","n":"Buttongrid"}]},{"u":"OpenHAB/DSL/Sitemaps/SitemapBuilder.html","n":"SitemapBuilder","s":"LinkableWidgetBuilder"}]},{"u":"OpenHAB/DSL/ConfigDescription.html","n":"ConfigDescription","c":[{"u":"OpenHAB/DSL/ConfigDescription/Builder.html","n":"Builder","s":"Object"}]}]},{"u":"OpenHAB/Log.html","n":"Log"},{"u":"OpenHAB/Logger.html","n":"Logger","s":"Object"},{"u":"OpenHAB/Core.html","n":"Core","c":[{"u":"OpenHAB/Core/DTO.html","n":"DTO","c":[{"u":"OpenHAB/Core/DTO/AbstractThingDTO.html","n":"AbstractThingDTO","s":"Object"},{"u":"OpenHAB/Core/DTO/ItemChannelLinkDTO.html","n":"ItemChannelLinkDTO","s":"Object"}]},{"u":"OpenHAB/Core/Items.html","n":"Items","c":[{"u":"OpenHAB/Core/Items/Item.html","n":"Item"},{"u":"OpenHAB/Core/Items/Metadata.html","n":"Metadata","c":[{"u":"OpenHAB/Core/Items/Metadata/Hash.html","n":"Hash","s":"Object"},{"u":"OpenHAB/Core/Items/Metadata/Provider.html","n":"Provider","s":"Provider"},{"u":"OpenHAB/Core/Items/Metadata/NamespaceHash.html","n":"NamespaceHash","s":"Object"}]},{"u":"OpenHAB/Core/Items/Provider.html","n":"Provider","s":"Provider"},{"u":"OpenHAB/Core/Items/Registry.html","n":"Registry","s":"Object"},{"u":"OpenHAB/Core/Items/CallItem.html","n":"CallItem","s":"GenericItem"},{"u":"OpenHAB/Core/Items/Semantics.html","n":"Semantics","c":[{"u":"OpenHAB/Core/Items/Semantics/Provider.html","n":"Provider","s":"Provider"},{"u":"OpenHAB/Core/Items/Semantics/SemanticTag.html","n":"SemanticTag"},{"u":"OpenHAB/Core/Items/Semantics/TagClassMethods.html","n":"TagClassMethods"}]},{"u":"OpenHAB/Core/Items/ColorItem.html","n":"ColorItem","s":"DimmerItem"},{"u":"OpenHAB/Core/Items/GroupItem.html","n":"GroupItem","s":"GenericItem","c":[{"u":"OpenHAB/Core/Items/GroupItem/Members.html","n":"Members","s":"Object"}]},{"u":"OpenHAB/Core/Items/ImageItem.html","n":"ImageItem","s":"GenericItem"},{"u":"OpenHAB/Core/Items/DimmerItem.html","n":"DimmerItem","s":"SwitchItem"},{"u":"OpenHAB/Core/Items/NumberItem.html","n":"NumberItem","s":"GenericItem"},{"u":"OpenHAB/Core/Items/Persistence.html","n":"Persistence","c":[{"u":"OpenHAB/Core/Items/Persistence/PersistedState.html","n":"PersistedState","s":"SimpleDelegator"}]},{"u":"OpenHAB/Core/Items/PlayerItem.html","n":"PlayerItem","s":"GenericItem"},{"u":"OpenHAB/Core/Items/StringItem.html","n":"StringItem","s":"GenericItem"},{"u":"OpenHAB/Core/Items/SwitchItem.html","n":"SwitchItem","s":"GenericItem"},{"u":"OpenHAB/Core/Items/ContactItem.html","n":"ContactItem","s":"GenericItem"},{"u":"OpenHAB/Core/Items/GenericItem.html","n":"GenericItem","s":"Object"},{"u":"OpenHAB/Core/Items/NumericItem.html","n":"NumericItem"},{"u":"OpenHAB/Core/Items/LocationItem.html","n":"LocationItem","s":"GenericItem"},{"u":"OpenHAB/Core/Items/StateStorage.html","n":"StateStorage","s":"SimpleDelegator"},{"u":"OpenHAB/Core/Items/DateTimeItem.html","n":"DateTimeItem","s":"GenericItem"},{"u":"OpenHAB/Core/Items/GroupFunction.html","n":"GroupFunction"},{"u":"OpenHAB/Core/Items/ItemChannelLinks.html","n":"ItemChannelLinks","s":"SimpleDelegator"},{"u":"OpenHAB/Core/Items/RollershutterItem.html","n":"RollershutterItem","s":"GenericItem"}]},{"u":"OpenHAB/Core/Rules.html","n":"Rules","c":[{"u":"OpenHAB/Core/Rules/Rule.html","n":"Rule"},{"u":"OpenHAB/Core/Rules/Provider.html","n":"Provider","s":"Provider"},{"u":"OpenHAB/Core/Rules/Registry.html","n":"Registry","s":"Object"},{"u":"OpenHAB/Core/Rules/TaggedArray.html","n":"TaggedArray","s":"Object"}]},{"u":"OpenHAB/Core/Timer.html","n":"Timer","s":"Object"},{"u":"OpenHAB/Core/Types.html","n":"Types","c":[{"u":"OpenHAB/Core/Types/Type.html","n":"Type"},{"u":"OpenHAB/Core/Types/Command.html","n":"Command"},{"u":"OpenHAB/Core/Types/State.html","n":"State"},{"u":"OpenHAB/Core/Types/HSBType.html","n":"HSBType","s":"PercentType"},{"u":"OpenHAB/Core/Types/RawType.html","n":"RawType","s":"Object"},{"u":"OpenHAB/Core/Types/PointType.html","n":"PointType","s":"Object"},{"u":"OpenHAB/Core/Types/OnOffType.html","n":"OnOffType","s":"Object"},{"u":"OpenHAB/Core/Types/StringType.html","n":"StringType","s":"Object"},{"u":"OpenHAB/Core/Types/TimeSeries.html","n":"TimeSeries","s":"Object"},{"u":"OpenHAB/Core/Types/UnDefType.html","n":"UnDefType","s":"Object"},{"u":"OpenHAB/Core/Types/DecimalType.html","n":"DecimalType","s":"Object"},{"u":"OpenHAB/Core/Types/NumericType.html","n":"NumericType"},{"u":"OpenHAB/Core/Types/PercentType.html","n":"PercentType","s":"DecimalType"},{"u":"OpenHAB/Core/Types/RefreshType.html","n":"RefreshType","s":"Object"},{"u":"OpenHAB/Core/Types/UpDownType.html","n":"UpDownType","s":"Object"},{"u":"OpenHAB/Core/Types/QuantityType.html","n":"QuantityType","s":"Object"},{"u":"OpenHAB/Core/Types/DateTimeType.html","n":"DateTimeType","s":"Object"},{"u":"OpenHAB/Core/Types/StopMoveType.html","n":"StopMoveType","s":"Object"},{"u":"OpenHAB/Core/Types/PlayPauseType.html","n":"PlayPauseType","s":"Object"},{"u":"OpenHAB/Core/Types/OpenClosedType.html","n":"OpenClosedType","s":"Object"},{"u":"OpenHAB/Core/Types/StringListType.html","n":"StringListType","s":"Object"},{"u":"OpenHAB/Core/Types/NextPreviousType.html","n":"NextPreviousType","s":"Object"},{"u":"OpenHAB/Core/Types/IncreaseDecreaseType.html","n":"IncreaseDecreaseType","s":"Object"},{"u":"OpenHAB/Core/Types/RewindFastforwardType.html","n":"RewindFastforwardType","s":"Object"}]},{"u":"OpenHAB/Core/Events.html","n":"Events","c":[{"u":"OpenHAB/Core/Events/ItemEvent.html","n":"ItemEvent","s":"AbstractEvent"},{"u":"OpenHAB/Core/Events/TimerEvent.html","n":"TimerEvent","s":"AbstractEvent"},{"u":"OpenHAB/Core/Events/AbstractEvent.html","n":"AbstractEvent","s":"Object"},{"u":"OpenHAB/Core/Events/ItemState.html","n":"ItemState"},{"u":"OpenHAB/Core/Events/ItemStateEvent.html","n":"ItemStateEvent","s":"ItemEvent"},{"u":"OpenHAB/Core/Events/StartlevelEvent.html","n":"StartlevelEvent","s":"AbstractEvent"},{"u":"OpenHAB/Core/Events/ItemCommandEvent.html","n":"ItemCommandEvent","s":"ItemEvent"},{"u":"OpenHAB/Core/Events/ChannelTriggeredEvent.html","n":"ChannelTriggeredEvent","s":"AbstractEvent"},{"u":"OpenHAB/Core/Events/ThingStatusInfoChangedEvent.html","n":"ThingStatusInfoChangedEvent","s":"AbstractEvent"},{"u":"OpenHAB/Core/Events/ThingStatusInfoEvent.html","n":"ThingStatusInfoEvent","s":"AbstractEvent"},{"u":"OpenHAB/Core/Events/ItemStateChangedEvent.html","n":"ItemStateChangedEvent","s":"ItemEvent"},{"u":"OpenHAB/Core/Events/ItemStateUpdatedEvent.html","n":"ItemStateUpdatedEvent","s":"ItemEvent"},{"u":"OpenHAB/Core/Events/AbstractItemRegistryEvent.html","n":"AbstractItemRegistryEvent","s":"AbstractEvent"},{"u":"OpenHAB/Core/Events/ItemAddedEvent.html","n":"ItemAddedEvent","s":"AbstractItemRegistryEvent"},{"u":"OpenHAB/Core/Events/ItemUpdatedEvent.html","n":"ItemUpdatedEvent","s":"AbstractItemRegistryEvent"},{"u":"OpenHAB/Core/Events/ItemRemovedEvent.html","n":"ItemRemovedEvent","s":"AbstractItemRegistryEvent"},{"u":"OpenHAB/Core/Events/AbstractThingRegistryEvent.html","n":"AbstractThingRegistryEvent","s":"AbstractEvent"},{"u":"OpenHAB/Core/Events/ThingAddedEvent.html","n":"ThingAddedEvent","s":"AbstractThingRegistryEvent"},{"u":"OpenHAB/Core/Events/ThingUpdatedEvent.html","n":"ThingUpdatedEvent","s":"AbstractThingRegistryEvent"},{"u":"OpenHAB/Core/Events/ThingRemovedEvent.html","n":"ThingRemovedEvent","s":"AbstractThingRegistryEvent"},{"u":"OpenHAB/Core/Events/ItemTimeSeriesUpdatedEvent.html","n":"ItemTimeSeriesUpdatedEvent","s":"ItemEvent"},{"u":"OpenHAB/Core/Events/AbstractItemChannelLinkRegistryEvent.html","n":"AbstractItemChannelLinkRegistryEvent","s":"AbstractEvent"},{"u":"OpenHAB/Core/Events/ItemChannelLinkAddedEvent.html","n":"ItemChannelLinkAddedEvent","s":"AbstractItemChannelLinkRegistryEvent"},{"u":"OpenHAB/Core/Events/ItemChannelLinkRemovedEvent.html","n":"ItemChannelLinkRemovedEvent","s":"AbstractItemChannelLinkRegistryEvent"}]},{"u":"OpenHAB/Core/Things.html","n":"Things","c":[{"u":"OpenHAB/Core/Things/UID.html","n":"UID","s":"AbstractUID"},{"u":"OpenHAB/Core/Things/Thing.html","n":"Thing","c":[{"u":"OpenHAB/Core/Things/Thing/ChannelsArray.html","n":"ChannelsArray","s":"Array"}]},{"u":"OpenHAB/Core/Things/Channel.html","n":"Channel","s":"Object"},{"u":"OpenHAB/Core/Things/Provider.html","n":"Provider","s":"Provider"},{"u":"OpenHAB/Core/Things/Registry.html","n":"Registry","s":"Object"},{"u":"OpenHAB/Core/Things/ThingUID.html","n":"ThingUID","s":"UID"},{"u":"OpenHAB/Core/Things/ThingType.html","n":"ThingType","s":"AbstractDescriptionType"},{"u":"OpenHAB/Core/Things/ChannelUID.html","n":"ChannelUID","s":"UID"},{"u":"OpenHAB/Core/Things/ChannelType.html","n":"ChannelType","s":"AbstractDescriptionType"},{"u":"OpenHAB/Core/Things/Links.html","n":"Links","c":[{"u":"OpenHAB/Core/Things/Links/Provider.html","n":"Provider","s":"Provider"}]},{"u":"OpenHAB/Core/Things/ThingTypeUID.html","n":"ThingTypeUID","s":"UID"},{"u":"OpenHAB/Core/Things/ChannelTypeUID.html","n":"ChannelTypeUID","s":"UID"},{"u":"OpenHAB/Core/Things/ProfileCallback.html","n":"ProfileCallback"},{"u":"OpenHAB/Core/Things/ChannelGroupUID.html","n":"ChannelGroupUID","s":"UID"},{"u":"OpenHAB/Core/Things/ItemChannelLink.html","n":"ItemChannelLink","s":"Object"},{"u":"OpenHAB/Core/Things/ChannelDefinition.html","n":"ChannelDefinition","s":"Object"},{"u":"OpenHAB/Core/Things/ChannelGroupType.html","n":"ChannelGroupType","s":"AbstractDescriptionType"},{"u":"OpenHAB/Core/Things/ChannelGroupTypeUID.html","n":"ChannelGroupTypeUID","s":"UID"},{"u":"OpenHAB/Core/Things/ChannelGroupDefinition.html","n":"ChannelGroupDefinition","s":"Object"},{"u":"OpenHAB/Core/Things/AbstractDescriptionType.html","n":"AbstractDescriptionType","s":"Object"}]},{"u":"OpenHAB/Core/Actions.html","n":"Actions","c":[{"u":"OpenHAB/Core/Actions/Exec.html","n":"Exec","s":"Object"},{"u":"OpenHAB/Core/Actions/HTTP.html","n":"HTTP","s":"Object"},{"u":"OpenHAB/Core/Actions/Ping.html","n":"Ping","s":"Object"},{"u":"OpenHAB/Core/Actions/Audio.html","n":"Audio","s":"Object"},{"u":"OpenHAB/Core/Actions/Voice.html","n":"Voice","s":"Object"},{"u":"OpenHAB/Core/Actions/Ephemeris.html","n":"Ephemeris","s":"Object"},{"u":"OpenHAB/Core/Actions/Notification.html","n":"Notification","s":"Object"},{"u":"OpenHAB/Core/Actions/Transformation.html","n":"Transformation","s":"Object"}]},{"u":"OpenHAB/Core/Provider.html","n":"Provider","s":"org.openhab.core.common.registry.AbstractProvider"},{"u":"OpenHAB/Core/Registry.html","n":"Registry","s":"Object"},{"u":"OpenHAB/Core/LazyArray.html","n":"LazyArray"},{"u":"OpenHAB/Core/ValueCache.html","n":"ValueCache"},{"u":"OpenHAB/Core/AbstractUID.html","n":"AbstractUID","s":"Object"},{"u":"OpenHAB/Core/EmulateHash.html","n":"EmulateHash"},{"u":"OpenHAB/Core/Configuration.html","n":"Configuration","s":"Object"},{"u":"OpenHAB/Core/EntityLookup.html","n":"EntityLookup"},{"u":"OpenHAB/Core/ScriptHandling.html","n":"ScriptHandling"},{"u":"OpenHAB/Core/Sitemaps.html","n":"Sitemaps","c":[{"u":"OpenHAB/Core/Sitemaps/Provider.html","n":"Provider","s":"Provider"}]}]},{"u":"OpenHAB/OSGi.html","n":"OSGi"},{"u":"OpenHAB/CoreExt.html","n":"CoreExt","c":[{"u":"OpenHAB/CoreExt/Java.html","n":"Java","c":[{"u":"OpenHAB/CoreExt/Java/Time.html","n":"Time"},{"u":"OpenHAB/CoreExt/Java/Class.html","n":"Class","s":"Object"},{"u":"OpenHAB/CoreExt/Java/Month.html","n":"Month","s":"Object"},{"u":"OpenHAB/CoreExt/Java/Period.html","n":"Period","s":"Object"},{"u":"OpenHAB/CoreExt/Java/Instant.html","n":"Instant","s":"java.lang.Object"},{"u":"OpenHAB/CoreExt/Java/Duration.html","n":"Duration","s":"Object"},{"u":"OpenHAB/CoreExt/Java/MonthDay.html","n":"MonthDay","s":"Object"},{"u":"OpenHAB/CoreExt/Java/LocalDate.html","n":"LocalDate","s":"Object"},{"u":"OpenHAB/CoreExt/Java/LocalTime.html","n":"LocalTime","s":"Object"},{"u":"OpenHAB/CoreExt/Java/TemporalAmount.html","n":"TemporalAmount"},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html","n":"ZonedDateTime","s":"Object"}]},{"u":"OpenHAB/CoreExt/Ruby.html","n":"Ruby","c":[{"u":"OpenHAB/CoreExt/Ruby/Range.html","n":"Range"},{"u":"OpenHAB/CoreExt/Ruby/QuantityTypeConversion.html","n":"QuantityTypeConversion"},{"u":"OpenHAB/CoreExt/Ruby/Numeric.html","n":"Numeric"}]},{"u":"OpenHAB/CoreExt/Between.html","n":"Between"},{"u":"OpenHAB/CoreExt/Ephemeris.html","n":"Ephemeris"}]},{"u":"OpenHAB/RSpec.html","n":"RSpec","c":[{"u":"OpenHAB/RSpec/Helpers.html","n":"Helpers"},{"u":"OpenHAB/RSpec/Configuration.html","n":"Configuration"},{"u":"OpenHAB/RSpec/ExampleGroup.html","n":"ExampleGroup","c":[{"u":"OpenHAB/RSpec/ExampleGroup/ClassMethods.html","n":"ClassMethods"}]}]},{"u":"OpenHAB/Transform.html","n":"Transform"}]},{"u":"Numeric.html","n":"Numeric","s":"Object"},{"u":"Range.html","n":"Range","s":"Object"},{"u":"Date.html","n":"Date","s":"Object"},{"u":"Time.html","n":"Time","s":"Object"},{"u":"Array.html","n":"Array","s":"Object"},{"u":"Module.html","n":"Module","s":"Object"},{"u":"Symbol.html","n":"Symbol","s":"Object"},{"u":"Integer.html","n":"Integer","s":"Object"},{"u":"Float.html","n":"Float","s":"Object"},{"u":"DateTime.html","n":"DateTime","s":"Date"},{"u":"Enumerable.html","n":"Enumerable"}],"methods":[{"u":"Array.html#wrap-class_method","n":"wrap","p":"Array","d":null},{"u":"Date.html#coerce-instance_method","n":"#coerce","p":"Date","d":null},{"u":"Date.html#compare_with_coercion-instance_method","n":"#compare_with_coercion","p":"Date","d":null},{"u":"Date.html#inspect-instance_method","n":"#inspect","p":"Date","d":null},{"u":"Date.html#minus_with_temporal-instance_method","n":"#minus_with_temporal","p":"Date","d":null},{"u":"Date.html#plus_with_temporal-instance_method","n":"#plus_with_temporal","p":"Date","d":null},{"u":"Date.html#to_instant-instance_method","n":"#to_instant","p":"Date","d":null},{"u":"Date.html#to_local_date-instance_method","n":"#to_local_date","p":"Date","d":null},{"u":"Date.html#to_month-instance_method","n":"#to_month","p":"Date","d":null},{"u":"Date.html#to_month_day-instance_method","n":"#to_month_day","p":"Date","d":null},{"u":"Date.html#to_zoned_date_time-instance_method","n":"#to_zoned_date_time","p":"Date","d":null},{"u":"Date.html#today%3F-instance_method","n":"#today?","p":"Date","d":null},{"u":"Date.html#tomorrow%3F-instance_method","n":"#tomorrow?","p":"Date","d":null},{"u":"Date.html#yesterday%3F-instance_method","n":"#yesterday?","p":"Date","d":null},{"u":"DateTime.html#coerce-instance_method","n":"#coerce","p":"DateTime","d":null},{"u":"DateTime.html#minus_with_temporal-instance_method","n":"#minus_with_temporal","p":"DateTime","d":null},{"u":"DateTime.html#plus_with_temporal-instance_method","n":"#plus_with_temporal","p":"DateTime","d":null},{"u":"DateTime.html#to_instant-instance_method","n":"#to_instant","p":"DateTime","d":null},{"u":"DateTime.html#to_local_time-instance_method","n":"#to_local_time","p":"DateTime","d":null},{"u":"DateTime.html#to_zoned_date_time-instance_method","n":"#to_zoned_date_time","p":"DateTime","d":null},{"u":"Enumerable.html#all_groups-instance_method","n":"#all_groups","p":"Enumerable","d":null},{"u":"Enumerable.html#all_members-instance_method","n":"#all_members","p":"Enumerable","d":null},{"u":"Enumerable.html#command-instance_method","n":"#command","p":"Enumerable","d":null},{"u":"Enumerable.html#command!-instance_method","n":"#command!","p":"Enumerable","d":null},{"u":"Enumerable.html#decrease-instance_method","n":"#decrease","p":"Enumerable","d":null},{"u":"Enumerable.html#down-instance_method","n":"#down","p":"Enumerable","d":null},{"u":"Enumerable.html#equipments-instance_method","n":"#equipments","p":"Enumerable","d":null},{"u":"Enumerable.html#fast_forward-instance_method","n":"#fast_forward","p":"Enumerable","d":null},{"u":"Enumerable.html#groups-instance_method","n":"#groups","p":"Enumerable","d":null},{"u":"Enumerable.html#increase-instance_method","n":"#increase","p":"Enumerable","d":null},{"u":"Enumerable.html#locations-instance_method","n":"#locations","p":"Enumerable","d":null},{"u":"Enumerable.html#member_of-instance_method","n":"#member_of","p":"Enumerable","d":null},{"u":"Enumerable.html#members-instance_method","n":"#members","p":"Enumerable","d":null},{"u":"Enumerable.html#move-instance_method","n":"#move","p":"Enumerable","d":null},{"u":"Enumerable.html#next-instance_method","n":"#next","p":"Enumerable","d":null},{"u":"Enumerable.html#not_member_of-instance_method","n":"#not_member_of","p":"Enumerable","d":null},{"u":"Enumerable.html#not_tagged-instance_method","n":"#not_tagged","p":"Enumerable","d":null},{"u":"Enumerable.html#off-instance_method","n":"#off","p":"Enumerable","d":null},{"u":"Enumerable.html#on-instance_method","n":"#on","p":"Enumerable","d":null},{"u":"Enumerable.html#pause-instance_method","n":"#pause","p":"Enumerable","d":null},{"u":"Enumerable.html#play-instance_method","n":"#play","p":"Enumerable","d":null},{"u":"Enumerable.html#points-instance_method","n":"#points","p":"Enumerable","d":null},{"u":"Enumerable.html#previous-instance_method","n":"#previous","p":"Enumerable","d":null},{"u":"Enumerable.html#refresh-instance_method","n":"#refresh","p":"Enumerable","d":null},{"u":"Enumerable.html#rewind-instance_method","n":"#rewind","p":"Enumerable","d":null},{"u":"Enumerable.html#stop-instance_method","n":"#stop","p":"Enumerable","d":null},{"u":"Enumerable.html#tagged-instance_method","n":"#tagged","p":"Enumerable","d":null},{"u":"Enumerable.html#toggle-instance_method","n":"#toggle","p":"Enumerable","d":null},{"u":"Enumerable.html#up-instance_method","n":"#up","p":"Enumerable","d":null},{"u":"Enumerable.html#update-instance_method","n":"#update","p":"Enumerable","d":null},{"u":"Enumerable.html#update!-instance_method","n":"#update!","p":"Enumerable","d":null},{"u":"Float.html#days-instance_method","n":"#days","p":"Float","d":null},{"u":"Float.html#hours-instance_method","n":"#hours","p":"Float","d":null},{"u":"Float.html#milliseconds-instance_method","n":"#milliseconds","p":"Float","d":null},{"u":"Float.html#minutes-instance_method","n":"#minutes","p":"Float","d":null},{"u":"Float.html#months-instance_method","n":"#months","p":"Float","d":null},{"u":"Float.html#seconds-instance_method","n":"#seconds","p":"Float","d":null},{"u":"Float.html#years-instance_method","n":"#years","p":"Float","d":null},{"u":"Integer.html#days-instance_method","n":"#days","p":"Integer","d":null},{"u":"Integer.html#hours-instance_method","n":"#hours","p":"Integer","d":null},{"u":"Integer.html#milliseconds-instance_method","n":"#milliseconds","p":"Integer","d":null},{"u":"Integer.html#minutes-instance_method","n":"#minutes","p":"Integer","d":null},{"u":"Integer.html#months-instance_method","n":"#months","p":"Integer","d":null},{"u":"Integer.html#seconds-instance_method","n":"#seconds","p":"Integer","d":null},{"u":"Integer.html#years-instance_method","n":"#years","p":"Integer","d":null},{"u":"Module.html#simple_name-instance_method","n":"#simple_name","p":"Module","d":null},{"u":"OpenHAB/Core/AbstractUID.html#==-instance_method","n":"#==","p":"OpenHAB::Core::AbstractUID","d":null},{"u":"OpenHAB/Core/AbstractUID.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::AbstractUID","d":null},{"u":"OpenHAB/Core/AbstractUID.html#to_str-instance_method","n":"#to_str","p":"OpenHAB::Core::AbstractUID","d":null},{"u":"OpenHAB/Core/Actions/Audio.html#play_sound-class_method","n":"play_sound","p":"OpenHAB::Core::Actions::Audio","d":null},{"u":"OpenHAB/Core/Actions/Audio.html#play_stream-class_method","n":"play_stream","p":"OpenHAB::Core::Actions::Audio","d":null},{"u":"OpenHAB/Core/Actions/Ephemeris.html#holiday_name-class_method","n":"holiday_name","p":"OpenHAB::Core::Actions::Ephemeris","d":null},{"u":"OpenHAB/Core/Actions/Exec.html#execute_command_line-class_method","n":"execute_command_line","p":"OpenHAB::Core::Actions::Exec","d":null},{"u":"OpenHAB/Core/Actions/HTTP.html#send_http_delete_request-class_method","n":"send_http_delete_request","p":"OpenHAB::Core::Actions::HTTP","d":null},{"u":"OpenHAB/Core/Actions/HTTP.html#send_http_get_request-class_method","n":"send_http_get_request","p":"OpenHAB::Core::Actions::HTTP","d":null},{"u":"OpenHAB/Core/Actions/HTTP.html#send_http_post_request-class_method","n":"send_http_post_request","p":"OpenHAB::Core::Actions::HTTP","d":null},{"u":"OpenHAB/Core/Actions/HTTP.html#send_http_put_request-class_method","n":"send_http_put_request","p":"OpenHAB::Core::Actions::HTTP","d":null},{"u":"OpenHAB/Core/Actions/Notification.html#hide-class_method","n":"hide","p":"OpenHAB::Core::Actions::Notification","d":null},{"u":"OpenHAB/Core/Actions/Notification.html#log-class_method","n":"log","p":"OpenHAB::Core::Actions::Notification","d":null},{"u":"OpenHAB/Core/Actions/Notification.html#send-class_method","n":"send","p":"OpenHAB::Core::Actions::Notification","d":null},{"u":"OpenHAB/Core/Actions/Ping.html#check_vitality-class_method","n":"check_vitality","p":"OpenHAB::Core::Actions::Ping","d":null},{"u":"OpenHAB/Core/Actions/Transformation.html#transform-class_method","n":"transform","p":"OpenHAB::Core::Actions::Transformation","d":null},{"u":"OpenHAB/Core/Actions/Voice.html#say-class_method","n":"say","p":"OpenHAB::Core::Actions::Voice","d":null},{"u":"OpenHAB/Core/Actions.html#notify-class_method","n":"notify","p":"OpenHAB::Core::Actions","d":1},{"u":"OpenHAB/Core/DTO/AbstractThingDTO.html#bridge_uid-instance_method","n":"#bridge_uid","p":"OpenHAB::Core::DTO::AbstractThingDTO","d":null},{"u":"OpenHAB/Core/DTO/AbstractThingDTO.html#thing_type_uid-instance_method","n":"#thing_type_uid","p":"OpenHAB::Core::DTO::AbstractThingDTO","d":null},{"u":"OpenHAB/Core/DTO/AbstractThingDTO.html#uid-instance_method","n":"#uid","p":"OpenHAB::Core::DTO::AbstractThingDTO","d":null},{"u":"OpenHAB/Core/DTO/ItemChannelLinkDTO.html#channel_uid-instance_method","n":"#channel_uid","p":"OpenHAB::Core::DTO::ItemChannelLinkDTO","d":null},{"u":"OpenHAB/Core/DTO/ItemChannelLinkDTO.html#item-instance_method","n":"#item","p":"OpenHAB::Core::DTO::ItemChannelLinkDTO","d":null},{"u":"OpenHAB/Core/DTO/ItemChannelLinkDTO.html#item_name-instance_method","n":"#item_name","p":"OpenHAB::Core::DTO::ItemChannelLinkDTO","d":null},{"u":"OpenHAB/Core/DTO/ItemChannelLinkDTO.html#to_s-instance_method","n":"#to_s","p":"OpenHAB::Core::DTO::ItemChannelLinkDTO","d":null},{"u":"OpenHAB/Core/EntityLookup.html#items-instance_method","n":"#items","p":"OpenHAB::Core::EntityLookup","d":null},{"u":"OpenHAB/Core/EntityLookup.html#method_missing-instance_method","n":"#method_missing","p":"OpenHAB::Core::EntityLookup","d":null},{"u":"OpenHAB/Core/EntityLookup.html#things-instance_method","n":"#things","p":"OpenHAB::Core::EntityLookup","d":null},{"u":"OpenHAB/Core/Events/AbstractEvent.html#attachment-instance_method","n":"#attachment","p":"OpenHAB::Core::Events::AbstractEvent","d":null},{"u":"OpenHAB/Core/Events/AbstractEvent.html#inputs-instance_method","n":"#inputs","p":"OpenHAB::Core::Events::AbstractEvent","d":null},{"u":"OpenHAB/Core/Events/AbstractEvent.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Events::AbstractEvent","d":null},{"u":"OpenHAB/Core/Events/AbstractEvent.html#payload-instance_method","n":"#payload","p":"OpenHAB::Core::Events::AbstractEvent","d":null},{"u":"OpenHAB/Core/Events/AbstractEvent.html#source-instance_method","n":"#source","p":"OpenHAB::Core::Events::AbstractEvent","d":null},{"u":"OpenHAB/Core/Events/AbstractItemChannelLinkRegistryEvent.html#link-instance_method","n":"#link","p":"OpenHAB::Core::Events::AbstractItemChannelLinkRegistryEvent","d":null},{"u":"OpenHAB/Core/Events/AbstractItemRegistryEvent.html#item-instance_method","n":"#item","p":"OpenHAB::Core::Events::AbstractItemRegistryEvent","d":null},{"u":"OpenHAB/Core/Events/AbstractThingRegistryEvent.html#thing-instance_method","n":"#thing","p":"OpenHAB::Core::Events::AbstractThingRegistryEvent","d":null},{"u":"OpenHAB/Core/Events/ChannelTriggeredEvent.html#channel-instance_method","n":"#channel","p":"OpenHAB::Core::Events::ChannelTriggeredEvent","d":null},{"u":"OpenHAB/Core/Events/ChannelTriggeredEvent.html#channel_uid-instance_method","n":"#channel_uid","p":"OpenHAB::Core::Events::ChannelTriggeredEvent","d":null},{"u":"OpenHAB/Core/Events/ChannelTriggeredEvent.html#event-instance_method","n":"#event","p":"OpenHAB::Core::Events::ChannelTriggeredEvent","d":null},{"u":"OpenHAB/Core/Events/ChannelTriggeredEvent.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Events::ChannelTriggeredEvent","d":null},{"u":"OpenHAB/Core/Events/ChannelTriggeredEvent.html#thing-instance_method","n":"#thing","p":"OpenHAB::Core::Events::ChannelTriggeredEvent","d":null},{"u":"OpenHAB/Core/Events/ItemCommandEvent.html#command-instance_method","n":"#command","p":"OpenHAB::Core::Events::ItemCommandEvent","d":null},{"u":"OpenHAB/Core/Events/ItemCommandEvent.html#decrease%3F-instance_method","n":"#decrease?","p":"OpenHAB::Core::Events::ItemCommandEvent","d":null},{"u":"OpenHAB/Core/Events/ItemCommandEvent.html#down%3F-instance_method","n":"#down?","p":"OpenHAB::Core::Events::ItemCommandEvent","d":null},{"u":"OpenHAB/Core/Events/ItemCommandEvent.html#fast_forward%3F-instance_method","n":"#fast_forward?","p":"OpenHAB::Core::Events::ItemCommandEvent","d":null},{"u":"OpenHAB/Core/Events/ItemCommandEvent.html#increase%3F-instance_method","n":"#increase?","p":"OpenHAB::Core::Events::ItemCommandEvent","d":null},{"u":"OpenHAB/Core/Events/ItemCommandEvent.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Events::ItemCommandEvent","d":null},{"u":"OpenHAB/Core/Events/ItemCommandEvent.html#move%3F-instance_method","n":"#move?","p":"OpenHAB::Core::Events::ItemCommandEvent","d":null},{"u":"OpenHAB/Core/Events/ItemCommandEvent.html#next%3F-instance_method","n":"#next?","p":"OpenHAB::Core::Events::ItemCommandEvent","d":null},{"u":"OpenHAB/Core/Events/ItemCommandEvent.html#off%3F-instance_method","n":"#off?","p":"OpenHAB::Core::Events::ItemCommandEvent","d":null},{"u":"OpenHAB/Core/Events/ItemCommandEvent.html#on%3F-instance_method","n":"#on?","p":"OpenHAB::Core::Events::ItemCommandEvent","d":null},{"u":"OpenHAB/Core/Events/ItemCommandEvent.html#pause%3F-instance_method","n":"#pause?","p":"OpenHAB::Core::Events::ItemCommandEvent","d":null},{"u":"OpenHAB/Core/Events/ItemCommandEvent.html#play%3F-instance_method","n":"#play?","p":"OpenHAB::Core::Events::ItemCommandEvent","d":null},{"u":"OpenHAB/Core/Events/ItemCommandEvent.html#previous%3F-instance_method","n":"#previous?","p":"OpenHAB::Core::Events::ItemCommandEvent","d":null},{"u":"OpenHAB/Core/Events/ItemCommandEvent.html#refresh%3F-instance_method","n":"#refresh?","p":"OpenHAB::Core::Events::ItemCommandEvent","d":null},{"u":"OpenHAB/Core/Events/ItemCommandEvent.html#rewind%3F-instance_method","n":"#rewind?","p":"OpenHAB::Core::Events::ItemCommandEvent","d":null},{"u":"OpenHAB/Core/Events/ItemCommandEvent.html#stop%3F-instance_method","n":"#stop?","p":"OpenHAB::Core::Events::ItemCommandEvent","d":null},{"u":"OpenHAB/Core/Events/ItemCommandEvent.html#up%3F-instance_method","n":"#up?","p":"OpenHAB::Core::Events::ItemCommandEvent","d":null},{"u":"OpenHAB/Core/Events/ItemEvent.html#group-instance_method","n":"#group","p":"OpenHAB::Core::Events::ItemEvent","d":null},{"u":"OpenHAB/Core/Events/ItemEvent.html#item-instance_method","n":"#item","p":"OpenHAB::Core::Events::ItemEvent","d":null},{"u":"OpenHAB/Core/Events/ItemState.html#closed%3F-instance_method","n":"#closed?","p":"OpenHAB::Core::Events::ItemState","d":null},{"u":"OpenHAB/Core/Events/ItemState.html#down%3F-instance_method","n":"#down?","p":"OpenHAB::Core::Events::ItemState","d":null},{"u":"OpenHAB/Core/Events/ItemState.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Events::ItemState","d":null},{"u":"OpenHAB/Core/Events/ItemState.html#null%3F-instance_method","n":"#null?","p":"OpenHAB::Core::Events::ItemState","d":null},{"u":"OpenHAB/Core/Events/ItemState.html#off%3F-instance_method","n":"#off?","p":"OpenHAB::Core::Events::ItemState","d":null},{"u":"OpenHAB/Core/Events/ItemState.html#on%3F-instance_method","n":"#on?","p":"OpenHAB::Core::Events::ItemState","d":null},{"u":"OpenHAB/Core/Events/ItemState.html#open%3F-instance_method","n":"#open?","p":"OpenHAB::Core::Events::ItemState","d":null},{"u":"OpenHAB/Core/Events/ItemState.html#paused%3F-instance_method","n":"#paused?","p":"OpenHAB::Core::Events::ItemState","d":null},{"u":"OpenHAB/Core/Events/ItemState.html#playing%3F-instance_method","n":"#playing?","p":"OpenHAB::Core::Events::ItemState","d":null},{"u":"OpenHAB/Core/Events/ItemState.html#state-instance_method","n":"#state","p":"OpenHAB::Core::Events::ItemState","d":null},{"u":"OpenHAB/Core/Events/ItemState.html#state%3F-instance_method","n":"#state?","p":"OpenHAB::Core::Events::ItemState","d":null},{"u":"OpenHAB/Core/Events/ItemState.html#undef%3F-instance_method","n":"#undef?","p":"OpenHAB::Core::Events::ItemState","d":null},{"u":"OpenHAB/Core/Events/ItemState.html#up%3F-instance_method","n":"#up?","p":"OpenHAB::Core::Events::ItemState","d":null},{"u":"OpenHAB/Core/Events/ItemStateChangedEvent.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Events::ItemStateChangedEvent","d":null},{"u":"OpenHAB/Core/Events/ItemStateChangedEvent.html#was-instance_method","n":"#was","p":"OpenHAB::Core::Events::ItemStateChangedEvent","d":null},{"u":"OpenHAB/Core/Events/ItemStateChangedEvent.html#was%3F-instance_method","n":"#was?","p":"OpenHAB::Core::Events::ItemStateChangedEvent","d":null},{"u":"OpenHAB/Core/Events/ItemStateChangedEvent.html#was_closed%3F-instance_method","n":"#was_closed?","p":"OpenHAB::Core::Events::ItemStateChangedEvent","d":null},{"u":"OpenHAB/Core/Events/ItemStateChangedEvent.html#was_down%3F-instance_method","n":"#was_down?","p":"OpenHAB::Core::Events::ItemStateChangedEvent","d":null},{"u":"OpenHAB/Core/Events/ItemStateChangedEvent.html#was_null%3F-instance_method","n":"#was_null?","p":"OpenHAB::Core::Events::ItemStateChangedEvent","d":null},{"u":"OpenHAB/Core/Events/ItemStateChangedEvent.html#was_off%3F-instance_method","n":"#was_off?","p":"OpenHAB::Core::Events::ItemStateChangedEvent","d":null},{"u":"OpenHAB/Core/Events/ItemStateChangedEvent.html#was_on%3F-instance_method","n":"#was_on?","p":"OpenHAB::Core::Events::ItemStateChangedEvent","d":null},{"u":"OpenHAB/Core/Events/ItemStateChangedEvent.html#was_open%3F-instance_method","n":"#was_open?","p":"OpenHAB::Core::Events::ItemStateChangedEvent","d":null},{"u":"OpenHAB/Core/Events/ItemStateChangedEvent.html#was_paused%3F-instance_method","n":"#was_paused?","p":"OpenHAB::Core::Events::ItemStateChangedEvent","d":null},{"u":"OpenHAB/Core/Events/ItemStateChangedEvent.html#was_playing%3F-instance_method","n":"#was_playing?","p":"OpenHAB::Core::Events::ItemStateChangedEvent","d":null},{"u":"OpenHAB/Core/Events/ItemStateChangedEvent.html#was_undef%3F-instance_method","n":"#was_undef?","p":"OpenHAB::Core::Events::ItemStateChangedEvent","d":null},{"u":"OpenHAB/Core/Events/ItemStateChangedEvent.html#was_up%3F-instance_method","n":"#was_up?","p":"OpenHAB::Core::Events::ItemStateChangedEvent","d":null},{"u":"OpenHAB/Core/Events/ItemTimeSeriesUpdatedEvent.html#time_series-instance_method","n":"#time_series","p":"OpenHAB::Core::Events::ItemTimeSeriesUpdatedEvent","d":null},{"u":"OpenHAB/Core/Events/ItemUpdatedEvent.html#old_item-instance_method","n":"#old_item","p":"OpenHAB::Core::Events::ItemUpdatedEvent","d":null},{"u":"OpenHAB/Core/Events/StartlevelEvent.html#startlevel-instance_method","n":"#startlevel","p":"OpenHAB::Core::Events::StartlevelEvent","d":null},{"u":"OpenHAB/Core/Events/ThingStatusInfoChangedEvent.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Events::ThingStatusInfoChangedEvent","d":null},{"u":"OpenHAB/Core/Events/ThingStatusInfoChangedEvent.html#status-instance_method","n":"#status","p":"OpenHAB::Core::Events::ThingStatusInfoChangedEvent","d":null},{"u":"OpenHAB/Core/Events/ThingStatusInfoChangedEvent.html#thing-instance_method","n":"#thing","p":"OpenHAB::Core::Events::ThingStatusInfoChangedEvent","d":null},{"u":"OpenHAB/Core/Events/ThingStatusInfoChangedEvent.html#uid-instance_method","n":"#uid","p":"OpenHAB::Core::Events::ThingStatusInfoChangedEvent","d":null},{"u":"OpenHAB/Core/Events/ThingStatusInfoChangedEvent.html#was-instance_method","n":"#was","p":"OpenHAB::Core::Events::ThingStatusInfoChangedEvent","d":null},{"u":"OpenHAB/Core/Events/ThingStatusInfoEvent.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Events::ThingStatusInfoEvent","d":null},{"u":"OpenHAB/Core/Events/ThingStatusInfoEvent.html#status-instance_method","n":"#status","p":"OpenHAB::Core::Events::ThingStatusInfoEvent","d":null},{"u":"OpenHAB/Core/Events/ThingStatusInfoEvent.html#thing-instance_method","n":"#thing","p":"OpenHAB::Core::Events::ThingStatusInfoEvent","d":null},{"u":"OpenHAB/Core/Events/ThingStatusInfoEvent.html#uid-instance_method","n":"#uid","p":"OpenHAB::Core::Events::ThingStatusInfoEvent","d":null},{"u":"OpenHAB/Core/Events/ThingUpdatedEvent.html#old_thing-instance_method","n":"#old_thing","p":"OpenHAB::Core::Events::ThingUpdatedEvent","d":null},{"u":"OpenHAB/Core/Events/TimerEvent.html#cron_expression-instance_method","n":"#cron_expression","p":"OpenHAB::Core::Events::TimerEvent","d":null},{"u":"OpenHAB/Core/Events/TimerEvent.html#item-instance_method","n":"#item","p":"OpenHAB::Core::Events::TimerEvent","d":null},{"u":"OpenHAB/Core/Events/TimerEvent.html#offset-instance_method","n":"#offset","p":"OpenHAB::Core::Events::TimerEvent","d":null},{"u":"OpenHAB/Core/Events/TimerEvent.html#time-instance_method","n":"#time","p":"OpenHAB::Core::Events::TimerEvent","d":null},{"u":"OpenHAB/Core/Events/TimerEvent.html#time_only%3F-instance_method","n":"#time_only?","p":"OpenHAB::Core::Events::TimerEvent","d":null},{"u":"OpenHAB/Core/Items/CallItem.html#state-instance_method","n":"#state","p":"OpenHAB::Core::Items::CallItem","d":null},{"u":"OpenHAB/Core/Items/ColorItem.html#state-instance_method","n":"#state","p":"OpenHAB::Core::Items::ColorItem","d":null},{"u":"OpenHAB/Core/Items/ContactItem.html#state-instance_method","n":"#state","p":"OpenHAB::Core::Items::ContactItem","d":null},{"u":"OpenHAB/Core/Items/DateTimeItem.html#state-instance_method","n":"#state","p":"OpenHAB::Core::Items::DateTimeItem","d":null},{"u":"OpenHAB/Core/Items/DimmerItem.html#brighten-instance_method","n":"#brighten","p":"OpenHAB::Core::Items::DimmerItem","d":null},{"u":"OpenHAB/Core/Items/DimmerItem.html#decrease-instance_method","n":"#decrease","p":"OpenHAB::Core::Items::DimmerItem","d":null},{"u":"OpenHAB/Core/Items/DimmerItem.html#dim-instance_method","n":"#dim","p":"OpenHAB::Core::Items::DimmerItem","d":null},{"u":"OpenHAB/Core/Items/DimmerItem.html#increase-instance_method","n":"#increase","p":"OpenHAB::Core::Items::DimmerItem","d":null},{"u":"OpenHAB/Core/Items/DimmerItem.html#state-instance_method","n":"#state","p":"OpenHAB::Core::Items::DimmerItem","d":null},{"u":"OpenHAB/Core/Items/GenericItem.html#category-instance_method","n":"#category","p":"OpenHAB::Core::Items::GenericItem","d":null},{"u":"OpenHAB/Core/Items/GenericItem.html#command-instance_method","n":"#command","p":"OpenHAB::Core::Items::GenericItem","d":null},{"u":"OpenHAB/Core/Items/GenericItem.html#formatted_state-instance_method","n":"#formatted_state","p":"OpenHAB::Core::Items::GenericItem","d":null},{"u":"OpenHAB/Core/Items/GenericItem.html#label-instance_method","n":"#label","p":"OpenHAB::Core::Items::GenericItem","d":null},{"u":"OpenHAB/Core/Items/GenericItem.html#modify-instance_method","n":"#modify","p":"OpenHAB::Core::Items::GenericItem","d":null},{"u":"OpenHAB/Core/Items/GenericItem.html#name-instance_method","n":"#name","p":"OpenHAB::Core::Items::GenericItem","d":null},{"u":"OpenHAB/Core/Items/GenericItem.html#null%3F-instance_method","n":"#null?","p":"OpenHAB::Core::Items::GenericItem","d":null},{"u":"OpenHAB/Core/Items/GenericItem.html#raw_state-instance_method","n":"#raw_state","p":"OpenHAB::Core::Items::GenericItem","d":null},{"u":"OpenHAB/Core/Items/GenericItem.html#refresh-instance_method","n":"#refresh","p":"OpenHAB::Core::Items::GenericItem","d":null},{"u":"OpenHAB/Core/Items/GenericItem.html#state-instance_method","n":"#state","p":"OpenHAB::Core::Items::GenericItem","d":null},{"u":"OpenHAB/Core/Items/GenericItem.html#state%3F-instance_method","n":"#state?","p":"OpenHAB::Core::Items::GenericItem","d":null},{"u":"OpenHAB/Core/Items/GenericItem.html#tags-instance_method","n":"#tags","p":"OpenHAB::Core::Items::GenericItem","d":null},{"u":"OpenHAB/Core/Items/GenericItem.html#time_series=-instance_method","n":"#time_series=","p":"OpenHAB::Core::Items::GenericItem","d":null},{"u":"OpenHAB/Core/Items/GenericItem.html#undef%3F-instance_method","n":"#undef?","p":"OpenHAB::Core::Items::GenericItem","d":null},{"u":"OpenHAB/Core/Items/GenericItem.html#update-instance_method","n":"#update","p":"OpenHAB::Core::Items::GenericItem","d":null},{"u":"OpenHAB/Core/Items/GroupFunction.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Items::GroupFunction","d":null},{"u":"OpenHAB/Core/Items/GroupFunction.html#to_s-instance_method","n":"#to_s","p":"OpenHAB::Core::Items::GroupFunction","d":null},{"u":"OpenHAB/Core/Items/GroupItem/Members.html#add-instance_method","n":"#add","p":"OpenHAB::Core::Items::GroupItem::Members","d":null},{"u":"OpenHAB/Core/Items/GroupItem/Members.html#group-instance_method","n":"#group","p":"OpenHAB::Core::Items::GroupItem::Members","d":null},{"u":"OpenHAB/Core/Items/GroupItem/Members.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Items::GroupItem::Members","d":null},{"u":"OpenHAB/Core/Items/GroupItem/Members.html#name-instance_method","n":"#name","p":"OpenHAB::Core::Items::GroupItem::Members","d":null},{"u":"OpenHAB/Core/Items/GroupItem/Members.html#to_a-instance_method","n":"#to_a","p":"OpenHAB::Core::Items::GroupItem::Members","d":null},{"u":"OpenHAB/Core/Items/GroupItem.html#all_members-instance_method","n":"#all_members","p":"OpenHAB::Core::Items::GroupItem","d":null},{"u":"OpenHAB/Core/Items/GroupItem.html#base_item-instance_method","n":"#base_item","p":"OpenHAB::Core::Items::GroupItem","d":null},{"u":"OpenHAB/Core/Items/GroupItem.html#equipments-instance_method","n":"#equipments","p":"OpenHAB::Core::Items::GroupItem","d":null},{"u":"OpenHAB/Core/Items/GroupItem.html#function-instance_method","n":"#function","p":"OpenHAB::Core::Items::GroupItem","d":null},{"u":"OpenHAB/Core/Items/GroupItem.html#locations-instance_method","n":"#locations","p":"OpenHAB::Core::Items::GroupItem","d":null},{"u":"OpenHAB/Core/Items/GroupItem.html#members-instance_method","n":"#members","p":"OpenHAB::Core::Items::GroupItem","d":null},{"u":"OpenHAB/Core/Items/ImageItem.html#state-instance_method","n":"#state","p":"OpenHAB::Core::Items::ImageItem","d":null},{"u":"OpenHAB/Core/Items/ImageItem.html#update_from_bytes-instance_method","n":"#update_from_bytes","p":"OpenHAB::Core::Items::ImageItem","d":null},{"u":"OpenHAB/Core/Items/ImageItem.html#update_from_file-instance_method","n":"#update_from_file","p":"OpenHAB::Core::Items::ImageItem","d":null},{"u":"OpenHAB/Core/Items/ImageItem.html#update_from_url-instance_method","n":"#update_from_url","p":"OpenHAB::Core::Items::ImageItem","d":null},{"u":"OpenHAB/Core/Items/Item.html#accepted_command_types-instance_method","n":"#accepted_command_types","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#accepted_data_types-instance_method","n":"#accepted_data_types","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#all_groups-instance_method","n":"#all_groups","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#call_item%3F-instance_method","n":"#call_item?","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#channel-instance_method","n":"#channel","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#channel_uid-instance_method","n":"#channel_uid","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#channel_uids-instance_method","n":"#channel_uids","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#channels-instance_method","n":"#channels","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#color_item%3F-instance_method","n":"#color_item?","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#contact_item%3F-instance_method","n":"#contact_item?","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#date_time_item%3F-instance_method","n":"#date_time_item?","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#dimmer_item%3F-instance_method","n":"#dimmer_item?","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#group_item%3F-instance_method","n":"#group_item?","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#groups-instance_method","n":"#groups","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#image_item%3F-instance_method","n":"#image_item?","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#link-instance_method","n":"#link","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#links-instance_method","n":"#links","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#location_item%3F-instance_method","n":"#location_item?","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#member_of%3F-instance_method","n":"#member_of?","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#metadata-instance_method","n":"#metadata","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#name-instance_method","n":"#name","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#number_item%3F-instance_method","n":"#number_item?","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#player_item%3F-instance_method","n":"#player_item?","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#provider-instance_method","n":"#provider","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#rollershutter_item%3F-instance_method","n":"#rollershutter_item?","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#string_item%3F-instance_method","n":"#string_item?","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#switch_item%3F-instance_method","n":"#switch_item?","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#tagged%3F-instance_method","n":"#tagged?","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#thing-instance_method","n":"#thing","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#things-instance_method","n":"#things","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#to_s-instance_method","n":"#to_s","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/Item.html#unlink-instance_method","n":"#unlink","p":"OpenHAB::Core::Items::Item","d":null},{"u":"OpenHAB/Core/Items/ItemChannelLinks.html#clear-instance_method","n":"#clear","p":"OpenHAB::Core::Items::ItemChannelLinks","d":null},{"u":"OpenHAB/Core/Items/LocationItem.html#state-instance_method","n":"#state","p":"OpenHAB::Core::Items::LocationItem","d":null},{"u":"OpenHAB/Core/Items/Metadata/Hash.html#attached%3F-instance_method","n":"#attached?","p":"OpenHAB::Core::Items::Metadata::Hash","d":null},{"u":"OpenHAB/Core/Items/Metadata/Hash.html#item-instance_method","n":"#item","p":"OpenHAB::Core::Items::Metadata::Hash","d":null},{"u":"OpenHAB/Core/Items/Metadata/Hash.html#namespace-instance_method","n":"#namespace","p":"OpenHAB::Core::Items::Metadata::Hash","d":null},{"u":"OpenHAB/Core/Items/Metadata/Hash.html#provider-instance_method","n":"#provider","p":"OpenHAB::Core::Items::Metadata::Hash","d":null},{"u":"OpenHAB/Core/Items/Metadata/Hash.html#provider!-instance_method","n":"#provider!","p":"OpenHAB::Core::Items::Metadata::Hash","d":null},{"u":"OpenHAB/Core/Items/Metadata/Hash.html#replace-instance_method","n":"#replace","p":"OpenHAB::Core::Items::Metadata::Hash","d":null},{"u":"OpenHAB/Core/Items/Metadata/Hash.html#value-instance_method","n":"#value","p":"OpenHAB::Core::Items::Metadata::Hash","d":null},{"u":"OpenHAB/Core/Items/Metadata/NamespaceHash.html#attached%3F-instance_method","n":"#attached?","p":"OpenHAB::Core::Items::Metadata::NamespaceHash","d":null},{"u":"OpenHAB/Core/Items/Metadata/NamespaceHash.html#to_hash-instance_method","n":"#to_hash","p":"OpenHAB::Core::Items::Metadata::NamespaceHash","d":null},{"u":"OpenHAB/Core/Items/Metadata/Provider.html#remove_item_metadata-instance_method","n":"#remove_item_metadata","p":"OpenHAB::Core::Items::Metadata::Provider","d":null},{"u":"OpenHAB/Core/Items/Metadata/Provider.html#registry-class_method","n":"registry","p":"OpenHAB::Core::Items::Metadata::Provider","d":null},{"u":"OpenHAB/Core/Items/NumberItem.html#dimension-instance_method","n":"#dimension","p":"OpenHAB::Core::Items::NumberItem","d":null},{"u":"OpenHAB/Core/Items/NumberItem.html#range-instance_method","n":"#range","p":"OpenHAB::Core::Items::NumberItem","d":null},{"u":"OpenHAB/Core/Items/NumberItem.html#state-instance_method","n":"#state","p":"OpenHAB::Core::Items::NumberItem","d":null},{"u":"OpenHAB/Core/Items/NumberItem.html#type_details-instance_method","n":"#type_details","p":"OpenHAB::Core::Items::NumberItem","d":null},{"u":"OpenHAB/Core/Items/NumberItem.html#unit-instance_method","n":"#unit","p":"OpenHAB::Core::Items::NumberItem","d":null},{"u":"OpenHAB/Core/Items/Persistence/PersistedState.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::Core::Items::Persistence::PersistedState","d":null},{"u":"OpenHAB/Core/Items/Persistence/PersistedState.html#instant-instance_method","n":"#instant","p":"OpenHAB::Core::Items::Persistence::PersistedState","d":null},{"u":"OpenHAB/Core/Items/Persistence/PersistedState.html#name-instance_method","n":"#name","p":"OpenHAB::Core::Items::Persistence::PersistedState","d":null},{"u":"OpenHAB/Core/Items/Persistence/PersistedState.html#state-instance_method","n":"#state","p":"OpenHAB::Core::Items::Persistence::PersistedState","d":null},{"u":"OpenHAB/Core/Items/Persistence/PersistedState.html#timestamp-instance_method","n":"#timestamp","p":"OpenHAB::Core::Items::Persistence::PersistedState","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#all_states_between-instance_method","n":"#all_states_between","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#all_states_since-instance_method","n":"#all_states_since","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#all_states_until-instance_method","n":"#all_states_until","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#average_between-instance_method","n":"#average_between","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#average_since-instance_method","n":"#average_since","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#average_until-instance_method","n":"#average_until","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#changed_between%3F-instance_method","n":"#changed_between?","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#changed_since%3F-instance_method","n":"#changed_since?","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#changed_until%3F-instance_method","n":"#changed_until?","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#count_between-instance_method","n":"#count_between","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#count_since-instance_method","n":"#count_since","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#count_state_changes_between-instance_method","n":"#count_state_changes_between","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#count_state_changes_since-instance_method","n":"#count_state_changes_since","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#count_state_changes_until-instance_method","n":"#count_state_changes_until","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#count_until-instance_method","n":"#count_until","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#delta_between-instance_method","n":"#delta_between","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#delta_since-instance_method","n":"#delta_since","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#delta_until-instance_method","n":"#delta_until","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#deviation_between-instance_method","n":"#deviation_between","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#deviation_since-instance_method","n":"#deviation_since","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#deviation_until-instance_method","n":"#deviation_until","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#evolution_rate-instance_method","n":"#evolution_rate","p":"OpenHAB::Core::Items::Persistence","d":1},{"u":"OpenHAB/Core/Items/Persistence.html#evolution_rate_between-instance_method","n":"#evolution_rate_between","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#evolution_rate_since-instance_method","n":"#evolution_rate_since","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#evolution_rate_until-instance_method","n":"#evolution_rate_until","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#historic_state-instance_method","n":"#historic_state","p":"OpenHAB::Core::Items::Persistence","d":1},{"u":"OpenHAB/Core/Items/Persistence.html#last_change-instance_method","n":"#last_change","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#last_update-instance_method","n":"#last_update","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#maximum_between-instance_method","n":"#maximum_between","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#maximum_since-instance_method","n":"#maximum_since","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#maximum_until-instance_method","n":"#maximum_until","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#median_between-instance_method","n":"#median_between","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#median_since-instance_method","n":"#median_since","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#median_until-instance_method","n":"#median_until","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#minimum_between-instance_method","n":"#minimum_between","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#minimum_since-instance_method","n":"#minimum_since","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#minimum_until-instance_method","n":"#minimum_until","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#next_change-instance_method","n":"#next_change","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#next_state-instance_method","n":"#next_state","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#next_update-instance_method","n":"#next_update","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#persist-instance_method","n":"#persist","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#persisted_state-instance_method","n":"#persisted_state","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#previous_state-instance_method","n":"#previous_state","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#remove_all_states_between-instance_method","n":"#remove_all_states_between","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#remove_all_states_since-instance_method","n":"#remove_all_states_since","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#remove_all_states_until-instance_method","n":"#remove_all_states_until","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#sum_between-instance_method","n":"#sum_between","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#sum_since-instance_method","n":"#sum_since","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#sum_until-instance_method","n":"#sum_until","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#updated_between%3F-instance_method","n":"#updated_between?","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#updated_since%3F-instance_method","n":"#updated_since?","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#updated_until%3F-instance_method","n":"#updated_until?","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#variance_between-instance_method","n":"#variance_between","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#variance_since-instance_method","n":"#variance_since","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/Persistence.html#variance_until-instance_method","n":"#variance_until","p":"OpenHAB::Core::Items::Persistence","d":null},{"u":"OpenHAB/Core/Items/PlayerItem.html#state-instance_method","n":"#state","p":"OpenHAB::Core::Items::PlayerItem","d":null},{"u":"OpenHAB/Core/Items/Provider.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::Core::Items::Provider","d":null},{"u":"OpenHAB/Core/Items/Provider.html#remove-instance_method","n":"#remove","p":"OpenHAB::Core::Items::Provider","d":null},{"u":"OpenHAB/Core/Items/Provider.html#registry-class_method","n":"registry","p":"OpenHAB::Core::Items::Provider","d":null},{"u":"OpenHAB/Core/Items/Registry.html#[]-instance_method","n":"#[]","p":"OpenHAB::Core::Items::Registry","d":null},{"u":"OpenHAB/Core/Items/Registry.html#build-instance_method","n":"#build","p":"OpenHAB::Core::Items::Registry","d":null},{"u":"OpenHAB/Core/Items/Registry.html#key%3F-instance_method","n":"#key?","p":"OpenHAB::Core::Items::Registry","d":null},{"u":"OpenHAB/Core/Items/Registry.html#remove-instance_method","n":"#remove","p":"OpenHAB::Core::Items::Registry","d":null},{"u":"OpenHAB/Core/Items/Registry.html#to_a-instance_method","n":"#to_a","p":"OpenHAB::Core::Items::Registry","d":null},{"u":"OpenHAB/Core/Items/RollershutterItem.html#down-instance_method","n":"#down","p":"OpenHAB::Core::Items::RollershutterItem","d":null},{"u":"OpenHAB/Core/Items/RollershutterItem.html#down!-instance_method","n":"#down!","p":"OpenHAB::Core::Items::RollershutterItem","d":null},{"u":"OpenHAB/Core/Items/RollershutterItem.html#down%3F-instance_method","n":"#down?","p":"OpenHAB::Core::Items::RollershutterItem","d":null},{"u":"OpenHAB/Core/Items/RollershutterItem.html#move-instance_method","n":"#move","p":"OpenHAB::Core::Items::RollershutterItem","d":null},{"u":"OpenHAB/Core/Items/RollershutterItem.html#state-instance_method","n":"#state","p":"OpenHAB::Core::Items::RollershutterItem","d":null},{"u":"OpenHAB/Core/Items/RollershutterItem.html#stop-instance_method","n":"#stop","p":"OpenHAB::Core::Items::RollershutterItem","d":null},{"u":"OpenHAB/Core/Items/RollershutterItem.html#up-instance_method","n":"#up","p":"OpenHAB::Core::Items::RollershutterItem","d":null},{"u":"OpenHAB/Core/Items/RollershutterItem.html#up!-instance_method","n":"#up!","p":"OpenHAB::Core::Items::RollershutterItem","d":null},{"u":"OpenHAB/Core/Items/RollershutterItem.html#up%3F-instance_method","n":"#up?","p":"OpenHAB::Core::Items::RollershutterItem","d":null},{"u":"OpenHAB/Core/Items/Semantics/Provider.html#registry-class_method","n":"registry","p":"OpenHAB::Core::Items::Semantics::Provider","d":null},{"u":"OpenHAB/Core/Items/Semantics/SemanticTag.html#description-instance_method","n":"#description","p":"OpenHAB::Core::Items::Semantics::SemanticTag","d":null},{"u":"OpenHAB/Core/Items/Semantics/SemanticTag.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Items::Semantics::SemanticTag","d":null},{"u":"OpenHAB/Core/Items/Semantics/SemanticTag.html#label-instance_method","n":"#label","p":"OpenHAB::Core::Items::Semantics::SemanticTag","d":null},{"u":"OpenHAB/Core/Items/Semantics/SemanticTag.html#localized-instance_method","n":"#localized","p":"OpenHAB::Core::Items::Semantics::SemanticTag","d":null},{"u":"OpenHAB/Core/Items/Semantics/SemanticTag.html#name-instance_method","n":"#name","p":"OpenHAB::Core::Items::Semantics::SemanticTag","d":null},{"u":"OpenHAB/Core/Items/Semantics/SemanticTag.html#parent_uid-instance_method","n":"#parent_uid","p":"OpenHAB::Core::Items::Semantics::SemanticTag","d":null},{"u":"OpenHAB/Core/Items/Semantics/SemanticTag.html#synonyms-instance_method","n":"#synonyms","p":"OpenHAB::Core::Items::Semantics::SemanticTag","d":null},{"u":"OpenHAB/Core/Items/Semantics/SemanticTag.html#to_s-instance_method","n":"#to_s","p":"OpenHAB::Core::Items::Semantics::SemanticTag","d":null},{"u":"OpenHAB/Core/Items/Semantics/SemanticTag.html#uid-instance_method","n":"#uid","p":"OpenHAB::Core::Items::Semantics::SemanticTag","d":null},{"u":"OpenHAB/Core/Items/Semantics/TagClassMethods.html#description-instance_method","n":"#description","p":"OpenHAB::Core::Items::Semantics::TagClassMethods","d":null},{"u":"OpenHAB/Core/Items/Semantics/TagClassMethods.html#label-instance_method","n":"#label","p":"OpenHAB::Core::Items::Semantics::TagClassMethods","d":null},{"u":"OpenHAB/Core/Items/Semantics/TagClassMethods.html#synonyms-instance_method","n":"#synonyms","p":"OpenHAB::Core::Items::Semantics::TagClassMethods","d":null},{"u":"OpenHAB/Core/Items/Semantics/TagClassMethods.html#to_s-instance_method","n":"#to_s","p":"OpenHAB::Core::Items::Semantics::TagClassMethods","d":null},{"u":"OpenHAB/Core/Items/Semantics.html#equipment-instance_method","n":"#equipment","p":"OpenHAB::Core::Items::Semantics","d":null},{"u":"OpenHAB/Core/Items/Semantics.html#equipment%3F-instance_method","n":"#equipment?","p":"OpenHAB::Core::Items::Semantics","d":null},{"u":"OpenHAB/Core/Items/Semantics.html#equipment_type-instance_method","n":"#equipment_type","p":"OpenHAB::Core::Items::Semantics","d":null},{"u":"OpenHAB/Core/Items/Semantics.html#location-instance_method","n":"#location","p":"OpenHAB::Core::Items::Semantics","d":null},{"u":"OpenHAB/Core/Items/Semantics.html#location%3F-instance_method","n":"#location?","p":"OpenHAB::Core::Items::Semantics","d":null},{"u":"OpenHAB/Core/Items/Semantics.html#location_type-instance_method","n":"#location_type","p":"OpenHAB::Core::Items::Semantics","d":null},{"u":"OpenHAB/Core/Items/Semantics.html#point%3F-instance_method","n":"#point?","p":"OpenHAB::Core::Items::Semantics","d":null},{"u":"OpenHAB/Core/Items/Semantics.html#point_type-instance_method","n":"#point_type","p":"OpenHAB::Core::Items::Semantics","d":null},{"u":"OpenHAB/Core/Items/Semantics.html#points-instance_method","n":"#points","p":"OpenHAB::Core::Items::Semantics","d":null},{"u":"OpenHAB/Core/Items/Semantics.html#property_type-instance_method","n":"#property_type","p":"OpenHAB::Core::Items::Semantics","d":null},{"u":"OpenHAB/Core/Items/Semantics.html#semantic%3F-instance_method","n":"#semantic?","p":"OpenHAB::Core::Items::Semantics","d":null},{"u":"OpenHAB/Core/Items/Semantics.html#semantic_type-instance_method","n":"#semantic_type","p":"OpenHAB::Core::Items::Semantics","d":null},{"u":"OpenHAB/Core/Items/Semantics.html#add-class_method","n":"add","p":"OpenHAB::Core::Items::Semantics","d":null},{"u":"OpenHAB/Core/Items/Semantics.html#lookup-class_method","n":"lookup","p":"OpenHAB::Core::Items::Semantics","d":null},{"u":"OpenHAB/Core/Items/Semantics.html#remove-class_method","n":"remove","p":"OpenHAB::Core::Items::Semantics","d":null},{"u":"OpenHAB/Core/Items/Semantics.html#tags-class_method","n":"tags","p":"OpenHAB::Core::Items::Semantics","d":null},{"u":"OpenHAB/Core/Items/StateStorage.html#changed%3F-instance_method","n":"#changed?","p":"OpenHAB::Core::Items::StateStorage","d":null},{"u":"OpenHAB/Core/Items/StateStorage.html#restore-instance_method","n":"#restore","p":"OpenHAB::Core::Items::StateStorage","d":null},{"u":"OpenHAB/Core/Items/StateStorage.html#restore_changes-instance_method","n":"#restore_changes","p":"OpenHAB::Core::Items::StateStorage","d":null},{"u":"OpenHAB/Core/Items/StringItem.html#state-instance_method","n":"#state","p":"OpenHAB::Core::Items::StringItem","d":null},{"u":"OpenHAB/Core/Items/SwitchItem.html#off-instance_method","n":"#off","p":"OpenHAB::Core::Items::SwitchItem","d":null},{"u":"OpenHAB/Core/Items/SwitchItem.html#off!-instance_method","n":"#off!","p":"OpenHAB::Core::Items::SwitchItem","d":null},{"u":"OpenHAB/Core/Items/SwitchItem.html#off%3F-instance_method","n":"#off?","p":"OpenHAB::Core::Items::SwitchItem","d":null},{"u":"OpenHAB/Core/Items/SwitchItem.html#on-instance_method","n":"#on","p":"OpenHAB::Core::Items::SwitchItem","d":null},{"u":"OpenHAB/Core/Items/SwitchItem.html#on!-instance_method","n":"#on!","p":"OpenHAB::Core::Items::SwitchItem","d":null},{"u":"OpenHAB/Core/Items/SwitchItem.html#on%3F-instance_method","n":"#on?","p":"OpenHAB::Core::Items::SwitchItem","d":null},{"u":"OpenHAB/Core/Items/SwitchItem.html#state-instance_method","n":"#state","p":"OpenHAB::Core::Items::SwitchItem","d":null},{"u":"OpenHAB/Core/Items/SwitchItem.html#toggle-instance_method","n":"#toggle","p":"OpenHAB::Core::Items::SwitchItem","d":null},{"u":"OpenHAB/Core/Items.html#closed%3F-instance_method","n":"#closed?","p":"OpenHAB::Core::Items","d":null},{"u":"OpenHAB/Core/Items.html#fast_forward-instance_method","n":"#fast_forward","p":"OpenHAB::Core::Items","d":null},{"u":"OpenHAB/Core/Items.html#fast_forward!-instance_method","n":"#fast_forward!","p":"OpenHAB::Core::Items","d":null},{"u":"OpenHAB/Core/Items.html#fast_forwarding%3F-instance_method","n":"#fast_forwarding?","p":"OpenHAB::Core::Items","d":null},{"u":"OpenHAB/Core/Items.html#next-instance_method","n":"#next","p":"OpenHAB::Core::Items","d":null},{"u":"OpenHAB/Core/Items.html#open%3F-instance_method","n":"#open?","p":"OpenHAB::Core::Items","d":null},{"u":"OpenHAB/Core/Items.html#pause-instance_method","n":"#pause","p":"OpenHAB::Core::Items","d":null},{"u":"OpenHAB/Core/Items.html#pause!-instance_method","n":"#pause!","p":"OpenHAB::Core::Items","d":null},{"u":"OpenHAB/Core/Items.html#paused%3F-instance_method","n":"#paused?","p":"OpenHAB::Core::Items","d":null},{"u":"OpenHAB/Core/Items.html#play-instance_method","n":"#play","p":"OpenHAB::Core::Items","d":null},{"u":"OpenHAB/Core/Items.html#play!-instance_method","n":"#play!","p":"OpenHAB::Core::Items","d":null},{"u":"OpenHAB/Core/Items.html#play%3F-instance_method","n":"#play?","p":"OpenHAB::Core::Items","d":null},{"u":"OpenHAB/Core/Items.html#previous-instance_method","n":"#previous","p":"OpenHAB::Core::Items","d":null},{"u":"OpenHAB/Core/Items.html#rewind-instance_method","n":"#rewind","p":"OpenHAB::Core::Items","d":null},{"u":"OpenHAB/Core/Items.html#rewind!-instance_method","n":"#rewind!","p":"OpenHAB::Core::Items","d":null},{"u":"OpenHAB/Core/Items.html#rewinding%3F-instance_method","n":"#rewinding?","p":"OpenHAB::Core::Items","d":null},{"u":"OpenHAB/Core/Items.html#import_into_global_namespace-class_method","n":"import_into_global_namespace","p":"OpenHAB::Core::Items","d":null},{"u":"OpenHAB/Core/LazyArray.html#each-instance_method","n":"#each","p":"OpenHAB::Core::LazyArray","d":null},{"u":"OpenHAB/Core/LazyArray.html#method_missing-instance_method","n":"#method_missing","p":"OpenHAB::Core::LazyArray","d":null},{"u":"OpenHAB/Core/LazyArray.html#to_ary-instance_method","n":"#to_ary","p":"OpenHAB::Core::LazyArray","d":null},{"u":"OpenHAB/Core/Provider.html#[]-instance_method","n":"#[]","p":"OpenHAB::Core::Provider","d":null},{"u":"OpenHAB/Core/Provider.html#all-instance_method","n":"#all","p":"OpenHAB::Core::Provider","d":null},{"u":"OpenHAB/Core/Provider.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Provider","d":null},{"u":"OpenHAB/Core/Provider.html#current-class_method","n":"current","p":"OpenHAB::Core::Provider","d":null},{"u":"OpenHAB/Core/Provider.html#registry-class_method","n":"registry","p":"OpenHAB::Core::Provider","d":null},{"u":"OpenHAB/Core/Provider.html#type-class_method","n":"type","p":"OpenHAB::Core::Provider","d":null},{"u":"OpenHAB/Core/Proxy/EventSubscriber.html#event_filter-instance_method","n":"#event_filter","p":"OpenHAB::Core::Proxy::EventSubscriber","d":null},{"u":"OpenHAB/Core/Proxy/EventSubscriber.html#fetch-instance_method","n":"#fetch","p":"OpenHAB::Core::Proxy::EventSubscriber","d":null},{"u":"OpenHAB/Core/Proxy/EventSubscriber.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::Core::Proxy::EventSubscriber","d":null},{"u":"OpenHAB/Core/Proxy/EventSubscriber.html#receive-instance_method","n":"#receive","p":"OpenHAB::Core::Proxy::EventSubscriber","d":null},{"u":"OpenHAB/Core/Proxy/EventSubscriber.html#subscribed_event_types-instance_method","n":"#subscribed_event_types","p":"OpenHAB::Core::Proxy::EventSubscriber","d":null},{"u":"OpenHAB/Core/Registry.html#provider_for-instance_method","n":"#provider_for","p":"OpenHAB::Core::Registry","d":null},{"u":"OpenHAB/Core/Registry.html#providers-instance_method","n":"#providers","p":"OpenHAB::Core::Registry","d":null},{"u":"OpenHAB/Core/Rules/Provider.html#registry-class_method","n":"registry","p":"OpenHAB::Core::Rules::Provider","d":null},{"u":"OpenHAB/Core/Rules/Registry.html#[]-instance_method","n":"#[]","p":"OpenHAB::Core::Rules::Registry","d":null},{"u":"OpenHAB/Core/Rules/Registry.html#build-instance_method","n":"#build","p":"OpenHAB::Core::Rules::Registry","d":null},{"u":"OpenHAB/Core/Rules/Registry.html#remove-instance_method","n":"#remove","p":"OpenHAB::Core::Rules::Registry","d":null},{"u":"OpenHAB/Core/Rules/Registry.html#scenes-instance_method","n":"#scenes","p":"OpenHAB::Core::Rules::Registry","d":null},{"u":"OpenHAB/Core/Rules/Registry.html#scripts-instance_method","n":"#scripts","p":"OpenHAB::Core::Rules::Registry","d":null},{"u":"OpenHAB/Core/Rules/Registry.html#to_a-instance_method","n":"#to_a","p":"OpenHAB::Core::Rules::Registry","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#description-instance_method","n":"#description","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#disable-instance_method","n":"#disable","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#disabled%3F-instance_method","n":"#disabled?","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#enable-instance_method","n":"#enable","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#enabled%3F-instance_method","n":"#enabled?","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#expert%3F-instance_method","n":"#expert?","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#hidden%3F-instance_method","n":"#hidden?","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#idle%3F-instance_method","n":"#idle?","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#initializing%3F-instance_method","n":"#initializing?","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#name-instance_method","n":"#name","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#running%3F-instance_method","n":"#running?","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#status-instance_method","n":"#status","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#status_info-instance_method","n":"#status_info","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#tagged%3F-instance_method","n":"#tagged?","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#tags-instance_method","n":"#tags","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#to_s-instance_method","n":"#to_s","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#trigger-instance_method","n":"#trigger","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#uninitialized%3F-instance_method","n":"#uninitialized?","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/Rule.html#visible%3F-instance_method","n":"#visible?","p":"OpenHAB::Core::Rules::Rule","d":null},{"u":"OpenHAB/Core/Rules/TaggedArray.html#[]-instance_method","n":"#[]","p":"OpenHAB::Core::Rules::TaggedArray","d":null},{"u":"OpenHAB/Core/Rules/TaggedArray.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::Core::Rules::TaggedArray","d":null},{"u":"OpenHAB/Core/Rules/TaggedArray.html#to_a-instance_method","n":"#to_a","p":"OpenHAB::Core::Rules::TaggedArray","d":null},{"u":"OpenHAB/Core/Rules.html#manager-class_method","n":"manager","p":"OpenHAB::Core::Rules","d":null},{"u":"OpenHAB/Core/ScriptHandling.html#script_loaded-class_method","n":"script_loaded","p":"OpenHAB::Core::ScriptHandling","d":null},{"u":"OpenHAB/Core/ScriptHandling.html#script_unloaded-class_method","n":"script_unloaded","p":"OpenHAB::Core::ScriptHandling","d":null},{"u":"OpenHAB/Core/Sitemaps/Provider.html#build-instance_method","n":"#build","p":"OpenHAB::Core::Sitemaps::Provider","d":null},{"u":"OpenHAB/Core/Sitemaps/Provider.html#remove-instance_method","n":"#remove","p":"OpenHAB::Core::Sitemaps::Provider","d":null},{"u":"OpenHAB/Core/Sitemaps/Provider.html#update-instance_method","n":"#update","p":"OpenHAB::Core::Sitemaps::Provider","d":null},{"u":"OpenHAB/Core/Things/AbstractDescriptionType.html#description-instance_method","n":"#description","p":"OpenHAB::Core::Things::AbstractDescriptionType","d":null},{"u":"OpenHAB/Core/Things/AbstractDescriptionType.html#label-instance_method","n":"#label","p":"OpenHAB::Core::Things::AbstractDescriptionType","d":null},{"u":"OpenHAB/Core/Things/Channel.html#channel_type-instance_method","n":"#channel_type","p":"OpenHAB::Core::Things::Channel","d":null},{"u":"OpenHAB/Core/Things/Channel.html#channel_type_uid-instance_method","n":"#channel_type_uid","p":"OpenHAB::Core::Things::Channel","d":null},{"u":"OpenHAB/Core/Things/Channel.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Things::Channel","d":null},{"u":"OpenHAB/Core/Things/Channel.html#item-instance_method","n":"#item","p":"OpenHAB::Core::Things::Channel","d":null},{"u":"OpenHAB/Core/Things/Channel.html#item_name-instance_method","n":"#item_name","p":"OpenHAB::Core::Things::Channel","d":null},{"u":"OpenHAB/Core/Things/Channel.html#item_names-instance_method","n":"#item_names","p":"OpenHAB::Core::Things::Channel","d":null},{"u":"OpenHAB/Core/Things/Channel.html#items-instance_method","n":"#items","p":"OpenHAB::Core::Things::Channel","d":null},{"u":"OpenHAB/Core/Things/Channel.html#link-instance_method","n":"#link","p":"OpenHAB::Core::Things::Channel","d":null},{"u":"OpenHAB/Core/Things/Channel.html#links-instance_method","n":"#links","p":"OpenHAB::Core::Things::Channel","d":null},{"u":"OpenHAB/Core/Things/Channel.html#thing-instance_method","n":"#thing","p":"OpenHAB::Core::Things::Channel","d":null},{"u":"OpenHAB/Core/Things/Channel.html#to_s-instance_method","n":"#to_s","p":"OpenHAB::Core::Things::Channel","d":null},{"u":"OpenHAB/Core/Things/Channel.html#uid-instance_method","n":"#uid","p":"OpenHAB::Core::Things::Channel","d":null},{"u":"OpenHAB/Core/Things/Channel.html#unlink-instance_method","n":"#unlink","p":"OpenHAB::Core::Things::Channel","d":null},{"u":"OpenHAB/Core/Things/ChannelDefinition.html#auto_update_policy-instance_method","n":"#auto_update_policy","p":"OpenHAB::Core::Things::ChannelDefinition","d":null},{"u":"OpenHAB/Core/Things/ChannelDefinition.html#channel_type-instance_method","n":"#channel_type","p":"OpenHAB::Core::Things::ChannelDefinition","d":null},{"u":"OpenHAB/Core/Things/ChannelDefinition.html#channel_type_uid-instance_method","n":"#channel_type_uid","p":"OpenHAB::Core::Things::ChannelDefinition","d":null},{"u":"OpenHAB/Core/Things/ChannelDefinition.html#description-instance_method","n":"#description","p":"OpenHAB::Core::Things::ChannelDefinition","d":null},{"u":"OpenHAB/Core/Things/ChannelDefinition.html#id-instance_method","n":"#id","p":"OpenHAB::Core::Things::ChannelDefinition","d":null},{"u":"OpenHAB/Core/Things/ChannelDefinition.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Things::ChannelDefinition","d":null},{"u":"OpenHAB/Core/Things/ChannelDefinition.html#label-instance_method","n":"#label","p":"OpenHAB::Core::Things::ChannelDefinition","d":null},{"u":"OpenHAB/Core/Things/ChannelDefinition.html#properties-instance_method","n":"#properties","p":"OpenHAB::Core::Things::ChannelDefinition","d":null},{"u":"OpenHAB/Core/Things/ChannelDefinition.html#to_s-instance_method","n":"#to_s","p":"OpenHAB::Core::Things::ChannelDefinition","d":null},{"u":"OpenHAB/Core/Things/ChannelGroupDefinition.html#channel_group_type-instance_method","n":"#channel_group_type","p":"OpenHAB::Core::Things::ChannelGroupDefinition","d":null},{"u":"OpenHAB/Core/Things/ChannelGroupDefinition.html#channel_group_type_uid-instance_method","n":"#channel_group_type_uid","p":"OpenHAB::Core::Things::ChannelGroupDefinition","d":null},{"u":"OpenHAB/Core/Things/ChannelGroupDefinition.html#description-instance_method","n":"#description","p":"OpenHAB::Core::Things::ChannelGroupDefinition","d":null},{"u":"OpenHAB/Core/Things/ChannelGroupDefinition.html#id-instance_method","n":"#id","p":"OpenHAB::Core::Things::ChannelGroupDefinition","d":null},{"u":"OpenHAB/Core/Things/ChannelGroupDefinition.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Things::ChannelGroupDefinition","d":null},{"u":"OpenHAB/Core/Things/ChannelGroupDefinition.html#label-instance_method","n":"#label","p":"OpenHAB::Core::Things::ChannelGroupDefinition","d":null},{"u":"OpenHAB/Core/Things/ChannelGroupDefinition.html#to_s-instance_method","n":"#to_s","p":"OpenHAB::Core::Things::ChannelGroupDefinition","d":null},{"u":"OpenHAB/Core/Things/ChannelGroupType.html#category-instance_method","n":"#category","p":"OpenHAB::Core::Things::ChannelGroupType","d":null},{"u":"OpenHAB/Core/Things/ChannelGroupType.html#channel_definitions-instance_method","n":"#channel_definitions","p":"OpenHAB::Core::Things::ChannelGroupType","d":null},{"u":"OpenHAB/Core/Things/ChannelGroupType.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Things::ChannelGroupType","d":null},{"u":"OpenHAB/Core/Things/ChannelGroupType.html#to_s-instance_method","n":"#to_s","p":"OpenHAB::Core::Things::ChannelGroupType","d":null},{"u":"OpenHAB/Core/Things/ChannelGroupType.html#uid-instance_method","n":"#uid","p":"OpenHAB::Core::Things::ChannelGroupType","d":null},{"u":"OpenHAB/Core/Things/ChannelGroupTypeUID.html#category-instance_method","n":"#category","p":"OpenHAB::Core::Things::ChannelGroupTypeUID","d":null},{"u":"OpenHAB/Core/Things/ChannelGroupTypeUID.html#channel_definitions-instance_method","n":"#channel_definitions","p":"OpenHAB::Core::Things::ChannelGroupTypeUID","d":null},{"u":"OpenHAB/Core/Things/ChannelGroupTypeUID.html#channel_group_type-instance_method","n":"#channel_group_type","p":"OpenHAB::Core::Things::ChannelGroupTypeUID","d":null},{"u":"OpenHAB/Core/Things/ChannelGroupTypeUID.html#id-instance_method","n":"#id","p":"OpenHAB::Core::Things::ChannelGroupTypeUID","d":null},{"u":"OpenHAB/Core/Things/ChannelGroupUID.html#id-instance_method","n":"#id","p":"OpenHAB::Core::Things::ChannelGroupUID","d":null},{"u":"OpenHAB/Core/Things/ChannelGroupUID.html#thing_uid-instance_method","n":"#thing_uid","p":"OpenHAB::Core::Things::ChannelGroupUID","d":null},{"u":"OpenHAB/Core/Things/ChannelType.html#advanced%3F-instance_method","n":"#advanced?","p":"OpenHAB::Core::Things::ChannelType","d":null},{"u":"OpenHAB/Core/Things/ChannelType.html#auto_update_policy-instance_method","n":"#auto_update_policy","p":"OpenHAB::Core::Things::ChannelType","d":null},{"u":"OpenHAB/Core/Things/ChannelType.html#category-instance_method","n":"#category","p":"OpenHAB::Core::Things::ChannelType","d":null},{"u":"OpenHAB/Core/Things/ChannelType.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Things::ChannelType","d":null},{"u":"OpenHAB/Core/Things/ChannelType.html#item_type-instance_method","n":"#item_type","p":"OpenHAB::Core::Things::ChannelType","d":null},{"u":"OpenHAB/Core/Things/ChannelType.html#kind-instance_method","n":"#kind","p":"OpenHAB::Core::Things::ChannelType","d":null},{"u":"OpenHAB/Core/Things/ChannelType.html#tags-instance_method","n":"#tags","p":"OpenHAB::Core::Things::ChannelType","d":null},{"u":"OpenHAB/Core/Things/ChannelType.html#to_s-instance_method","n":"#to_s","p":"OpenHAB::Core::Things::ChannelType","d":null},{"u":"OpenHAB/Core/Things/ChannelType.html#uid-instance_method","n":"#uid","p":"OpenHAB::Core::Things::ChannelType","d":null},{"u":"OpenHAB/Core/Things/ChannelTypeUID.html#advanced%3F-instance_method","n":"#advanced?","p":"OpenHAB::Core::Things::ChannelTypeUID","d":null},{"u":"OpenHAB/Core/Things/ChannelTypeUID.html#auto_update_policy-instance_method","n":"#auto_update_policy","p":"OpenHAB::Core::Things::ChannelTypeUID","d":null},{"u":"OpenHAB/Core/Things/ChannelTypeUID.html#category-instance_method","n":"#category","p":"OpenHAB::Core::Things::ChannelTypeUID","d":null},{"u":"OpenHAB/Core/Things/ChannelTypeUID.html#channel_type-instance_method","n":"#channel_type","p":"OpenHAB::Core::Things::ChannelTypeUID","d":null},{"u":"OpenHAB/Core/Things/ChannelTypeUID.html#id-instance_method","n":"#id","p":"OpenHAB::Core::Things::ChannelTypeUID","d":null},{"u":"OpenHAB/Core/Things/ChannelTypeUID.html#item_type-instance_method","n":"#item_type","p":"OpenHAB::Core::Things::ChannelTypeUID","d":null},{"u":"OpenHAB/Core/Things/ChannelTypeUID.html#tags-instance_method","n":"#tags","p":"OpenHAB::Core::Things::ChannelTypeUID","d":null},{"u":"OpenHAB/Core/Things/ChannelUID.html#channel-instance_method","n":"#channel","p":"OpenHAB::Core::Things::ChannelUID","d":null},{"u":"OpenHAB/Core/Things/ChannelUID.html#group_id-instance_method","n":"#group_id","p":"OpenHAB::Core::Things::ChannelUID","d":null},{"u":"OpenHAB/Core/Things/ChannelUID.html#id-instance_method","n":"#id","p":"OpenHAB::Core::Things::ChannelUID","d":null},{"u":"OpenHAB/Core/Things/ChannelUID.html#id_without_group-instance_method","n":"#id_without_group","p":"OpenHAB::Core::Things::ChannelUID","d":null},{"u":"OpenHAB/Core/Things/ChannelUID.html#in_group%3F-instance_method","n":"#in_group?","p":"OpenHAB::Core::Things::ChannelUID","d":null},{"u":"OpenHAB/Core/Things/ChannelUID.html#item-instance_method","n":"#item","p":"OpenHAB::Core::Things::ChannelUID","d":null},{"u":"OpenHAB/Core/Things/ChannelUID.html#items-instance_method","n":"#items","p":"OpenHAB::Core::Things::ChannelUID","d":null},{"u":"OpenHAB/Core/Things/ChannelUID.html#thing-instance_method","n":"#thing","p":"OpenHAB::Core::Things::ChannelUID","d":null},{"u":"OpenHAB/Core/Things/ChannelUID.html#thing_uid-instance_method","n":"#thing_uid","p":"OpenHAB::Core::Things::ChannelUID","d":null},{"u":"OpenHAB/Core/Things/ItemChannelLink.html#channel-instance_method","n":"#channel","p":"OpenHAB::Core::Things::ItemChannelLink","d":null},{"u":"OpenHAB/Core/Things/ItemChannelLink.html#channel_uid-instance_method","n":"#channel_uid","p":"OpenHAB::Core::Things::ItemChannelLink","d":null},{"u":"OpenHAB/Core/Things/ItemChannelLink.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Things::ItemChannelLink","d":null},{"u":"OpenHAB/Core/Things/ItemChannelLink.html#item-instance_method","n":"#item","p":"OpenHAB::Core::Things::ItemChannelLink","d":null},{"u":"OpenHAB/Core/Things/ItemChannelLink.html#thing-instance_method","n":"#thing","p":"OpenHAB::Core::Things::ItemChannelLink","d":null},{"u":"OpenHAB/Core/Things/Links/Provider.html#remove_links_for_item-instance_method","n":"#remove_links_for_item","p":"OpenHAB::Core::Things::Links::Provider","d":null},{"u":"OpenHAB/Core/Things/Links/Provider.html#remove_links_for_thing-instance_method","n":"#remove_links_for_thing","p":"OpenHAB::Core::Things::Links::Provider","d":null},{"u":"OpenHAB/Core/Things/Links/Provider.html#registry-class_method","n":"registry","p":"OpenHAB::Core::Things::Links::Provider","d":null},{"u":"OpenHAB/Core/Things/ProfileCallback.html#handle_command-instance_method","n":"#handle_command","p":"OpenHAB::Core::Things::ProfileCallback","d":null},{"u":"OpenHAB/Core/Things/ProfileCallback.html#send_command-instance_method","n":"#send_command","p":"OpenHAB::Core::Things::ProfileCallback","d":null},{"u":"OpenHAB/Core/Things/ProfileCallback.html#send_time_series-instance_method","n":"#send_time_series","p":"OpenHAB::Core::Things::ProfileCallback","d":null},{"u":"OpenHAB/Core/Things/ProfileCallback.html#send_update-instance_method","n":"#send_update","p":"OpenHAB::Core::Things::ProfileCallback","d":null},{"u":"OpenHAB/Core/Things/Provider.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::Core::Things::Provider","d":null},{"u":"OpenHAB/Core/Things/Provider.html#registry-class_method","n":"registry","p":"OpenHAB::Core::Things::Provider","d":null},{"u":"OpenHAB/Core/Things/Registry.html#[]-instance_method","n":"#[]","p":"OpenHAB::Core::Things::Registry","d":null},{"u":"OpenHAB/Core/Things/Registry.html#build-instance_method","n":"#build","p":"OpenHAB::Core::Things::Registry","d":null},{"u":"OpenHAB/Core/Things/Registry.html#remove-instance_method","n":"#remove","p":"OpenHAB::Core::Things::Registry","d":null},{"u":"OpenHAB/Core/Things/Registry.html#to_a-instance_method","n":"#to_a","p":"OpenHAB::Core::Things::Registry","d":null},{"u":"OpenHAB/Core/Things/Thing/ChannelsArray.html#[]-instance_method","n":"#[]","p":"OpenHAB::Core::Things::Thing::ChannelsArray","d":null},{"u":"OpenHAB/Core/Things/Thing/ChannelsArray.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::Core::Things::Thing::ChannelsArray","d":null},{"u":"OpenHAB/Core/Things/Thing.html#actions-instance_method","n":"#actions","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#bridge-instance_method","n":"#bridge","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#bridge%3F-instance_method","n":"#bridge?","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#bridge_uid-instance_method","n":"#bridge_uid","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#channels-instance_method","n":"#channels","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#config_eql%3F-instance_method","n":"#config_eql?","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#configuration-instance_method","n":"#configuration","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#disable-instance_method","n":"#disable","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#enable-instance_method","n":"#enable","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#initialized%3F-instance_method","n":"#initialized?","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#label-instance_method","n":"#label","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#location-instance_method","n":"#location","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#method_missing-instance_method","n":"#method_missing","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#offline%3F-instance_method","n":"#offline?","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#online%3F-instance_method","n":"#online?","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#properties-instance_method","n":"#properties","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#provider-instance_method","n":"#provider","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#removed%3F-instance_method","n":"#removed?","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#removing%3F-instance_method","n":"#removing?","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#status-instance_method","n":"#status","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#thing_type-instance_method","n":"#thing_type","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#thing_type_uid-instance_method","n":"#thing_type_uid","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#to_s-instance_method","n":"#to_s","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#uid-instance_method","n":"#uid","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#uninitialized%3F-instance_method","n":"#uninitialized?","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/Thing.html#unknown%3F-instance_method","n":"#unknown?","p":"OpenHAB::Core::Things::Thing","d":null},{"u":"OpenHAB/Core/Things/ThingType.html#category-instance_method","n":"#category","p":"OpenHAB::Core::Things::ThingType","d":null},{"u":"OpenHAB/Core/Things/ThingType.html#channel_definitions-instance_method","n":"#channel_definitions","p":"OpenHAB::Core::Things::ThingType","d":null},{"u":"OpenHAB/Core/Things/ThingType.html#channel_group_definitions-instance_method","n":"#channel_group_definitions","p":"OpenHAB::Core::Things::ThingType","d":null},{"u":"OpenHAB/Core/Things/ThingType.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Things::ThingType","d":null},{"u":"OpenHAB/Core/Things/ThingType.html#listed%3F-instance_method","n":"#listed?","p":"OpenHAB::Core::Things::ThingType","d":null},{"u":"OpenHAB/Core/Things/ThingType.html#properties-instance_method","n":"#properties","p":"OpenHAB::Core::Things::ThingType","d":null},{"u":"OpenHAB/Core/Things/ThingType.html#supported_bridge_type_uids-instance_method","n":"#supported_bridge_type_uids","p":"OpenHAB::Core::Things::ThingType","d":null},{"u":"OpenHAB/Core/Things/ThingType.html#to_s-instance_method","n":"#to_s","p":"OpenHAB::Core::Things::ThingType","d":null},{"u":"OpenHAB/Core/Things/ThingType.html#uid-instance_method","n":"#uid","p":"OpenHAB::Core::Things::ThingType","d":null},{"u":"OpenHAB/Core/Things/ThingTypeUID.html#category-instance_method","n":"#category","p":"OpenHAB::Core::Things::ThingTypeUID","d":null},{"u":"OpenHAB/Core/Things/ThingTypeUID.html#channel_definitions-instance_method","n":"#channel_definitions","p":"OpenHAB::Core::Things::ThingTypeUID","d":null},{"u":"OpenHAB/Core/Things/ThingTypeUID.html#channel_group_definitions-instance_method","n":"#channel_group_definitions","p":"OpenHAB::Core::Things::ThingTypeUID","d":null},{"u":"OpenHAB/Core/Things/ThingTypeUID.html#id-instance_method","n":"#id","p":"OpenHAB::Core::Things::ThingTypeUID","d":null},{"u":"OpenHAB/Core/Things/ThingTypeUID.html#listed%3F-instance_method","n":"#listed?","p":"OpenHAB::Core::Things::ThingTypeUID","d":null},{"u":"OpenHAB/Core/Things/ThingTypeUID.html#properties-instance_method","n":"#properties","p":"OpenHAB::Core::Things::ThingTypeUID","d":null},{"u":"OpenHAB/Core/Things/ThingTypeUID.html#supported_bridge_type_uids-instance_method","n":"#supported_bridge_type_uids","p":"OpenHAB::Core::Things::ThingTypeUID","d":null},{"u":"OpenHAB/Core/Things/ThingTypeUID.html#thing_type-instance_method","n":"#thing_type","p":"OpenHAB::Core::Things::ThingTypeUID","d":null},{"u":"OpenHAB/Core/Things/ThingUID.html#bridge_ids-instance_method","n":"#bridge_ids","p":"OpenHAB::Core::Things::ThingUID","d":null},{"u":"OpenHAB/Core/Things/ThingUID.html#id-instance_method","n":"#id","p":"OpenHAB::Core::Things::ThingUID","d":null},{"u":"OpenHAB/Core/Things/ThingUID.html#thing-instance_method","n":"#thing","p":"OpenHAB::Core::Things::ThingUID","d":null},{"u":"OpenHAB/Core/Things/UID.html#binding_id-instance_method","n":"#binding_id","p":"OpenHAB::Core::Things::UID","d":null},{"u":"OpenHAB/Core/Things/UID.html#category-instance_method","n":"#category","p":"OpenHAB::Core::Things::UID","d":null},{"u":"OpenHAB/Core/Timer.html#active%3F-instance_method","n":"#active?","p":"OpenHAB::Core::Timer","d":null},{"u":"OpenHAB/Core/Timer.html#cancel-instance_method","n":"#cancel","p":"OpenHAB::Core::Timer","d":null},{"u":"OpenHAB/Core/Timer.html#cancelled%3F-instance_method","n":"#cancelled?","p":"OpenHAB::Core::Timer","d":null},{"u":"OpenHAB/Core/Timer.html#execution_time-instance_method","n":"#execution_time","p":"OpenHAB::Core::Timer","d":null},{"u":"OpenHAB/Core/Timer.html#id-instance_method","n":"#id","p":"OpenHAB::Core::Timer","d":null},{"u":"OpenHAB/Core/Timer.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Core::Timer","d":null},{"u":"OpenHAB/Core/Timer.html#reschedule-instance_method","n":"#reschedule","p":"OpenHAB::Core::Timer","d":null},{"u":"OpenHAB/Core/Timer.html#running%3F-instance_method","n":"#running?","p":"OpenHAB::Core::Timer","d":null},{"u":"OpenHAB/Core/Timer.html#terminated%3F-instance_method","n":"#terminated?","p":"OpenHAB::Core::Timer","d":null},{"u":"OpenHAB/Core/Types/DateTimeType.html#%2B-instance_method","n":"#+","p":"OpenHAB::Core::Types::DateTimeType","d":null},{"u":"OpenHAB/Core/Types/DateTimeType.html#--instance_method","n":"#-","p":"OpenHAB::Core::Types::DateTimeType","d":null},{"u":"OpenHAB/Core/Types/DateTimeType.html#<=>-instance_method","n":"#<=>","p":"OpenHAB::Core::Types::DateTimeType","d":null},{"u":"OpenHAB/Core/Types/DateTimeType.html#coerce-instance_method","n":"#coerce","p":"OpenHAB::Core::Types::DateTimeType","d":null},{"u":"OpenHAB/Core/Types/DateTimeType.html#eql%3F-instance_method","n":"#eql?","p":"OpenHAB::Core::Types::DateTimeType","d":null},{"u":"OpenHAB/Core/Types/DateTimeType.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::Core::Types::DateTimeType","d":null},{"u":"OpenHAB/Core/Types/DateTimeType.html#method_missing-instance_method","n":"#method_missing","p":"OpenHAB::Core::Types::DateTimeType","d":null},{"u":"OpenHAB/Core/Types/DateTimeType.html#to_f-instance_method","n":"#to_f","p":"OpenHAB::Core::Types::DateTimeType","d":null},{"u":"OpenHAB/Core/Types/DateTimeType.html#to_instant-instance_method","n":"#to_instant","p":"OpenHAB::Core::Types::DateTimeType","d":null},{"u":"OpenHAB/Core/Types/DateTimeType.html#to_zoned_date_time-instance_method","n":"#to_zoned_date_time","p":"OpenHAB::Core::Types::DateTimeType","d":null},{"u":"OpenHAB/Core/Types/DateTimeType.html#utc%3F-instance_method","n":"#utc?","p":"OpenHAB::Core::Types::DateTimeType","d":null},{"u":"OpenHAB/Core/Types/DateTimeType.html#utc_offset-instance_method","n":"#utc_offset","p":"OpenHAB::Core::Types::DateTimeType","d":null},{"u":"OpenHAB/Core/Types/DateTimeType.html#wday-instance_method","n":"#wday","p":"OpenHAB::Core::Types::DateTimeType","d":null},{"u":"OpenHAB/Core/Types/DateTimeType.html#zone-instance_method","n":"#zone","p":"OpenHAB::Core::Types::DateTimeType","d":1},{"u":"OpenHAB/Core/Types/DateTimeType.html#parse-class_method","n":"parse","p":"OpenHAB::Core::Types::DateTimeType","d":null},{"u":"OpenHAB/Core/Types/DecimalType.html#-@-instance_method","n":"#-@","p":"OpenHAB::Core::Types::DecimalType","d":null},{"u":"OpenHAB/Core/Types/DecimalType.html#<=>-instance_method","n":"#<=>","p":"OpenHAB::Core::Types::DecimalType","d":null},{"u":"OpenHAB/Core/Types/DecimalType.html#coerce-instance_method","n":"#coerce","p":"OpenHAB::Core::Types::DecimalType","d":null},{"u":"OpenHAB/Core/Types/DecimalType.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::Core::Types::DecimalType","d":null},{"u":"OpenHAB/Core/Types/DecimalType.html#%7C-instance_method","n":"#|","p":"OpenHAB::Core::Types::DecimalType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#<=>-instance_method","n":"#<=>","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#argb-instance_method","n":"#argb","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#blue-instance_method","n":"#blue","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#brightness-instance_method","n":"#brightness","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#cct-instance_method","n":"#cct","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#duv-instance_method","n":"#duv","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#green-instance_method","n":"#green","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#hue-instance_method","n":"#hue","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#planckian%3F-instance_method","n":"#planckian?","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#planckian_cct-instance_method","n":"#planckian_cct","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#red-instance_method","n":"#red","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#rgb-instance_method","n":"#rgb","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#saturation-instance_method","n":"#saturation","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#to_hex-instance_method","n":"#to_hex","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#to_rgb-instance_method","n":"#to_rgb","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#to_xy-instance_method","n":"#to_xy","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#from_cct-class_method","n":"from_cct","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#from_hsb-class_method","n":"from_hsb","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#from_rgb-class_method","n":"from_rgb","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/HSBType.html#from_xy-class_method","n":"from_xy","p":"OpenHAB::Core::Types::HSBType","d":null},{"u":"OpenHAB/Core/Types/IncreaseDecreaseType.html#decrease%3F-instance_method","n":"#decrease?","p":"OpenHAB::Core::Types::IncreaseDecreaseType","d":null},{"u":"OpenHAB/Core/Types/IncreaseDecreaseType.html#increase%3F-instance_method","n":"#increase?","p":"OpenHAB::Core::Types::IncreaseDecreaseType","d":null},{"u":"OpenHAB/Core/Types/NextPreviousType.html#next%3F-instance_method","n":"#next?","p":"OpenHAB::Core::Types::NextPreviousType","d":null},{"u":"OpenHAB/Core/Types/NextPreviousType.html#previous%3F-instance_method","n":"#previous?","p":"OpenHAB::Core::Types::NextPreviousType","d":null},{"u":"OpenHAB/Core/Types/NumericType.html#%2B@-instance_method","n":"#+@","p":"OpenHAB::Core::Types::NumericType","d":null},{"u":"OpenHAB/Core/Types/NumericType.html#eql%3F-instance_method","n":"#eql?","p":"OpenHAB::Core::Types::NumericType","d":null},{"u":"OpenHAB/Core/Types/NumericType.html#to_d-instance_method","n":"#to_d","p":"OpenHAB::Core::Types::NumericType","d":null},{"u":"OpenHAB/Core/Types/NumericType.html#to_f-instance_method","n":"#to_f","p":"OpenHAB::Core::Types::NumericType","d":null},{"u":"OpenHAB/Core/Types/NumericType.html#to_i-instance_method","n":"#to_i","p":"OpenHAB::Core::Types::NumericType","d":null},{"u":"OpenHAB/Core/Types/OnOffType.html#!-instance_method","n":"#!","p":"OpenHAB::Core::Types::OnOffType","d":null},{"u":"OpenHAB/Core/Types/OnOffType.html#off%3F-instance_method","n":"#off?","p":"OpenHAB::Core::Types::OnOffType","d":null},{"u":"OpenHAB/Core/Types/OnOffType.html#on%3F-instance_method","n":"#on?","p":"OpenHAB::Core::Types::OnOffType","d":null},{"u":"OpenHAB/Core/Types/OpenClosedType.html#!-instance_method","n":"#!","p":"OpenHAB::Core::Types::OpenClosedType","d":null},{"u":"OpenHAB/Core/Types/OpenClosedType.html#closed%3F-instance_method","n":"#closed?","p":"OpenHAB::Core::Types::OpenClosedType","d":null},{"u":"OpenHAB/Core/Types/OpenClosedType.html#open%3F-instance_method","n":"#open?","p":"OpenHAB::Core::Types::OpenClosedType","d":null},{"u":"OpenHAB/Core/Types/PercentType.html#down%3F-instance_method","n":"#down?","p":"OpenHAB::Core::Types::PercentType","d":null},{"u":"OpenHAB/Core/Types/PercentType.html#off%3F-instance_method","n":"#off?","p":"OpenHAB::Core::Types::PercentType","d":null},{"u":"OpenHAB/Core/Types/PercentType.html#on%3F-instance_method","n":"#on?","p":"OpenHAB::Core::Types::PercentType","d":null},{"u":"OpenHAB/Core/Types/PercentType.html#scale-instance_method","n":"#scale","p":"OpenHAB::Core::Types::PercentType","d":null},{"u":"OpenHAB/Core/Types/PercentType.html#to_byte-instance_method","n":"#to_byte","p":"OpenHAB::Core::Types::PercentType","d":null},{"u":"OpenHAB/Core/Types/PercentType.html#up%3F-instance_method","n":"#up?","p":"OpenHAB::Core::Types::PercentType","d":null},{"u":"OpenHAB/Core/Types/PlayPauseType.html#paused%3F-instance_method","n":"#paused?","p":"OpenHAB::Core::Types::PlayPauseType","d":null},{"u":"OpenHAB/Core/Types/PlayPauseType.html#playing%3F-instance_method","n":"#playing?","p":"OpenHAB::Core::Types::PlayPauseType","d":null},{"u":"OpenHAB/Core/Types/PointType.html#==-instance_method","n":"#==","p":"OpenHAB::Core::Types::PointType","d":null},{"u":"OpenHAB/Core/Types/PointType.html#altitude-instance_method","n":"#altitude","p":"OpenHAB::Core::Types::PointType","d":null},{"u":"OpenHAB/Core/Types/PointType.html#distance_from-instance_method","n":"#distance_from","p":"OpenHAB::Core::Types::PointType","d":null},{"u":"OpenHAB/Core/Types/PointType.html#eql%3F-instance_method","n":"#eql?","p":"OpenHAB::Core::Types::PointType","d":null},{"u":"OpenHAB/Core/Types/PointType.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::Core::Types::PointType","d":null},{"u":"OpenHAB/Core/Types/PointType.html#latitude-instance_method","n":"#latitude","p":"OpenHAB::Core::Types::PointType","d":null},{"u":"OpenHAB/Core/Types/PointType.html#longitude-instance_method","n":"#longitude","p":"OpenHAB::Core::Types::PointType","d":null},{"u":"OpenHAB/Core/Types/QuantityType.html#-@-instance_method","n":"#-@","p":"OpenHAB::Core::Types::QuantityType","d":null},{"u":"OpenHAB/Core/Types/QuantityType.html#<=>-instance_method","n":"#<=>","p":"OpenHAB::Core::Types::QuantityType","d":null},{"u":"OpenHAB/Core/Types/QuantityType.html#coerce-instance_method","n":"#coerce","p":"OpenHAB::Core::Types::QuantityType","d":null},{"u":"OpenHAB/Core/Types/QuantityType.html#to_invertible_unit-instance_method","n":"#to_invertible_unit","p":"OpenHAB::Core::Types::QuantityType","d":null},{"u":"OpenHAB/Core/Types/RawType.html#bytes-instance_method","n":"#bytes","p":"OpenHAB::Core::Types::RawType","d":null},{"u":"OpenHAB/Core/Types/RawType.html#mime_type-instance_method","n":"#mime_type","p":"OpenHAB::Core::Types::RawType","d":null},{"u":"OpenHAB/Core/Types/RefreshType.html#refresh%3F-instance_method","n":"#refresh?","p":"OpenHAB::Core::Types::RefreshType","d":null},{"u":"OpenHAB/Core/Types/RewindFastforwardType.html#fast_forwarding%3F-instance_method","n":"#fast_forwarding?","p":"OpenHAB::Core::Types::RewindFastforwardType","d":null},{"u":"OpenHAB/Core/Types/RewindFastforwardType.html#rewinding%3F-instance_method","n":"#rewinding?","p":"OpenHAB::Core::Types::RewindFastforwardType","d":null},{"u":"OpenHAB/Core/Types/StopMoveType.html#move%3F-instance_method","n":"#move?","p":"OpenHAB::Core::Types::StopMoveType","d":null},{"u":"OpenHAB/Core/Types/StopMoveType.html#stop%3F-instance_method","n":"#stop?","p":"OpenHAB::Core::Types::StopMoveType","d":null},{"u":"OpenHAB/Core/Types/StringListType.html#to_a-instance_method","n":"#to_a","p":"OpenHAB::Core::Types::StringListType","d":null},{"u":"OpenHAB/Core/Types/StringType.html#<=>-instance_method","n":"#<=>","p":"OpenHAB::Core::Types::StringType","d":null},{"u":"OpenHAB/Core/Types/StringType.html#coerce-instance_method","n":"#coerce","p":"OpenHAB::Core::Types::StringType","d":null},{"u":"OpenHAB/Core/Types/StringType.html#eql%3F-instance_method","n":"#eql?","p":"OpenHAB::Core::Types::StringType","d":null},{"u":"OpenHAB/Core/Types/TimeSeries.html#<<-instance_method","n":"#<<","p":"OpenHAB::Core::Types::TimeSeries","d":null},{"u":"OpenHAB/Core/Types/TimeSeries.html#add-instance_method","n":"#add","p":"OpenHAB::Core::Types::TimeSeries","d":null},{"u":"OpenHAB/Core/Types/TimeSeries.html#add%3F-instance_method","n":"#add?","p":"OpenHAB::Core::Types::TimeSeries","d":null},{"u":"OpenHAB/Core/Types/TimeSeries.html#begin-instance_method","n":"#begin","p":"OpenHAB::Core::Types::TimeSeries","d":null},{"u":"OpenHAB/Core/Types/TimeSeries.html#end-instance_method","n":"#end","p":"OpenHAB::Core::Types::TimeSeries","d":null},{"u":"OpenHAB/Core/Types/TimeSeries.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::Core::Types::TimeSeries","d":null},{"u":"OpenHAB/Core/Types/TimeSeries.html#policy-instance_method","n":"#policy","p":"OpenHAB::Core::Types::TimeSeries","d":null},{"u":"OpenHAB/Core/Types/TimeSeries.html#replace%3F-instance_method","n":"#replace?","p":"OpenHAB::Core::Types::TimeSeries","d":null},{"u":"OpenHAB/Core/Types/TimeSeries.html#size-instance_method","n":"#size","p":"OpenHAB::Core::Types::TimeSeries","d":null},{"u":"OpenHAB/Core/Types/TimeSeries.html#states-instance_method","n":"#states","p":"OpenHAB::Core::Types::TimeSeries","d":null},{"u":"OpenHAB/Core/Types/TimeSeries.html#to_a-instance_method","n":"#to_a","p":"OpenHAB::Core::Types::TimeSeries","d":null},{"u":"OpenHAB/Core/Types/Type.html#==-instance_method","n":"#==","p":"OpenHAB::Core::Types::Type","d":null},{"u":"OpenHAB/Core/Types/Type.html#eql%3F-instance_method","n":"#eql?","p":"OpenHAB::Core::Types::Type","d":null},{"u":"OpenHAB/Core/Types/UnDefType.html#null%3F-instance_method","n":"#null?","p":"OpenHAB::Core::Types::UnDefType","d":null},{"u":"OpenHAB/Core/Types/UnDefType.html#undef%3F-instance_method","n":"#undef?","p":"OpenHAB::Core::Types::UnDefType","d":null},{"u":"OpenHAB/Core/Types/UpDownType.html#!-instance_method","n":"#!","p":"OpenHAB::Core::Types::UpDownType","d":null},{"u":"OpenHAB/Core/Types/UpDownType.html#down%3F-instance_method","n":"#down?","p":"OpenHAB::Core::Types::UpDownType","d":null},{"u":"OpenHAB/Core/Types/UpDownType.html#up%3F-instance_method","n":"#up?","p":"OpenHAB::Core::Types::UpDownType","d":null},{"u":"OpenHAB/Core/ValueCache.html#[]-instance_method","n":"#[]","p":"OpenHAB::Core::ValueCache","d":null},{"u":"OpenHAB/Core/ValueCache.html#[]=-instance_method","n":"#[]=","p":"OpenHAB::Core::ValueCache","d":null},{"u":"OpenHAB/Core/ValueCache.html#assoc-instance_method","n":"#assoc","p":"OpenHAB::Core::ValueCache","d":null},{"u":"OpenHAB/Core/ValueCache.html#compute_if_absent-instance_method","n":"#compute_if_absent","p":"OpenHAB::Core::ValueCache","d":null},{"u":"OpenHAB/Core/ValueCache.html#delete-instance_method","n":"#delete","p":"OpenHAB::Core::ValueCache","d":null},{"u":"OpenHAB/Core/ValueCache.html#dig-instance_method","n":"#dig","p":"OpenHAB::Core::ValueCache","d":null},{"u":"OpenHAB/Core/ValueCache.html#fetch-instance_method","n":"#fetch","p":"OpenHAB::Core::ValueCache","d":null},{"u":"OpenHAB/Core/ValueCache.html#fetch_values-instance_method","n":"#fetch_values","p":"OpenHAB::Core::ValueCache","d":null},{"u":"OpenHAB/Core/ValueCache.html#key%3F-instance_method","n":"#key?","p":"OpenHAB::Core::ValueCache","d":null},{"u":"OpenHAB/Core/ValueCache.html#merge!-instance_method","n":"#merge!","p":"OpenHAB::Core::ValueCache","d":null},{"u":"OpenHAB/Core/ValueCache.html#slice-instance_method","n":"#slice","p":"OpenHAB::Core::ValueCache","d":null},{"u":"OpenHAB/Core/ValueCache.html#to_proc-instance_method","n":"#to_proc","p":"OpenHAB::Core::ValueCache","d":null},{"u":"OpenHAB/Core/ValueCache.html#values_at-instance_method","n":"#values_at","p":"OpenHAB::Core::ValueCache","d":null},{"u":"OpenHAB/Core.html#automation_manager-class_method","n":"automation_manager","p":"OpenHAB::Core","d":null},{"u":"OpenHAB/Core.html#config_folder-class_method","n":"config_folder","p":"OpenHAB::Core","d":null},{"u":"OpenHAB/Core.html#import_preset-class_method","n":"import_preset","p":"OpenHAB::Core","d":null},{"u":"OpenHAB/CoreExt/Between.html#between%3F-instance_method","n":"#between?","p":"OpenHAB::CoreExt::Between","d":null},{"u":"OpenHAB/CoreExt/Ephemeris.html#days_until-instance_method","n":"#days_until","p":"OpenHAB::CoreExt::Ephemeris","d":null},{"u":"OpenHAB/CoreExt/Ephemeris.html#holiday-instance_method","n":"#holiday","p":"OpenHAB::CoreExt::Ephemeris","d":null},{"u":"OpenHAB/CoreExt/Ephemeris.html#holiday%3F-instance_method","n":"#holiday?","p":"OpenHAB::CoreExt::Ephemeris","d":null},{"u":"OpenHAB/CoreExt/Ephemeris.html#in_dayset%3F-instance_method","n":"#in_dayset?","p":"OpenHAB::CoreExt::Ephemeris","d":null},{"u":"OpenHAB/CoreExt/Ephemeris.html#next_holiday-instance_method","n":"#next_holiday","p":"OpenHAB::CoreExt::Ephemeris","d":null},{"u":"OpenHAB/CoreExt/Ephemeris.html#weekend%3F-instance_method","n":"#weekend?","p":"OpenHAB::CoreExt::Ephemeris","d":null},{"u":"OpenHAB/CoreExt/Java/Class.html#ancestors-instance_method","n":"#ancestors","p":"OpenHAB::CoreExt::Java::Class","d":null},{"u":"OpenHAB/CoreExt/Java/Class.html#generic_ancestors-instance_method","n":"#generic_ancestors","p":"OpenHAB::CoreExt::Java::Class","d":null},{"u":"OpenHAB/CoreExt/Java/Duration.html#<=>-instance_method","n":"#<=>","p":"OpenHAB::CoreExt::Java::Duration","d":null},{"u":"OpenHAB/CoreExt/Java/Duration.html#coerce-instance_method","n":"#coerce","p":"OpenHAB::CoreExt::Java::Duration","d":null},{"u":"OpenHAB/CoreExt/Java/Duration.html#positive%3F-instance_method","n":"#positive?","p":"OpenHAB::CoreExt::Java::Duration","d":null},{"u":"OpenHAB/CoreExt/Java/Duration.html#to_f-instance_method","n":"#to_f","p":"OpenHAB::CoreExt::Java::Duration","d":null},{"u":"OpenHAB/CoreExt/Java/Duration.html#to_i-instance_method","n":"#to_i","p":"OpenHAB::CoreExt::Java::Duration","d":null},{"u":"OpenHAB/CoreExt/Java/Duration.html#zero%3F-instance_method","n":"#zero?","p":"OpenHAB::CoreExt::Java::Duration","d":null},{"u":"OpenHAB/CoreExt/Java/Instant.html#%2B-instance_method","n":"#+","p":"OpenHAB::CoreExt::Java::Instant","d":null},{"u":"OpenHAB/CoreExt/Java/Instant.html#--instance_method","n":"#-","p":"OpenHAB::CoreExt::Java::Instant","d":null},{"u":"OpenHAB/CoreExt/Java/Instant.html#<=>-instance_method","n":"#<=>","p":"OpenHAB::CoreExt::Java::Instant","d":null},{"u":"OpenHAB/CoreExt/Java/Instant.html#coerce-instance_method","n":"#coerce","p":"OpenHAB::CoreExt::Java::Instant","d":null},{"u":"OpenHAB/CoreExt/Java/Instant.html#to_date-instance_method","n":"#to_date","p":"OpenHAB::CoreExt::Java::Instant","d":null},{"u":"OpenHAB/CoreExt/Java/Instant.html#to_f-instance_method","n":"#to_f","p":"OpenHAB::CoreExt::Java::Instant","d":null},{"u":"OpenHAB/CoreExt/Java/Instant.html#to_i-instance_method","n":"#to_i","p":"OpenHAB::CoreExt::Java::Instant","d":null},{"u":"OpenHAB/CoreExt/Java/Instant.html#to_local_date-instance_method","n":"#to_local_date","p":"OpenHAB::CoreExt::Java::Instant","d":null},{"u":"OpenHAB/CoreExt/Java/Instant.html#to_local_time-instance_method","n":"#to_local_time","p":"OpenHAB::CoreExt::Java::Instant","d":null},{"u":"OpenHAB/CoreExt/Java/Instant.html#to_month-instance_method","n":"#to_month","p":"OpenHAB::CoreExt::Java::Instant","d":null},{"u":"OpenHAB/CoreExt/Java/Instant.html#to_month_day-instance_method","n":"#to_month_day","p":"OpenHAB::CoreExt::Java::Instant","d":null},{"u":"OpenHAB/CoreExt/Java/Instant.html#to_time-instance_method","n":"#to_time","p":"OpenHAB::CoreExt::Java::Instant","d":null},{"u":"OpenHAB/CoreExt/Java/Instant.html#to_zoned_date_time-instance_method","n":"#to_zoned_date_time","p":"OpenHAB::CoreExt::Java::Instant","d":null},{"u":"OpenHAB/CoreExt/Java/Instant.html#today%3F-instance_method","n":"#today?","p":"OpenHAB::CoreExt::Java::Instant","d":null},{"u":"OpenHAB/CoreExt/Java/Instant.html#tomorrow%3F-instance_method","n":"#tomorrow?","p":"OpenHAB::CoreExt::Java::Instant","d":null},{"u":"OpenHAB/CoreExt/Java/Instant.html#yesterday%3F-instance_method","n":"#yesterday?","p":"OpenHAB::CoreExt::Java::Instant","d":null},{"u":"OpenHAB/CoreExt/Java/Instant.html#now-class_method","n":"now","p":"OpenHAB::CoreExt::Java::Instant","d":null},{"u":"OpenHAB/CoreExt/Java/Instant.html#parse-class_method","n":"parse","p":"OpenHAB::CoreExt::Java::Instant","d":null},{"u":"OpenHAB/CoreExt/Java/LocalDate.html#%2B-instance_method","n":"#+","p":"OpenHAB::CoreExt::Java::LocalDate","d":null},{"u":"OpenHAB/CoreExt/Java/LocalDate.html#--instance_method","n":"#-","p":"OpenHAB::CoreExt::Java::LocalDate","d":null},{"u":"OpenHAB/CoreExt/Java/LocalDate.html#succ-instance_method","n":"#succ","p":"OpenHAB::CoreExt::Java::LocalDate","d":null},{"u":"OpenHAB/CoreExt/Java/LocalDate.html#to_date-instance_method","n":"#to_date","p":"OpenHAB::CoreExt::Java::LocalDate","d":null},{"u":"OpenHAB/CoreExt/Java/LocalDate.html#to_instant-instance_method","n":"#to_instant","p":"OpenHAB::CoreExt::Java::LocalDate","d":null},{"u":"OpenHAB/CoreExt/Java/LocalDate.html#to_local_date-instance_method","n":"#to_local_date","p":"OpenHAB::CoreExt::Java::LocalDate","d":null},{"u":"OpenHAB/CoreExt/Java/LocalDate.html#to_month-instance_method","n":"#to_month","p":"OpenHAB::CoreExt::Java::LocalDate","d":null},{"u":"OpenHAB/CoreExt/Java/LocalDate.html#to_month_day-instance_method","n":"#to_month_day","p":"OpenHAB::CoreExt::Java::LocalDate","d":null},{"u":"OpenHAB/CoreExt/Java/LocalDate.html#to_zoned_date_time-instance_method","n":"#to_zoned_date_time","p":"OpenHAB::CoreExt::Java::LocalDate","d":null},{"u":"OpenHAB/CoreExt/Java/LocalDate.html#now-class_method","n":"now","p":"OpenHAB::CoreExt::Java::LocalDate","d":null},{"u":"OpenHAB/CoreExt/Java/LocalDate.html#parse-class_method","n":"parse","p":"OpenHAB::CoreExt::Java::LocalDate","d":null},{"u":"OpenHAB/CoreExt/Java/LocalTime.html#%2B-instance_method","n":"#+","p":"OpenHAB::CoreExt::Java::LocalTime","d":null},{"u":"OpenHAB/CoreExt/Java/LocalTime.html#--instance_method","n":"#-","p":"OpenHAB::CoreExt::Java::LocalTime","d":null},{"u":"OpenHAB/CoreExt/Java/LocalTime.html#succ-instance_method","n":"#succ","p":"OpenHAB::CoreExt::Java::LocalTime","d":null},{"u":"OpenHAB/CoreExt/Java/LocalTime.html#to_instant-instance_method","n":"#to_instant","p":"OpenHAB::CoreExt::Java::LocalTime","d":null},{"u":"OpenHAB/CoreExt/Java/LocalTime.html#to_local_time-instance_method","n":"#to_local_time","p":"OpenHAB::CoreExt::Java::LocalTime","d":null},{"u":"OpenHAB/CoreExt/Java/LocalTime.html#to_zoned_date_time-instance_method","n":"#to_zoned_date_time","p":"OpenHAB::CoreExt::Java::LocalTime","d":null},{"u":"OpenHAB/CoreExt/Java/LocalTime.html#now-class_method","n":"now","p":"OpenHAB::CoreExt::Java::LocalTime","d":null},{"u":"OpenHAB/CoreExt/Java/LocalTime.html#parse-class_method","n":"parse","p":"OpenHAB::CoreExt::Java::LocalTime","d":null},{"u":"OpenHAB/CoreExt/Java/Month.html#%2B-instance_method","n":"#+","p":"OpenHAB::CoreExt::Java::Month","d":null},{"u":"OpenHAB/CoreExt/Java/Month.html#--instance_method","n":"#-","p":"OpenHAB::CoreExt::Java::Month","d":null},{"u":"OpenHAB/CoreExt/Java/Month.html#succ-instance_method","n":"#succ","p":"OpenHAB::CoreExt::Java::Month","d":null},{"u":"OpenHAB/CoreExt/Java/Month.html#to_date-instance_method","n":"#to_date","p":"OpenHAB::CoreExt::Java::Month","d":null},{"u":"OpenHAB/CoreExt/Java/Month.html#to_instant-instance_method","n":"#to_instant","p":"OpenHAB::CoreExt::Java::Month","d":null},{"u":"OpenHAB/CoreExt/Java/Month.html#to_local_date-instance_method","n":"#to_local_date","p":"OpenHAB::CoreExt::Java::Month","d":null},{"u":"OpenHAB/CoreExt/Java/Month.html#to_month-instance_method","n":"#to_month","p":"OpenHAB::CoreExt::Java::Month","d":null},{"u":"OpenHAB/CoreExt/Java/Month.html#to_month_day-instance_method","n":"#to_month_day","p":"OpenHAB::CoreExt::Java::Month","d":null},{"u":"OpenHAB/CoreExt/Java/Month.html#to_zoned_date_time-instance_method","n":"#to_zoned_date_time","p":"OpenHAB::CoreExt::Java::Month","d":null},{"u":"OpenHAB/CoreExt/Java/MonthDay.html#%2B-instance_method","n":"#+","p":"OpenHAB::CoreExt::Java::MonthDay","d":null},{"u":"OpenHAB/CoreExt/Java/MonthDay.html#--instance_method","n":"#-","p":"OpenHAB::CoreExt::Java::MonthDay","d":null},{"u":"OpenHAB/CoreExt/Java/MonthDay.html#succ-instance_method","n":"#succ","p":"OpenHAB::CoreExt::Java::MonthDay","d":null},{"u":"OpenHAB/CoreExt/Java/MonthDay.html#to_date-instance_method","n":"#to_date","p":"OpenHAB::CoreExt::Java::MonthDay","d":null},{"u":"OpenHAB/CoreExt/Java/MonthDay.html#to_instant-instance_method","n":"#to_instant","p":"OpenHAB::CoreExt::Java::MonthDay","d":null},{"u":"OpenHAB/CoreExt/Java/MonthDay.html#to_local_date-instance_method","n":"#to_local_date","p":"OpenHAB::CoreExt::Java::MonthDay","d":null},{"u":"OpenHAB/CoreExt/Java/MonthDay.html#to_month-instance_method","n":"#to_month","p":"OpenHAB::CoreExt::Java::MonthDay","d":null},{"u":"OpenHAB/CoreExt/Java/MonthDay.html#to_month_day-instance_method","n":"#to_month_day","p":"OpenHAB::CoreExt::Java::MonthDay","d":null},{"u":"OpenHAB/CoreExt/Java/MonthDay.html#to_s-instance_method","n":"#to_s","p":"OpenHAB::CoreExt::Java::MonthDay","d":null},{"u":"OpenHAB/CoreExt/Java/MonthDay.html#to_zoned_date_time-instance_method","n":"#to_zoned_date_time","p":"OpenHAB::CoreExt::Java::MonthDay","d":null},{"u":"OpenHAB/CoreExt/Java/MonthDay.html#parse-class_method","n":"parse","p":"OpenHAB::CoreExt::Java::MonthDay","d":null},{"u":"OpenHAB/CoreExt/Java/Period.html#<=>-instance_method","n":"#<=>","p":"OpenHAB::CoreExt::Java::Period","d":null},{"u":"OpenHAB/CoreExt/Java/Period.html#coerce-instance_method","n":"#coerce","p":"OpenHAB::CoreExt::Java::Period","d":null},{"u":"OpenHAB/CoreExt/Java/Period.html#to_f-instance_method","n":"#to_f","p":"OpenHAB::CoreExt::Java::Period","d":null},{"u":"OpenHAB/CoreExt/Java/Period.html#to_i-instance_method","n":"#to_i","p":"OpenHAB::CoreExt::Java::Period","d":null},{"u":"OpenHAB/CoreExt/Java/TemporalAmount.html#-@-instance_method","n":"#-@","p":"OpenHAB::CoreExt::Java::TemporalAmount","d":null},{"u":"OpenHAB/CoreExt/Java/TemporalAmount.html#ago-instance_method","n":"#ago","p":"OpenHAB::CoreExt::Java::TemporalAmount","d":null},{"u":"OpenHAB/CoreExt/Java/TemporalAmount.html#from_now-instance_method","n":"#from_now","p":"OpenHAB::CoreExt::Java::TemporalAmount","d":null},{"u":"OpenHAB/CoreExt/Java/TemporalAmount.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::CoreExt::Java::TemporalAmount","d":null},{"u":"OpenHAB/CoreExt/Java/Time.html#<=>-instance_method","n":"#<=>","p":"OpenHAB::CoreExt::Java::Time","d":null},{"u":"OpenHAB/CoreExt/Java/Time.html#coerce-instance_method","n":"#coerce","p":"OpenHAB::CoreExt::Java::Time","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#%2B-instance_method","n":"#+","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#--instance_method","n":"#-","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#<=>-instance_method","n":"#<=>","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#coerce-instance_method","n":"#coerce","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#days_until-instance_method","n":"#days_until","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#holiday-instance_method","n":"#holiday","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#holiday%3F-instance_method","n":"#holiday?","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#in_dayset%3F-instance_method","n":"#in_dayset?","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#next_holiday-instance_method","n":"#next_holiday","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#to_date-instance_method","n":"#to_date","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#to_f-instance_method","n":"#to_f","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#to_i-instance_method","n":"#to_i","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#to_instant-instance_method","n":"#to_instant","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#to_local_date-instance_method","n":"#to_local_date","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#to_local_time-instance_method","n":"#to_local_time","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#to_month-instance_method","n":"#to_month","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#to_month_day-instance_method","n":"#to_month_day","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#to_time-instance_method","n":"#to_time","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#to_zoned_date_time-instance_method","n":"#to_zoned_date_time","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#today%3F-instance_method","n":"#today?","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#tomorrow%3F-instance_method","n":"#tomorrow?","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#weekend%3F-instance_method","n":"#weekend?","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#yesterday%3F-instance_method","n":"#yesterday?","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#now-class_method","n":"now","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Java/ZonedDateTime.html#parse-class_method","n":"parse","p":"OpenHAB::CoreExt::Java::ZonedDateTime","d":null},{"u":"OpenHAB/CoreExt/Ruby/QuantityTypeConversion.html#%7C-instance_method","n":"#|","p":"OpenHAB::CoreExt::Ruby::QuantityTypeConversion","d":null},{"u":"OpenHAB/CoreExt/Ruby/Range.html#circular%3F-instance_method","n":"#circular?","p":"OpenHAB::CoreExt::Ruby::Range","d":null},{"u":"OpenHAB/CoreExt/Ruby/Range.html#cover%3F-instance_method","n":"#cover?","p":"OpenHAB::CoreExt::Ruby::Range","d":null},{"u":"OpenHAB/CoreExt/Ruby/Range.html#each-instance_method","n":"#each","p":"OpenHAB::CoreExt::Ruby::Range","d":null},{"u":"OpenHAB/DSL/ConfigDescription/Builder.html#build-instance_method","n":"#build","p":"OpenHAB::DSL::ConfigDescription::Builder","d":null},{"u":"OpenHAB/DSL/ConfigDescription/Builder.html#group-instance_method","n":"#group","p":"OpenHAB::DSL::ConfigDescription::Builder","d":null},{"u":"OpenHAB/DSL/ConfigDescription/Builder.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::DSL::ConfigDescription::Builder","d":null},{"u":"OpenHAB/DSL/ConfigDescription/Builder.html#parameter-instance_method","n":"#parameter","p":"OpenHAB::DSL::ConfigDescription::Builder","d":null},{"u":"OpenHAB/DSL/Debouncer.html#call-instance_method","n":"#call","p":"OpenHAB::DSL::Debouncer","d":null},{"u":"OpenHAB/DSL/Debouncer.html#call!-instance_method","n":"#call!","p":"OpenHAB::DSL::Debouncer","d":null},{"u":"OpenHAB/DSL/Debouncer.html#flush-instance_method","n":"#flush","p":"OpenHAB::DSL::Debouncer","d":null},{"u":"OpenHAB/DSL/Debouncer.html#idle_time-instance_method","n":"#idle_time","p":"OpenHAB::DSL::Debouncer","d":null},{"u":"OpenHAB/DSL/Debouncer.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::DSL::Debouncer","d":null},{"u":"OpenHAB/DSL/Debouncer.html#interval-instance_method","n":"#interval","p":"OpenHAB::DSL::Debouncer","d":null},{"u":"OpenHAB/DSL/Debouncer.html#leading%3F-instance_method","n":"#leading?","p":"OpenHAB::DSL::Debouncer","d":null},{"u":"OpenHAB/DSL/Debouncer.html#reset-instance_method","n":"#reset","p":"OpenHAB::DSL::Debouncer","d":null},{"u":"OpenHAB/DSL/Events/WatchEvent.html#attachment-instance_method","n":"#attachment","p":"OpenHAB::DSL::Events::WatchEvent","d":null},{"u":"OpenHAB/DSL/Events/WatchEvent.html#path-instance_method","n":"#path","p":"OpenHAB::DSL::Events::WatchEvent","d":null},{"u":"OpenHAB/DSL/Events/WatchEvent.html#type-instance_method","n":"#type","p":"OpenHAB::DSL::Events::WatchEvent","d":null},{"u":"OpenHAB/DSL/Items/Builder.html#call_item-instance_method","n":"#call_item","p":"OpenHAB::DSL::Items::Builder","d":null},{"u":"OpenHAB/DSL/Items/Builder.html#color_item-instance_method","n":"#color_item","p":"OpenHAB::DSL::Items::Builder","d":null},{"u":"OpenHAB/DSL/Items/Builder.html#contact_item-instance_method","n":"#contact_item","p":"OpenHAB::DSL::Items::Builder","d":null},{"u":"OpenHAB/DSL/Items/Builder.html#date_time_item-instance_method","n":"#date_time_item","p":"OpenHAB::DSL::Items::Builder","d":null},{"u":"OpenHAB/DSL/Items/Builder.html#dimmer_item-instance_method","n":"#dimmer_item","p":"OpenHAB::DSL::Items::Builder","d":null},{"u":"OpenHAB/DSL/Items/Builder.html#group_item-instance_method","n":"#group_item","p":"OpenHAB::DSL::Items::Builder","d":null},{"u":"OpenHAB/DSL/Items/Builder.html#image_item-instance_method","n":"#image_item","p":"OpenHAB::DSL::Items::Builder","d":null},{"u":"OpenHAB/DSL/Items/Builder.html#location_item-instance_method","n":"#location_item","p":"OpenHAB::DSL::Items::Builder","d":null},{"u":"OpenHAB/DSL/Items/Builder.html#number_item-instance_method","n":"#number_item","p":"OpenHAB::DSL::Items::Builder","d":null},{"u":"OpenHAB/DSL/Items/Builder.html#player_item-instance_method","n":"#player_item","p":"OpenHAB::DSL::Items::Builder","d":null},{"u":"OpenHAB/DSL/Items/Builder.html#rollershutter_item-instance_method","n":"#rollershutter_item","p":"OpenHAB::DSL::Items::Builder","d":null},{"u":"OpenHAB/DSL/Items/Builder.html#string_item-instance_method","n":"#string_item","p":"OpenHAB::DSL::Items::Builder","d":null},{"u":"OpenHAB/DSL/Items/Builder.html#switch_item-instance_method","n":"#switch_item","p":"OpenHAB::DSL::Items::Builder","d":null},{"u":"OpenHAB/DSL/Items/Ensure/Ensurable.html#ensure-instance_method","n":"#ensure","p":"OpenHAB::DSL::Items::Ensure::Ensurable","d":null},{"u":"OpenHAB/DSL/Items/GroupItemBuilder.html#function-instance_method","n":"#function","p":"OpenHAB::DSL::Items::GroupItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/GroupItemBuilder.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::DSL::Items::GroupItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/GroupItemBuilder.html#label_base-instance_method","n":"#label_base","p":"OpenHAB::DSL::Items::GroupItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/GroupItemBuilder.html#members-instance_method","n":"#members","p":"OpenHAB::DSL::Items::GroupItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/GroupItemBuilder.html#name_base-instance_method","n":"#name_base","p":"OpenHAB::DSL::Items::GroupItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/GroupItemBuilder.html#thing-instance_method","n":"#thing","p":"OpenHAB::DSL::Items::GroupItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/GroupItemBuilder.html#unit-instance_method","n":"#unit","p":"OpenHAB::DSL::Items::GroupItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#alexa-instance_method","n":"#alexa","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#autoupdate-instance_method","n":"#autoupdate","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#channel-instance_method","n":"#channel","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#channels-instance_method","n":"#channels","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#command_options-instance_method","n":"#command_options","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#dimension-instance_method","n":"#dimension","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#expire-instance_method","n":"#expire","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#format-instance_method","n":"#format","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#ga-instance_method","n":"#ga","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#group-instance_method","n":"#group","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#groups-instance_method","n":"#groups","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#homekit-instance_method","n":"#homekit","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#icon-instance_method","n":"#icon","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#label-instance_method","n":"#label","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#metadata-instance_method","n":"#metadata","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#name-instance_method","n":"#name","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#range-instance_method","n":"#range","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#read_only-instance_method","n":"#read_only","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#state-instance_method","n":"#state","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#state_options-instance_method","n":"#state_options","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#step-instance_method","n":"#step","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#tag-instance_method","n":"#tag","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#tags-instance_method","n":"#tags","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#to_s-instance_method","n":"#to_s","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#type-instance_method","n":"#type","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/ItemBuilder.html#unit-instance_method","n":"#unit","p":"OpenHAB::DSL::Items::ItemBuilder","d":null},{"u":"OpenHAB/DSL/Items/TimedCommand/TimedCommandDetails.html#cancelled%3F-instance_method","n":"#cancelled?","p":"OpenHAB::DSL::Items::TimedCommand::TimedCommandDetails","d":null},{"u":"OpenHAB/DSL/Items/TimedCommand/TimedCommandDetails.html#expired%3F-instance_method","n":"#expired?","p":"OpenHAB::DSL::Items::TimedCommand::TimedCommandDetails","d":null},{"u":"OpenHAB/DSL/Items/TimedCommand/TimedCommandDetails.html#reschedule-instance_method","n":"#reschedule","p":"OpenHAB::DSL::Items::TimedCommand::TimedCommandDetails","d":null},{"u":"OpenHAB/DSL/Items/TimedCommand/TimedCommandDetails.html#resume-instance_method","n":"#resume","p":"OpenHAB::DSL::Items::TimedCommand::TimedCommandDetails","d":null},{"u":"OpenHAB/DSL/Items/TimedCommand.html#command-instance_method","n":"#command","p":"OpenHAB::DSL::Items::TimedCommand","d":null},{"u":"OpenHAB/DSL/Rules/Builder.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::DSL::Rules::Builder","d":null},{"u":"OpenHAB/DSL/Rules/Builder.html#provider-instance_method","n":"#provider","p":"OpenHAB::DSL::Rules::Builder","d":null},{"u":"OpenHAB/DSL/Rules/Builder.html#rule-instance_method","n":"#rule","p":"OpenHAB::DSL::Rules::Builder","d":null},{"u":"OpenHAB/DSL/Rules/Builder.html#scene-instance_method","n":"#scene","p":"OpenHAB::DSL::Rules::Builder","d":null},{"u":"OpenHAB/DSL/Rules/Builder.html#script-instance_method","n":"#script","p":"OpenHAB::DSL::Rules::Builder","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#at-instance_method","n":"#at","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#between-instance_method","n":"#between","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#changed-instance_method","n":"#changed","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#channel-instance_method","n":"#channel","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#channel_linked-instance_method","n":"#channel_linked","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#channel_unlinked-instance_method","n":"#channel_unlinked","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#cron-instance_method","n":"#cron","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#debounce_for-instance_method","n":"#debounce_for","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#delay-instance_method","n":"#delay","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#dependencies-instance_method","n":"#dependencies","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#description-instance_method","n":"#description","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#enabled-instance_method","n":"#enabled","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#event-instance_method","n":"#event","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#every-instance_method","n":"#every","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#item_added-instance_method","n":"#item_added","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#item_removed-instance_method","n":"#item_removed","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#item_updated-instance_method","n":"#item_updated","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#name-instance_method","n":"#name","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#not_if-instance_method","n":"#not_if","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#on_load-instance_method","n":"#on_load","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#on_start-instance_method","n":"#on_start","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#only_every-instance_method","n":"#only_every","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#only_if-instance_method","n":"#only_if","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#otherwise-instance_method","n":"#otherwise","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#received_command-instance_method","n":"#received_command","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#run-instance_method","n":"#run","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#tags-instance_method","n":"#tags","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#thing_added-instance_method","n":"#thing_added","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#thing_removed-instance_method","n":"#thing_removed","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#thing_updated-instance_method","n":"#thing_updated","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#throttle_for-instance_method","n":"#throttle_for","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#time_series_updated-instance_method","n":"#time_series_updated","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#trigger-instance_method","n":"#trigger","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#triggered-instance_method","n":"#triggered","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#uid-instance_method","n":"#uid","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#updated-instance_method","n":"#updated","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/BuilderDSL.html#watch-instance_method","n":"#watch","p":"OpenHAB::DSL::Rules::BuilderDSL","d":null},{"u":"OpenHAB/DSL/Rules/Terse.html#changed-instance_method","n":"#changed","p":"OpenHAB::DSL::Rules::Terse","d":null},{"u":"OpenHAB/DSL/Rules/Terse.html#channel-instance_method","n":"#channel","p":"OpenHAB::DSL::Rules::Terse","d":null},{"u":"OpenHAB/DSL/Rules/Terse.html#channel_linked-instance_method","n":"#channel_linked","p":"OpenHAB::DSL::Rules::Terse","d":null},{"u":"OpenHAB/DSL/Rules/Terse.html#channel_unlinked-instance_method","n":"#channel_unlinked","p":"OpenHAB::DSL::Rules::Terse","d":null},{"u":"OpenHAB/DSL/Rules/Terse.html#cron-instance_method","n":"#cron","p":"OpenHAB::DSL::Rules::Terse","d":null},{"u":"OpenHAB/DSL/Rules/Terse.html#every-instance_method","n":"#every","p":"OpenHAB::DSL::Rules::Terse","d":null},{"u":"OpenHAB/DSL/Rules/Terse.html#item_added-instance_method","n":"#item_added","p":"OpenHAB::DSL::Rules::Terse","d":null},{"u":"OpenHAB/DSL/Rules/Terse.html#item_removed-instance_method","n":"#item_removed","p":"OpenHAB::DSL::Rules::Terse","d":null},{"u":"OpenHAB/DSL/Rules/Terse.html#item_updated-instance_method","n":"#item_updated","p":"OpenHAB::DSL::Rules::Terse","d":null},{"u":"OpenHAB/DSL/Rules/Terse.html#on_start-instance_method","n":"#on_start","p":"OpenHAB::DSL::Rules::Terse","d":null},{"u":"OpenHAB/DSL/Rules/Terse.html#received_command-instance_method","n":"#received_command","p":"OpenHAB::DSL::Rules::Terse","d":null},{"u":"OpenHAB/DSL/Rules/Terse.html#thing_added-instance_method","n":"#thing_added","p":"OpenHAB::DSL::Rules::Terse","d":null},{"u":"OpenHAB/DSL/Rules/Terse.html#thing_removed-instance_method","n":"#thing_removed","p":"OpenHAB::DSL::Rules::Terse","d":null},{"u":"OpenHAB/DSL/Rules/Terse.html#thing_updated-instance_method","n":"#thing_updated","p":"OpenHAB::DSL::Rules::Terse","d":null},{"u":"OpenHAB/DSL/Rules/Terse.html#updated-instance_method","n":"#updated","p":"OpenHAB::DSL::Rules::Terse","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/Conditions/Duration.html#cleanup-instance_method","n":"#cleanup","p":"OpenHAB::DSL::Rules::Triggers::Conditions::Duration","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/Conditions/Duration.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::DSL::Rules::Triggers::Conditions::Duration","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/Conditions/Duration.html#process-instance_method","n":"#process","p":"OpenHAB::DSL::Rules::Triggers::Conditions::Duration","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/Conditions/Duration.html#rule-instance_method","n":"#rule","p":"OpenHAB::DSL::Rules::Triggers::Conditions::Duration","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/Conditions/Generic.html#from%3F-instance_method","n":"#from?","p":"OpenHAB::DSL::Rules::Triggers::Conditions::Generic","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/Conditions/Generic.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::DSL::Rules::Triggers::Conditions::Generic","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/Conditions/Generic.html#process-instance_method","n":"#process","p":"OpenHAB::DSL::Rules::Triggers::Conditions::Generic","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/CronHandler/CronTriggerHandler.html#dispose-instance_method","n":"#dispose","p":"OpenHAB::DSL::Rules::Triggers::CronHandler::CronTriggerHandler","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/CronHandler/CronTriggerHandler.html#getTemporalAdjuster-instance_method","n":"#getTemporalAdjuster","p":"OpenHAB::DSL::Rules::Triggers::CronHandler::CronTriggerHandler","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/CronHandler/CronTriggerHandler.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::DSL::Rules::Triggers::CronHandler::CronTriggerHandler","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/CronHandler/CronTriggerHandler.html#run-instance_method","n":"#run","p":"OpenHAB::DSL::Rules::Triggers::CronHandler::CronTriggerHandler","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/CronHandler/CronTriggerHandler.html#setCallback-instance_method","n":"#setCallback","p":"OpenHAB::DSL::Rules::Triggers::CronHandler::CronTriggerHandler","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/CronHandler/CronTriggerHandlerFactory.html#get-instance_method","n":"#get","p":"OpenHAB::DSL::Rules::Triggers::CronHandler::CronTriggerHandlerFactory","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/CronHandler/CronTriggerHandlerFactory.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::DSL::Rules::Triggers::CronHandler::CronTriggerHandlerFactory","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/WatchHandler/WatchTriggerHandler.html#dispose-instance_method","n":"#dispose","p":"OpenHAB::DSL::Rules::Triggers::WatchHandler::WatchTriggerHandler","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/WatchHandler/WatchTriggerHandler.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::DSL::Rules::Triggers::WatchHandler::WatchTriggerHandler","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/WatchHandler/WatchTriggerHandler.html#setCallback-instance_method","n":"#setCallback","p":"OpenHAB::DSL::Rules::Triggers::WatchHandler::WatchTriggerHandler","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/WatchHandler/WatchTriggerHandler.html#watch_event_handler-instance_method","n":"#watch_event_handler","p":"OpenHAB::DSL::Rules::Triggers::WatchHandler::WatchTriggerHandler","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/WatchHandler/WatchTriggerHandler.html#dir_subdir_glob-class_method","n":"dir_subdir_glob","p":"OpenHAB::DSL::Rules::Triggers::WatchHandler::WatchTriggerHandler","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/WatchHandler/WatchTriggerHandler.html#find_parent-class_method","n":"find_parent","p":"OpenHAB::DSL::Rules::Triggers::WatchHandler::WatchTriggerHandler","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/WatchHandler/WatchTriggerHandler.html#glob%3F-class_method","n":"glob?","p":"OpenHAB::DSL::Rules::Triggers::WatchHandler::WatchTriggerHandler","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/WatchHandler/WatchTriggerHandler.html#recursive_glob%3F-class_method","n":"recursive_glob?","p":"OpenHAB::DSL::Rules::Triggers::WatchHandler::WatchTriggerHandler","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/WatchHandler/WatchTriggerHandlerFactory.html#get-instance_method","n":"#get","p":"OpenHAB::DSL::Rules::Triggers::WatchHandler::WatchTriggerHandlerFactory","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/WatchHandler/WatchTriggerHandlerFactory.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::DSL::Rules::Triggers::WatchHandler::WatchTriggerHandlerFactory","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/WatchHandler/Watcher.html#activate-instance_method","n":"#activate","p":"OpenHAB::DSL::Rules::Triggers::WatchHandler::Watcher","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/WatchHandler/Watcher.html#deactivate-instance_method","n":"#deactivate","p":"OpenHAB::DSL::Rules::Triggers::WatchHandler::Watcher","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/WatchHandler/Watcher.html#getWatchEventKinds-instance_method","n":"#getWatchEventKinds","p":"OpenHAB::DSL::Rules::Triggers::WatchHandler::Watcher","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/WatchHandler/Watcher.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::DSL::Rules::Triggers::WatchHandler::Watcher","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/WatchHandler/Watcher.html#processWatchEvent-instance_method","n":"#processWatchEvent","p":"OpenHAB::DSL::Rules::Triggers::WatchHandler::Watcher","d":null},{"u":"OpenHAB/DSL/Rules/Triggers/WatchHandler/Watcher.html#watchSubDirectories-instance_method","n":"#watchSubDirectories","p":"OpenHAB::DSL::Rules::Triggers::WatchHandler::Watcher","d":null},{"u":"OpenHAB/DSL/Sitemaps/Builder.html#sitemap-instance_method","n":"#sitemap","p":"OpenHAB::DSL::Sitemaps::Builder","d":null},{"u":"OpenHAB/DSL/Sitemaps/ButtonBuilder.html#click-instance_method","n":"#click","p":"OpenHAB::DSL::Sitemaps::ButtonBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/ButtonBuilder.html#column-instance_method","n":"#column","p":"OpenHAB::DSL::Sitemaps::ButtonBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/ButtonBuilder.html#release-instance_method","n":"#release","p":"OpenHAB::DSL::Sitemaps::ButtonBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/ButtonBuilder.html#row-instance_method","n":"#row","p":"OpenHAB::DSL::Sitemaps::ButtonBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/ButtonBuilder.html#stateless%3F-instance_method","n":"#stateless?","p":"OpenHAB::DSL::Sitemaps::ButtonBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/ButtongridBuilder/Buttongrid.html#children-instance_method","n":"#children","p":"OpenHAB::DSL::Sitemaps::ButtongridBuilder::Buttongrid","d":null},{"u":"OpenHAB/DSL/Sitemaps/ButtongridBuilder.html#button-instance_method","n":"#button","p":"OpenHAB::DSL::Sitemaps::ButtongridBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/ChartBuilder.html#group%3F-instance_method","n":"#group?","p":"OpenHAB::DSL::Sitemaps::ChartBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/ChartBuilder.html#legend%3F-instance_method","n":"#legend?","p":"OpenHAB::DSL::Sitemaps::ChartBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/ChartBuilder.html#period-instance_method","n":"#period","p":"OpenHAB::DSL::Sitemaps::ChartBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/ChartBuilder.html#refresh-instance_method","n":"#refresh","p":"OpenHAB::DSL::Sitemaps::ChartBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/ChartBuilder.html#service-instance_method","n":"#service","p":"OpenHAB::DSL::Sitemaps::ChartBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/ChartBuilder.html#y_axis_pattern-instance_method","n":"#y_axis_pattern","p":"OpenHAB::DSL::Sitemaps::ChartBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/ColorpickerBuilder.html#frequency-instance_method","n":"#frequency","p":"OpenHAB::DSL::Sitemaps::ColorpickerBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/ColortemperaturepickerBuilder.html#range-instance_method","n":"#range","p":"OpenHAB::DSL::Sitemaps::ColortemperaturepickerBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/DefaultBuilder.html#height-instance_method","n":"#height","p":"OpenHAB::DSL::Sitemaps::DefaultBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/ImageBuilder.html#refresh-instance_method","n":"#refresh","p":"OpenHAB::DSL::Sitemaps::ImageBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/ImageBuilder.html#url-instance_method","n":"#url","p":"OpenHAB::DSL::Sitemaps::ImageBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/InputBuilder.html#hint-instance_method","n":"#hint","p":"OpenHAB::DSL::Sitemaps::InputBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html#buttongrid-instance_method","n":"#buttongrid","p":"OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html#chart-instance_method","n":"#chart","p":"OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html#colorpicker-instance_method","n":"#colorpicker","p":"OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html#colortemperaturepicker-instance_method","n":"#colortemperaturepicker","p":"OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html#default-instance_method","n":"#default","p":"OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html#frame-instance_method","n":"#frame","p":"OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html#group-instance_method","n":"#group","p":"OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html#image-instance_method","n":"#image","p":"OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html#input-instance_method","n":"#input","p":"OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html#mapview-instance_method","n":"#mapview","p":"OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html#selection-instance_method","n":"#selection","p":"OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html#setpoint-instance_method","n":"#setpoint","p":"OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html#slider-instance_method","n":"#slider","p":"OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html#switch-instance_method","n":"#switch","p":"OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html#text-instance_method","n":"#text","p":"OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html#video-instance_method","n":"#video","p":"OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/LinkableWidgetBuilder.html#webview-instance_method","n":"#webview","p":"OpenHAB::DSL::Sitemaps::LinkableWidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/SetpointBuilder.html#range-instance_method","n":"#range","p":"OpenHAB::DSL::Sitemaps::SetpointBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/SetpointBuilder.html#step-instance_method","n":"#step","p":"OpenHAB::DSL::Sitemaps::SetpointBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/SitemapBuilder.html#name-instance_method","n":"#name","p":"OpenHAB::DSL::Sitemaps::SitemapBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/SliderBuilder.html#frequency-instance_method","n":"#frequency","p":"OpenHAB::DSL::Sitemaps::SliderBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/SliderBuilder.html#release_only%3F-instance_method","n":"#release_only?","p":"OpenHAB::DSL::Sitemaps::SliderBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/SliderBuilder.html#switch%3F-instance_method","n":"#switch?","p":"OpenHAB::DSL::Sitemaps::SliderBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/SwitchBuilder.html#mappings-instance_method","n":"#mappings","p":"OpenHAB::DSL::Sitemaps::SwitchBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/VideoBuilder.html#encoding-instance_method","n":"#encoding","p":"OpenHAB::DSL::Sitemaps::VideoBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/VideoBuilder.html#url-instance_method","n":"#url","p":"OpenHAB::DSL::Sitemaps::VideoBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/WebviewBuilder.html#url-instance_method","n":"#url","p":"OpenHAB::DSL::Sitemaps::WebviewBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/WidgetBuilder.html#icon-instance_method","n":"#icon","p":"OpenHAB::DSL::Sitemaps::WidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/WidgetBuilder.html#icon_color-instance_method","n":"#icon_color","p":"OpenHAB::DSL::Sitemaps::WidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/WidgetBuilder.html#icon_colors-instance_method","n":"#icon_colors","p":"OpenHAB::DSL::Sitemaps::WidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/WidgetBuilder.html#item-instance_method","n":"#item","p":"OpenHAB::DSL::Sitemaps::WidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/WidgetBuilder.html#label-instance_method","n":"#label","p":"OpenHAB::DSL::Sitemaps::WidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/WidgetBuilder.html#label_color-instance_method","n":"#label_color","p":"OpenHAB::DSL::Sitemaps::WidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/WidgetBuilder.html#label_colors-instance_method","n":"#label_colors","p":"OpenHAB::DSL::Sitemaps::WidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/WidgetBuilder.html#static_icon-instance_method","n":"#static_icon","p":"OpenHAB::DSL::Sitemaps::WidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/WidgetBuilder.html#value_color-instance_method","n":"#value_color","p":"OpenHAB::DSL::Sitemaps::WidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/WidgetBuilder.html#value_colors-instance_method","n":"#value_colors","p":"OpenHAB::DSL::Sitemaps::WidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/WidgetBuilder.html#visibilities-instance_method","n":"#visibilities","p":"OpenHAB::DSL::Sitemaps::WidgetBuilder","d":null},{"u":"OpenHAB/DSL/Sitemaps/WidgetBuilder.html#visibility-instance_method","n":"#visibility","p":"OpenHAB::DSL::Sitemaps::WidgetBuilder","d":null},{"u":"OpenHAB/DSL/Things/BridgeBuilder.html#bridge-instance_method","n":"#bridge","p":"OpenHAB::DSL::Things::BridgeBuilder","d":null},{"u":"OpenHAB/DSL/Things/BridgeBuilder.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::DSL::Things::BridgeBuilder","d":null},{"u":"OpenHAB/DSL/Things/BridgeBuilder.html#thing-instance_method","n":"#thing","p":"OpenHAB::DSL::Things::BridgeBuilder","d":null},{"u":"OpenHAB/DSL/Things/Builder.html#bridge-instance_method","n":"#bridge","p":"OpenHAB::DSL::Things::Builder","d":null},{"u":"OpenHAB/DSL/Things/Builder.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::DSL::Things::Builder","d":null},{"u":"OpenHAB/DSL/Things/Builder.html#provider-instance_method","n":"#provider","p":"OpenHAB::DSL::Things::Builder","d":null},{"u":"OpenHAB/DSL/Things/Builder.html#thing-instance_method","n":"#thing","p":"OpenHAB::DSL::Things::Builder","d":null},{"u":"OpenHAB/DSL/Things/ChannelBuilder.html#accepted_item_type-instance_method","n":"#accepted_item_type","p":"OpenHAB::DSL::Things::ChannelBuilder","d":null},{"u":"OpenHAB/DSL/Things/ChannelBuilder.html#auto_update_policy-instance_method","n":"#auto_update_policy","p":"OpenHAB::DSL::Things::ChannelBuilder","d":null},{"u":"OpenHAB/DSL/Things/ChannelBuilder.html#config-instance_method","n":"#config","p":"OpenHAB::DSL::Things::ChannelBuilder","d":null},{"u":"OpenHAB/DSL/Things/ChannelBuilder.html#default_tags-instance_method","n":"#default_tags","p":"OpenHAB::DSL::Things::ChannelBuilder","d":null},{"u":"OpenHAB/DSL/Things/ChannelBuilder.html#description-instance_method","n":"#description","p":"OpenHAB::DSL::Things::ChannelBuilder","d":null},{"u":"OpenHAB/DSL/Things/ChannelBuilder.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::DSL::Things::ChannelBuilder","d":null},{"u":"OpenHAB/DSL/Things/ChannelBuilder.html#label-instance_method","n":"#label","p":"OpenHAB::DSL::Things::ChannelBuilder","d":null},{"u":"OpenHAB/DSL/Things/ChannelBuilder.html#properties-instance_method","n":"#properties","p":"OpenHAB::DSL::Things::ChannelBuilder","d":null},{"u":"OpenHAB/DSL/Things/ChannelBuilder.html#type-instance_method","n":"#type","p":"OpenHAB::DSL::Things::ChannelBuilder","d":null},{"u":"OpenHAB/DSL/Things/ChannelBuilder.html#uid-instance_method","n":"#uid","p":"OpenHAB::DSL::Things::ChannelBuilder","d":null},{"u":"OpenHAB/DSL/Things/ThingBuilder.html#bridge_uid-instance_method","n":"#bridge_uid","p":"OpenHAB::DSL::Things::ThingBuilder","d":null},{"u":"OpenHAB/DSL/Things/ThingBuilder.html#channel-instance_method","n":"#channel","p":"OpenHAB::DSL::Things::ThingBuilder","d":null},{"u":"OpenHAB/DSL/Things/ThingBuilder.html#channels-instance_method","n":"#channels","p":"OpenHAB::DSL::Things::ThingBuilder","d":null},{"u":"OpenHAB/DSL/Things/ThingBuilder.html#config-instance_method","n":"#config","p":"OpenHAB::DSL::Things::ThingBuilder","d":null},{"u":"OpenHAB/DSL/Things/ThingBuilder.html#enabled-instance_method","n":"#enabled","p":"OpenHAB::DSL::Things::ThingBuilder","d":null},{"u":"OpenHAB/DSL/Things/ThingBuilder.html#initialize-instance_method","n":"#initialize","p":"OpenHAB::DSL::Things::ThingBuilder","d":null},{"u":"OpenHAB/DSL/Things/ThingBuilder.html#label-instance_method","n":"#label","p":"OpenHAB::DSL::Things::ThingBuilder","d":null},{"u":"OpenHAB/DSL/Things/ThingBuilder.html#location-instance_method","n":"#location","p":"OpenHAB::DSL::Things::ThingBuilder","d":null},{"u":"OpenHAB/DSL/Things/ThingBuilder.html#thing_type_uid-instance_method","n":"#thing_type_uid","p":"OpenHAB::DSL::Things::ThingBuilder","d":null},{"u":"OpenHAB/DSL/Things/ThingBuilder.html#uid-instance_method","n":"#uid","p":"OpenHAB::DSL::Things::ThingBuilder","d":null},{"u":"OpenHAB/DSL/TimerManager.html#cancel-instance_method","n":"#cancel","p":"OpenHAB::DSL::TimerManager","d":null},{"u":"OpenHAB/DSL/TimerManager.html#cancel_all-instance_method","n":"#cancel_all","p":"OpenHAB::DSL::TimerManager","d":null},{"u":"OpenHAB/DSL/TimerManager.html#include%3F-instance_method","n":"#include?","p":"OpenHAB::DSL::TimerManager","d":null},{"u":"OpenHAB/DSL/TimerManager.html#reschedule-instance_method","n":"#reschedule","p":"OpenHAB::DSL::TimerManager","d":null},{"u":"OpenHAB/DSL/TimerManager.html#schedule-instance_method","n":"#schedule","p":"OpenHAB::DSL::TimerManager","d":null},{"u":"OpenHAB/DSL.html#after-class_method","n":"after","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#between-class_method","n":"between","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#config_description-class_method","n":"config_description","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#debounce_for-class_method","n":"debounce_for","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#ensure_states-class_method","n":"ensure_states","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#ensure_states!-class_method","n":"ensure_states!","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#holiday_file-class_method","n":"holiday_file","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#holiday_file!-class_method","n":"holiday_file!","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#items-class_method","n":"items","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#only_every-class_method","n":"only_every","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#persistence-class_method","n":"persistence","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#persistence!-class_method","n":"persistence!","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#profile-class_method","n":"profile","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#provider-class_method","n":"provider","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#provider!-class_method","n":"provider!","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#rule-class_method","n":"rule","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#rule!-class_method","n":"rule!","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#rules-class_method","n":"rules","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#scene-class_method","n":"scene","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#scene!-class_method","n":"scene!","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#script-class_method","n":"script","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#script!-class_method","n":"script!","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#shared_cache-class_method","n":"shared_cache","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#sitemaps-class_method","n":"sitemaps","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#store_states-class_method","n":"store_states","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#things-class_method","n":"things","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#throttle_for-class_method","n":"throttle_for","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#timers-class_method","n":"timers","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#transform-class_method","n":"transform","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#unit-class_method","n":"unit","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/DSL.html#unit!-class_method","n":"unit!","p":"OpenHAB::DSL","d":null},{"u":"OpenHAB/Log.html#logger-instance_method","n":"#logger","p":"OpenHAB::Log","d":null},{"u":"OpenHAB/Log.html#logger-class_method","n":"logger","p":"OpenHAB::Log","d":null},{"u":"OpenHAB/Logger.html#debug-instance_method","n":"#debug","p":"OpenHAB::Logger","d":null},{"u":"OpenHAB/Logger.html#debug%3F-instance_method","n":"#debug?","p":"OpenHAB::Logger","d":null},{"u":"OpenHAB/Logger.html#error-instance_method","n":"#error","p":"OpenHAB::Logger","d":null},{"u":"OpenHAB/Logger.html#error%3F-instance_method","n":"#error?","p":"OpenHAB::Logger","d":null},{"u":"OpenHAB/Logger.html#info-instance_method","n":"#info","p":"OpenHAB::Logger","d":null},{"u":"OpenHAB/Logger.html#info%3F-instance_method","n":"#info?","p":"OpenHAB::Logger","d":null},{"u":"OpenHAB/Logger.html#inspect-instance_method","n":"#inspect","p":"OpenHAB::Logger","d":null},{"u":"OpenHAB/Logger.html#level-instance_method","n":"#level","p":"OpenHAB::Logger","d":null},{"u":"OpenHAB/Logger.html#log_exception-instance_method","n":"#log_exception","p":"OpenHAB::Logger","d":null},{"u":"OpenHAB/Logger.html#name-instance_method","n":"#name","p":"OpenHAB::Logger","d":null},{"u":"OpenHAB/Logger.html#trace-instance_method","n":"#trace","p":"OpenHAB::Logger","d":null},{"u":"OpenHAB/Logger.html#trace%3F-instance_method","n":"#trace?","p":"OpenHAB::Logger","d":null},{"u":"OpenHAB/Logger.html#warn-instance_method","n":"#warn","p":"OpenHAB::Logger","d":null},{"u":"OpenHAB/Logger.html#warn%3F-instance_method","n":"#warn?","p":"OpenHAB::Logger","d":null},{"u":"OpenHAB/Logger.html#events-class_method","n":"events","p":"OpenHAB::Logger","d":null},{"u":"OpenHAB/Logger.html#gem_root-class_method","n":"gem_root","p":"OpenHAB::Logger","d":null},{"u":"OpenHAB/Logger.html#root-class_method","n":"root","p":"OpenHAB::Logger","d":null},{"u":"OpenHAB/OSGi.html#bundle-class_method","n":"bundle","p":"OpenHAB::OSGi","d":null},{"u":"OpenHAB/OSGi.html#bundle_context-class_method","n":"bundle_context","p":"OpenHAB::OSGi","d":null},{"u":"OpenHAB/OSGi.html#register_service-class_method","n":"register_service","p":"OpenHAB::OSGi","d":null},{"u":"OpenHAB/OSGi.html#service-class_method","n":"service","p":"OpenHAB::OSGi","d":null},{"u":"OpenHAB/OSGi.html#services-class_method","n":"services","p":"OpenHAB::OSGi","d":null},{"u":"OpenHAB/RSpec/Configuration.html#include_bindings-class_method","n":"include_bindings","p":"OpenHAB::RSpec::Configuration","d":null},{"u":"OpenHAB/RSpec/Configuration.html#include_jsondb-class_method","n":"include_jsondb","p":"OpenHAB::RSpec::Configuration","d":null},{"u":"OpenHAB/RSpec/Configuration.html#private_confdir-class_method","n":"private_confdir","p":"OpenHAB::RSpec::Configuration","d":null},{"u":"OpenHAB/RSpec/Configuration.html#use_root_instance-class_method","n":"use_root_instance","p":"OpenHAB::RSpec::Configuration","d":null},{"u":"OpenHAB/RSpec/ExampleGroup/ClassMethods.html#consistent_proxies%3F-instance_method","n":"#consistent_proxies?","p":"OpenHAB::RSpec::ExampleGroup::ClassMethods","d":null},{"u":"OpenHAB/RSpec/ExampleGroup/ClassMethods.html#mock_timers%3F-instance_method","n":"#mock_timers?","p":"OpenHAB::RSpec::ExampleGroup::ClassMethods","d":null},{"u":"OpenHAB/RSpec/ExampleGroup/ClassMethods.html#propagate_exceptions%3F-instance_method","n":"#propagate_exceptions?","p":"OpenHAB::RSpec::ExampleGroup::ClassMethods","d":null},{"u":"OpenHAB/RSpec/Helpers.html#autorequires-class_method","n":"autorequires","p":"OpenHAB::RSpec::Helpers","d":null},{"u":"OpenHAB/RSpec/Helpers.html#autoupdate_all_items-class_method","n":"autoupdate_all_items","p":"OpenHAB::RSpec::Helpers","d":1},{"u":"OpenHAB/RSpec/Helpers.html#execute_timers-class_method","n":"execute_timers","p":"OpenHAB::RSpec::Helpers","d":null},{"u":"OpenHAB/RSpec/Helpers.html#initialize_missing_thing_types-class_method","n":"initialize_missing_thing_types","p":"OpenHAB::RSpec::Helpers","d":null},{"u":"OpenHAB/RSpec/Helpers.html#install_addon-class_method","n":"install_addon","p":"OpenHAB::RSpec::Helpers","d":null},{"u":"OpenHAB/RSpec/Helpers.html#launch_karaf-class_method","n":"launch_karaf","p":"OpenHAB::RSpec::Helpers","d":null},{"u":"OpenHAB/RSpec/Helpers.html#load_rules-class_method","n":"load_rules","p":"OpenHAB::RSpec::Helpers","d":null},{"u":"OpenHAB/RSpec/Helpers.html#load_transforms-class_method","n":"load_transforms","p":"OpenHAB::RSpec::Helpers","d":null},{"u":"OpenHAB/RSpec/Helpers.html#log_file-class_method","n":"log_file","p":"OpenHAB::RSpec::Helpers","d":null},{"u":"OpenHAB/RSpec/Helpers.html#spec_log_lines-class_method","n":"spec_log_lines","p":"OpenHAB::RSpec::Helpers","d":null},{"u":"OpenHAB/RSpec/Helpers.html#suspend_rules-class_method","n":"suspend_rules","p":"OpenHAB::RSpec::Helpers","d":null},{"u":"OpenHAB/RSpec/Helpers.html#time_travel_and_execute_timers-class_method","n":"time_travel_and_execute_timers","p":"OpenHAB::RSpec::Helpers","d":null},{"u":"OpenHAB/RSpec/Helpers.html#trigger_channel-class_method","n":"trigger_channel","p":"OpenHAB::RSpec::Helpers","d":null},{"u":"OpenHAB/RSpec/Helpers.html#wait-class_method","n":"wait","p":"OpenHAB::RSpec::Helpers","d":null},{"u":"Symbol.html#name-instance_method","n":"#name","p":"Symbol","d":null},{"u":"Time.html#coerce-instance_method","n":"#coerce","p":"Time","d":null},{"u":"Time.html#minus_with_temporal-instance_method","n":"#minus_with_temporal","p":"Time","d":null},{"u":"Time.html#plus_with_temporal-instance_method","n":"#plus_with_temporal","p":"Time","d":null},{"u":"Time.html#to_instant-instance_method","n":"#to_instant","p":"Time","d":null},{"u":"Time.html#to_local_date-instance_method","n":"#to_local_date","p":"Time","d":null},{"u":"Time.html#to_local_time-instance_method","n":"#to_local_time","p":"Time","d":null},{"u":"Time.html#to_month-instance_method","n":"#to_month","p":"Time","d":null},{"u":"Time.html#to_month_day-instance_method","n":"#to_month_day","p":"Time","d":null},{"u":"Time.html#to_zoned_date_time-instance_method","n":"#to_zoned_date_time","p":"Time","d":null},{"u":"Time.html#today%3F-instance_method","n":"#today?","p":"Time","d":null},{"u":"Time.html#tomorrow%3F-instance_method","n":"#tomorrow?","p":"Time","d":null},{"u":"Time.html#yesterday%3F-instance_method","n":"#yesterday?","p":"Time","d":null}]} \ No newline at end of file diff --git a/5.33/js/app.js b/5.33/js/app.js new file mode 100644 index 0000000000..4c58d67431 --- /dev/null +++ b/5.33/js/app.js @@ -0,0 +1,387 @@ +(function() { + +var localStorage = {}, sessionStorage = {}; +try { localStorage = window.localStorage; } catch (e) { } +try { sessionStorage = window.sessionStorage; } catch (e) { } + +function createSourceLinks() { + $('.method_details_list .source_code, .attr_details .source_code'). + before("[View source]"); + $('.toggleSource').toggle(function() { + $(this).parent().nextAll('.source_code').slideDown(100); + $(this).text("Hide source"); + }, + function() { + $(this).parent().nextAll('.source_code').slideUp(100); + $(this).text("View source"); + }); +} + +function createDefineLinks() { + var tHeight = 0; + $('.defines').after(" more..."); + $('.toggleDefines').toggle(function() { + tHeight = $(this).parent().prev().height(); + $(this).prev().css('display', 'inline'); + $(this).parent().prev().height($(this).parent().height()); + $(this).text("(less)"); + }, + function() { + $(this).prev().hide(); + $(this).parent().prev().height(tHeight); + $(this).text("more..."); + }); +} + +function createFullTreeLinks() { + var tHeight = 0; + $('.inheritanceTree').toggle(function() { + tHeight = $(this).parent().prev().height(); + $(this).parent().toggleClass('showAll'); + $(this).text("(hide)"); + $(this).parent().prev().height($(this).parent().height()); + }, + function() { + $(this).parent().toggleClass('showAll'); + $(this).parent().prev().height(tHeight); + $(this).text("show all"); + }); +} + +function searchFrameButtons() { + $('.full_list_link').click(function() { + toggleSearchFrame(this, $(this).attr('href')); + return false; + }); + window.addEventListener('message', function(e) { + if (e.data === 'navEscape') { + $('#nav').slideUp(100); + $('#search a').removeClass('active inactive'); + $(window).focus(); + } + }); + + $(window).resize(function() { + if ($('#search:visible').length === 0) { + $('#nav').removeAttr('style'); + $('#search a').removeClass('active inactive'); + $(window).focus(); + } + }); +} + +function toggleSearchFrame(id, link) { + var frame = $('#nav'); + $('#search a').removeClass('active').addClass('inactive'); + if (frame.attr('src') === link && frame.css('display') !== "none") { + frame.slideUp(100); + $('#search a').removeClass('active inactive'); + } + else { + $(id).addClass('active').removeClass('inactive'); + if (frame.attr('src') !== link) frame.attr('src', link); + frame.slideDown(100); + } +} + +function linkSummaries() { + $('.summary_signature').click(function() { + document.location = $(this).find('a').attr('href'); + }); +} + +function summaryToggle() { + $('.summary_toggle').click(function(e) { + e.preventDefault(); + localStorage.summaryCollapsed = $(this).text(); + $('.summary_toggle').each(function() { + $(this).text($(this).text() == "collapse" ? "expand" : "collapse"); + var next = $(this).parent().parent().nextAll('ul.summary').first(); + if (next.hasClass('compact')) { + next.toggle(); + next.nextAll('ul.summary').first().toggle(); + } + else if (next.hasClass('summary')) { + var list = $('