openhab-scripting 4.8.2 → 4.8.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f20bdd4334857cc9d65e95a218f509f90dd6f5b68d7acf550671f942385a426
|
4
|
+
data.tar.gz: a0bcdfba1ab5328f14b52ca16d9e56555fef6f479626aab11f655229a0c4f81a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd22e0e28fce41231eb34a2e0ed4c567b2457584f40852f9af7d684de6d981094bb8da5771b616191827fb42817e32cda3796b97aba8730de38fb95a80bb51b3
|
7
|
+
data.tar.gz: 00aeb56148a1c1117724515596a6ccdf8112246de26418b0ab0e978b75f2efc7766e545458e663a66f196d391c5eb9a281432d9aba6b5ef9b49250e1eae3702e
|
@@ -31,18 +31,18 @@ module OpenHAB
|
|
31
31
|
# @return [Trigger] OpenHAB trigger
|
32
32
|
#
|
33
33
|
def changed(*items, to: nil, from: nil, for: nil)
|
34
|
-
separate_groups(items).
|
34
|
+
separate_groups(items).map do |item|
|
35
35
|
logger.trace("Creating changed trigger for entity(#{item}), to(#{to}), from(#{from})")
|
36
36
|
# for is a reserved word in ruby, so use local_variable_get :for
|
37
37
|
if (wait_duration = binding.local_variable_get(:for))
|
38
38
|
changed_wait(item, to: to, from: from, duration: wait_duration)
|
39
39
|
else
|
40
40
|
# Place in array and flatten to support multiple to elements or single or nil
|
41
|
-
[to].flatten.
|
42
|
-
[from].flatten.
|
41
|
+
[to].flatten.map do |to_state|
|
42
|
+
[from].flatten.map { |from_state| create_changed_trigger(item, from_state, to_state) }
|
43
43
|
end
|
44
44
|
end
|
45
|
-
end
|
45
|
+
end.flatten
|
46
46
|
end
|
47
47
|
|
48
48
|
private
|
@@ -55,12 +55,13 @@ module OpenHAB
|
|
55
55
|
# @param [Item State] to OpenHAB Item State item or group needs to change to
|
56
56
|
# @param [Item State] from OpenHAB Item State item or group needs to be coming from
|
57
57
|
#
|
58
|
-
# @return [
|
58
|
+
# @return [Trigger] OpenHAB trigger
|
59
59
|
#
|
60
60
|
def changed_wait(item, duration:, to: nil, from: nil)
|
61
61
|
trigger = create_changed_trigger(item, nil, nil)
|
62
62
|
logger.trace("Creating Changed Wait Change Trigger for #{item}")
|
63
63
|
@trigger_delays[trigger.id] = TriggerDelay.new(to: to, from: from, duration: duration)
|
64
|
+
trigger
|
64
65
|
end
|
65
66
|
|
66
67
|
#
|
@@ -22,14 +22,14 @@ module OpenHAB
|
|
22
22
|
#
|
23
23
|
#
|
24
24
|
def received_command(*items, command: nil, commands: nil)
|
25
|
-
separate_groups(items).
|
25
|
+
separate_groups(items).map do |item|
|
26
26
|
logger.trace("Creating received command trigger for item(#{item})"\
|
27
27
|
"command(#{command}) commands(#{commands})")
|
28
28
|
|
29
29
|
# Combine command and commands, doing union so only a single nil will be in the combined array.
|
30
30
|
combined_commands = combine_commands(command, commands)
|
31
31
|
create_received_trigger(combined_commands, item)
|
32
|
-
end
|
32
|
+
end.flatten
|
33
33
|
end
|
34
34
|
|
35
35
|
private
|
@@ -42,7 +42,7 @@ module OpenHAB
|
|
42
42
|
#
|
43
43
|
#
|
44
44
|
def create_received_trigger(commands, item)
|
45
|
-
commands.
|
45
|
+
commands.map do |command|
|
46
46
|
if item.is_a? OpenHAB::DSL::Items::GroupItem::GroupMembers
|
47
47
|
config, trigger = create_group_command_trigger(item)
|
48
48
|
else
|
@@ -20,13 +20,13 @@ module OpenHAB
|
|
20
20
|
# @return [Trigger] Trigger for updated entity
|
21
21
|
#
|
22
22
|
def updated(*items, to: nil)
|
23
|
-
separate_groups(items).
|
23
|
+
separate_groups(items).map do |item|
|
24
24
|
logger.trace("Creating updated trigger for item(#{item}) to(#{to})")
|
25
|
-
[to].flatten.
|
25
|
+
[to].flatten.map do |to_state|
|
26
26
|
trigger, config = create_update_trigger(item, to_state)
|
27
27
|
append_trigger(trigger, config)
|
28
28
|
end
|
29
|
-
end
|
29
|
+
end.flatten
|
30
30
|
end
|
31
31
|
|
32
32
|
private
|
data/lib/openhab/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openhab-scripting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.8.
|
4
|
+
version: 4.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian O'Connell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|