openhab-scripting 2.21.0 → 2.22.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 219fcaa44946f026fe4c8873e4c12ff6b44343b1abf63368134f26317ed7dc2a
|
4
|
+
data.tar.gz: 9b671ec4883980e7fbd21ead7e6f7e71bd2f60bc260ab41195879877df67e25e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3784775e6cb7847fbdab271de2363b781c34e9472c3a65e3694220f377f80ad6afc923a406e4e218605d140a95780bf22c9ed82a43ac9c69ecb2a32d5368728e
|
7
|
+
data.tar.gz: 0a4e16ce610516a48beec6cf1f951a64084c0f07557ec5f8ac72ab5e3245b315d8a223d4de6e943a6177a5b74e05431d2d68bf59ad37cf362e2455f386b6b38c
|
@@ -63,6 +63,27 @@ module OpenHAB
|
|
63
63
|
logger.trace("#{self.class} #{self} == #{other} (#{other.class})")
|
64
64
|
(self <=> other).zero?
|
65
65
|
end
|
66
|
+
|
67
|
+
#
|
68
|
+
# Convert DecimalType to a Quantity
|
69
|
+
#
|
70
|
+
# @param [Object] other String or Unit representing an OpenHAB Unit
|
71
|
+
#
|
72
|
+
# @return [OpenHAB::Core::DSL::Types::Quantity] NumberItem converted to supplied Unit
|
73
|
+
#
|
74
|
+
def |(other)
|
75
|
+
other = SimpleUnitFormat.instance.unitFor(other) if other.is_a? String
|
76
|
+
Quantity.new(QuantityType.new(to_big_decimal, other))
|
77
|
+
end
|
78
|
+
|
79
|
+
#
|
80
|
+
# Provide details about DecimalType object
|
81
|
+
#
|
82
|
+
# @return [String] Representing details about the DecimalType object
|
83
|
+
#
|
84
|
+
def inspect
|
85
|
+
to_string
|
86
|
+
end
|
66
87
|
end
|
67
88
|
end
|
68
89
|
end
|
@@ -22,6 +22,7 @@ module OpenHAB
|
|
22
22
|
def_delegator :@quantity, :to_s
|
23
23
|
|
24
24
|
java_import org.openhab.core.library.types.QuantityType
|
25
|
+
java_import org.openhab.core.library.types.DecimalType
|
25
26
|
java_import 'tec.uom.se.format.SimpleUnitFormat'
|
26
27
|
java_import 'tec.uom.se.AbstractUnit'
|
27
28
|
|
@@ -92,6 +93,7 @@ module OpenHAB
|
|
92
93
|
case other
|
93
94
|
when Quantity then [other.quantity, quantity]
|
94
95
|
when QuantityType then [other, quantity]
|
96
|
+
when DecimalType then [Quantity.new(other.to_big_decimal.to_d), quantity]
|
95
97
|
when NumberItem then [other.to_qt.quantity, quantity]
|
96
98
|
when Numeric, String then [Quantity.new(other), self]
|
97
99
|
end
|
data/lib/openhab/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openhab-scripting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian O'Connell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|