openhab-scripting 5.47.5 → 5.49.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d22421ade202e53be08b9511bcacdeb16b8242587999d8b9a017f928748318cd
4
- data.tar.gz: 6c4e7e8d938b2c6c62c41a8bb1baf5b10470f73fe371f0e2130fc09bf1c09124
3
+ metadata.gz: 7cd17ad8e229eaed4db0be72e682f771612f10c59a1fed7612dae537eb5df073
4
+ data.tar.gz: a10d086518f1069b0f283f3ba680572f55ce4e5ef372397dde455259330b27ae
5
5
  SHA512:
6
- metadata.gz: d338d71faf5eb7adf46c4b787a3202bcf33c5705541727b40d669331e3d85266464681842439e9a5f1fa79f4b5bd1b527b549c2a266f06b7f90ec8ac31a57a9c
7
- data.tar.gz: 34bd14d2816fc2350fbce61f65d891d10b098f0014d09f113ec0ee85347bfed2ec35255fd836d6894db0b1d283315d5da75d74a1e4bb0f4d4ddcdaffd61b84dc
6
+ metadata.gz: ffd401dad6cd239b69f6c28c394d87fbfc9bbe557f3f080520ff579034170dfaabd84f9fc883d53a1b4c2a97bdffa767964a1526010764c7b28bac427cbc3d0a
7
+ data.tar.gz: d8e684891946c9b0fa67ff1b29f0a4ceabc1d1173611ff904993cf39589bc89aad7b882d647bf1eda1045d7f37210d5dc56ea04023bbc4d7638cf2f016f4c1e5
@@ -15,7 +15,8 @@ module OpenHAB
15
15
  # openHAB Cloud Notification Action}.
16
16
  #
17
17
  # @param msg [String] The message to send.
18
- # @param email [String, nil] The email address to send to. If `nil`, the message will be broadcasted.
18
+ # @param email [String, <String>, nil] The email address(es) to send to. If `nil`, the message will be
19
+ # broadcast.
19
20
  # @param icon [String, Symbol, nil] The icon name
20
21
  # (as described in {https://www.openhab.org/docs/configuration/items.html#icons Items}).
21
22
  # @param tag [String, Symbol, nil] a name to group the type or severity of the notification.
@@ -83,7 +84,21 @@ module OpenHAB
83
84
  end
84
85
 
85
86
  args = []
86
- if email
87
+ if email.is_a?(Enumerable)
88
+ email.each do |e|
89
+ send(msg,
90
+ email: e,
91
+ icon:,
92
+ tag:,
93
+ severity:,
94
+ id:,
95
+ title:,
96
+ on_click:,
97
+ attachment:,
98
+ buttons:)
99
+ end
100
+ return
101
+ elsif email
87
102
  args.push(:send_notification, email)
88
103
  else
89
104
  args.push(:send_broadcast_notification)
@@ -116,7 +131,7 @@ module OpenHAB
116
131
  # - Notifications matching the `id` will be hidden, and
117
132
  # - Notifications matching the `tag` will be hidden, independently from the given tag.
118
133
  #
119
- # @param email [String, nil] The email address to hide notifications for.
134
+ # @param email [String, <String>, nil] The email address(es) to hide notifications for.
120
135
  # If nil, hide broadcast notifications.
121
136
  # @param id [String, nil] hide notifications associated with the given reference ID.
122
137
  # @param tag [String, nil] hide notifications associated with the given tag.
@@ -130,7 +145,12 @@ module OpenHAB
130
145
  raise ArgumentError, "Either id or tag must be provided." unless id || tag
131
146
 
132
147
  args = []
133
- if email
148
+ if email.is_a?(Enumerable)
149
+ email.each do |e|
150
+ hide(email: e, id:, tag:)
151
+ end
152
+ return
153
+ elsif email
134
154
  args.push(email)
135
155
  notification = :notification
136
156
  else
