openhab-scripting 5.47.4 → 5.48.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: 5278818a9473735ac2ae2c0b85d09df5f5c5b9bc196915cde58fda8ff36fb604
4
- data.tar.gz: d7daf509023b161958993d172cfbf77c5db589735c9b5340243d01cb26674e90
3
+ metadata.gz: ebd253fc1f0f462a281d219b0a102bb6f929e4fc9ae1555c60b8611e2e212487
4
+ data.tar.gz: fc0e411cf1a935d87999ceaaf3750d9ef8d6deee6ebd642c751cd2d1d5085054
5
5
  SHA512:
6
- metadata.gz: 2b173a5be4a3c72e93c12f98de780a9e8d6211182a706f0a66003ff776d9db97d4f91a04282bcb9db6b6a224de76e08b4d33bb54ce9aef4d1ae020339237c737
7
- data.tar.gz: 8b1a93d407a4a69faeceb40be50ef09654b7c95c8ceec213f6bac104041e33e72689e73b6a5a2dad20c19367131ec6aa4276d9b62c8e76510c2c42d560aca670
6
+ metadata.gz: 922a3b755a5258e853e4b3285d67f975d14acc03760adb9f3b66503068053dfa78377a83d60c366f43bac36784df03ff646794905a57883b9b1052b131486f2e
7
+ data.tar.gz: b59b65d06610d7acaa9724b84993ade4464d000d0efe3490b6caf1a4aaaac4082540dfc9a8f5238ab44da85118af8b4e424ce8abb91fd69670070c4c54bd38fd
@@ -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
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenHAB
4
+ module Core
5
+ module Sitemaps
6
+ # @interface
7
+ java_import org.openhab.core.sitemap.LinkableWidget
8
+
9
+ # @since openHAB 5.2.0
10
+ module LinkableWidget
11
+ # @!parse
12
+ # include Widget
13
+
14
+ # @!attribute [r] widgets
15
+ # @return [<Widget>]
16
+
17
+ private
18
+
19
+ def inspect_details
20
+ children_count = widgets.size
21
+ " (#{children_count} child#{"ren" if children_count != 1})" if children_count.positive?
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -37,7 +37,9 @@ module OpenHAB
37
37
 
38
38
  # @deprecated OH 5.2: remove the non-registry branch when dropping OH 5.1
39
39
  if registry
40
+ require_relative "linkable_widget"
40
41
  require_relative "sitemap"
42
+ require_relative "widget"
41
43
 
42
44
  include org.openhab.core.sitemap.registry.SitemapProvider
43
45
  else
@@ -5,6 +5,32 @@ module OpenHAB
5
5
  module Sitemaps
6
6
  # @interface
7
7
  java_import org.openhab.core.sitemap.Sitemap
8
+
9
+ # @since openHAB 5.2.0
10
+ module Sitemap
11
+ # @!attribute [r] name
12
+ # @return [String]
13
+
14
+ # @!attribute [r] label
15
+ # @return [String, nil]
16
+
17
+ # @!attribute [r] icon
18
+ # @return [String, nil]
19
+
20
+ # @!attribute [r] widgets
21
+ # @return [<Widget>]
22
+
23
+ # @return [String]
24
+ def to_s
25
+ r = "#<OpenHAB::Core::Sitemaps::Sitemap #{name}"
26
+ r += " #{label.inspect}" if label
27
+ r += " icon=#{icon.inspect}" if icon
28
+ children_count = widgets.size
29
+ r += " (#{children_count} child#{"ren" if children_count != 1})" if children_count.positive?
30
+ "#{r}>"
31
+ end
32
+ alias_method :inspect, :to_s
33
+ end
8
34
  end
9
35
  end
10
36
  end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenHAB
4
+ module Core
5
+ module Sitemaps
6
+ # @interface
7
+ java_import org.openhab.core.sitemap.Widget
8
+
9
+ # @since openHAB 5.2.0
10
+ module Widget
11
+ # @!attribute [r] item
12
+ # @return [String, nil]
13
+
14
+ # @!attribute [r] label
15
+ # @return [String, nil]
16
+
17
+ # @!attribute [r] icon
18
+ # @return [String, nil]
19
+
20
+ # @!attribute [r] widget_type
21
+ # @return [String]
22
+
23
+ # @return [String]
24
+ def to_s
25
+ r = "#<OpenHAB::Core::Sitemaps::#{widget_type}"
26
+ r += " #{label.inspect}" if label
27
+ r += " item=#{item}" if item
28
+ r += inspect_details.to_s
29
+ "#{r}>"
30
+ end
31
+ alias_method :inspect, :to_s
32
+
33
+ private
34
+
35
+ def inspect_details; end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -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
@@ -1170,7 +1170,10 @@ module OpenHAB
1170
1170
  widget = super
1171
1171
 
1172
1172
  children.each do |child|
1173
- widget.widgets.add(child.build)
1173
+ child = child.build
1174
+ # @deprecated OH 5.2: Remove conditional when dropping OH 5.1
1175
+ child.parent = widget if child.respond_to?(:parent=)
1176
+ widget.widgets.add(child)
1174
1177
  end
1175
1178
 
1176
1179
  widget
@@ -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.4"
7
+ VERSION = "5.48.0"
8
8
  end
9
9
  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.4
4
+ version: 5.48.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian O'Connell
@@ -173,10 +173,12 @@ files:
173
173
  - lib/openhab/core/rules/tagged_array.rb
174
174
  - lib/openhab/core/script_handling.rb
175
175
  - lib/openhab/core/sitemaps/compatibility.rb
176
+ - lib/openhab/core/sitemaps/linkable_widget.rb
176
177
  - lib/openhab/core/sitemaps/model.rb
177
178
  - lib/openhab/core/sitemaps/provider.rb
178
179
  - lib/openhab/core/sitemaps/registry.rb
179
180
  - lib/openhab/core/sitemaps/sitemap.rb
181
+ - lib/openhab/core/sitemaps/widget.rb
180
182
  - lib/openhab/core/things.rb
181
183
  - lib/openhab/core/things/abstract_description_type.rb
182
184
  - lib/openhab/core/things/channel.rb
@@ -358,7 +360,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
358
360
  - !ruby/object:Gem::Version
359
361
  version: '0'
360
362
  requirements: []
361
- rubygems_version: 4.0.9
363
+ rubygems_version: 4.0.11
362
364
  specification_version: 4
363
365
  summary: JRuby Helper Libraries for openHAB Scripting
364
366
  test_files: []