openhab-scripting 3.6.2 → 3.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32d2b52800d9262e6acafa9d34f52341ff864afdee914656244259172236c00f
4
- data.tar.gz: a0bffdf4bc45e3e76054fd3664803bde6a8614eb3fee91572dc5054aeb0e2748
3
+ metadata.gz: ce4c09125467556cead8a8ddbe0e2d24c087dcb1166bcc25d5e3ba0feb453f73
4
+ data.tar.gz: 9f06de9ff62504c2722d09d040d379e28dc2d8015e8191e1011825e48e6ef8a7
5
5
  SHA512:
6
- metadata.gz: c6f6cff7d8416cc278ec6ce2553018e3e420e5c02641d37fa1ffe4f6aede13f92a98041c65e1a607aff5e219eaef6e7ab90e9472a308096b4807617c7ab9046f
7
- data.tar.gz: abbc99702d523b507c327cd1f77f52e73d8ae1d2ed63be0e3ac06112f6a6287d4a4a65f2ba8fe77f8d71339ce374cdc55fd1db30d95a57415b7c116696c77dac
6
+ metadata.gz: c0466716357e5c9d895dc097a7b93b5592c4c40940cdb373a412426698ca9b892546f04eb26ad702586109621b057383bea82accbf2e9cf9a19135f578fc2e2e
7
+ data.tar.gz: 825609752e1294f3bc0fc03167307b52c6518a1745176d7bc7d61c916be5f1b5234b2c60342bf5603b6031241e65fcc9c4ba9f23d57e35327dc4b71583f650e9
@@ -42,6 +42,8 @@ module OpenHAB
42
42
  def_delegator item, method
43
43
  end
44
44
  define_method(:oh_item) { instance_variable_get(item) }
45
+ define_method(:hash) { oh_item.hash_code }
46
+ define_method(:eql?) { |other| hash == other.hash }
45
47
  end
46
48
 
47
49
  #
@@ -106,10 +106,10 @@ module OpenHAB
106
106
  return true if check_to(trigger_delay, new_state)
107
107
 
108
108
  logger.trace("Skipped execution of rule '#{name}' because to state #{new_state}"\
109
- " does not equal specified state(#{trigger_delay.to})")
109
+ " does not equal specified state(#{trigger_delay.to})")
110
110
  else
111
111
  logger.trace("Skipped execution of rule '#{name}' because old state #{old_state}"\
112
- " does not equal specified state(#{trigger_delay.from})")
112
+ " does not equal specified state(#{trigger_delay.from})")
113
113
  end
114
114
  end
115
115
 
@@ -237,7 +237,7 @@ module OpenHAB
237
237
  return true if @between.cover? now
238
238
 
239
239
  logger.trace("Skipped execution of rule '#{name}' because the current time #{now} "\
240
- "is not between #{@between.begin} and #{@between.end}")
240
+ "is not between #{@between.begin} and #{@between.end}")
241
241
  else
242
242
  logger.trace("Skipped execution of rule '#{name}' because of guard #{@guard}")
243
243
  end
@@ -140,11 +140,11 @@ module OpenHAB
140
140
  #
141
141
  def inspect
142
142
  "Name: (#{name}) " \
143
- "Triggers: (#{triggers}) " \
144
- "Run blocks: (#{run}) " \
145
- "on_start: (#{on_start?}) " \
146
- "Trigger Waits: #{trigger_delays} " \
147
- "Trigger UIDs: #{triggers.map(&:id).join(', ')}"
143
+ "Triggers: (#{triggers}) " \
144
+ "Run blocks: (#{run}) " \
145
+ "on_start: (#{on_start?}) " \
146
+ "Trigger Waits: #{trigger_delays} " \
147
+ "Trigger UIDs: #{triggers.map(&:id).join(', ')}"
148
148
  end
149
149
  end
150
150
  end
@@ -153,9 +153,9 @@ module OpenHAB
153
153
  other_second_of_day = to_second_of_day(other)
154
154
  logger.trace do
155
155
  "SOD(#{sod}) "\
156
- "other SOD(#{other_second_of_day}) "\
157
- "Other Class (#{other.class}) "\
158
- "Result (#{sod <=> other_second_of_day})"
156
+ "other SOD(#{other_second_of_day}) "\
157
+ "Other Class (#{other.class}) "\
158
+ "Result (#{sod <=> other_second_of_day})"
159
159
  end
160
160
  sod <=> other_second_of_day
161
161
  end
@@ -152,7 +152,7 @@ module OpenHAB
152
152
  # @return [Float] Number of seconds since the Epoch, with nanosecond presicion
153
153
  #
154
154
  def to_f
155
- zoned_date_time.to_epoch_second + zoned_date_time.nano / 1_000_000_000
155
+ zoned_date_time.to_epoch_second + (zoned_date_time.nano / 1_000_000_000)
156
156
  end
157
157
 
158
158
  #
@@ -20,6 +20,7 @@ module OpenHAB
20
20
  include OpenHAB::Log
21
21
 
22
22
  def_delegator :@quantity, :to_s
23
+ def_delegators '@quantity.double_value', :positive?, :negative?, :zero?
23
24
 
24
25
  java_import org.openhab.core.library.types.QuantityType
25
26
  java_import org.openhab.core.library.types.DecimalType
@@ -146,7 +147,7 @@ module OpenHAB
146
147
  define_method(operation) do |other|
147
148
  logger.trace do
148
149
  "Executing math operation '#{operation}' on quantity #{inspect} "\
149
- "with other type #{other.class} and value #{other.inspect}"
150
+ "with other type #{other.class} and value #{other.inspect}"
150
151
  end
151
152
 
152
153
  a, b = to_qt(coerce(other).reverse)
@@ -185,8 +186,8 @@ module OpenHAB
185
186
  #
186
187
  # @return [Array] Array of QuantityType objects
187
188
  #
188
- def to_qt(*quanities)
189
- [quanities].flatten.compact.map { |item| item.is_a?(Quantity) ? item.quantity : item }
189
+ def to_qt(*quantities)
190
+ [quantities].flatten.compact.map { |item| item.is_a?(Quantity) ? item.quantity : item }
190
191
  end
191
192
 
192
193
  #
@@ -5,5 +5,5 @@
5
5
  #
6
6
  module OpenHAB
7
7
  # @return [String] Version of OpenHAB helper libraries
8
- VERSION = '3.6.2'
8
+ VERSION = '3.7.1'
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openhab-scripting
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.2
4
+ version: 3.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian O'Connell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-02 00:00:00.000000000 Z
11
+ date: 2021-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler