openhab-scripting 2.11.0 → 2.11.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 506ce31e641f76fe22663d36003bdbfcec17d01042c882bf240e85d18f622525
4
- data.tar.gz: d4b390223605105da4308a6b11a6124f9e953cd916d6bfdb7cd4788da01ef008
3
+ metadata.gz: daa36a09bcefbd672716ede992f1525cf81edbf3db5bef1b40e46f7ab0a46837
4
+ data.tar.gz: 871e30faf15a2bd26010c5d118c26cbc569182bf7b849217b5b751148ec95fb7
5
5
  SHA512:
6
- metadata.gz: 987a35a048c611e33e990dc9b3c9d83fd592ba844ee90781c976d2c66b43bdb10837c2c3652c4140b5acc7af6214315a7015f3b64c088943ecaa2a82e65a6477
7
- data.tar.gz: f70fbff98656f3ad15a45ebd2a693462a43dce48515724818f5421bfaf91c194aab9db0c2011c7f1379b38fd6c315fb1ba329664c53cca330dd41970a4831f81
6
+ metadata.gz: fe9756bf909c3061d9824cf4a072ddd1e4c83ebdcec5710ebb166db4a9b302d06942bc3a10ab00a89acc28ab6db2c716a1adfd5cf39beee2462fbf253525bb84
7
+ data.tar.gz: '039eec961406e82062744e131aeb8da4db95dc613c9da0c017f0be70d77edae181f40bdbb49693b8b5244dbcabc9289470fb77eca2033f596285fcc5c0dc1a72'
@@ -97,6 +97,7 @@ module OpenHAB
97
97
  #
98
98
  def updated(*items, to: nil)
99
99
  items.flatten.each do |item|
100
+ item = item.group if item.is_a? Group
100
101
  logger.trace("Creating updated trigger for item(#{item}) to(#{to})")
101
102
  [to].flatten.each do |to_state|
102
103
  case item
@@ -303,6 +303,23 @@ module OpenHAB
303
303
  false
304
304
  end
305
305
 
306
+ #
307
+ # Patch event to include event.item when it doesn't exist
308
+ # This is to patch a bug see https://github.com/boc-tothefuture/openhab-jruby/issues/75
309
+ # It may be fixed in the openhab core in the future, in which case, this patch will no longer be necessary
310
+ #
311
+ # @param [OpenHAB Event] event to check for item accessor
312
+ # @param [OpenHAB Event Inputs] inputs inputs to running rule
313
+ #
314
+ def add_event_item(event, inputs)
315
+ return if event.nil? || defined?(event.item)
316
+
317
+ class << event
318
+ attr_accessor :item
319
+ end
320
+ event.item = inputs&.dig('triggeringItem')
321
+ end
322
+
306
323
  #
307
324
  # Process the run queue
308
325
  #
@@ -317,7 +334,7 @@ module OpenHAB
317
334
  when RuleConfig::Run
318
335
 
319
336
  event = inputs&.dig('event')
320
-
337
+ add_event_item(event, inputs)
321
338
  logger.trace { "Executing rule '#{name}' run block with event(#{event})" }
322
339
  task.block.call(event)
323
340
  when RuleConfig::Trigger
@@ -5,5 +5,5 @@
5
5
  #
6
6
  module OpenHAB
7
7
  # @return [String] Version of OpenHAB helper libraries
8
- VERSION = '2.11.0'
8
+ VERSION = '2.11.1'
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openhab-scripting
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.0
4
+ version: 2.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian O'Connell