openhab-scripting 5.38.5 → 5.39.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: f837c043c0b58d688830c0cc06c0c681fb2bc3337cb2339735698e8b32cb22db
4
- data.tar.gz: 7fc34b3422e4bbf599175431297ac35bf8342c333d1a79b9c331d73fb5d1d816
3
+ metadata.gz: 42bb17850e8b9ed0e6c1d585eb4484d8aa32cd4d7606d6a33e92da33c8f25495
4
+ data.tar.gz: ceedee653482dffbd6612808f2707639d162e5b15113fc882b3c0e27785375d6
5
5
  SHA512:
6
- metadata.gz: e36b375d4ecc8ec2ba59b5c154d1ca037d61c6bb9a2fdce9a7084038bf62e3cccdf1173fb9768f0015e07afa0ee9ec0b0ac92839be98ea750ce752862d9a7fc8
7
- data.tar.gz: 0beef971e272145cc43dbdedc62f07dce8ac3e5e6fba37d8fbee4eda8fe26d73f246c1338607de007db6196e73488ed1778099bbe119282cf5c33ce5f3c7a151
6
+ metadata.gz: 3c6ee7006beb70981412855a33d503a8eb93d79418cba0838f2424b514725754522c02e35ab170484beb724bb8c5bb26f750c62d8b739bac645bb4e43685b2f2
7
+ data.tar.gz: 337b1069f2e153acb498fdcf4ec7ffa359197b88b9fc1c3075d24cc1ec1ba83bd4269ff741b442c7dad1c8b5b8bb6a6dcffddf85af35af511efcd2a860e2a92b
@@ -23,7 +23,7 @@ module OpenHAB
23
23
  end
24
24
 
25
25
  def winsize
26
- [@terminal.width, @terminal.height]
26
+ [@terminal.height, @terminal.width]
27
27
  end
28
28
 
29
29
  def inspect
@@ -132,15 +132,25 @@ module OpenHAB
132
132
  # @since openHAB 4.2
133
133
  # @since openHAB 5.0 riemann_type parameter added
134
134
 
135
- # @!method average_between(start, finish, service = nil, riemann_type: nil)
135
+ # @!method average_between
136
136
  # Returns the average value of the item's state between two points in time
137
- # @param [#to_zoned_date_time] start The point in time from which to search
138
- # @param [#to_zoned_date_time] finish The point in time to which to search
139
- # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
140
- # @param [:left, :midpoint, :right, :trapezoidal] riemann_type An optional approximation type for Riemann sum.
141
- # If nil, :left is used.
137
+ #
138
+ # @overload average_between(start, finish, service = nil, reimann_type: nil)
139
+ # @param [#to_zoned_date_time] start The point in time from which to search
140
+ # @param [#to_zoned_date_time] finish The point in time to which to search
141
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
142
+ # @param [:left, :midpoint, :right, :trapezoidal] riemann_type An optional approximation type for Riemann
143
+ # sum. If nil, :left is used.
144
+ #
145
+ # @overload average_between(range, service = nil, reimann_type: nil)
146
+ # @param [Range<#to_zoned_date_time>] range The time range to search
147
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
148
+ # @param [:left, :midpoint, :right, :trapezoidal] riemann_type An optional approximation type for Riemann
149
+ # sum. If nil, :left is used.
150
+ #
142
151
  # @return [DecimalType, QuantityType, nil] The average value between `start` and `finish`,
143
152
  # or nil if no states could be found.
153
+ #
144
154
  # @since openHAB 5.0 riemann_type parameter added
145
155
 
146
156
  # @!method delta_since(timestamp, service = nil)
@@ -158,11 +168,18 @@ module OpenHAB
158
168
  # or nil if no future states could be found.
159
169
  # @since openHAB 4.2
160
170
 
161
- # @!method delta_between(start, finish, service = nil)
171
+ # @!method delta_between
162
172
  # Returns the difference value of the item's state between two points in time