@@ -897,6 +897,7 @@ module OpenHAB
897
897
  # @param [String, Core::Things::Channel, Core::Things::ChannelUID] channels
898
898
  # channels to create triggers for in form of 'binding_id:type_id:thing_id#channel_id'
899
899
  # or 'channel_id' if thing is provided.
900
+ # A string that contains `*` and `?` wildcards are supported since openHAB 5.2.
900
901
  # @param [String, Core::Things::Thing, Core::Things::ThingUID] thing
901
902
  # Thing(s) to create trigger for if not specified with the channel.
902
903
  # @param [String, Array<String>] triggered
@@ -4,6 +4,6 @@ module OpenHAB
4
4
  module DSL
5
5
  # Version of openHAB helper libraries
6
6
  # @return [String]
7
- VERSION = "5.47.5"
7
+ VERSION = "5.49.0"
8
8
  end
9
9
  end
@@ -257,6 +257,13 @@ module OpenHAB
257
257
  rs.register_tracker(org.openhab.core.service.ReadyService::ReadyTracker.impl { continue.call }, filter)
258
258
  end
259
259
 
260
+ # openHAB 5.2.0.M5+ can leave RuleEngineImpl.started false in the rspec
261
+ # harness even after the rule-engine startlevel marker is reached.
262
+ # Force it on so RuleEngineImpl.runRule won't drop triggered events.
263
+ rule_manager = OSGi.service("org.openhab.core.automation.RuleManager")
264
+ rule_manager.class.field_accessor :started
265
+ rule_manager.started = true unless rule_manager.started
266
+
260
267
  begin
261
268
  # load storage based type providers
262
269
  ast = org.openhab.core.thing.binding.AbstractStorageBasedTypeProvider
@@ -26,15 +26,18 @@ module OpenHAB
26
26
  end
27
27
 
28
28
  def submit(runnable)
29
- return super unless Thread.current == main_thread
30
-
31
- runnable.respond_to?(:run) ? runnable.run : runnable.call
29
+ if OpenHAB::Core.version < "5.1.0" # @deprecated OH5.1 remove the version guard
30
+ return super unless Thread.current == main_thread # rubocop:disable Style/SoleNestedConditional
31
+ end
32
32
 
33
- java.util.concurrent.CompletableFuture.completed_future(nil)
33
+ value = runnable.respond_to?(:run) ? runnable.run : runnable.call
34
+ java.util.concurrent.CompletableFuture.completed_future(value)
34
35
  end
35
36
 
36
37
  def execute(runnable)
37
- return super unless Thread.current == main_thread
38
+ if OpenHAB::Core.version < "5.1.0" # @deprecated OH5.1 remove the version guard
39
+ return super unless Thread.current == main_thread # rubocop:disable Style/SoleNestedConditional
40
+ end
38
41
 
39
42
  runnable.run
40
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openhab-scripting
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.47.5
4
+ version: 5.49.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian O'Connell
@@ -68,7 +68,7 @@ dependencies:
68
68
  version: 5.0.0
69
69
  - - "<"
70
70
  - !ruby/object:Gem::Version
71
- version: '5.3'
71
+ version: '5.4'
72
72
  type: :runtime
73
73
  prerelease: false
74
74
  version_requirements: !ruby/object:Gem::Requirement
@@ -78,7 +78,7 @@ dependencies:
78
78
  version: 5.0.0
79
79
  - - "<"
80
80
  - !ruby/object:Gem::Version
81
- version: '5.3'
81
+ version: '5.4'
82
82
  email:
83
83
  - broconne+github@gmail.com
84
84
  - cody@cutrer.us
@@ -360,7 +360,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
360
360
  - !ruby/object:Gem::Version
361
361
  version: '0'
362
362
  requirements: []
363
- rubygems_version: 4.0.10
363
+ rubygems_version: 4.0.15
364
364
  specification_version: 4
365
365
  summary: JRuby Helper Libraries for openHAB Scripting
366
366
  test_files: []