openhab-scripting 5.40.1 → 5.41.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 +4 -4
- data/lib/openhab/core/items/metadata/provider.rb +1 -1
- data/lib/openhab/core/profile_factory.rb +3 -2
- data/lib/openhab/core/provider.rb +2 -1
- data/lib/openhab/core/sitemaps/provider.rb +1 -1
- data/lib/openhab/core/things/links/provider.rb +2 -2
- data/lib/openhab/core/things/proxy.rb +1 -0
- data/lib/openhab/core.rb +2 -0
- data/lib/openhab/core_ext/java/duration.rb +1 -0
- data/lib/openhab/core_ext/java/local_time.rb +1 -0
- data/lib/openhab/core_ext/java/month.rb +1 -0
- data/lib/openhab/core_ext/ruby/numeric.rb +1 -0
- data/lib/openhab/dsl/rules/automation_rule.rb +3 -4
- data/lib/openhab/dsl/rules/name_inference.rb +1 -1
- data/lib/openhab/dsl/rules/triggers/conditions/generic.rb +5 -5
- data/lib/openhab/dsl/rules/triggers/watch/watch_handler.rb +1 -0
- data/lib/openhab/dsl/version.rb +1 -1
- data/lib/openhab/dsl.rb +3 -0
- data/lib/openhab/log.rb +1 -0
- data/lib/openhab/rspec/mocks/abstract_storage_based_type_provider_wrapped_storage_service.rb +1 -1
- data/lib/openhab/rspec/mocks/event_admin.rb +3 -3
- data/lib/openhab/yard/markdown_helper.rb +2 -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: 6920b2ea75f2c8d7e849173181ebbcd05d40006c2cd70785b119b8645e34032e
|
4
|
+
data.tar.gz: 91cd7e588646072b2cd82ffece697dc8d74b8ddad377575e88748adac7325b63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e330a848117416e972df7b10e9735e27c20d71a622242a12d4e4dba7401ce9eb4b9e82171830d328d282d852d4e68e9d11d7ed16e495743658f14d0a6e8ea3a
|
7
|
+
data.tar.gz: 367be6bb928558652035129c6ec0d8c372ab6cedcc04a914d247a9cf3421830c1a5a188197361a7334c0036f813553ed0168df71a5e74e7d4be7920e51a90485
|
@@ -37,8 +37,8 @@ module OpenHAB
|
|
37
37
|
end
|
38
38
|
|
39
39
|
# @!visibility private
|
40
|
-
def onCommandFromItem(command)
|
41
|
-
return unless process_event(:command_from_item, command:) == true
|
40
|
+
def onCommandFromItem(command, source = nil)
|
41
|
+
return unless process_event(:command_from_item, command:, source:) == true
|
42
42
|
|
43
43
|
logger.trace("Forwarding original command")
|
44
44
|
@callback.handle_command(command)
|
@@ -92,6 +92,7 @@ module OpenHAB
|
|
92
92
|
params[:command] ||= nil
|
93
93
|
params[:trigger] ||= nil
|
94
94
|
params[:time_series] ||= nil
|
95
|
+
params[:source] ||= nil
|
95
96
|
|
96
97
|
kwargs = {}
|
97
98
|
@block.parameters.each do |(param_type, name)|
|
@@ -40,6 +40,7 @@ module OpenHAB
|
|
40
40
|
include org.openhab.core.common.registry.ManagedProvider
|
41
41
|
include Enumerable
|
42
42
|
include Singleton
|
43
|
+
|
43
44
|
public_class_method :new
|
44
45
|
|
45
46
|
# Known supported provider types
|
@@ -183,7 +184,7 @@ module OpenHAB
|
|
183
184
|
def all
|
184
185
|
@elements.values
|
185
186
|
end
|
186
|
-
alias_method :getAll, :all
|
187
|
+
alias_method :getAll, :all # rubocop:disable Naming/MethodName
|
187
188
|
|
188
189
|
#
|
189
190
|
# Remove an element from this provider
|
@@ -50,7 +50,7 @@ module OpenHAB
|
|
50
50
|
end
|
51
51
|
count
|
52
52
|
end
|
53
|
-
alias_method :removeLinksForItem, :remove_links_for_item
|
53
|
+
alias_method :removeLinksForItem, :remove_links_for_item # rubocop:disable Naming/MethodName
|
54
54
|
|
55
55
|
#
|
56
56
|
# Removes all links to a given thing.
|
@@ -69,7 +69,7 @@ module OpenHAB
|
|
69
69
|
end
|
70
70
|
count
|
71
71
|
end
|
72
|
-
alias_method :removeLinksForThing, :remove_links_for_thing
|
72
|
+
alias_method :removeLinksForThing, :remove_links_for_thing # rubocop:disable Naming/MethodName
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
data/lib/openhab/core.rb
CHANGED
@@ -15,6 +15,8 @@ module OpenHAB
|
|
15
15
|
V4_3 = Gem::Version.new("4.3.0").freeze
|
16
16
|
# @!visibility private
|
17
17
|
V5_0 = Gem::Version.new("5.0.0").freeze
|
18
|
+
# @!visibility private
|
19
|
+
V5_1 = Gem::Version.new("5.1.0").freeze
|
18
20
|
|
19
21
|
# @return [Gem::Version] Returns the current openHAB version as a Gem::Version object
|
20
22
|
# Note, this strips off snapshots, milestones and RC versions and returns the release version.
|
@@ -120,10 +120,9 @@ module OpenHAB
|
|
120
120
|
# @return [Queue] <description>
|
121
121
|
#
|
122
122
|
def create_queue(event)
|
123
|
-
|
124
|
-
when true
|
123
|
+
if check_guards?(event:)
|
125
124
|
@run_queue.dup.grep_v(BuilderDSL::Otherwise)
|
126
|
-
|
125
|
+
else
|
127
126
|
@run_queue.dup.grep(BuilderDSL::Otherwise)
|
128
127
|
end
|
129
128
|
end
|
@@ -211,7 +210,7 @@ module OpenHAB
|
|
211
210
|
# @return [true,false] True if guards says rule should execute, false otherwise
|
212
211
|
#
|
213
212
|
# Loggging inflates method length
|
214
|
-
def check_guards(event:)
|
213
|
+
def check_guards?(event:)
|
215
214
|
return true if @guard.nil?
|
216
215
|
|
217
216
|
unless @between.nil?
|
@@ -162,7 +162,7 @@ module OpenHAB
|
|
162
162
|
def format_offset(offset)
|
163
163
|
return "" unless offset&.nonzero?
|
164
164
|
|
165
|
-
" #{
|
165
|
+
" #{"+" if offset.positive?}#{offset.seconds.to_s.downcase[2..]}" # Remove "PT" from the ISO8601 string
|
166
166
|
end
|
167
167
|
end
|
168
168
|
end
|
@@ -29,11 +29,11 @@ module OpenHAB
|
|
29
29
|
# @param [Hash] inputs inputs from trigger
|
30
30
|
# @return [true, false] if the conditions passed (and therefore the block was run)
|
31
31
|
#
|
32
|
-
def process(mod:, inputs:)
|
32
|
+
def process(mod:, inputs:) # rubocop:disable Naming/PredicateMethod
|
33
33
|
logger.trace { "Checking #{inputs} against condition trigger #{self}" }
|
34
|
-
unless check_value(Conditions.old_state_from(inputs), @from) &&
|
35
|
-
check_value(Conditions.new_state_from(inputs), @to) &&
|
36
|
-
check_value(inputs["command"], @command)
|
34
|
+
unless check_value?(Conditions.old_state_from(inputs), @from) &&
|
35
|
+
check_value?(Conditions.new_state_from(inputs), @to) &&
|
36
|
+
check_value?(inputs["command"], @command)
|
37
37
|
return false
|
38
38
|
end
|
39
39
|
|
@@ -50,7 +50,7 @@ module OpenHAB
|
|
50
50
|
|
51
51
|
private
|
52
52
|
|
53
|
-
def check_value(value, expected_value)
|
53
|
+
def check_value?(value, expected_value)
|
54
54
|
return true if value.nil?
|
55
55
|
|
56
56
|
return true if expected_value.nil?
|
@@ -26,6 +26,7 @@ module OpenHAB
|
|
26
26
|
class Watcher
|
27
27
|
# Use full java class name here to satisfy YARD linter
|
28
28
|
include org.openhab.core.service.WatchService::WatchEventListener
|
29
|
+
|
29
30
|
java_import org.openhab.core.service.WatchService
|
30
31
|
|
31
32
|
# Hash of event symbols as strings to map to WatchService events
|
data/lib/openhab/dsl/version.rb
CHANGED
data/lib/openhab/dsl.rb
CHANGED
@@ -58,6 +58,7 @@ module OpenHAB
|
|
58
58
|
# include this before Core::Actions so that Core::Action's method_missing
|
59
59
|
# takes priority
|
60
60
|
include Core::EntityLookup
|
61
|
+
|
61
62
|
#
|
62
63
|
# @!parse
|
63
64
|
# include Core::Actions
|
@@ -157,6 +158,8 @@ module OpenHAB
|
|
157
158
|
# @yieldparam [Core::Things::ChannelUID] channel_uid The linked channel.
|
158
159
|
# @yieldparam [Hash] configuration The profile configuration.
|
159
160
|
# @yieldparam [org.openhab.core.thing.profiles.ProfileContext] context The profile context.
|
161
|
+
# @yieldparam [String, nil] source The source of the event.
|
162
|
+
# @since openHAB 5.1
|
160
163
|
# @yieldreturn [Boolean] Return true from the block in order to have default processing.
|
161
164
|
# @return [void]
|
162
165
|
#
|
data/lib/openhab/log.rb
CHANGED
data/lib/openhab/rspec/mocks/abstract_storage_based_type_provider_wrapped_storage_service.rb
CHANGED
@@ -15,7 +15,7 @@ module OpenHAB
|
|
15
15
|
@java_klass = java_klass
|
16
16
|
end
|
17
17
|
|
18
|
-
def getStorage(name, _class_loader)
|
18
|
+
def getStorage(name, _class_loader)
|
19
19
|
super(name.sub(@ruby_klass.name, @java_klass.name), @java_klass.class_loader)
|
20
20
|
end
|
21
21
|
end
|
@@ -97,7 +97,7 @@ module OpenHAB
|
|
97
97
|
open
|
98
98
|
end
|
99
99
|
|
100
|
-
def addingService(reference)
|
100
|
+
def addingService(reference)
|
101
101
|
topics = Array(reference.get_property(org.osgi.service.event.EventConstants::EVENT_TOPIC))
|
102
102
|
topics = nil if topics.empty? || topics.include?("*")
|
103
103
|
|
@@ -119,11 +119,11 @@ module OpenHAB
|
|
119
119
|
service
|
120
120
|
end
|
121
121
|
|
122
|
-
def postEvent(event)
|
122
|
+
def postEvent(event)
|
123
123
|
sendEvent(event)
|
124
124
|
end
|
125
125
|
|
126
|
-
def sendEvent(event)
|
126
|
+
def sendEvent(event)
|
127
127
|
# prevent re-entrancy
|
128
128
|
if (pending_events = Thread.current[:event_admin_pending_events])
|
129
129
|
pending_events << event
|
@@ -5,6 +5,7 @@ module OpenHAB
|
|
5
5
|
# @!visibility private
|
6
6
|
module MarkdownHelper
|
7
7
|
include ::YARD::Templates::Helpers::HtmlHelper
|
8
|
+
|
8
9
|
# @group Linking Objects and URLs
|
9
10
|
|
10
11
|
def diskfile
|
@@ -44,7 +45,7 @@ module OpenHAB
|
|
44
45
|
end) + (match ? $`.count("\n") : 0)
|
45
46
|
if match
|
46
47
|
log.warn "In file `#{file}':#{line}: Cannot resolve link to #{name} from text#{match ? ":" : "."}\n" \
|
47
|
-
"\t#{
|
48
|
+
"\t#{"..." if match[1]}#{match[2].delete("\n")}#{"..." if match[3]}"
|
48
49
|
# Don't strip the link. This is so literals like {RUBY_ENGINE_VERSION} remain as they are,
|
49
50
|
# not stripped to "RUBY_ENGINE_VERSION"
|
50
51
|
next str
|