163
- # @param [#to_zoned_date_time] start The point in time from which to search
164
- # @param [#to_zoned_date_time] finish The point in time to which to search
165
- # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
173
+ #
174
+ # @overload delta_between(start, finish, service = nil)
175
+ # @param [#to_zoned_date_time] start The point in time from which to search
176
+ # @param [#to_zoned_date_time] finish The point in time to which to search
177
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
178
+ #
179
+ # @overload delta_between(range, service = nil)
180
+ # @param [Range<#to_zoned_date_time>] range The time range to search
181
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
182
+ #
166
183
  # @return [DecimalType, QuantityType, nil] The difference value between `start` and `finish`,
167
184
  # or nil if no states could be found.
168
185
 
@@ -187,13 +204,19 @@ module OpenHAB
187
204
  # @since openHAB 4.2
188
205
  # @since openHAB 5.0 riemann_type parameter added
189
206
 
190
- # @!method deviation_between(start, finish, service = nil, riemann_type: nil)
207
+ # @!method deviation_between
191
208
  # Returns the standard deviation of the item's state between two points in time
192
- # @param [#to_zoned_date_time] start The point in time from which to search
193
- # @param [#to_zoned_date_time] finish The point in time to which to search
194
- # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
195
- # @param [:left, :midpoint, :right, :trapezoidal] riemann_type An optional approximation type for Riemann sum.
196
- # If nil, :left is used.
209
+ #
210
+ # @overload deviation_between(start, finish, service = nil)
211
+ # @param [#to_zoned_date_time] start The point in time from which to search
212
+ # @param [#to_zoned_date_time] finish The point in time to which to search
213
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
214
+ # @param [:left, :midpoint, :right, :trapezoidal] riemann_type An optional approximation type for Riemann
215
+ # sum. If nil, :left is used.
216
+ # @overload deviation_between(range, service = nil)
217
+ # @param [Range<#to_zoned_date_time>] range The time range to search
218
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
219
+ #
197
220
  # @return [DecimalType, QuantityType, nil] The standard deviation between `start` and `finish`,
198
221
  # or nil if no states could be found.
199
222
  # @since openHAB 5.0 riemann_type parameter added
@@ -214,11 +237,17 @@ module OpenHAB
214
237
  # or nil if no future states could be found.
215
238
  # @since openHAB 4.3
216
239
 
217
- # @!method median_between(start, finish, service = nil)
240
+ # @!method median_between
218
241
  # Returns the median of the item's state between two points in time
219
- # @param [#to_zoned_date_time] start The point in time from which to search
220
- # @param [#to_zoned_date_time] finish The point in time to which to search
221
- # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
242
+ #
243
+ # @overload median_between(start, finish, service = nil)
244
+ # @param [#to_zoned_date_time] start The point in time from which to search
245
+ # @param [#to_zoned_date_time] finish The point in time to which to search
246
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
247
+ # @overload median_between(range, service = nil)
248
+ # @param [Range<#to_zoned_date_time>] range The time range to search
249
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
250
+ #
222
251
  # @return [DecimalType, QuantityType, nil] The median between `start` and `finish`,
223
252
  # or nil if no states could be found.
224
253
  # @since openHAB 4.3
@@ -238,11 +267,17 @@ module OpenHAB
238
267
  # or nil if no future states could be found.
239
268
  # @since openHAB 4.2
240
269
 
241
- # @!method sum_between(start, finish, service = nil)
270
+ # @!method sum_between
242
271
  # Returns the sum of the item's state between two points in time
243
- # @param [#to_zoned_date_time] start The point in time from which to search
244
- # @param [#to_zoned_date_time] finish The point in time to which to search
245
- # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
272
+ #
273
+ # @overload sum_between(start, finish, service = nil)
274
+ # @param [#to_zoned_date_time] start The point in time from which to search
275
+ # @param [#to_zoned_date_time] finish The point in time to which to search
276
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
277
+ # @overload sum_between(range, service = nil)
278
+ # @param [Range<#to_zoned_date_time>] range The time range to search
279
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
280
+ #
246
281
  # @return [DecimalType, QuantityType, nil] The sum between `start` and `finish`,
