openhab-scripting 5.34.2 → 5.35.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/emulate_hash.rb +1 -1
- data/lib/openhab/core/things/proxy.rb +11 -0
- data/lib/openhab/core/things/thing.rb +33 -2
- data/lib/openhab/dsl/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: 34c9100f2748e1c7736131f0a3144c1f2cd997a7e6757bc1c18f6785973cbee0
|
4
|
+
data.tar.gz: f9582b65775c086ad9124e0d726b2f39a4376976c6191a5140fee61db18889fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03e8a9dc657a8524dc9dd15b681e538f8b4cb970f18735dd0b91ee6331d57672507975abad1c59169e7f4670c850c3dad178401c31ac1f620f057edefbf61ec9
|
7
|
+
data.tar.gz: 7b108943f0e1c09b00d101f99adaed0689b27213426251d273bff517554f122095bffaaba733d1589cf43e30597b53fa7622a05e198b39d74e471413d79ee98d
|
@@ -32,6 +32,17 @@ module OpenHAB
|
|
32
32
|
Thing::ChannelsArray.new(self, super.to_a)
|
33
33
|
end
|
34
34
|
|
35
|
+
# Returns the properties of this Thing
|
36
|
+
#
|
37
|
+
# @note This is defined on this class, and not on {Thing}, because
|
38
|
+
# that's the interface and if you define it there, it will be hidden
|
39
|
+
# by the method on ThingImpl.
|
40
|
+
#
|
41
|
+
# @return [Thing::Properties] properties map
|
42
|
+
def properties
|
43
|
+
Thing::Properties.new(self)
|
44
|
+
end
|
45
|
+
|
35
46
|
#
|
36
47
|
# Set the proxy item (called by super)
|
37
48
|
#
|
@@ -62,14 +62,21 @@ module OpenHAB
|
|
62
62
|
#
|
63
63
|
# @example
|
64
64
|
# logger.info things["smtp:mail:local"].configuration["hostname"]
|
65
|
-
# logger.info things["ipcamera:dahua:frontporch"].configuration[
|
65
|
+
# logger.info things["ipcamera:dahua:frontporch"].configuration[:ipAddress]
|
66
|
+
#
|
67
|
+
# @example Changing Thing configuration
|
68
|
+
# things["smtp:mail:local"].configuration[:hostname] = "smtp.gmail.com"
|
66
69
|
#
|
67
70
|
# @!attribute [r] properties
|
68
71
|
# Return the properties when available.
|
69
|
-
# @return [
|
72
|
+
# @return [Properties]
|
70
73
|
#
|
71
74
|
# @example
|
72
75
|
# logger.info things["fronius:meter:mybridge:mymeter"].properties["modelId"]
|
76
|
+
# logger.info things["fronius:meter:mybridge:mymeter"].properties[:modelId]
|
77
|
+
#
|
78
|
+
# @example Changing Thing properties
|
79
|
+
# things["lgwebos:WebOSTV:livingroom"].properties[:deviceId] = "e57ae675-aea0-4397-97bc-c39bea30c2ee"
|
73
80
|
#
|
74
81
|
module Thing
|
75
82
|
# Array wrapper class to allow searching a list of channels
|
@@ -92,6 +99,30 @@ module OpenHAB
|
|
92
99
|
end
|
93
100
|
end
|
94
101
|
|
102
|
+
# Properties wrapper class to allow setting Thing's properties with hash-like syntax
|
103
|
+
class Properties
|
104
|
+
include EmulateHash
|
105
|
+
|
106
|
+
def initialize(thing)
|
107
|
+
@thing = thing
|
108
|
+
end
|
109
|
+
|
110
|
+
# @!visibility private
|
111
|
+
def store(key, value)
|
112
|
+
@thing.set_property(key, value)
|
113
|
+
end
|
114
|
+
|
115
|
+
# @!visibility private
|
116
|
+
def replace(hash)
|
117
|
+
@thing.set_properties(hash)
|
118
|
+
end
|
119
|
+
|
120
|
+
# @!visibility private
|
121
|
+
def to_map
|
122
|
+
@thing.get_properties
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
95
126
|
class << self
|
96
127
|
# @!visibility private
|
97
128
|
#
|
data/lib/openhab/dsl/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: 5.
|
4
|
+
version: 5.35.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian O'Connell
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
- Jimmy Tanagra
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-02-
|
12
|
+
date: 2025-02-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|