openhab-scripting 5.34.1 → 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: fce096267797942787402ee95f2c757c3629772b64d061bda1aa3b3c7046fca6
4
- data.tar.gz: 9fcaf3ee9bba2e9c18a696de78fbe644cf8e30ca9edc629549d2a74bcadbacac
3
+ metadata.gz: 34c9100f2748e1c7736131f0a3144c1f2cd997a7e6757bc1c18f6785973cbee0
4
+ data.tar.gz: f9582b65775c086ad9124e0d726b2f39a4376976c6191a5140fee61db18889fc
5
5
  SHA512:
6
- metadata.gz: 66a8b0bda211a633650d76306c3fbcd1a78a2a29eda5520f05952387eceb514470ab161f6115c2bfa6a75632a649f7ccfb11c756e44984b524c71d3d4946ab7b
7
- data.tar.gz: 9dc227346259c8a2f593972e79bc25d60757ef96b832de2f832a6a8d2c81f35e787c308bce8c12a6f38c9d42124a7372dd1057aecd3a3a8eef42989f6e655db5
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
  #
@@ -2162,6 +2162,7 @@ module OpenHAB
2162
2162
  added_rule.actions.first.configuration.put("script", script) if script
2163
2163
 
2164
2164
  if enabled
2165
+ added_rule.enable unless added_rule.enabled?
2165
2166
  process_on_load { |module_id| rule.execute(nil, { "module" => module_id }) }
2166
2167
  else
2167
2168
  added_rule.disable
@@ -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.1"
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.1
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-04 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