247
282
  # or nil if no states could be found.
248
283
 
@@ -267,13 +302,21 @@ module OpenHAB
267
302
  # @since openHAB 4.2
268
303
  # @since openHAB 5.0 riemann_type parameter added
269
304
 
270
- # @!method variance_between(start, finish, service = nil, riemann_type: nil)
305
+ # @!method variance_between
271
306
  # Returns the variance of the item's state between two points in time
272
- # @param [#to_zoned_date_time] start The point in time from which to search
273
- # @param [#to_zoned_date_time] finish The point in time to which to search
274
- # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
275
- # @param [:left, :midpoint, :right, :trapezoidal] riemann_type An optional approximation type for Riemann sum.
276
- # If nil, :left is used.
307
+ #
308
+ # @overload variance_between(start, finish, service = nil, reimann_type: nil)
309
+ # @param [#to_zoned_date_time] start The point in time from which to search
310
+ # @param [#to_zoned_date_time] finish The point in time to which to search
311
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
312
+ # @param [:left, :midpoint, :right, :trapezoidal] riemann_type An optional approximation type for Riemann
313
+ # sum. If nil, :left is used.
314
+ # @overload variance_between(range, service = nil, reimann_type: nil)
315
+ # @param [Range<#to_zoned_date_time>] range The time range to search
316
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
317
+ # @param [:left, :midpoint, :right, :trapezoidal] riemann_type An optional approximation type for Riemann
318
+ # sum. If nil, :left is used.
319
+ #
277
320
  # @return [DecimalType, QuantityType, nil] The variance between `start` and `finish`,
278
321
  # or nil if no states could be found.
279
322
  # @since openHAB 5.0 riemann_type parameter added
@@ -291,11 +334,17 @@ module OpenHAB
291
334
  # @return [true,false] True if the item's state has changed until the given `timestamp`, False otherwise.
292
335
  # @since openHAB 4.2
293
336
 
294
- # @!method changed_between?(start, finish, service = nil)
337
+ # @!method changed_between?
295
338
  # Whether the item's state changed between two points in time
296
- # @param [#to_zoned_date_time] start The point in time from which to search
297
- # @param [#to_zoned_date_time] finish The point in time to which to search
298
- # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
339
+ #
340
+ # @overload changed_between?(start, finish, service = nil)
341
+ # @param [#to_zoned_date_time] start The point in time from which to search
342
+ # @param [#to_zoned_date_time] finish The point in time to which to search
343
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
344
+ # @overload changed_between?(range, service = nil)
345
+ # @param [Range<#to_zoned_date_time>] range The time range to search
346
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
347
+ #
299
348
  # @return [true,false] True if the item's state changed between `start` and `finish`, False otherwise.
300
349
 
301
350
  # @!method evolution_rate(timestamp, service = nil)
@@ -335,11 +384,17 @@ module OpenHAB
335
384
  # or nil if no future states could be found.
336
385
  # @since openHAB 4.2
337
386
 
338
- # @!method evolution_rate_between(start, finish, service = nil)
387
+ # @!method evolution_rate_between
339
388
  # Returns the evolution rate of the item's state between two points in time
340
- # @param [#to_zoned_date_time] start The point in time from which to search
341
- # @param [#to_zoned_date_time] finish The point in time to which to search
342
- # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
389
+ #
390
+ # @overload evolution_rate_between(start, finish, service = nil)
391
+ # @param [#to_zoned_date_time] start The point in time from which to search
392
+ # @param [#to_zoned_date_time] finish The point in time to which to search
393
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
394
+ # @overload evolution_rate_between(range, service = nil)
395
+ # @param [Range<#to_zoned_date_time>] range The time range to search
396
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
397
+ #
343
398
  # @return [DecimalType, nil] The evolution rate between `start` and `finish`,
