openhab-scripting 4.28.0 → 4.28.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 +4 -4
- data/lib/openhab/dsl/rules/automation_rule.rb +2 -12
- data/lib/openhab/dsl/rules/rule.rb +4 -15
- data/lib/openhab/dsl/types/date_time_type.rb +2 -2
- data/lib/openhab/dsl/types/decimal_type.rb +1 -1
- data/lib/openhab/dsl/types/hsb_type.rb +1 -1
- data/lib/openhab/dsl/types/increase_decrease_type.rb +1 -1
- data/lib/openhab/dsl/types/next_previous_type.rb +1 -1
- data/lib/openhab/dsl/types/on_off_type.rb +1 -1
- data/lib/openhab/dsl/types/open_closed_type.rb +1 -1
- data/lib/openhab/dsl/types/percent_type.rb +1 -1
- data/lib/openhab/dsl/types/play_pause_type.rb +1 -1
- data/lib/openhab/dsl/types/point_type.rb +1 -1
- data/lib/openhab/dsl/types/quantity_type.rb +1 -1
- data/lib/openhab/dsl/types/refresh_type.rb +1 -1
- data/lib/openhab/dsl/types/rewind_fastforward_type.rb +1 -1
- data/lib/openhab/dsl/types/stop_move_type.rb +1 -1
- data/lib/openhab/dsl/types/string_type.rb +1 -1
- data/lib/openhab/dsl/types/un_def_type.rb +1 -1
- data/lib/openhab/dsl/types/up_down_type.rb +1 -1
- data/lib/openhab/log/configuration.rb +1 -1
- data/lib/openhab/log/logger.rb +10 -0
- data/lib/openhab/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 824e2af85aba6737c05884f3f6ca06adc1873a388b8091062781b274290c6476
|
4
|
+
data.tar.gz: 159ed6ce10d55640c37b61429a937f4dafaecf529479b3423552bff9d929d30d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f6f18504814c73aad6e9c5d5a7548ae17165dff3d4f85a618103f79574389d201c82a528ec09b27b37e975b05b47bb0cd78e958ba0a4bb3b094314f842b9c0e
|
7
|
+
data.tar.gz: d0baf3b51e76656b68e24faa3ceb8d0e76e6afea89b2ba6f81c152ce0f2ddb560fe1942af225f8f1b7ace9c5d3e9c1605c83a1654bddecdceb16f57d47c93b6e
|
@@ -304,7 +304,7 @@ module OpenHAB
|
|
304
304
|
end
|
305
305
|
false
|
306
306
|
rescue StandardError => e
|
307
|
-
|
307
|
+
logger.log_exception(e, name)
|
308
308
|
end
|
309
309
|
# rubocop:enable Metrics/MethodLength
|
310
310
|
|
@@ -328,7 +328,7 @@ module OpenHAB
|
|
328
328
|
end
|
329
329
|
end
|
330
330
|
rescue StandardError => e
|
331
|
-
|
331
|
+
logger.log_exception(e, name)
|
332
332
|
end
|
333
333
|
|
334
334
|
#
|
@@ -399,16 +399,6 @@ module OpenHAB
|
|
399
399
|
@run_context.instance_exec(event, &task.block)
|
400
400
|
end
|
401
401
|
|
402
|
-
#
|
403
|
-
# Print error and stack trace without calls to internal classes
|
404
|
-
#
|
405
|
-
# @param [Exception] error A rescued error
|
406
|
-
#
|
407
|
-
def print_backtrace(error)
|
408
|
-
error = logger.clean_backtrace(error)
|
409
|
-
logger.error { "#{error.message} (#{error.class})\nIn rule: #{name}\n#{error.backtrace&.join("\n")}" }
|
410
|
-
end
|
411
|
-
|
412
402
|
#
|
413
403
|
# Create a new hash in which all elements are converted to strings
|
414
404
|
#
|
@@ -26,7 +26,7 @@ module OpenHAB
|
|
26
26
|
@registry = OpenHAB::Core.rule_registry
|
27
27
|
class << self
|
28
28
|
attr_reader :script_rules, :automation_manager, :registry
|
29
|
-
end
|
29
|
+
end
|
30
30
|
|
31
31
|
#
|
32
32
|
# Create a new rule
|
@@ -35,7 +35,7 @@ end
|
|
35
35
|
# @yield [] Block executed in context of a RuleConfig
|
36
36
|
#
|
37
37
|
#
|
38
|
-
# rubocop: disable Metrics
|
38
|
+
# rubocop: disable Metrics/MethodLength
|
39
39
|
def rule(rule_name, &block)
|
40
40
|
thread_local(RULE_NAME: rule_name) do
|
41
41
|
@rule_name = rule_name
|
@@ -47,10 +47,9 @@ end
|
|
47
47
|
nil # Must return something other than the rule object. See https://github.com/boc-tothefuture/openhab-jruby/issues/438
|
48
48
|
end
|
49
49
|
rescue StandardError => e
|
50
|
-
|
51
|
-
re_raise_with_backtrace(e)
|
50
|
+
logger.log_exception(e, @rule_name)
|
52
51
|
end
|
53
|
-
# rubocop: enable Metrics
|
52
|
+
# rubocop: enable Metrics/MethodLength
|
54
53
|
|
55
54
|
#
|
56
55
|
# Cleanup rules in this script file
|
@@ -62,16 +61,6 @@ end
|
|
62
61
|
|
63
62
|
private
|
64
63
|
|
65
|
-
#
|
66
|
-
# Re-raises a rescued error to OpenHAB with added rule name and stack trace
|
67
|
-
#
|
68
|
-
# @param [Exception] error A rescued error
|
69
|
-
#
|
70
|
-
def re_raise_with_backtrace(error)
|
71
|
-
error = logger.clean_backtrace(error)
|
72
|
-
raise error, "#{error.message}\nIn rule: #{@rule_name}\n#{error.backtrace.join("\n")}"
|
73
|
-
end
|
74
|
-
|
75
64
|
#
|
76
65
|
# Process a rule based on the supplied configuration
|
77
66
|
#
|
@@ -7,8 +7,8 @@ require 'java'
|
|
7
7
|
module OpenHAB
|
8
8
|
module DSL
|
9
9
|
module Types
|
10
|
-
|
11
|
-
java_import java.time.ZonedDateTime
|
10
|
+
DateTimeType = org.openhab.core.library.types.DateTimeType
|
11
|
+
java_import java.time.ZonedDateTime # This is needed for the addon prior to ruby_class fix (OH 3.2.0)
|
12
12
|
|
13
13
|
# global alias
|
14
14
|
::DateTimeType = DateTimeType
|
@@ -6,7 +6,7 @@ require_relative 'numeric_type'
|
|
6
6
|
module OpenHAB
|
7
7
|
module DSL
|
8
8
|
module Types
|
9
|
-
|
9
|
+
DecimalType = org.openhab.core.library.types.DecimalType
|
10
10
|
|
11
11
|
#
|
12
12
|
# Add methods to core OpenHAB DecimalType to make it behave as a Ruby
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module OpenHAB
|
4
4
|
module DSL
|
5
5
|
module Types
|
6
|
-
|
6
|
+
IncreaseDecreaseType = org.openhab.core.library.types.IncreaseDecreaseType
|
7
7
|
|
8
8
|
# Adds methods to core OpenHAB IncreaseDecreaseType to make it more
|
9
9
|
# natural in Ruby
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module OpenHAB
|
4
4
|
module DSL
|
5
5
|
module Types
|
6
|
-
|
6
|
+
OpenClosedType = org.openhab.core.library.types.OpenClosedType
|
7
7
|
|
8
8
|
# Adds methods to core OpenHAB OpenClosedType to make it more natural in Ruby
|
9
9
|
class OpenClosedType
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module OpenHAB
|
4
4
|
module DSL
|
5
5
|
module Types
|
6
|
-
|
6
|
+
RefreshType = org.openhab.core.types.RefreshType
|
7
7
|
|
8
8
|
# Adds methods to core OpenHAB RefreshType to make it more natural in Ruby
|
9
9
|
class RefreshType # rubocop:disable Lint/EmptyClass
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module OpenHAB
|
4
4
|
module DSL
|
5
5
|
module Types
|
6
|
-
|
6
|
+
RewindFastforwardType = org.openhab.core.library.types.RewindFastforwardType
|
7
7
|
|
8
8
|
# Adds methods to core OpenHAB RewindFastforwardType to make it more
|
9
9
|
# natural in Ruby
|
@@ -7,7 +7,7 @@ require_relative 'comparable_type'
|
|
7
7
|
module OpenHAB
|
8
8
|
module DSL
|
9
9
|
module Types
|
10
|
-
|
10
|
+
StringType = org.openhab.core.library.types.StringType
|
11
11
|
|
12
12
|
#
|
13
13
|
# Add methods to core OpenHAB StringType to make it behave as a Ruby
|
data/lib/openhab/log/logger.rb
CHANGED
@@ -82,6 +82,16 @@ module OpenHAB
|
|
82
82
|
error
|
83
83
|
end
|
84
84
|
|
85
|
+
#
|
86
|
+
# Print error and stack trace without calls to internal classes
|
87
|
+
#
|
88
|
+
# @param [Exception] error A rescued error
|
89
|
+
#
|
90
|
+
def log_exception(exception, rule_name)
|
91
|
+
exception = clean_backtrace(exception)
|
92
|
+
error { "#{exception.message} (#{exception.class})\nIn rule: #{rule_name}\n#{exception.backtrace&.join("\n")}" }
|
93
|
+
end
|
94
|
+
|
85
95
|
private
|
86
96
|
|
87
97
|
#
|
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.28.
|
4
|
+
version: 4.28.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: 2022-01-
|
11
|
+
date: 2022-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|