openhab-scripting 4.11.2 → 4.13.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5277fc6afcbe8ae48365fc8a0d867ccd678dfb89e098e3ced9dde91231a19de5
|
4
|
+
data.tar.gz: c7f1dbde6e49b58dcc9e12857d8b3898c8f0b6be556e5170539217197eec4bcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fde0980ddcc145964165c59a53a7020386c6be95c44b5abb8ecf7e075b2c72d374a6d10b8030bb8ca3b0644f0addf61fbd1d48b22e47f0c2fd42bccbfa3ed0b
|
7
|
+
data.tar.gz: dc05be4ab897a1fa6c5a827b9ec46a8aad579eb3e1c27c34cb0089b32bf72eaf86008181c90b667418561e29b7c392ee3238f8ca332a0457c30fa654653ac85b
|
@@ -279,7 +279,7 @@ module OpenHAB
|
|
279
279
|
# Loggging inflates method length
|
280
280
|
def check_guards(event:)
|
281
281
|
if @guard.should_run? event
|
282
|
-
now =
|
282
|
+
now = Time.now
|
283
283
|
return true if @between.cover? now
|
284
284
|
|
285
285
|
logger.trace("Skipped execution of rule '#{name}' because the current time #{now} "\
|
@@ -64,6 +64,32 @@ module OpenHAB
|
|
64
64
|
def to_s
|
65
65
|
"#{to_string}%"
|
66
66
|
end
|
67
|
+
|
68
|
+
#
|
69
|
+
# Scale the value to a particular range
|
70
|
+
#
|
71
|
+
# @param range [Range] the range as a numeric
|
72
|
+
# @return [Numeric] the value as a percentage of the range
|
73
|
+
#
|
74
|
+
def scale(range) # rubocop:disable Metrics/AbcSize
|
75
|
+
unless range.is_a?(Range) && range.min.is_a?(Numeric) && range.max.is_a?(Numeric)
|
76
|
+
raise ArgumentError, 'range must be a Range of Numerics'
|
77
|
+
end
|
78
|
+
|
79
|
+
result = (to_d * (range.max - range.min) / 100) + range.min
|
80
|
+
case range.max
|
81
|
+
when Integer then result.round
|
82
|
+
when Float then result.to_f
|
83
|
+
else result
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# scale the value to fit in a single byte
|
88
|
+
#
|
89
|
+
# @return [Integer] an integer in the range 0-255
|
90
|
+
def to_byte
|
91
|
+
scale(0..255)
|
92
|
+
end
|
67
93
|
end
|
68
94
|
end
|
69
95
|
end
|
@@ -50,6 +50,9 @@ module OpenHAB
|
|
50
50
|
def <=>(other) # rubocop:disable Metrics
|
51
51
|
logger.trace("(#{self.class}) #{self} <=> #{other} (#{other.class})")
|
52
52
|
if other.is_a?(self.class)
|
53
|
+
return unitize(other.unit).compare_to(other) if unit == ONE
|
54
|
+
return compare_to(other.unitize(unit)) if other.unit == ONE
|
55
|
+
|
53
56
|
compare_to(other)
|
54
57
|
elsif other.is_a?(Items::NumericItem) ||
|
55
58
|
(other.is_a?(Items::GroupItem) && other.base_item.is_a?(NumericItem))
|
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: 4.
|
4
|
+
version: 4.13.1
|
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-11-
|
11
|
+
date: 2021-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -152,15 +152,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
152
|
requirements:
|
153
153
|
- - ">="
|
154
154
|
- !ruby/object:Gem::Version
|
155
|
-
version: 2.
|
155
|
+
version: 2.6.0
|
156
156
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
158
|
- - ">="
|
159
159
|
- !ruby/object:Gem::Version
|
160
160
|
version: '0'
|
161
161
|
requirements: []
|
162
|
-
|
163
|
-
rubygems_version: 2.7.6.3
|
162
|
+
rubygems_version: 3.0.3.1
|
164
163
|
signing_key:
|
165
164
|
specification_version: 4
|
166
165
|
summary: JRuby Helper Libraries for OpenHAB Scripting
|