344
399
  # or nil if no states could be found.
345
400
  # @since openHAB 4.2
@@ -375,11 +430,17 @@ module OpenHAB
375
430
  # or nil if no future states could be found.
376
431
  # @since openHAB 4.2
377
432
 
378
- # @!method maximum_between(start, finish, service = nil)
433
+ # @!method maximum_between
379
434
  # Returns the maximum value of the item's state between two points in time
380
- # @param [#to_zoned_date_time] start The point in time from which to search
381
- # @param [#to_zoned_date_time] finish The point in time to which to search
382
- # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
435
+ #
436
+ # @overload maximum_between(start, finish, service = nil)
437
+ # @param [#to_zoned_date_time] start The point in time from which to search
438
+ # @param [#to_zoned_date_time] finish The point in time to which to search
439
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
440
+ # @overload maximum_between(range, service = nil)
441
+ # @param [Range<#to_zoned_date_time>] range The time range to search
442
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
443
+ #
383
444
  # @return [PersistedState, nil] The maximum value between `start` and `finish`,
384
445
  # or nil if no states could be found.
385
446
 
@@ -398,11 +459,17 @@ module OpenHAB
398
459
  # or nil if no future states could be found.
399
460
  # @since openHAB 4.2
400
461
 
401
- # @!method minimum_between(start, finish, service = nil)
462
+ # @!method minimum_between
402
463
  # Returns the minimum value of the item's state between two points in time
403
- # @param [#to_zoned_date_time] start The point in time from which to search
404
- # @param [#to_zoned_date_time] finish The point in time to which to search
405
- # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
464
+ #
465
+ # @overload minimum_between(start, finish, service = nil)
466
+ # @param [#to_zoned_date_time] start The point in time from which to search
467
+ # @param [#to_zoned_date_time] finish The point in time to which to search
468
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
469
+ # @overload minimum_between(range, service = nil)
470
+ # @param [Range<#to_zoned_date_time>] range The time range to search
471
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
472
+ #
406
473
  # @return [PersistedState, nil] The minimum value between `start` and `finish`,
407
474
  # or nil if no states could be found.
408
475
 
@@ -419,11 +486,17 @@ module OpenHAB
419
486
  # @return [true,false] True if the item's state will be updated until the given `timestamp`, False otherwise.
420
487
  # @since openHAB 4.2
421
488
 
422
- # @!method updated_between?(start, finish, service = nil)
489
+ # @!method updated_between?
423
490
  # Whether the item's state was updated between two points in time
424
- # @param [#to_zoned_date_time] start The point in time from which to search
425
- # @param [#to_zoned_date_time] finish The point in time to which to search
426
- # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
491
+ #
492
+ # @overload updated_between?(start, finish, service = nil)
493
+ # @param [#to_zoned_date_time] start The point in time from which to search
494
+ # @param [#to_zoned_date_time] finish The point in time to which to search
495
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
496
+ # @overload updated_between?(range, service = nil)
497
+ # @param [Range<#to_zoned_date_time>] range The time range to search
498
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
499
+ #
427
500
  # @return [true,false] True if the item's state was updated between `start` and `finish`, False otherwise.
428
501
 
429
502
  # @!method count_since(timestamp, service = nil)
@@ -439,11 +512,17 @@ module OpenHAB
439
512
  # @return [Integer] The number of values persisted for this item.
440
513
  # @since openHAB 4.2
441
514
 
442
- # @!method count_between(start, finish, service = nil)
515
+ # @!method count_between
443
516
  # Returns the number of available data points between two points in time.
444
- # @param [#to_zoned_date_time] start The point in time from which to search
445
- # @param [#to_zoned_date_time] finish The point in time to which to search
446
- # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
517
+ #
518
+ # @overload count_between(start, finish, service = nil)
519
+ # @param [#to_zoned_date_time] start The point in time from which to search
520
+ # @param [#to_zoned_date_time] finish The point in time to which to search
521
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
522
+ # @overload count_between(range, service = nil)
523
+ # @param [Range<#to_zoned_date_time>] range The time range to search
524
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
525
+ #
447
526
  # @return [Integer] The number of values persisted for this item.
