openhab-scripting 2.22.1 → 2.23.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b38e635249a2d0e8633e75504eb3e42f79399d1e66b90f5242f3dc8062c711b
|
4
|
+
data.tar.gz: dcb573a627b8f93d5a4f6e1bbb8e9b8033f4765b33e49ab88d07414e055b5e7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6b8e1f865bf8912e0575495c0539e96acd5f7c8dc77582ab355bee6e5def4e45701cf159d77b12fe7975cb8493fafbcc0260706f2bd500fddeecf4a66683e5e
|
7
|
+
data.tar.gz: fb3c37bf6fdd9f9f95feb26e39e44cd336b7da07a4831e1d3b8079bcbac0f57c005c7324e683dbcb5baa67c60124e947e965edb88b3f8a43a51f03e29fa383a9
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'java'
|
4
|
+
|
5
|
+
module OpenHAB
|
6
|
+
module DSL
|
7
|
+
module MonkeyPatch
|
8
|
+
#
|
9
|
+
# Patches OpenHAB events
|
10
|
+
#
|
11
|
+
module Events
|
12
|
+
java_import Java::OrgOpenhabCoreItemsEvents::ItemStateEvent
|
13
|
+
|
14
|
+
#
|
15
|
+
# MonkeyPatch with ruby style accessors
|
16
|
+
#
|
17
|
+
class ItemStateEvent
|
18
|
+
alias state item_state
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -29,7 +29,7 @@ module OpenHAB
|
|
29
29
|
def_delegator :@metadata, :value
|
30
30
|
|
31
31
|
def initialize(metadata: nil, key: nil, value: nil, config: nil)
|
32
|
-
@metadata = metadata || Metadata.new(key || MetadataKey.new('', ''), value, config)
|
32
|
+
@metadata = metadata || Metadata.new(key || MetadataKey.new('', ''), value&.to_s, config)
|
33
33
|
super(@metadata&.configuration)
|
34
34
|
end
|
35
35
|
|
@@ -60,9 +60,7 @@ module OpenHAB
|
|
60
60
|
# @return [Java::Org::openhab::core::items::Metadata] the old metadata
|
61
61
|
#
|
62
62
|
def value=(value)
|
63
|
-
|
64
|
-
|
65
|
-
metadata = Metadata.new(@metadata&.uID, value, @metadata&.configuration)
|
63
|
+
metadata = Metadata.new(@metadata&.uID, value&.to_s, @metadata&.configuration)
|
66
64
|
NamespaceAccessor.registry.update(metadata) if @metadata&.uID
|
67
65
|
end
|
68
66
|
|
@@ -125,7 +123,7 @@ module OpenHAB
|
|
125
123
|
meta_value, configuration = update_from_value(value)
|
126
124
|
|
127
125
|
key = MetadataKey.new(namespace, @item_name)
|
128
|
-
metadata = Metadata.new(key, meta_value, configuration)
|
126
|
+
metadata = Metadata.new(key, meta_value&.to_s, configuration)
|
129
127
|
# registry.get can be omitted, but registry.update will log a warning for nonexistent metadata
|
130
128
|
if NamespaceAccessor.registry.get(key)
|
131
129
|
NamespaceAccessor.registry.update(metadata)
|
data/lib/openhab/version.rb
CHANGED
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.
|
4
|
+
version: 2.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian O'Connell
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- lib/openhab/dsl/monkey_patch/actions/script_thing_actions.rb
|
50
50
|
- lib/openhab/dsl/monkey_patch/events/events.rb
|
51
51
|
- lib/openhab/dsl/monkey_patch/events/item_command.rb
|
52
|
+
- lib/openhab/dsl/monkey_patch/events/item_state.rb
|
52
53
|
- lib/openhab/dsl/monkey_patch/events/item_state_changed.rb
|
53
54
|
- lib/openhab/dsl/monkey_patch/events/thing_status_info.rb
|
54
55
|
- lib/openhab/dsl/monkey_patch/items/contact_item.rb
|