openhab-scripting 5.34.2 → 5.35.0

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: 60f2430df81cdc2c1455081302fe53ae038559a284713a130c1f8ed31dc18662
4
- data.tar.gz: 1303d6cf57456fc36a09b2c097278afff9ebad5c01cf021117bee12a326364f6
3
+ metadata.gz: 34c9100f2748e1c7736131f0a3144c1f2cd997a7e6757bc1c18f6785973cbee0
4
+ data.tar.gz: f9582b65775c086ad9124e0d726b2f39a4376976c6191a5140fee61db18889fc
5
5
  SHA512:
6
- metadata.gz: afe16ead5472cbd62cc0d270c62f155816ed4f5d6ac280ae48afb1ab4d8153d62457761dbbb680fba9f05275a2be213619dc5055dbb8d9f6db5431f5407c2366
7
- data.tar.gz: ee914d04941db213144cfa8a34a2e903807cb304154de5ee8668f431c91a5c892de248c4f9b43ea92a5c6201c605a2663c123059ef0ca4d07f184162fd39732b
6
+ metadata.gz: 03e8a9dc657a8524dc9dd15b681e538f8b4cb970f18735dd0b91ee6331d57672507975abad1c59169e7f4670c850c3dad178401c31ac1f620f057edefbf61ec9
7
+ data.tar.gz: 7b108943f0e1c09b00d101f99adaed0689b27213426251d273bff517554f122095bffaaba733d1589cf43e30597b53fa7622a05e198b39d74e471413d79ee98d
@@ -113,7 +113,7 @@ module OpenHAB
113
113
  alias_method :update, :merge!
114
114
 
115
115
  # @!visibility private
116
- def replace
116
+ def replace(hash)
117
117
  raise NotImplementedError
118
118
  end
119
119
 
@@ -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["ipAddress"]
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 [Hash]
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
  #
@@ -4,6 +4,6 @@ module OpenHAB
4
4
  module DSL
5
5
  # Version of openHAB helper libraries
6
6
  # @return [String]
7
- VERSION = "5.34.2"
7
+ VERSION = "5.35.0"
8
8
  end
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: 5.34.2
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-10 00:00:00.000000000 Z
12
+ date: 2025-02-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler