openhab-scripting 5.30.1 → 5.31.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: 93b780d352d981919615e78e687910eb11ee024c6c567a6294db4538ddd8712a
4
- data.tar.gz: dbdcb9b48ee07a0d626bf8aa5ef6da60273d330395c89647dd5a360b28bc3f1c
3
+ metadata.gz: 1d1996259cb097848c88f6ed61d4d715710299a6f9ac93e4e8ccf2925b651c7e
4
+ data.tar.gz: 4283efc59d3e6e0df288c79f2ab6e8220c64441f4d5bd63474b5075690c1556b
5
5
  SHA512:
6
- metadata.gz: 12c20ab4f52a6fac707f62d004c5eb9268ca6a00a9d9490f96892530091a7da6bc812d5b729b3041a51c1567690269b91dd77e31325a826b15ba3e2d32f5a53a
7
- data.tar.gz: 718e2af872273b04125d64edce10d248883654388a14ca126c12fdcdaef68ebc25032466fa0bb20963b491fccb753406c668acdb1499ec9ac1567baeb02b10ff
6
+ metadata.gz: 3d9d5ef94c19724d7c4f58e349c41def3c538c7240a4f744c44dd15dd96692b9ffb368e4173ee43dff5f5d56a3128610a03411589d2c668d3a7418c3ad84a52e
7
+ data.tar.gz: dcd5c517c8e536f25a629a32d4681ce488168c07c23739c775ea147184d640aa36c1eea3c43ffb8d228051c4d7a19e62b5fb8507c4107b4baa442315ad58ec15
@@ -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.1"
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.1
4
+ version: 5.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian O'Connell
@@ -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