openhab-scripting 2.14.2 → 2.16.2
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 +4 -4
- data/lib/openhab/core/dsl.rb +4 -0
- data/lib/openhab/core/dsl/entities.rb +23 -16
- data/lib/openhab/core/dsl/group.rb +9 -0
- data/lib/openhab/core/dsl/items/items.rb +1 -1
- data/lib/openhab/core/dsl/items/number_item.rb +9 -4
- data/lib/openhab/core/dsl/items/string_item.rb +2 -0
- data/lib/openhab/core/dsl/monkey_patch/items/dimmer_item.rb +20 -5
- data/lib/openhab/core/dsl/monkey_patch/items/items.rb +2 -0
- data/lib/openhab/core/dsl/monkey_patch/items/persistence.rb +72 -0
- data/lib/openhab/core/dsl/monkey_patch/ruby/ruby.rb +1 -0
- data/lib/openhab/core/dsl/monkey_patch/ruby/string.rb +43 -0
- data/lib/openhab/core/dsl/monkey_patch/types/decimal_type.rb +41 -5
- data/lib/openhab/core/dsl/monkey_patch/types/quantity_type.rb +58 -0
- data/lib/openhab/core/dsl/monkey_patch/types/types.rb +1 -0
- data/lib/openhab/core/dsl/persistence.rb +27 -0
- data/lib/openhab/core/dsl/rule/automation_rule.rb +11 -14
- data/lib/openhab/core/dsl/rule/triggers/changed.rb +1 -1
- data/lib/openhab/core/dsl/time_of_day.rb +3 -1
- data/lib/openhab/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7471d207d040d9fb085fa45e4f6be88f7ad9d99b0987b6a6845f2bb85c8bf5ab
|
4
|
+
data.tar.gz: b000d8e9397d5556c4387f09e1ec247ccd8303cfa83b27722737e38324ac91b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13d1994d629262afc44f8c8e62c965e65e383e91224b8fbd12d83f9ec61fa707a0655060c805e3342b373adc5d3034f1744defca1803f84d52190aab055cd8de
|
7
|
+
data.tar.gz: 368969daaa876bdebbd0b60b8818f9da333c2c6d9df96fa7f00abf99df4891f32cd2151d576a6819c2213630fd1ccf3e1a81a1ddc5aa48d2bfe20be776a3c91a
|
data/lib/openhab/core/dsl.rb
CHANGED
@@ -19,6 +19,7 @@ require 'core/dsl/gems'
|
|
19
19
|
require 'core/dsl/units'
|
20
20
|
require 'core/dsl/types/quantity'
|
21
21
|
require 'core/dsl/states'
|
22
|
+
require 'core/dsl/persistence'
|
22
23
|
|
23
24
|
module OpenHAB
|
24
25
|
#
|
@@ -30,6 +31,7 @@ module OpenHAB
|
|
30
31
|
#
|
31
32
|
module DSL
|
32
33
|
# Extend the calling module/class with the DSL
|
34
|
+
# rubocop: disable Metrics/MethodLength
|
33
35
|
def self.extended(base)
|
34
36
|
base.send :include, OpenHAB::Core::DSL::Rule
|
35
37
|
base.send :include, OpenHAB::Core::DSL::Items
|
@@ -40,8 +42,10 @@ module OpenHAB
|
|
40
42
|
base.send :include, OpenHAB::Core::DSL::Timers
|
41
43
|
base.send :include, OpenHAB::Core::DSL::States
|
42
44
|
base.send :include, OpenHAB::Core::DSL::Tod
|
45
|
+
base.send :include, OpenHAB::Core::DSL::Persistence
|
43
46
|
base.send :include, Things
|
44
47
|
end
|
48
|
+
# rubocop: enable Metrics/MethodLength
|
45
49
|
end
|
46
50
|
end
|
47
51
|
end
|
@@ -27,6 +27,7 @@ end
|
|
27
27
|
#
|
28
28
|
module EntityLookup
|
29
29
|
include Logging
|
30
|
+
|
30
31
|
#
|
31
32
|
# Decorate items with Ruby wrappers
|
32
33
|
#
|
@@ -34,26 +35,32 @@ module EntityLookup
|
|
34
35
|
#
|
35
36
|
# @return [Array] Array of decorated items
|
36
37
|
#
|
37
|
-
# rubocop: disable Metrics/MethodLength
|
38
|
-
# Disabled line length - case dispatch pattern
|
39
38
|
def self.decorate_items(*items)
|
40
|
-
items.flatten.map
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
39
|
+
items.flatten.map { |item| decorate_item(item) }
|
40
|
+
end
|
41
|
+
|
42
|
+
#
|
43
|
+
# Decorate item with Ruby wrappers
|
44
|
+
#
|
45
|
+
# @param [Object] item the item object to decorate
|
46
|
+
#
|
47
|
+
# @return [Object] the ruby wrapper for the item
|
48
|
+
#
|
49
|
+
def self.decorate_item(item)
|
50
|
+
case item
|
51
|
+
when GroupItem
|
52
|
+
decorate_group(item)
|
53
|
+
when Java::Org.openhab.core.library.items::NumberItem
|
54
|
+
OpenHAB::Core::DSL::Items::NumberItem.new(item)
|
55
|
+
when Java::Org.openhab.core.library.items::StringItem
|
56
|
+
OpenHAB::Core::DSL::Items::StringItem.new(item)
|
57
|
+
else
|
58
|
+
item
|
51
59
|
end
|
52
60
|
end
|
53
|
-
# rubocop: enable Metrics/MethodLength
|
54
61
|
|
55
62
|
#
|
56
|
-
#
|
63
|
+
# Looks up a Thing in the OpenHAB registry replacing '_' with ':'
|
57
64
|
#
|
58
65
|
# @param [String] name of Thing to lookup in Thing registry
|
59
66
|
#
|
@@ -86,7 +93,7 @@ module EntityLookup
|
|
86
93
|
# rubocop: disable Style/GlobalVars
|
87
94
|
item = $ir.get(name)
|
88
95
|
# rubocop: enable Style/GlobalVars
|
89
|
-
EntityLookup.
|
96
|
+
EntityLookup.decorate_item(item)
|
90
97
|
end
|
91
98
|
|
92
99
|
#
|
@@ -86,6 +86,15 @@ module OpenHAB
|
|
86
86
|
def to_s
|
87
87
|
"[#{map(&:to_s).join(',')}]"
|
88
88
|
end
|
89
|
+
|
90
|
+
#
|
91
|
+
# Get an ID for the group, using the label if set, otherwise group name
|
92
|
+
#
|
93
|
+
# @return [String] label if set otherwise name
|
94
|
+
#
|
95
|
+
def id
|
96
|
+
label || name
|
97
|
+
end
|
89
98
|
end
|
90
99
|
end
|
91
100
|
end
|
@@ -21,7 +21,7 @@ module OpenHAB
|
|
21
21
|
# rubocop: disable Style/GlobalVars
|
22
22
|
item = $ir.getItem(name)
|
23
23
|
# rubocop: enable Style/GlobalVars
|
24
|
-
item.is_a?(GroupItem) ? nil : item
|
24
|
+
item.is_a?(GroupItem) ? nil : EntityLookup.decorate_item(item)
|
25
25
|
rescue Java::OrgOpenhabCoreItems::ItemNotFoundException
|
26
26
|
nil
|
27
27
|
end
|
@@ -58,7 +58,7 @@ module OpenHAB
|
|
58
58
|
when Quantity then coerce_from_quantity(other)
|
59
59
|
when Numeric then coerce_from_numeric(other)
|
60
60
|
else
|
61
|
-
logger.trace("#{self} cannot be
|
61
|
+
logger.trace("#{self} cannot be coerced to #{other.class}")
|
62
62
|
nil
|
63
63
|
end
|
64
64
|
end
|
@@ -71,14 +71,19 @@ module OpenHAB
|
|
71
71
|
# @return [Integer] -1,0,1 or nil depending on value supplied,
|
72
72
|
# nil comparison to supplied object is not possible.
|
73
73
|
#
|
74
|
+
# rubocop: disable Metrics/AbcSize
|
74
75
|
def <=>(other)
|
75
|
-
logger.trace("
|
76
|
+
logger.trace("NumberItem #{self} <=> #{other} (#{other.class})")
|
76
77
|
case other
|
77
78
|
when NumberItem then number_item_compare(other)
|
78
|
-
when Numeric then
|
79
|
-
when String
|
79
|
+
when Numeric then @number_item.state.to_big_decimal.to_d <=> other.to_d
|
80
|
+
when String then @number_item.state <=> QuantityType.new(other) if dimension
|
81
|
+
else
|
82
|
+
other = other.state if other.respond_to? :state
|
83
|
+
@number_item.state <=> other
|
80
84
|
end
|
81
85
|
end
|
86
|
+
# rubocop: enable Metrics/AbcSize
|
82
87
|
|
83
88
|
#
|
84
89
|
# Convert NumberItem to a Quantity
|
@@ -96,12 +96,27 @@ class Java::OrgOpenhabCoreLibraryItems::DimmerItem
|
|
96
96
|
def <=>(other)
|
97
97
|
logger.trace("Comparing #{self} to #{other}")
|
98
98
|
case other
|
99
|
-
when
|
100
|
-
|
101
|
-
when
|
102
|
-
|
99
|
+
when Java::OrgOpenhabCoreItems::GenericItem, NumberItem then state <=> other.state
|
100
|
+
when DecimalType then state <=> other
|
101
|
+
when Numeric then state.to_big_decimal.to_d <=> other.to_d
|
102
|
+
else compare_to(other)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
#
|
107
|
+
# Coerce objects into a DimmerItem
|
108
|
+
#
|
109
|
+
# @param [Object] other object to coerce to a DimmerItem if possible
|
110
|
+
#
|
111
|
+
# @return [Object] Numeric when applicable
|
112
|
+
#
|
113
|
+
def coerce(other)
|
114
|
+
logger.trace("Coercing #{self} as a request from #{other.class}")
|
115
|
+
case other
|
116
|
+
when Numeric
|
117
|
+
[other, state.to_big_decimal.to_d]
|
103
118
|
else
|
104
|
-
|
119
|
+
[other, state]
|
105
120
|
end
|
106
121
|
end
|
107
122
|
|
@@ -6,6 +6,7 @@ require 'bigdecimal'
|
|
6
6
|
|
7
7
|
# Monkey patch items
|
8
8
|
require 'openhab/core/dsl/monkey_patch/items/metadata'
|
9
|
+
require 'openhab/core/dsl/monkey_patch/items/persistence'
|
9
10
|
require 'openhab/core/dsl/monkey_patch/items/contact_item'
|
10
11
|
require 'openhab/core/dsl/monkey_patch/items/dimmer_item'
|
11
12
|
require 'openhab/core/dsl/monkey_patch/items/switch_item'
|
@@ -127,4 +128,5 @@ class Java::OrgOpenhabCoreItems::GenericItem
|
|
127
128
|
# rubocop:enable Style/ClassAndModuleChildren
|
128
129
|
prepend OpenHAB::Core::DSL::MonkeyPatch::Items::ItemExtensions
|
129
130
|
prepend OpenHAB::Core::DSL::MonkeyPatch::Items::Metadata
|
131
|
+
prepend OpenHAB::Core::DSL::MonkeyPatch::Items::Persistence
|
130
132
|
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenHAB
|
4
|
+
module Core
|
5
|
+
module DSL
|
6
|
+
module MonkeyPatch
|
7
|
+
module Items
|
8
|
+
#
|
9
|
+
# Persistence extension for Items
|
10
|
+
#
|
11
|
+
module Persistence
|
12
|
+
%w[persist last_update].each do |method|
|
13
|
+
define_method(method) do |service = nil|
|
14
|
+
service ||= persistence_service
|
15
|
+
PersistenceExtensions.public_send(method, self, service&.to_s)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
#
|
20
|
+
# Return the previous state of the item
|
21
|
+
#
|
22
|
+
# @param skip_equal [Boolean] if true, skips equal state values and
|
23
|
+
# searches the first state not equal the current state
|
24
|
+
# @param service [String] the name of the PersistenceService to use
|
25
|
+
#
|
26
|
+
# @return the previous state or nil if no previous state could be found,
|
27
|
+
# or if the default persistence service is not configured or
|
28
|
+
# does not refer to a valid service
|
29
|
+
#
|
30
|
+
def previous_state(service = nil, skip_equal: false)
|
31
|
+
service ||= persistence_service
|
32
|
+
PersistenceExtensions.previous_state(self, skip_equal, service&.to_s)
|
33
|
+
end
|
34
|
+
|
35
|
+
%w[
|
36
|
+
average_since
|
37
|
+
changed_since
|
38
|
+
delta_since
|
39
|
+
deviation_since
|
40
|
+
evolution_rate
|
41
|
+
historic_state
|
42
|
+
maximum_since
|
43
|
+
minimum_since
|
44
|
+
sum_since
|
45
|
+
updated_since
|
46
|
+
variance_since
|
47
|
+
].each do |method|
|
48
|
+
define_method(method) do |timestamp, service = nil|
|
49
|
+
service ||= persistence_service
|
50
|
+
if timestamp.is_a? Java::JavaTimeTemporal::TemporalAmount
|
51
|
+
timestamp = Java::JavaTime::ZonedDateTime.now.minus(timestamp)
|
52
|
+
end
|
53
|
+
PersistenceExtensions.public_send(method, self, timestamp, service&.to_s)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
#
|
60
|
+
# Get the specified persistence service from the current thread local variable
|
61
|
+
#
|
62
|
+
# @return [Object] Persistence service name as String or Symbol, or nil if not set
|
63
|
+
#
|
64
|
+
def persistence_service
|
65
|
+
Thread.current.thread_variable_get(:persistence_service)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'openhab/core/dsl/types/quantity'
|
4
|
+
|
5
|
+
module OpenHAB
|
6
|
+
module Core
|
7
|
+
module DSL
|
8
|
+
module MonkeyPatch
|
9
|
+
module Ruby
|
10
|
+
#
|
11
|
+
# Extend String class
|
12
|
+
#
|
13
|
+
module StringExtensions
|
14
|
+
include OpenHAB::Core
|
15
|
+
|
16
|
+
#
|
17
|
+
# Compares String to another object
|
18
|
+
#
|
19
|
+
# @param [Object] other object to compare to
|
20
|
+
#
|
21
|
+
# @return [Boolean] true if the two objects contain the same value, false otherwise
|
22
|
+
#
|
23
|
+
def ==(other)
|
24
|
+
case other
|
25
|
+
when OpenHAB::Core::DSL::Types::Quantity, QuantityType
|
26
|
+
other == self
|
27
|
+
else
|
28
|
+
super
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# Prepend String class with comparison extensions
|
40
|
+
#
|
41
|
+
class String
|
42
|
+
prepend OpenHAB::Core::DSL::MonkeyPatch::Ruby::StringExtensions
|
43
|
+
end
|
@@ -10,15 +10,51 @@ class Java::OrgOpenhabCoreLibraryTypes::DecimalType
|
|
10
10
|
# rubocop:enable Style/ClassAndModuleChildren
|
11
11
|
|
12
12
|
#
|
13
|
-
# Compare
|
13
|
+
# Compare DecimalType to supplied object
|
14
14
|
#
|
15
15
|
# @param [Object] other object to compare to
|
16
16
|
#
|
17
|
-
# @return [
|
17
|
+
# @return [Integer] -1,0,1 or nil depending on value supplied, nil comparison to supplied object is not possible.
|
18
18
|
#
|
19
|
-
def
|
20
|
-
|
19
|
+
def <=>(other)
|
20
|
+
logger.trace("#{self.class} #{self} <=> #{other} (#{other.class})")
|
21
|
+
case other
|
22
|
+
when Numeric
|
23
|
+
to_big_decimal.compare_to(other.to_d)
|
24
|
+
when Java::OrgOpenhabCoreTypes::UnDefType
|
25
|
+
1
|
26
|
+
else
|
27
|
+
other = other.state if other.respond_to? :state
|
28
|
+
compare_to(other)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# Coerce objects into a DecimalType
|
34
|
+
#
|
35
|
+
# @param [Object] other object to coerce to a DecimalType if possible
|
36
|
+
#
|
37
|
+
# @return [Object] Numeric when applicable
|
38
|
+
#
|
39
|
+
def coerce(other)
|
40
|
+
logger.trace("Coercing #{self} as a request from #{other.class}")
|
41
|
+
case other
|
42
|
+
when Numeric
|
43
|
+
[other.to_d, to_big_decimal]
|
44
|
+
else
|
45
|
+
[other, self]
|
46
|
+
end
|
47
|
+
end
|
21
48
|
|
22
|
-
|
49
|
+
#
|
50
|
+
# Compare self to other through the spaceship operator
|
51
|
+
#
|
52
|
+
# @param [Object] other object to compare to
|
53
|
+
#
|
54
|
+
# @return [Boolean] True if equals
|
55
|
+
#
|
56
|
+
def ==(other)
|
57
|
+
logger.trace("#{self.class} #{self} == #{other} (#{other.class})")
|
58
|
+
(self <=> other).zero?
|
23
59
|
end
|
24
60
|
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'java'
|
4
|
+
|
5
|
+
#
|
6
|
+
# MonkeyPatching QuantityType
|
7
|
+
#
|
8
|
+
# rubocop:disable Style/ClassAndModuleChildren
|
9
|
+
class Java::OrgOpenhabCoreLibraryTypes::QuantityType
|
10
|
+
# rubocop:enable Style/ClassAndModuleChildren
|
11
|
+
|
12
|
+
#
|
13
|
+
# Compare QuantityType to supplied object
|
14
|
+
#
|
15
|
+
# @param [Object] other object to compare to
|
16
|
+
#
|
17
|
+
# @return [Integer] -1,0,1 or nil depending on value supplied, nil comparison to supplied object is not possible.
|
18
|
+
#
|
19
|
+
def <=>(other)
|
20
|
+
logger.trace("#{self.class} #{self} <=> #{other} (#{other.class})")
|
21
|
+
case other
|
22
|
+
when Java::OrgOpenhabCoreTypes::UnDefType then 1
|
23
|
+
when String then self <=> Quantity.new(other)
|
24
|
+
when OpenHAB::Core::DSL::Types::Quantity then self <=> other.quantity
|
25
|
+
else
|
26
|
+
other = other.state if other.respond_to? :state
|
27
|
+
compare_to(other)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
#
|
32
|
+
# Coerce objects into a QuantityType
|
33
|
+
#
|
34
|
+
# @param [Object] other object to coerce to a QuantityType if possible
|
35
|
+
#
|
36
|
+
# @return [Object] Numeric when applicable
|
37
|
+
#
|
38
|
+
def coerce(other)
|
39
|
+
logger.trace("Coercing #{self} as a request from #{other.class}")
|
40
|
+
case other
|
41
|
+
when String
|
42
|
+
[Quantity.new(other), self]
|
43
|
+
else
|
44
|
+
[other, self]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
#
|
49
|
+
# Compare self to other using the spaceship operator
|
50
|
+
#
|
51
|
+
# @param [Object] other object to compare to
|
52
|
+
#
|
53
|
+
# @return [Boolean] True if equals
|
54
|
+
#
|
55
|
+
def ==(other)
|
56
|
+
(self <=> other).zero?
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenHAB
|
4
|
+
module Core
|
5
|
+
module DSL
|
6
|
+
#
|
7
|
+
# Provides support for interacting with OpenHAB Persistence service
|
8
|
+
#
|
9
|
+
module Persistence
|
10
|
+
#
|
11
|
+
# Sets a thread local variable to set the default persistence service
|
12
|
+
# for method calls inside the block
|
13
|
+
#
|
14
|
+
# @param [Object] Persistence service either as a String or a Symbol
|
15
|
+
# @yield [] Block executed in context of the supplied persistence service
|
16
|
+
#
|
17
|
+
#
|
18
|
+
def persistence(service)
|
19
|
+
Thread.current.thread_variable_set(:persistence_service, service)
|
20
|
+
yield
|
21
|
+
ensure
|
22
|
+
Thread.current.thread_variable_set(:persistence_service, nil)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -221,20 +221,18 @@ module OpenHAB
|
|
221
221
|
end
|
222
222
|
|
223
223
|
#
|
224
|
-
# Patch event to
|
225
|
-
# This is to patch a bug see https://github.com/boc-tothefuture/openhab-jruby/issues/75
|
226
|
-
# It may be fixed in the openhab core in the future, in which case, this patch will no longer be necessary
|
224
|
+
# Patch event to decorate event.item with our item wrapper
|
227
225
|
#
|
228
|
-
# @param [OpenHAB Event] event
|
229
|
-
# @param [OpenHAB Event Inputs] inputs inputs to running rule
|
226
|
+
# @param [OpenHAB Event] event patch
|
230
227
|
#
|
231
|
-
def
|
232
|
-
return if event.nil?
|
228
|
+
def decorate_event_item(event)
|
229
|
+
return if event.nil?
|
233
230
|
|
234
231
|
class << event
|
235
|
-
|
232
|
+
def item
|
233
|
+
EntityLookup.lookup_item(item_name)
|
234
|
+
end
|
236
235
|
end
|
237
|
-
event.item = inputs&.dig('triggeringItem')
|
238
236
|
end
|
239
237
|
|
240
238
|
#
|
@@ -266,6 +264,7 @@ module OpenHAB
|
|
266
264
|
#
|
267
265
|
#
|
268
266
|
def process_otherwise_task(event, task)
|
267
|
+
decorate_event_item(event)
|
269
268
|
logger.trace { "Executing rule '#{name}' otherwise block with event(#{event})" }
|
270
269
|
task.block.call(event)
|
271
270
|
end
|
@@ -292,9 +291,7 @@ module OpenHAB
|
|
292
291
|
#
|
293
292
|
#
|
294
293
|
def process_trigger_task(event, task)
|
295
|
-
|
296
|
-
triggering_item = $ir.get(event&.itemName)
|
297
|
-
# rubocop: enable Style/GlobalVars
|
294
|
+
triggering_item = EntityLookup.lookup_item(event&.itemName)
|
298
295
|
logger.trace { "Executing rule '#{name}' trigger block with item (#{triggering_item})" }
|
299
296
|
task.block.call(triggering_item) if triggering_item
|
300
297
|
end
|
@@ -307,8 +304,8 @@ module OpenHAB
|
|
307
304
|
# @param [Run] task to execute
|
308
305
|
#
|
309
306
|
#
|
310
|
-
def process_run_task(event,
|
311
|
-
|
307
|
+
def process_run_task(event, _inputs, task)
|
308
|
+
decorate_event_item(event)
|
312
309
|
logger.trace { "Executing rule '#{name}' run block with event(#{event})" }
|
313
310
|
task.block.call(event)
|
314
311
|
end
|
@@ -69,7 +69,7 @@ module OpenHAB
|
|
69
69
|
end
|
70
70
|
logger.trace("Creating Changed Wait Change Trigger for #{config}")
|
71
71
|
trigger = append_trigger(trigger, config)
|
72
|
-
@trigger_delays
|
72
|
+
@trigger_delays[trigger.id] = TriggerDelay.new(to: to, from: from, duration: duration)
|
73
73
|
end
|
74
74
|
|
75
75
|
#
|
@@ -127,7 +127,7 @@ module OpenHAB
|
|
127
127
|
end
|
128
128
|
|
129
129
|
# Modules that refines the Ruby Range object cover? and include? methods to support TimeOfDay ranges
|
130
|
-
class TimeOfDayRangeElement
|
130
|
+
class TimeOfDayRangeElement < Numeric
|
131
131
|
include Comparable
|
132
132
|
include Logging
|
133
133
|
|
@@ -138,6 +138,8 @@ module OpenHAB
|
|
138
138
|
def initialize(sod:, range_begin:)
|
139
139
|
@sod = sod
|
140
140
|
@range_begin = range_begin
|
141
|
+
|
142
|
+
super()
|
141
143
|
end
|
142
144
|
|
143
145
|
# Returns the current second of day advanced by 1 second
|
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.16.2
|
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-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -54,15 +54,19 @@ files:
|
|
54
54
|
- lib/openhab/core/dsl/monkey_patch/items/group_item.rb
|
55
55
|
- lib/openhab/core/dsl/monkey_patch/items/items.rb
|
56
56
|
- lib/openhab/core/dsl/monkey_patch/items/metadata.rb
|
57
|
+
- lib/openhab/core/dsl/monkey_patch/items/persistence.rb
|
57
58
|
- lib/openhab/core/dsl/monkey_patch/items/switch_item.rb
|
58
59
|
- lib/openhab/core/dsl/monkey_patch/ruby/number.rb
|
59
60
|
- lib/openhab/core/dsl/monkey_patch/ruby/range.rb
|
60
61
|
- lib/openhab/core/dsl/monkey_patch/ruby/ruby.rb
|
62
|
+
- lib/openhab/core/dsl/monkey_patch/ruby/string.rb
|
61
63
|
- lib/openhab/core/dsl/monkey_patch/types/decimal_type.rb
|
62
64
|
- lib/openhab/core/dsl/monkey_patch/types/on_off_type.rb
|
63
65
|
- lib/openhab/core/dsl/monkey_patch/types/open_closed_type.rb
|
64
66
|
- lib/openhab/core/dsl/monkey_patch/types/percent_type.rb
|
67
|
+
- lib/openhab/core/dsl/monkey_patch/types/quantity_type.rb
|
65
68
|
- lib/openhab/core/dsl/monkey_patch/types/types.rb
|
69
|
+
- lib/openhab/core/dsl/persistence.rb
|
66
70
|
- lib/openhab/core/dsl/property.rb
|
67
71
|
- lib/openhab/core/dsl/rule/automation_rule.rb
|
68
72
|
- lib/openhab/core/dsl/rule/guard.rb
|