openhab-scripting 4.42.0 → 4.43.0
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/thread_local.rb +1 -1
- data/lib/openhab/dsl/actions.rb +12 -0
- data/lib/openhab/dsl/items/comparable_item.rb +3 -2
- data/lib/openhab/dsl/items/ensure.rb +1 -0
- data/lib/openhab/dsl/items/persistence.rb +4 -4
- data/lib/openhab/dsl/items/timed_command.rb +1 -1
- data/lib/openhab/dsl/rules/rule_config.rb +0 -1
- data/lib/openhab/dsl/rules/triggers/conditions/duration.rb +1 -0
- data/lib/openhab/dsl/rules/triggers/conditions/proc.rb +3 -3
- data/lib/openhab/dsl/timers/timer.rb +1 -1
- data/lib/openhab/log/logger.rb +1 -1
- data/lib/openhab/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ced4a751b4de9b352e205574f4351ed291efe23b2b096b5be7f40e12cc20777
|
4
|
+
data.tar.gz: 914351269a8c397536cb1df56907891565d9214b1d11f6124543dbf91b6aa0f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6f5fd13e613a4b4b018f73236bb050b5b80f1087ac24e6747d5b5aa710920ad9b9bc6bbc56d437b4b8c8ba39f9db516995b15d64592ad813e4bee276ba79b67
|
7
|
+
data.tar.gz: fbee80a3b22ad7c2ee83c42e6294602a88b522926340fe0d5f089a76284b7742bc1d50352de8d2c087fd1a399b810f0182ea8c15f4d2e666eb86465ce6b907d1
|
@@ -33,7 +33,7 @@ module OpenHAB
|
|
33
33
|
# @param [Hash] values Keys and values to set for running thread, if hash is nil no values are set
|
34
34
|
#
|
35
35
|
def thread_local(**values, &block)
|
36
|
-
ThreadLocal.thread_local(values, &block)
|
36
|
+
ThreadLocal.thread_local(**values, &block)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
data/lib/openhab/dsl/actions.rb
CHANGED
@@ -101,6 +101,18 @@ module OpenHAB
|
|
101
101
|
volume = Types::PercentType.new(volume) unless volume.is_a?(Types::PercentType) || volume.nil?
|
102
102
|
Audio.playSound sink&.to_s, filename.to_s, volume
|
103
103
|
end
|
104
|
+
|
105
|
+
#
|
106
|
+
# Play an audio stream from an URL to the given sink(s). Set url to nil if streaming should be stopped
|
107
|
+
#
|
108
|
+
# @param [String] url The URL of the audio stream
|
109
|
+
# @param [String] sink The audio sink, or nil to use the default audio sink
|
110
|
+
#
|
111
|
+
# @return [void]
|
112
|
+
#
|
113
|
+
def play_stream(url, sink: nil)
|
114
|
+
Audio.playStream sink&.to_s, url
|
115
|
+
end
|
104
116
|
end
|
105
117
|
end
|
106
118
|
end
|
@@ -37,7 +37,7 @@ module OpenHAB
|
|
37
37
|
end
|
38
38
|
|
39
39
|
# if we're NULL or UNDEF, implement special logic
|
40
|
-
return nil_comparison unless state?
|
40
|
+
return nil_comparison(other) unless state?
|
41
41
|
|
42
42
|
# delegate to how the state compares to the other object
|
43
43
|
state <=> other
|
@@ -45,9 +45,10 @@ module OpenHAB
|
|
45
45
|
|
46
46
|
# Special logic for NULL/UNDEF state comparison
|
47
47
|
# @!visibility private
|
48
|
-
def nil_comparison
|
48
|
+
def nil_comparison(other)
|
49
49
|
# if comparing to nil, consider ourselves equal
|
50
50
|
return 0 if other.nil?
|
51
|
+
|
51
52
|
# if the other object is an Item, only consider equal if we're
|
52
53
|
# in the same _kind_ of UnDefType state
|
53
54
|
return raw_state == other.raw_state if other.is_a?(GenericItem) && !other.state?
|
@@ -220,10 +220,10 @@ module OpenHAB
|
|
220
220
|
end
|
221
221
|
|
222
222
|
PERSISTENCE_METHODS.each do |method|
|
223
|
-
public_method = method.to_s.delete_suffix('?') # For some reason, the boolean methods with '?' are missing
|
224
223
|
define_method(method) do |timestamp, service = nil|
|
225
224
|
service ||= persistence_service
|
226
|
-
result = PersistenceExtensions.public_send(
|
225
|
+
result = PersistenceExtensions.public_send(method.to_s.delete_suffix('?'), self, to_zdt(timestamp),
|
226
|
+
service&.to_s)
|
227
227
|
wrap_result(result, method)
|
228
228
|
end
|
229
229
|
|
@@ -232,8 +232,8 @@ module OpenHAB
|
|
232
232
|
between_method = method.to_s.sub('_since', '_between').to_sym
|
233
233
|
define_method(between_method) do |start, finish, service = nil|
|
234
234
|
service ||= persistence_service
|
235
|
-
result = PersistenceExtensions.public_send(
|
236
|
-
service&.to_s)
|
235
|
+
result = PersistenceExtensions.public_send(between_method.to_s.delete_suffix('?'), self, to_zdt(start),
|
236
|
+
to_zdt(finish), service&.to_s)
|
237
237
|
wrap_result(result, method)
|
238
238
|
end
|
239
239
|
end
|
@@ -173,7 +173,7 @@ module OpenHAB
|
|
173
173
|
def execute(_mod = nil, inputs = nil)
|
174
174
|
OpenHAB::DSL.import_presets
|
175
175
|
@semaphore.synchronize do
|
176
|
-
thread_local(
|
176
|
+
thread_local(**@thread_locals) do
|
177
177
|
logger.trace "Canceling implicit timer #{@timed_command_details.timer} for "\
|
178
178
|
"#{@timed_command_details.item.id} because received event #{inputs}"
|
179
179
|
@timed_command_details.timer.cancel
|
@@ -35,6 +35,7 @@ module OpenHAB
|
|
35
35
|
from = Conditions::Proc.from_value(from)
|
36
36
|
@conditions = Conditions::Proc.new(to: to, from: from)
|
37
37
|
@duration = duration
|
38
|
+
@timer = nil
|
38
39
|
logger.trace "Created Duration Condition To(#{to}) From(#{from}) "\
|
39
40
|
"Conditions(#{@conditions}) Duration(#{@duration})"
|
40
41
|
end
|
@@ -20,9 +20,6 @@ module OpenHAB
|
|
20
20
|
class Proc
|
21
21
|
include OpenHAB::Log
|
22
22
|
|
23
|
-
# Proc that doesn't check any fields
|
24
|
-
ANY = Proc.new.freeze
|
25
|
-
|
26
23
|
#
|
27
24
|
# Converts supplied ranges to procs that check range
|
28
25
|
# @param [Array] ranges objects to convert to range proc if they are ranges
|
@@ -83,6 +80,9 @@ module OpenHAB
|
|
83
80
|
@command = command
|
84
81
|
end
|
85
82
|
|
83
|
+
# Proc that doesn't check any fields
|
84
|
+
ANY = Proc.new.freeze # this needs to be defined _after_ initialize so its instance variables are set
|
85
|
+
|
86
86
|
#
|
87
87
|
# Process rule
|
88
88
|
# @param [Hash] inputs inputs from trigger
|
data/lib/openhab/log/logger.rb
CHANGED
@@ -212,7 +212,7 @@ module OpenHAB
|
|
212
212
|
.then { |klass| java_klass(klass) }
|
213
213
|
.then(&:name)
|
214
214
|
.then { |name| filter_base_classes(name) }
|
215
|
-
.then { |name| name
|
215
|
+
.then { |name| ".#{name}" unless name.nil? } # name is frozen in jruby 9.4
|
216
216
|
end
|
217
217
|
|
218
218
|
# Get the appropriate java class for the supplied klass if the supplied
|
data/lib/openhab/version.rb
CHANGED
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: 4.
|
4
|
+
version: 4.43.0
|
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: 2022-
|
11
|
+
date: 2022-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|