448
527
 
449
528
  # @!method count_state_changes_since(timestamp, service = nil)
@@ -459,11 +538,17 @@ module OpenHAB
459
538
  # @return [Integer] The number of values persisted for this item.
460
539
  # @since openHAB 4.2
461
540
 
462
- # @!method count_state_changes_between(start, finish, service = nil)
541
+ # @!method count_state_changes_between
463
542
  # Returns the number of changes in data points between two points in time.
464
- # @param [#to_zoned_date_time] start The point in time from which to search
465
- # @param [#to_zoned_date_time] finish The point in time to which to search
466
- # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
543
+ #
544
+ # @overload count_state_changes_between(start, finish, service = nil)
545
+ # @param [#to_zoned_date_time] start The point in time from which to search
546
+ # @param [#to_zoned_date_time] finish The point in time to which to search
547
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
548
+ # @overload count_state_changes_between(range, service = nil)
549
+ # @param [Range<#to_zoned_date_time>] range The time range to search
550
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
551
+ #
467
552
  # @return [Integer] The number of values persisted for this item.
468
553
 
469
554
  # @!method all_states_since(timestamp, service = nil)
@@ -480,11 +565,17 @@ module OpenHAB
480
565
  # @return [Array<PersistedState>] An array of {PersistedState} persisted for this item.
481
566
  # @since openHAB 4.2
482
567
 
483
- # @!method all_states_between(start, finish, service = nil)
568
+ # @!method all_states_between
484
569
  # Returns all the states between two points in time.
485
- # @param [#to_zoned_date_time] start The point in time from which to search
486
- # @param [#to_zoned_date_time] finish The point in time to which to search
487
- # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
570
+ #
571
+ # @overload all_states_between(start, finish, service = nil)
572
+ # @param [#to_zoned_date_time] start The point in time from which to search
573
+ # @param [#to_zoned_date_time] finish The point in time to which to search
574
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
575
+ # @overload all_states_between(range, service = nil)
576
+ # @param [Range<#to_zoned_date_time>] range The time range to search
577
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
578
+ #
488
579
  # @return [Array<PersistedState>] An array of {PersistedState} persisted for this item.
489
580
  # @since openHAB 4.0
490
581
 
@@ -508,13 +599,21 @@ module OpenHAB
508
599
  # or nil if no previous states could be found.
509
600
  # @since openHAB 5.0
510
601
 
511
- # @!method riemann_sum_between(start, finish, service = nil, riemann_type: nil)
602
+ # @!method riemann_sum_between
512
603
  # Returns the Riemann sum of the states between two points in time.
513
- # @param [#to_zoned_date_time] start The point in time from which to search
514
- # @param [#to_zoned_date_time] finish The point in time to which to search
515
- # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
516
- # @param [:left, :midpoint, :right, :trapezoidal] riemann_type An optional approximation type for Riemann sum.
517
- # If nil, :left is used.
604
+ #
605
+ # @overload riemann_sum_between(start, finish, service = nil, riemann_type: nil)
606
+ # @param [#to_zoned_date_time] start The point in time from which to search
607
+ # @param [#to_zoned_date_time] finish The point in time to which to search
608
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
609
+ # @param [:left, :midpoint, :right, :trapezoidal] riemann_type An optional approximation type for Riemann
610
+ # sum. If nil, :left is used.
611
+ # @overload riemann_sum_between(range, service = nil, riemann_type: nil)
612
+ # @param [Range<#to_zoned_date_time>] range The time range to search
613
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
614
+ # @param [:left, :midpoint, :right, :trapezoidal] riemann_type An optional approximation type for Riemann
615
+ # sum. If nil, :left is used.
616
+ #
518
617
  # @return [DecimalType, QuantityType, nil] The riemann sum between `start` and `finish`,
