openhab-scripting 5.30.0 → 5.31.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec8c705070eb9fa18e95281eb9247ec66e53b9656810f785cf1690ae7b9812f5
4
- data.tar.gz: 32fbf23e31ab742a9799579d51a4fa3e5b59274a771321129af1f085ed6170ed
3
+ metadata.gz: 1d1996259cb097848c88f6ed61d4d715710299a6f9ac93e4e8ccf2925b651c7e
4
+ data.tar.gz: 4283efc59d3e6e0df288c79f2ab6e8220c64441f4d5bd63474b5075690c1556b
5
5
  SHA512:
6
- metadata.gz: 66643a7bf0b77e60d0277ece16fa71a8f8fe51f3a84d26c38b726e76dcfaf336a11c6688b26a5a426569f98ee1ffee97f53491084959c00f217bb3468866f579
7
- data.tar.gz: 0a8d019c6de74b12183382680334606103be3878cd0b4ac2785df324fc82301e81d2f9c3e9b9d5ae747bb612439c2b25260106a5fd3bd092d83303015cde2e0d
6
+ metadata.gz: 3d9d5ef94c19724d7c4f58e349c41def3c538c7240a4f744c44dd15dd96692b9ffb368e4173ee43dff5f5d56a3128610a03411589d2c668d3a7418c3ad84a52e
7
+ data.tar.gz: dcd5c517c8e536f25a629a32d4681ce488168c07c23739c775ea147184d640aa36c1eea3c43ffb8d228051c4d7a19e62b5fb8507c4107b4baa442315ad58ec15
@@ -103,10 +103,10 @@ module Enumerable
103
103
 
104
104
  # Send a command to every item in the collection, even when {OpenHAB::DSL.ensure_states! ensure_states!} is in effect.
105
105
  # @return [self]
106
- def command!(command)
106
+ def command!(command, **kwargs)
107
107
  # We cannot alias this to #command above, otherwise it will call
108
108
  # DSL::Items::Ensure::Item#command which checks for ensure_states
109
- each { |i| i.command!(command) }
109
+ each { |i| i.command!(command, **kwargs) }
110
110
  self
111
111
  end
112
112
 
@@ -198,7 +198,7 @@ module Enumerable
198
198
  # Send a toggle command to every item in the collection
199
199
  # @return [self]
200
200
  #
201
- def toggle
202
- each(&:toggle)
201
+ def toggle(source: nil)
202
+ each { |i| i.toggle(source: source) }
203
203
  end
204
204
  end
@@ -49,10 +49,10 @@ module OpenHAB
49
49
  #
50
50
  # @return [self]
51
51
  #
52
- def toggle
53
- return on! unless state?
52
+ def toggle(source: nil)
53
+ return on!(source: source) unless state?
54
54
 
55
- command!(!state)
55
+ command!(!state, source: source)
56
56
  end
57
57
 
58
58
  # @!method on?
@@ -12,6 +12,11 @@ module OpenHAB
12
12
  # {HSBType} is a complex type with constituents for hue, saturation and
13
13
  # brightness and can be used for color items.
14
14
  class HSBType < PercentType
15
+ if OpenHAB::Core.version >= OpenHAB::Core::V4_0
16
+ java_import org.openhab.core.util.ColorUtil
17
+ private_constant :ColorUtil
18
+ end
19
+
15
20
  # @!constant BLACK
16
21
  # @return [HSBType]
17
22
  # @!constant WHITE
@@ -96,6 +101,14 @@ module OpenHAB
96
101
 
97
102
  super(*args)
98
103
  end
104
+
105
+ # Create HSBType from a color temperature
106
+ # @param cct [QuantityType, Number] The color temperature (assumed in Kelvin, if not a QuantityType)
107
+ # @return [HSBType]
108
+ # @since openHAB 4.3
109
+ def from_cct(cct)
110
+ from_xy(*ColorUtil.kelvin_to_xy((cct | "K").double_value))
111
+ end
99
112
  end
100
113
 
101
114
  #
@@ -175,6 +188,13 @@ module OpenHAB
175
188
  # @!method to_xy
176
189
  # Convert to the xyY values representing this object's color in CIE XY color model
177
190
  # @return [[PercentType, PercentType, PercentType]]
191
+
192
+ # @!attribute [r] cct
193
+ # @return [QuantityType] The color temperature in Kelvin
194
+ # @since openHAB 4.3
195
+ def cct
196
+ ColorUtil.xy_to_kelvin(to_xy[0..1].map { |x| x.double_value / 100 }) | "K"
197
+ end
178
198
  end
179
199
  end
180
200
  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.30.0"
7
+ VERSION = "5.31.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.30.0
4
+ version: 5.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian O'Connell
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-10-02 00:00:00.000000000 Z
13
+ date: 2024-10-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -490,7 +490,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
490
490
  - !ruby/object:Gem::Version
491
491
  version: '0'
492
492
  requirements: []
493
- rubygems_version: 3.5.20
493
+ rubygems_version: 3.5.21
494
494
  signing_key:
495
495
  specification_version: 4
496
496
  summary: JRuby Helper Libraries for openHAB Scripting