openhab-scripting 3.9.2 → 3.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/openhab/core/entity_lookup.rb +1 -1
- data/lib/openhab/dsl/timers.rb +2 -2
- data/lib/openhab/dsl/types/datetime.rb +3 -3
- data/lib/openhab/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c03b915b3027b19b32190a109fd89168ff9d4fd2b636176f7f24b0efc2d39b0
|
4
|
+
data.tar.gz: 281990d13b27ef66090ba90f0413f1102ea3945fc4d8f356688ac38b663ea3c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8531c1602708c55a29159ed8a82193040db66a21a23badeccf3eb960a6ac96dee573716de5e15f1d9b47d95bb4f563be87d54abf7ca7db17c30a104e954e295b
|
7
|
+
data.tar.gz: d880407cc64add80e583f99ba7b8220741b51894ab3479f2dafb63a7a30d9c539abaf2c96abacaa2cfbc8c8f64f6ad6679cc5f470fdeed12973af98eee65761c
|
@@ -129,7 +129,7 @@ module OpenHAB
|
|
129
129
|
# Thing UIDs have at least 3 segements
|
130
130
|
return if name.count('_') < 3
|
131
131
|
|
132
|
-
name = name.
|
132
|
+
name = name.tr('_', ':')
|
133
133
|
# rubocop: disable Style/GlobalVars
|
134
134
|
$things.get(Java::OrgOpenhabCoreThing::ThingUID.new(name))
|
135
135
|
# rubocop: enable Style/GlobalVars
|
data/lib/openhab/dsl/timers.rb
CHANGED
@@ -31,14 +31,14 @@ module OpenHAB
|
|
31
31
|
# @param [Duration] duration Duration until timer should fire
|
32
32
|
# @param [Block] block Block to execute when timer fires
|
33
33
|
#
|
34
|
-
def initialize(duration
|
34
|
+
def initialize(duration:)
|
35
35
|
@duration = duration
|
36
36
|
|
37
37
|
# A semaphore is used to prevent a race condition in which calling the block from the timer thread
|
38
38
|
# occurs before the @timer variable can be set resulting in @timer being nil
|
39
39
|
semaphore = Mutex.new
|
40
40
|
|
41
|
-
timer_block = proc { semaphore.synchronize {
|
41
|
+
timer_block = proc { semaphore.synchronize { yield(self) } }
|
42
42
|
|
43
43
|
semaphore.synchronize do
|
44
44
|
@timer = ScriptExecution.createTimer(
|
@@ -81,7 +81,7 @@ module OpenHAB
|
|
81
81
|
|
82
82
|
case other
|
83
83
|
when TimeOfDay::TimeOfDay, TimeOfDay::TimeOfDayRangeElement then to_tod <=> other
|
84
|
-
when String then self <=> DateTime.parse(DATE_ONLY_REGEX
|
84
|
+
when String then self <=> DateTime.parse(DATE_ONLY_REGEX.match?(other) ? "#{other}'T'00:00:00#{zone}" : other)
|
85
85
|
else
|
86
86
|
self <=> DateTime.from(other)
|
87
87
|
end
|
@@ -120,7 +120,7 @@ module OpenHAB
|
|
120
120
|
when Numeric then DateTime.from(to_time - other)
|
121
121
|
when String
|
122
122
|
dt = DateTime.parse(other)
|
123
|
-
TIME_ONLY_REGEX
|
123
|
+
TIME_ONLY_REGEX.match?(other) ? self - dt.to_f : time_diff(dt)
|
124
124
|
when Duration then DateTime.new(zoned_date_time.minus(other))
|
125
125
|
when Time, DateTime, DateTimeType, DateTimeItem then time_diff(other)
|
126
126
|
end
|
@@ -298,7 +298,7 @@ module OpenHAB
|
|
298
298
|
# @return [Java::org::openhab::core::library::types::DateTimeType] Object representing the same time
|
299
299
|
#
|
300
300
|
def self.parse(time_string)
|
301
|
-
time_string += 'Z' if TIME_ONLY_REGEX
|
301
|
+
time_string += 'Z' if TIME_ONLY_REGEX.match?(time_string)
|
302
302
|
DateTime.new(DateTimeType.new(time_string))
|
303
303
|
rescue Java::JavaLang::StringIndexOutOfBoundsException, Java::JavaLang::IllegalArgumentException
|
304
304
|
# Try ruby's Time.parse if OpenHAB's DateTimeType parser fails
|
data/lib/openhab/version.rb
CHANGED