519
618
  # or nil if no previous states could be found.
520
619
  # @since openHAB 5.0
@@ -533,11 +632,17 @@ module OpenHAB
533
632
  # @return [void]
534
633
  # @since openHAB 4.2
535
634
 
536
- # @!method remove_all_states_between(start, finish, service = nil)
635
+ # @!method remove_all_states_between
537
636
  # Removes persisted data points between two points in time.
538
- # @param [#to_zoned_date_time] start The point in time from which to remove
539
- # @param [#to_zoned_date_time] finish The point in time to which to remove
540
- # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
637
+ #
638
+ # @overload remove_all_states_between(start, finish, service = nil)
639
+ # @param [#to_zoned_date_time] start The point in time from which to remove
640
+ # @param [#to_zoned_date_time] finish The point in time to which to remove
641
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
642
+ # @overload remove_all_states_between(range, service = nil)
643
+ # @param [Range<#to_zoned_date_time>] range The time range to remove
644
+ # @param [Symbol, String] service An optional persistence id instead of the default persistence service.
645
+ #
541
646
  # @return [void]
542
647
  # @since openHAB 4.2
543
648
 
@@ -756,17 +861,23 @@ module OpenHAB
756
861
 
757
862
  method = "#{method}_between"
758
863
  class_eval <<~RUBY, __FILE__, __LINE__ + 1
