openhab-scripting 3.1.0 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openhab/dsl/items/rollershutter_item.rb +6 -4
- data/lib/openhab/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beab2ee97613a8a2016969c8410f4abcddc9c780ad16c5683e382bee28526122
|
4
|
+
data.tar.gz: 33f9ecf81357a4812e59188ad3d3f5b7ef034e79e874ec942e3bc880352853d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97b3a91ecda58df5763a79b6f9d0c3020f7064774e84f62c3716cbb6fc441a0848dee14778126f01cde1ca327e0c5413ea3f5e37e3b3fda1a0d5e432bfe36007
|
7
|
+
data.tar.gz: cece3de478210c8236d6d74a04af2edb1efe136bf4e380f86225df8b76b7b7edf3fcf83fde9dcc376dbcbcc62e443bbd5719cbb2efdc2949249467f06fa677ae
|
@@ -43,7 +43,7 @@ module OpenHAB
|
|
43
43
|
# @return [Java::OrgOpenhabCoreLibraryTypes::PercentType] the position of the rollershutter
|
44
44
|
#
|
45
45
|
def position
|
46
|
-
state
|
46
|
+
state&.as(PercentType)
|
47
47
|
end
|
48
48
|
|
49
49
|
#
|
@@ -54,6 +54,8 @@ module OpenHAB
|
|
54
54
|
# @return [Integer] -1, 0 or 1 depending on the result of the comparison
|
55
55
|
#
|
56
56
|
def <=>(other)
|
57
|
+
return nil unless state?
|
58
|
+
|
57
59
|
case other
|
58
60
|
when PercentType, Java::OrgOpenhabCoreLibraryTypes::DecimalType then position.compare_to(other)
|
59
61
|
when Numeric then position.int_value <=> other
|
@@ -73,8 +75,8 @@ module OpenHAB
|
|
73
75
|
raise ArgumentError, "Cannot coerce to #{other.class}" unless other.is_a? Numeric
|
74
76
|
|
75
77
|
case other
|
76
|
-
when Integer then [other, position
|
77
|
-
when Float then [other, position
|
78
|
+
when Integer then [other, position&.int_value]
|
79
|
+
when Float then [other, position&.float_value]
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|
@@ -84,7 +86,7 @@ module OpenHAB
|
|
84
86
|
%i[+ - * / %].each do |operator|
|
85
87
|
define_method(operator) do |other|
|
86
88
|
right, left = coerce(other)
|
87
|
-
left
|
89
|
+
left&.send(operator, right)
|
88
90
|
end
|
89
91
|
end
|
90
92
|
end
|
data/lib/openhab/version.rb
CHANGED