openhab-scripting 5.24.2 → 5.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openhab/core/items/group_item.rb +20 -0
- data/lib/openhab/core/items/persistence.rb +26 -0
- data/lib/openhab/core/things/thing.rb +14 -1
- data/lib/openhab/core.rb +2 -0
- data/lib/openhab/dsl/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c898bc5ce08126c859ea18fa49311cb13db576df162bdad7b223d0a969af295
|
4
|
+
data.tar.gz: 667905c4ce354563a439ad31c2449a9d93e321871ab64983ea6a9a108f664096
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c8db7176dfcf4fceb4b6ab9b796c0bcaea2357e539992d8671bd63392f99deca570237ab9591b956cabb4066889eba63b85d7d4c26fbf911d16d027d2efd845
|
7
|
+
data.tar.gz: 621e91b24ecb04685e308df788982df4b66245bbb3f1fe28a1e221173c3bc63c8308d913ddd1d8162bf540fad8c9617b4c0fa01e08266db4ee4ba92cfa4987b9
|
@@ -83,6 +83,26 @@ module OpenHAB
|
|
83
83
|
@group = group_item
|
84
84
|
end
|
85
85
|
|
86
|
+
#
|
87
|
+
# Adds a member to the group
|
88
|
+
#
|
89
|
+
# @param [Item, String] member The item to add to the group
|
90
|
+
# @return [Members] self
|
91
|
+
#
|
92
|
+
def add(member)
|
93
|
+
if member.is_a?(String)
|
94
|
+
member = items[member]
|
95
|
+
raise ArgumentError, "Item not found: #{member}" if member.nil?
|
96
|
+
end
|
97
|
+
|
98
|
+
member = member.__getobj__ if member.is_a?(Proxy)
|
99
|
+
raise ArgumentError, "Member must be an Item" unless member.is_a?(Item)
|
100
|
+
|
101
|
+
group.add_member(member)
|
102
|
+
self
|
103
|
+
end
|
104
|
+
alias_method :<<, :add
|
105
|
+
|
86
106
|
# Explicit conversion to Array
|
87
107
|
#
|
88
108
|
# @return [Array]
|
@@ -176,6 +176,31 @@ module OpenHAB
|
|
176
176
|
# @return [DecimalType, QuantityType, nil] The standard deviation between `start` and `finish`,
|
177
177
|
# or nil if no states could be found.
|
178
178
|
|
179
|
+
# @!method median_since(timestamp, service = nil)
|
180
|
+
# Returns the median of the item's state since the given time
|
181
|
+
# @param [#to_zoned_date_time] timestamp The point in time from which to search
|
182
|
+
# @param [Symbol, String] service An optional persistence id instead of the default persistence service.
|
183
|
+
# @return [DecimalType, QuantityType, nil] The median since `timestamp`,
|
184
|
+
# or nil if no previous states could be found.
|
185
|
+
# @since openHAB 4.3
|
186
|
+
|
187
|
+
# @!method median_until(timestamp, service = nil)
|
188
|
+
# Returns the median of the item's state beetween now until the given time
|
189
|
+
# @param [#to_zoned_date_time] timestamp The point in time until which to search
|
190
|
+
# @param [Symbol, String] service An optional persistence id instead of the default persistence service.
|
191
|
+
# @return [DecimalType, QuantityType, nil] The median until `timestamp`,
|
192
|
+
# or nil if no future states could be found.
|
193
|
+
# @since openHAB 4.3
|
194
|
+
|
195
|
+
# @!method median_between(start, finish, service = nil)
|
196
|
+
# Returns the median of the item's state between two points in time
|
197
|
+
# @param [#to_zoned_date_time] start The point in time from which to search
|
198
|
+
# @param [#to_zoned_date_time] finish The point in time to which to search
|
199
|
+
# @param [Symbol, String] service An optional persistence id instead of the default persistence service.
|
200
|
+
# @return [DecimalType, QuantityType, nil] The median between `start` and `finish`,
|
201
|
+
# or nil if no states could be found.
|
202
|
+
# @since openHAB 4.3
|
203
|
+
|
179
204
|
# @!method sum_since(timestamp, service = nil)
|
180
205
|
# Returns the sum of the item's state since the given time
|
181
206
|
# @param [#to_zoned_date_time] timestamp The point in time from which to search
|
@@ -661,6 +686,7 @@ module OpenHAB
|
|
661
686
|
end
|
662
687
|
|
663
688
|
def_persistence_methods(:average, quantify: true)
|
689
|
+
def_persistence_methods(:median, quantify: true) if OpenHAB::Core.version >= OpenHAB::Core::V4_3
|
664
690
|
def_persistence_methods(:delta, quantify: true)
|
665
691
|
def_persistence_methods(:deviation, quantify: true)
|
666
692
|
def_persistence_methods(:sum, quantify: true)
|
@@ -30,6 +30,14 @@ module OpenHAB
|
|
30
30
|
# # replace ':' with '_' in thing uid
|
31
31
|
# mqtt_broker_mosquitto.online? # is mqtt:broker:mosquitto thing online?
|
32
32
|
#
|
33
|
+
# @!attribute label
|
34
|
+
# Return the thing label
|
35
|
+
# @return [String]
|
36
|
+
#
|
37
|
+
# @!attribute location
|
38
|
+
# Return the thing location
|
39
|
+
# @return [String]
|
40
|
+
#
|
33
41
|
# @!attribute [r] status
|
34
42
|
# Return the {https://www.openhab.org/docs/concepts/things.html#thing-status thing status}
|
35
43
|
# @return [org.openhab.core.thing.ThingStatus]
|
@@ -43,7 +51,7 @@ module OpenHAB
|
|
43
51
|
#
|
44
52
|
# @!attribute [r] bridge_uid
|
45
53
|
# Return the Bridge UID when available.
|
46
|
-
# @return [ThingUID]
|
54
|
+
# @return [ThingUID, nil]
|
47
55
|
#
|
48
56
|
# @!attribute [r] thing_type_uid
|
49
57
|
# @return [ThingTypeUID]
|
@@ -171,6 +179,11 @@ module OpenHAB
|
|
171
179
|
bridge_uid && EntityLookup.lookup_thing(bridge_uid)
|
172
180
|
end
|
173
181
|
|
182
|
+
# @return [true,false] true if this Thing is a bridge
|
183
|
+
def bridge?
|
184
|
+
is_a?(org.openhab.core.thing.Bridge)
|
185
|
+
end
|
186
|
+
|
174
187
|
# @return [String]
|
175
188
|
def inspect
|
176
189
|
r = "#<OpenHAB::Core::Things::Thing #{uid}"
|
data/lib/openhab/core.rb
CHANGED
@@ -13,6 +13,8 @@ module OpenHAB
|
|
13
13
|
V4_1 = Gem::Version.new("4.1.0").freeze
|
14
14
|
# @!visibility private
|
15
15
|
V4_2 = Gem::Version.new("4.2.0").freeze
|
16
|
+
# @!visibility private
|
17
|
+
V4_3 = Gem::Version.new("4.3.0").freeze
|
16
18
|
|
17
19
|
# @return [Gem::Version] Returns the current openHAB version as a Gem::Version object
|
18
20
|
# Note, this strips off snapshots, milestones and RC versions and returns the release version.
|
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.26.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian O'Connell
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-08-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -490,7 +490,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
490
490
|
- !ruby/object:Gem::Version
|
491
491
|
version: '0'
|
492
492
|
requirements: []
|
493
|
-
rubygems_version: 3.5.
|
493
|
+
rubygems_version: 3.5.17
|
494
494
|
signing_key:
|
495
495
|
specification_version: 4
|
496
496
|
summary: JRuby Helper Libraries for openHAB Scripting
|