759
- def #{method}#{suffix}(start, finish, service = nil#{riemann_param}) # def changed_between?(start, finish, service = nil, riemann_type: nil)
760
- service ||= persistence_service # service ||= persistence_service
761
- result = Actions::PersistenceExtensions.#{method}( # result = Actions::PersistenceExtensions.average_between(
762
- self, # self,
763
- start.to_zoned_date_time, # start.to_zoned_date_time,
764
- finish.to_zoned_date_time, # finish.to_zoned_date_time,
765
- #{riemann_arg} # to_riemann_type(riemann_type),
766
- service&.to_s # service&.to_s
767
- ) # )
768
- wrap_result(result, quantify: #{quantify}) # wrap_result(result, quantify: false)
769
- end # end
864
+ def #{method}#{suffix}(start, finish = nil, service = nil#{riemann_param}) # def changed_between?(start, finish, service = nil, riemann_type: nil)
865
+ if start.is_a?(Range) # if start.is_a?(Range)
866
+ raise ArgumentError, "wrong number of arguments (given 3, expected 2)" if service # raise ArgumentError, "wrong number of arguments (given 3, expected 2)" if service
867
+ service = finish # service = finish
868
+ finish = start.end # finish = start.end
869
+ start = start.begin # start = start.begin
870
+ end # end
871
+ service ||= persistence_service # service ||= persistence_service
872
+ result = Actions::PersistenceExtensions.#{method}( # result = Actions::PersistenceExtensions.average_between(
873
+ self, # self,
874
+ start.to_zoned_date_time, # start.to_zoned_date_time,
875
+ finish.to_zoned_date_time, # finish.to_zoned_date_time,
876
+ #{riemann_arg} # to_riemann_type(riemann_type),
877
+ service&.to_s # service&.to_s
878
+ ) # )
879
+ wrap_result(result, quantify: #{quantify}) # wrap_result(result, quantify: false)
880
+ end # end
770
881
  RUBY
771
882
  end
772
883
  end
@@ -571,9 +571,9 @@ module Enumerable
571
571
  # Returns a new array of items that are a semantics Location (optionally of one of the given types)
572
572
  #
573
573
  # @param [SemanticTag] types
574
- # Pass 1 or more classes that are sub-classes of {Semantics::Location Semantics::Location}.
574
+ # Pass 1 or more tags that are sub-tags of {Semantics::Location Semantics::Location}.
575
575
  # Note that when comparing against semantic tags, it does a sub-class check by default.
576
- # So if you search for [Room], you'll get items tagged with [LivingRoom], [Kitchen], etc.
576
+ # So if you search for `Room`, you'll get items tagged with `LivingRoom`, `Kitchen`, etc.
577
577
  # @param [true, false] subclasses
578
578
  # If true, match all subclasses of the given types.
579
579
  # If false, only match the exact type.
@@ -614,9 +614,9 @@ module Enumerable
614
614
  # before calling {#points}. See the example with {#points}.
615
615
  #
616
616
  # @param [SemanticTag] types
617
- # Pass 1 or more classes that are sub-classes of {Semantics::Equipment Semantics::Equipment}.
618
- # Note that when comparing against semantic tags, it does a sub-class check by default.
619
- # So if you search for [Fan], you'll get items tagged with [CeilingFan], [KitchenHood], etc.
617
+ # Pass 1 or more tags that are sub-classes of {Semantics::Equipment Semantics::Equipment}.
618
+ # Note that when comparing against semantic tags, it does a sub-class check by default,
619
+ # so if you search for `Fan`, you'll get items tagged with `CeilingFan`, `KitchenHood`, etc.
620
620
  # @param [true, false] subclasses
621
621
  # If true, match all subclasses of the given types.
622
622
  # If false, only match the exact type.
@@ -649,11 +649,15 @@ module Enumerable
649
649
 
650
650
  # Returns a new array of items that are semantics points (optionally of a given type)
651
651
  #
652
- # @param [SemanticTag] point_or_property_types
653
- # Pass 1 or 2 classes that are sub-classes of {Semantics::Point Semantics::Point} or
654
- # {Semantics::Property Semantics::Property}.
655
- # Note that when comparing against semantic tags, it does a sub-class check by default.
656
- # So if you search for [Control], you'll get items tagged with [Switch].
652
+ # @param [SemanticTag, Array<SemanticTag>] point_or_property_types
653
+ # Pass 1 or more tags that are sub-tags of {Semantics::Point Semantics::Point} or
654
+ # {Semantics::Property Semantics::Property}. If multiple point _or_ property
655
+ # tags are given, the point only has to match one of them. But if point _and_
656
+ # property tag(s) are given, the point must match both a point and property tag.
657
+ # You may also pass an array of tags, to match multiple combination of tags at once.
658
+ # See the air temperature/speed control example below.
659
+ # Note that when comparing against semantic tags, it does a sub-class check by default,
660
+ # so if you search for `Control`, you'll get items tagged with `Switch`.
657
661
  # @param [true, false] subclasses
658
662
  # If true, match all subclasses of the given types.
659
663
  # If false, only match the exact type.
@@ -662,35 +666,58 @@ module Enumerable
662
666
  # @example Get all the power switch items for every equipment in a room
663
667
  # lGreatRoom.equipments.members.points(Semantics::Switch)
664
668
  #
669
+ # @example Get (all) the temperature setpoints for a thermostat
670
+ # eMainFloorThermostat.points(Semantics::Setpoint, Semantics::Temperature)
671
+ #
672
+ # @example Get all the brightness and color (light) points in a room
673
+ # lKitchen.equipments.members.points(Semantics::Brightness, Semantics::Color)
674
+ #
675
+ # @example Get all the brightness and color (light) control points in a room
676
+ # lKitchen.equipments.members.points(Semantics::Control, Semantics::Brightness, Semantics::Color)
677
+ #
678
+ # @example Get the air temperature and speed control points in a room
679
+ # lGreatRoom.equipments.members.points([Semantics::Measurement, Semantics::Temperature],
680
+ # [Semantics::Control, Semantics::Speed])
681
+ # # => [GreatRoom_AirTemp, GreatRoom_FanSpeed]
682
+ #
665
683
  # @see #members
666
684
  #
667
685
  def points(*point_or_property_types, subclasses: true)
668
- unless (0..2).cover?(point_or_property_types.length)
669
- raise ArgumentError, "wrong number of arguments (given #{point_or_property_types.length}, expected 0..2)"
670
- end
686
+ return select(&:point?) if point_or_property_types.empty?
671
687
 
672
688
  begin
673
- raise ArgumentError unless point_or_property_types.all? do |tag|
674
- tag < Semantics::Point ||
675
- tag < Semantics::Property
676
- end
689
+ arrays, non_arrays = point_or_property_types.partition { |tag| tag.is_a?(Array) }
690
+ arrays << non_arrays unless non_arrays.empty?
691
+
692
+ arrays.map! do |array|
693
+ points = array.select { |tag| tag < Semantics::Point }
694
+ properties = array.select { |tag| tag < Semantics::Property }
695
+ raise ArgumentError unless points.length + properties.length == array.length
696
+
697
+ [points, properties]
698
+ end
677
699
  rescue ArgumentError, TypeError
678
- raise ArgumentError, "point_or_property_types must all be a subclass of Point or Property"
679
- end
680
- if point_or_property_types.count { |tag| tag < Semantics::Point } > 1 ||
681
- point_or_property_types.count { |tag| tag < Semantics::Property } > 1
682
- raise ArgumentError, "point_or_property_types cannot both be a subclass of Point or Property"
700
+ raise ArgumentError, "point_or_property_types must all be arrays, or a subclass of Point or Property"
683
701
  end
684
702
 
685
703
  select do |point|
686
- point.point? && point_or_property_types.all? do |tag|
704
+ point.point? && arrays.any? do |(points, properties)|
687
705
  if subclasses
688
- (tag < Semantics::Point && point.point_type&.<=(tag)) ||
689
- (tag < Semantics::Property && point.property_type&.<=(tag))
706
+ next false if !points.empty? &&
707
+ ((point_type = point.point_type).nil? ||
708
+ points.none? { |tag| point_type <= tag })
709
+ next false if !properties.empty? &&
710
+ ((property_type = point.property_type).nil? ||
711
+ properties.none? { |tag| property_type <= tag })
690
712
  else
691
- (tag < Semantics::Point && point.point_type == tag) ||
692
- (tag < Semantics::Property && point.property_type == tag)
713
+ next false if !points.empty? &&
714
+ ((point_type = point.point_type).nil? ||
715
+ points.none?(point_type))
716
+ next false if !properties.empty? &&
717
+ ((property_type = point.property_type).nil? ||
718
+ properties.none?(property_type))
693
719
  end
720
+ true
694
721
  end
695
722
  end
696
723
  end
@@ -4,6 +4,6 @@ module OpenHAB
4
4
  module DSL
5
5
  # Version of openHAB helper libraries
6
6
  # @return [String]
7
- VERSION = "5.38.5"
7
+ VERSION = "5.39.0"
8
8
  end
9
9
  end
@@ -7,6 +7,7 @@ require "time"
7
7
 
8
8
  require_relative "jruby"
9
9
  require_relative "shell"
10
+ require_relative "mocks/synchronous_executor"
10
11
 
11
12
  module OpenHAB
12
13
  module RSpec
@@ -291,7 +292,6 @@ module OpenHAB
291
292
  cfg.update(props)
292
293
  end
293
294
  wait_for_service("org.openhab.core.automation.RuleManager") do |re|
294
- require_relative "mocks/synchronous_executor"
295
295
  # overwrite thCallbacks to one that will spy to remove threading
296
296
  field = re.class.java_class.declared_field :thCallbacks
297
297
  field.accessible = true
@@ -430,8 +430,6 @@ module OpenHAB
430
430
  end
431
431
 
432
432
  if bundle_name == "org.openhab.core"
433
- require_relative "mocks/synchronous_executor"
434
-
435
433
  org.openhab.core.common.ThreadPoolManager.field_accessor :pools
436
434
  org.openhab.core.common.ThreadPoolManager.pools = Mocks::SynchronousExecutorMap.instance
437
435
  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.38.5
4
+ version: 5.39.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian O'Connell