openhab-scripting 4.32.3 → 4.32.6

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: 7c1093824867216ac9015ebc8bba44843f327a03c5c896ae44e8c18a90d3ffba
4
- data.tar.gz: b3496046440b79efbc9d8967634337dc8ee035f4e64d596eb64863f4d2f8e617
3
+ metadata.gz: 34c74d99bb0771d8c4bfda01a96e59565dd3cd204918c0726b4286350b987b8b
4
+ data.tar.gz: 17414fbbbf1ad48e9645f0bfdda0cd09703270695885d4938b5b74a22b9b1e84
5
5
  SHA512:
6
- metadata.gz: b4267271e7c487fafc419b874b3a919026c21305c8449836427df7f54361299d91e2f22a26fe7533ca114630862e74e4c671f06828c9a591b485e53da6609eca
7
- data.tar.gz: cf88fac5372d571b4e2d68f85e8c395488397b314c260957180d1f60173f082c47ebbbc3670b0daa3f5fed753ca4f11154d4c4f45f678aae573626719236d3d2
6
+ metadata.gz: 2d79c2e5349ec783bef23e2b47f279052c1602a271d05d0c28e1f46f651aa5303138a0ee092a521db3d452764c05787e0416e16ac1a36c1cb1afcb823d205009
7
+ data.tar.gz: 20f6d14f431456ab6cfafca83a36fdcc7ef1f7c0f2c2b960f819bfe896916e6b676968dd616fd656288d734ac03e733eea31b0345d122d727dbe43b6978117a9
@@ -49,7 +49,7 @@ module OpenHAB
49
49
  return super(command) unless duration
50
50
 
51
51
  # Timer needs access to rule to disable, rule needs access to timer to cancel.
52
- # Using a mutux to ensure neither fires before the other is constructed
52
+ # Using a mutex to ensure neither fires before the other is constructed
53
53
  semaphore = Mutex.new
54
54
 
55
55
  semaphore.synchronize do
@@ -144,7 +144,7 @@ module OpenHAB
144
144
  include OpenHAB::Log
145
145
  include OpenHAB::Core::ThreadLocal
146
146
 
147
- def initialize(timed_command_details, semaphore, &block)
147
+ def initialize(timed_command_details, semaphore, &block) # rubocop:disable Metric/MethodLength
148
148
  super()
149
149
  @semaphore = semaphore
150
150
  @timed_command_details = timed_command_details
@@ -154,7 +154,8 @@ module OpenHAB
154
154
  set_name("Cancels implicit timer for #{timed_command_details.item.id}")
155
155
  set_triggers([OpenHAB::DSL::Rules::RuleTriggers.trigger(
156
156
  type: OpenHAB::DSL::Rules::Triggers::Changed::ITEM_STATE_CHANGE,
157
- config: { 'itemName' => timed_command_details.item.name }
157
+ config: { 'itemName' => timed_command_details.item.name,
158
+ 'previousState' => timed_command_details.command.to_s }
158
159
  )])
159
160
  end
160
161
 
@@ -34,7 +34,6 @@ module OpenHAB
34
34
  # @yield [] Block executed in context of a RuleConfig
35
35
  #
36
36
  #
37
- # rubocop: disable Metrics/MethodLength
38
37
  def rule(rule_name, &block)
39
38
  thread_local(RULE_NAME: rule_name) do
40
39
  @rule_name = rule_name
@@ -43,12 +42,10 @@ module OpenHAB
43
42
  config.guard = Guard::Guard.new(run_context: config.caller, only_if: config.only_if, not_if: config.not_if)
44
43
  logger.trace { config.inspect }
45
44
  process_rule_config(config)
46
- nil # Must return something other than the rule object. See https://github.com/boc-tothefuture/openhab-jruby/issues/438
47
45
  end
48
46
  rescue StandardError => e
49
47
  logger.log_exception(e, @rule_name)
50
48
  end
51
- # rubocop: enable Metrics/MethodLength
52
49
 
53
50
  #
54
51
  # Cleanup rules in this script file
@@ -71,10 +68,10 @@ module OpenHAB
71
68
 
72
69
  rule = AutomationRule.new(config: config)
73
70
  Rules.script_rules << rule
74
- add_rule(rule)
71
+ added_rule = add_rule(rule)
75
72
 
76
73
  rule.execute(nil, { 'event' => Struct.new(:attachment).new(config.start_attachment) }) if config.on_start?
77
- rule
74
+ added_rule
78
75
  end
79
76
 
80
77
  #
@@ -20,8 +20,7 @@ module OpenHAB
20
20
  # Invert the type
21
21
  # @return [OnOffType] +OFF+ if +ON+, +ON+ if +OFF+
22
22
  def !
23
- return OFF if on?
24
- return ON if off?
23
+ on? ? OFF : ON
25
24
  end
26
25
  end
27
26
  end
@@ -270,8 +270,7 @@ module OpenHAB
270
270
  #
271
271
  def log_caller
272
272
  caller_locations.map(&:path)
273
- .grep_v(/rubygems/)
274
- .grep_v(/openhab-scripting/)
273
+ .grep_v(/rubygems|openhab-scripting|<script>/)
275
274
  .first
276
275
  .then { |caller| File.basename(caller, '.*') if caller }
277
276
  end
@@ -5,5 +5,5 @@
5
5
  #
6
6
  module OpenHAB
7
7
  # @return [String] Version of OpenHAB helper libraries
8
- VERSION = '4.32.3'
8
+ VERSION = '4.32.6'
9
9
  end
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.32.3
4
+ version: 4.32.6
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-02-24 00:00:00.000000000 Z
11
+ date: 2022-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler