openhab-scripting 2.25.0 → 2.25.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openhab/dsl/items/datetime_item.rb +3 -1
- data/lib/openhab/dsl/items/item_command.rb +15 -0
- data/lib/openhab/dsl/items/number_item.rb +3 -0
- data/lib/openhab/dsl/items/rollershutter_item.rb +1 -7
- data/lib/openhab/dsl/items/string_item.rb +3 -1
- data/lib/openhab/dsl/monkey_patch/items/contact_item.rb +1 -1
- data/lib/openhab/dsl/monkey_patch/items/dimmer_item.rb +1 -2
- data/lib/openhab/dsl/monkey_patch/items/switch_item.rb +1 -2
- data/lib/openhab/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: 7226c1329289ce5ce0f85f552c091a6c5f89cb27427b9e6419d528c77a792239
|
4
|
+
data.tar.gz: e92ad134d92584fed6ddeeef98984cabc56355cd94f4d205a5228263ac2677d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0519c68cec3b2316751c36ba27c208267ee86f76230a1722dcd3369d61e19da73a96b6616ed2a71838daf68beb3f64b88e1553f82f8cb00daec4de5c859ecb87'
|
7
|
+
data.tar.gz: f688f894e8a4bde1c3ee12facc846836a922cc7a1120ffd5d89ff41a6d6be1692608467265179543aaed1262394ea37aaa92d4bd5b03ad9eb33bcdd13b06c8dc
|
@@ -17,11 +17,13 @@ module OpenHAB
|
|
17
17
|
class DateTimeItem
|
18
18
|
extend Forwardable
|
19
19
|
extend OpenHAB::DSL::Items::ItemDelegate
|
20
|
-
|
20
|
+
extend OpenHAB::DSL::Items::ItemCommand
|
21
21
|
include Comparable
|
22
22
|
|
23
23
|
def_item_delegator :@datetime_item
|
24
24
|
|
25
|
+
item_type Java::OrgOpenhabCoreLibraryItems::DateTimeItem
|
26
|
+
|
25
27
|
#
|
26
28
|
# Create a new DateTimeItem
|
27
29
|
#
|
@@ -51,6 +51,21 @@ module OpenHAB
|
|
51
51
|
end
|
52
52
|
# rubocop:enable Style/HashEachMethods
|
53
53
|
end
|
54
|
+
|
55
|
+
#
|
56
|
+
# Extract the accepted state and command types from the specified OpenHAB
|
57
|
+
# Item class and pass them to item_state/item_command
|
58
|
+
#
|
59
|
+
# @param [Java::JavaLang::Class] item_class a Class that implements Java::OrgOpenhabCoreItems::Item
|
60
|
+
#
|
61
|
+
def item_type(item_class)
|
62
|
+
item_class.field_reader(:ACCEPTED_DATA_TYPES)
|
63
|
+
item_class.field_reader(:ACCEPTED_COMMAND_TYPES)
|
64
|
+
item_class.ACCEPTED_DATA_TYPES.select(&:is_enum).grep_v(UnDefType).each { |type| item_state(type.ruby_class) }
|
65
|
+
item_class.ACCEPTED_COMMAND_TYPES.select(&:is_enum).grep_v(UnDefType).each do |type|
|
66
|
+
item_command(type.ruby_class)
|
67
|
+
end
|
68
|
+
end
|
54
69
|
end
|
55
70
|
end
|
56
71
|
end
|
@@ -17,6 +17,7 @@ module OpenHAB
|
|
17
17
|
# way of breaking it up into multiple classes
|
18
18
|
class NumberItem < Numeric
|
19
19
|
extend OpenHAB::DSL::Items::ItemDelegate
|
20
|
+
extend OpenHAB::DSL::Items::ItemCommand
|
20
21
|
|
21
22
|
def_item_delegator :@number_item
|
22
23
|
|
@@ -25,6 +26,8 @@ module OpenHAB
|
|
25
26
|
java_import 'tec.uom.se.format.SimpleUnitFormat'
|
26
27
|
java_import 'tec.uom.se.AbstractUnit'
|
27
28
|
|
29
|
+
item_type Java::OrgOpenhabCoreLibraryItems::NumberItem
|
30
|
+
|
28
31
|
#
|
29
32
|
# Create a new NumberItem
|
30
33
|
#
|
@@ -19,13 +19,7 @@ module OpenHAB
|
|
19
19
|
|
20
20
|
def_item_delegator :@rollershutter_item
|
21
21
|
|
22
|
-
|
23
|
-
java_import Java::OrgOpenhabCoreLibraryTypes::UpDownType
|
24
|
-
java_import Java::OrgOpenhabCoreLibraryTypes::StopMoveType
|
25
|
-
|
26
|
-
item_command Java::OrgOpenhabCoreLibraryTypes::StopMoveType
|
27
|
-
item_command Java::OrgOpenhabCoreLibraryTypes::UpDownType
|
28
|
-
item_state Java::OrgOpenhabCoreLibraryTypes::UpDownType
|
22
|
+
item_type Java::OrgOpenhabCoreLibraryItems::RollershutterItem
|
29
23
|
|
30
24
|
#
|
31
25
|
# Creates a new RollershutterItem
|
@@ -13,7 +13,7 @@ module OpenHAB
|
|
13
13
|
#
|
14
14
|
class StringItem
|
15
15
|
extend Forwardable
|
16
|
-
|
16
|
+
extend OpenHAB::DSL::Items::ItemCommand
|
17
17
|
include Comparable
|
18
18
|
extend OpenHAB::DSL::Items::ItemDelegate
|
19
19
|
|
@@ -23,6 +23,8 @@ module OpenHAB
|
|
23
23
|
|
24
24
|
def_item_delegator :@string_item
|
25
25
|
|
26
|
+
item_type Java::OrgOpenhabCoreLibraryItems::StringItem
|
27
|
+
|
26
28
|
#
|
27
29
|
# Create a new StringItem
|
28
30
|
#
|
@@ -30,8 +30,7 @@ module OpenHAB
|
|
30
30
|
extend Forwardable
|
31
31
|
extend OpenHAB::DSL::Items::ItemCommand
|
32
32
|
|
33
|
-
|
34
|
-
item_command Java::OrgOpenhabCoreLibraryTypes::IncreaseDecreaseType
|
33
|
+
item_type Java::OrgOpenhabCoreLibraryItems::DimmerItem
|
35
34
|
|
36
35
|
def_delegator :state, :to_s
|
37
36
|
|
@@ -23,8 +23,7 @@ module OpenHAB
|
|
23
23
|
|
24
24
|
java_import Java::OrgOpenhabCoreLibraryTypes::OnOffType
|
25
25
|
|
26
|
-
|
27
|
-
item_state Java::OrgOpenhabCoreLibraryTypes::OnOffType
|
26
|
+
item_type Java::OrgOpenhabCoreLibraryItems::SwitchItem
|
28
27
|
|
29
28
|
alias truthy? on?
|
30
29
|
|
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: 2.25.
|
4
|
+
version: 2.25.1
|
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-02-
|
11
|
+
date: 2021-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|