openhab-jrubyscripting 5.0.0.rc4 → 5.0.0.rc6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/lib/openhab/core/actions.rb +21 -9
  3. data/lib/openhab/core/dependency_tracking.rb +34 -0
  4. data/lib/openhab/core/entity_lookup.rb +132 -78
  5. data/lib/openhab/core/events/item_channel_link.rb +2 -2
  6. data/lib/openhab/core/events/item_command_event.rb +1 -1
  7. data/lib/openhab/core/events/item_event.rb +2 -2
  8. data/lib/openhab/core/events/item_state_changed_event.rb +1 -1
  9. data/lib/openhab/core/events/thing.rb +1 -1
  10. data/lib/openhab/core/items/accepted_data_types.rb +2 -2
  11. data/lib/openhab/core/items/contact_item.rb +1 -1
  12. data/lib/openhab/core/items/dimmer_item.rb +2 -2
  13. data/lib/openhab/core/items/generic_item.rb +45 -224
  14. data/lib/openhab/core/items/group_item.rb +5 -3
  15. data/lib/openhab/core/items/image_item.rb +2 -2
  16. data/lib/openhab/core/items/item.rb +219 -0
  17. data/lib/openhab/core/items/metadata/hash.rb +1 -1
  18. data/lib/openhab/core/items/metadata/namespace_hash.rb +1 -1
  19. data/lib/openhab/core/items/persistence.rb +19 -10
  20. data/lib/openhab/core/items/provider.rb +2 -2
  21. data/lib/openhab/core/items/proxy.rb +68 -7
  22. data/lib/openhab/core/items/registry.rb +6 -6
  23. data/lib/openhab/core/items/semantics/enumerable.rb +6 -6
  24. data/lib/openhab/core/items/semantics.rb +8 -7
  25. data/lib/openhab/core/items.rb +3 -2
  26. data/lib/openhab/core/provider.rb +14 -7
  27. data/lib/openhab/core/rules/registry.rb +2 -2
  28. data/lib/openhab/core/rules.rb +1 -1
  29. data/lib/openhab/core/script_handling.rb +6 -6
  30. data/lib/openhab/core/things/channel.rb +1 -1
  31. data/lib/openhab/core/things/channel_uid.rb +2 -2
  32. data/lib/openhab/core/things/item_channel_link.rb +2 -2
  33. data/lib/openhab/core/things/links/provider.rb +2 -2
  34. data/lib/openhab/core/things/profile_callback.rb +1 -1
  35. data/lib/openhab/core/things/registry.rb +1 -1
  36. data/lib/openhab/core/things/thing.rb +1 -1
  37. data/lib/openhab/core/timer.rb +21 -10
  38. data/lib/openhab/core/types/date_time_type.rb +4 -4
  39. data/lib/openhab/core/types/hsb_type.rb +2 -2
  40. data/lib/openhab/core/types/point_type.rb +1 -1
  41. data/lib/openhab/core/types/quantity_type.rb +1 -1
  42. data/lib/openhab/core/types.rb +1 -1
  43. data/lib/openhab/core/uid.rb +1 -1
  44. data/lib/openhab/core/value_cache.rb +188 -0
  45. data/lib/openhab/core.rb +57 -15
  46. data/lib/openhab/core_ext/between.rb +32 -0
  47. data/lib/openhab/core_ext/java/duration.rb +1 -0
  48. data/lib/openhab/core_ext/java/local_date.rb +1 -0
  49. data/lib/openhab/core_ext/java/local_time.rb +1 -0
  50. data/lib/openhab/core_ext/java/month.rb +12 -1
  51. data/lib/openhab/core_ext/java/month_day.rb +2 -0
  52. data/lib/openhab/core_ext/java/zoned_date_time.rb +4 -4
  53. data/lib/openhab/core_ext/ruby/date.rb +3 -1
  54. data/lib/openhab/core_ext/ruby/date_time.rb +1 -0
  55. data/lib/openhab/core_ext/ruby/symbol.rb +7 -0
  56. data/lib/openhab/core_ext/ruby/time.rb +1 -0
  57. data/lib/openhab/dsl/items/builder.rb +17 -10
  58. data/lib/openhab/dsl/items/ensure.rb +5 -5
  59. data/lib/openhab/dsl/items/timed_command.rb +5 -5
  60. data/lib/openhab/dsl/rules/automation_rule.rb +54 -40
  61. data/lib/openhab/dsl/rules/builder.rb +128 -79
  62. data/lib/openhab/dsl/rules/guard.rb +5 -5
  63. data/lib/openhab/dsl/rules/name_inference.rb +21 -2
  64. data/lib/openhab/dsl/rules/rule_triggers.rb +3 -3
  65. data/lib/openhab/dsl/rules/terse.rb +1 -0
  66. data/lib/openhab/dsl/rules/triggers/changed.rb +27 -24
  67. data/lib/openhab/dsl/rules/triggers/command.rb +6 -5
  68. data/lib/openhab/dsl/rules/triggers/conditions/duration.rb +3 -3
  69. data/lib/openhab/dsl/rules/triggers/cron/cron.rb +2 -2
  70. data/lib/openhab/dsl/rules/triggers/cron/cron_handler.rb +6 -6
  71. data/lib/openhab/dsl/rules/triggers/updated.rb +5 -5
  72. data/lib/openhab/dsl/rules/triggers/watch/watch_handler.rb +11 -12
  73. data/lib/openhab/dsl/things/builder.rb +73 -14
  74. data/lib/openhab/dsl/version.rb +2 -2
  75. data/lib/openhab/dsl.rb +45 -17
  76. data/lib/openhab/log.rb +5 -5
  77. data/lib/openhab/rspec/configuration.rb +5 -5
  78. data/lib/openhab/rspec/example_group.rb +1 -1
  79. data/lib/openhab/rspec/helpers.rb +5 -5
  80. data/lib/openhab/rspec/hooks.rb +19 -1
  81. data/lib/openhab/rspec/karaf.rb +13 -21
  82. data/lib/openhab/rspec/mocks/persistence_service.rb +15 -0
  83. data/lib/openhab/rspec/mocks/thing_handler.rb +2 -2
  84. data/lib/openhab/rspec/suspend_rules.rb +2 -1
  85. data/lib/openhab/yard/base_helper.rb +46 -0
  86. data/lib/openhab/yard/html_helper.rb +3 -3
  87. data/lib/openhab/yard/markdown_directive.rb +125 -0
  88. data/lib/openhab/yard/markdown_helper.rb +99 -0
  89. metadata +15 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e06b71ae524165363db99771e7ef601f542ed14c979572d152b079d70ad82a2
4
- data.tar.gz: 0d6002391ed26a68bbb907d94787f510df30ef6ef9a3a7cd445ac9c47122851b
3
+ metadata.gz: '073238949bf5ae76587de8f6bfedc6ef15c2e3ab86303fe6f7c1ca8ec874c33e'
4
+ data.tar.gz: 4846aaca23d7f772f558777ab8703cb6ea7d4e6b307c47a8f507fe468963620c
5
5
  SHA512:
6
- metadata.gz: 05a3016219eaf41fc4af71f1476029e2b8d0b320afc7bed99e9777b7726afc6897328d9aa92f643132e66d647aae8742eca36f26c703ab3763e1738c55d249e1
7
- data.tar.gz: d5a7d65543b3628e5c3abfa61cb2aa6d6f10e2ab2bb3334d9f38e1ee8952da655da6360c156d926bd53b25c013c86c7672dc1b492c85aaa056e898579a7be7dd
6
+ metadata.gz: 2a89863d588557b92642b12ba341c12c101b39079c18035cfec040b02172ee8b789d03c3b6f8bd7a636e9b72be6379819b654b19ec90dc6edfa7c2d4f738a515
7
+ data.tar.gz: a1c2906913f3578c75ee806aa45ded0017610a5e582280bc8bf19fc08316e2dfc539b0aa2829128ed65de24cf07f038d67faa259d3dd8847f3e9aaec05a60ea2
@@ -5,7 +5,7 @@ module OpenHAB
5
5
  #
6
6
  # Access to global actions.
7
7
  #
8
- # All OpenHAB's actions including those provided by add-ons are available, notably:
8
+ # All openHAB's actions including those provided by add-ons are available, notably:
9
9
  # * Audio
10
10
  # * Voice
11
11
  # * Things
@@ -17,7 +17,7 @@ module OpenHAB
17
17
  # From add-ons, e.g.:
18
18
  # * Transformation
19
19
  # * PersistenceExtensions (see {Items::Persistence})
20
- # * NotificationAction (from [OpenHAB Cloud Connector](https://www.openhab.org/addons/integrations/openhabcloud/))
20
+ # * NotificationAction (from [openHAB Cloud Connector](https://www.openhab.org/addons/integrations/openhabcloud/))
21
21
  #
22
22
  # Global actions are available as "global" methods on {OpenHAB::DSL}, or
23
23
  # explicitly from this {Actions} module, or you can explicitly reference a
@@ -39,7 +39,7 @@ module OpenHAB
39
39
  #
40
40
  # play_stream 'example.com'
41
41
  #
42
- # @example Send a broadcast notification via the OpenHAB Cloud
42
+ # @example Send a broadcast notification via the openHAB Cloud
43
43
  # rule 'Send an alert' do
44
44
  # changed Alarm_Triggered, to: ON
45
45
  # run { notify 'Red Alert!' }
@@ -66,10 +66,22 @@ module OpenHAB
66
66
  #
67
67
  module Actions
68
68
  OSGi.services("org.openhab.core.model.script.engine.action.ActionService")&.each do |service|
69
- klass = (java_import service.action_class.ruby_class).first
70
- logger.trace("Loaded ACTION: #{service.action_class}")
71
- Object.const_set(service.action_class.simple_name, klass)
69
+ action_class = service.action_class
70
+ module_name = action_class.simple_name
71
+ action = if action_class.interface?
72
+ impl = OSGi.service(action_class)
73
+ unless impl
74
+ logger.error("Unable to find an implementation object for action service #{action_class}.")
75
+ next
76
+ end
77
+ const_set(module_name, impl)
78
+ else
79
+ (java_import action_class.ruby_class).first
80
+ end
81
+ logger.trace("Loaded ACTION: #{action_class}")
82
+ Object.const_set(module_name, action)
72
83
  end
84
+
73
85
  # Import common actions
74
86
  %w[Exec HTTP Ping].each do |action|
75
87
  klass = (java_import "org.openhab.core.model.script.actions.#{action}").first
@@ -90,7 +102,7 @@ module OpenHAB
90
102
  #
91
103
  def notify(msg, email: nil, icon: nil, severity: nil)
92
104
  unless Actions.const_defined?(:NotificationAction)
93
- raise NoMethodError, "NotificationAction is not available. Please install the OpenHAB cloud addon"
105
+ raise NoMethodError, "NotificationAction is not available. Please install the openHAB cloud addon"
94
106
  end
95
107
 
96
108
  if email
@@ -101,7 +113,7 @@ module OpenHAB
101
113
  end
102
114
 
103
115
  #
104
- # Say text via OpenHAB Text-To-Speech service, Voice.say()
116
+ # Say text via openHAB Text-To-Speech service, Voice.say()
105
117
  #
106
118
  # @param text [String] The text to say
107
119
  # @param voice [String] Specify a particular voice to use
@@ -116,7 +128,7 @@ module OpenHAB
116
128
  end
117
129
 
118
130
  #
119
- # Play an audio file via OpenHAB sound service, Audio.playSound()
131
+ # Play an audio file via openHAB sound service, Audio.playSound()
120
132
  #
121
133
  # @param filename [String] The sound file to play
122
134
  # @param sink [String] Specify a particular sink to output the speech
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ if defined?($dependencyListener)
4
+ require "jruby"
5
+
6
+ klass = Class.new(org.jruby.util.collections.StringArraySet) do
7
+ def initialize(other)
8
+ super(JRuby.runtime)
9
+ other.each { |feature| append(feature) }
10
+ end
11
+
12
+ def append(name)
13
+ $dependencyListener.accept(name)
14
+
15
+ super
16
+ end
17
+ end
18
+
19
+ JRuby.runtime.load_service.class.field_accessor :loadedFeatures
20
+ JRuby.runtime.load_service.loadedFeatures = klass.new(JRuby.runtime.load_service.loadedFeatures)
21
+
22
+ loaded_specs = Gem.loaded_specs
23
+ loaded_specs.each_key do |gem|
24
+ $dependencyListener.accept("gem:#{gem}")
25
+ end
26
+
27
+ def loaded_specs.[]=(gem, _spec)
28
+ super
29
+
30
+ $dependencyListener.accept("gem:#{gem}")
31
+ end
32
+ else
33
+ logger.warn("Dependency listener not found; dependency tracking disabled.")
34
+ end
@@ -1,11 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "ruby2_keywords"
4
+
3
5
  module OpenHAB
4
6
  module Core
5
7
  #
6
- # Manages access to OpenHAB entities
8
+ # Manages access to openHAB entities
7
9
  #
8
- # You can access OpenHAB items and things directly using their name, anywhere `EntityLookup` is available.
10
+ # You can access openHAB items and things directly using their name, anywhere `EntityLookup` is available.
9
11
  #
10
12
  # @note Thing UIDs are separated by a colon `:`. Since it is not a valid symbol for an identifier,
11
13
  # it must be replaced with an underscore `_`. So to access `astro:sun:home`, use `astro_sun_home`
@@ -16,7 +18,7 @@ module OpenHAB
16
18
  #
17
19
  # @example Accessing Items and Groups
18
20
  # gAll_Lights # Access the gAll_Lights group. It is the same as items["gAll_Lights"]
19
- # Kitchen_Light.on # The OpenHAB object for the Kitchen_Light item and send an ON command
21
+ # Kitchen_Light.on # The openHAB object for the Kitchen_Light item and send an ON command
20
22
  #
21
23
  # @example Accessing Things
22
24
  # smtp_mail_local.send_mail('me@example.com', 'Subject', 'Dear Person, ...')
@@ -24,110 +26,162 @@ module OpenHAB
24
26
  # things['smtp:mail:local'].send_mail('me@example.com', 'Subject', 'Dear Person, ...')
25
27
  #
26
28
  module EntityLookup
27
- #
28
- # Automatically looks up OpenHAB items and things in appropriate registries
29
- #
30
- # @return [GenericItem, Things::Thing, nil]
31
- #
32
- def method_missing(method, *args, &block)
33
- logger.trace("method missing, performing OpenHab Lookup for: #{method}")
34
- EntityLookup.lookup_entity(method) || super
35
- end
36
-
37
29
  # @!visibility private
38
- def respond_to_missing?(method_name, _include_private = false)
39
- logger.trace("Checking if OpenHAB entities exist for #{method_name}")
40
- method_name = method_name.to_s if method_name.is_a?(Symbol)
30
+ module ClassMethods
31
+ # @!attribute [w] create_dummy_items
32
+ # @return [true,false]
33
+ def create_dummy_items=(value)
34
+ @create_dummy_items = value
35
+ end
36
+
37
+ # @return [Boolean] if dummy items should be created in this context
38
+ def create_dummy_items?
39
+ @create_dummy_items
40
+ end
41
+
42
+ # @!visibility private
43
+ def inherited(klass)
44
+ super
45
+
46
+ EntityLookup.included(klass)
47
+ end
41
48
 
42
- method_name == "scriptLoaded" ||
43
- method_name == "scriptUnloaded" ||
44
- EntityLookup.lookup_entity(method_name) ||
49
+ # @!visibility private
50
+ def included(klass)
45
51
  super
52
+
53
+ EntityLookup.included(klass)
54
+ end
46
55
  end
47
56
 
48
- #
49
- # Looks up an OpenHAB entity
50
- # items are checked first, then things
51
- #
52
57
  # @!visibility private
53
- #
54
- # @param [String] name of entity to lookup in item or thing registry
55
- #
56
- # @return [GenericItem, Things::Thing, nil]
57
- #
58
- def self.lookup_entity(name)
59
- lookup_item(name) || lookup_thing_const(name)
58
+ def self.included(klass)
59
+ klass.singleton_class.prepend(ClassMethods)
60
+ klass.ancestors.each do |ancestor|
61
+ next unless ancestor.singleton_class.ancestors.include?(ClassMethods)
62
+ next if ancestor.create_dummy_items?.nil?
63
+
64
+ klass.create_dummy_items = ancestor.create_dummy_items?
65
+ break
66
+ end
60
67
  end
61
68
 
62
69
  #
63
- # Looks up a Thing in the OpenHAB registry
64
- #
65
- # @!visibility private
66
- #
67
- # @param [String] uid name of Thing to lookup in Thing registry
70
+ # Automatically looks up openHAB items and things in appropriate registries
68
71
  #
69
- # @return [Things::Thing, nil]
72
+ # @return [Item, Things::Thing, nil]
70
73
  #
71
- def self.lookup_thing(uid)
72
- logger.trace("Looking up thing '#{uid}'")
73
- uid = uid.to_s if uid.is_a?(Symbol)
74
+ ruby2_keywords def method_missing(method, *args)
75
+ return super unless args.empty? && !block_given?
74
76
 
75
- uid = Things::ThingUID.new(uid) unless uid.is_a?(Things::ThingUID)
76
- thing = $things.get(uid)
77
- return unless thing
77
+ logger.trace("method missing, performing openHAB Lookup for: #{method}")
78
+ EntityLookup.lookup_entity(method,
79
+ create_dummy_items: self.class.respond_to?(:create_dummy_items?) &&
80
+ self.class.create_dummy_items?) || super
81
+ end
78
82
 
79
- logger.trace("Retrieved Thing(#{thing}) from registry for uid: #{uid}")
80
- Things::Proxy.new(thing)
83
+ # @!visibility private
84
+ def respond_to_missing?(method, *)
85
+ logger.trace("Checking if openHAB entities exist for #{method}")
86
+ EntityLookup.lookup_entity(method) || super
81
87
  end
82
88
 
83
- #
84
- # Looks up a Thing in the OpenHAB registry replacing `_` with `:`
85
- #
86
89
  # @!visibility private
87
- #
88
- # @param [String] name of Thing to lookup in Thing registry
89
- #
90
- # @return [Things::Thing, nil]
91
- #
92
- def self.lookup_thing_const(name)
93
- name = name.to_s if name.is_a?(Symbol)
90
+ def instance_eval_with_dummy_items(&block)
91
+ DSL::ThreadLocal.thread_local(openhab_create_dummy_items: self.class.create_dummy_items?) do
92
+ instance_eval(&block)
93
+ end
94
+ end
95
+
96
+ class << self
97
+ #
98
+ # Looks up an openHAB entity
99
+ # items are checked first, then things
100
+ #
101
+ # @!visibility private
102
+ #
103
+ # @param [String] name of entity to lookup in item or thing registry
104
+ # @param [true, false] create_dummy_items If a dummy {Item} should be created if an actual item can't be found
105
+ #
106
+ # @return [Item, Things::Thing, nil]
107
+ #
108
+ def lookup_entity(name, create_dummy_items: false)
109
+ # make sure we have a nil return
110
+ create_dummy_items = nil if create_dummy_items == false
111
+ lookup_item(name) || lookup_thing_const(name) || (create_dummy_items && Items::Proxy.new(name.to_sym))
112
+ end
113
+
114
+ #
115
+ # Looks up a Thing in the openHAB registry
116
+ #
117
+ # @!visibility private
118
+ #
119
+ # @param [String] uid name of Thing to lookup in Thing registry
120
+ #
121
+ # @return [Things::Thing, nil]
122
+ #
123
+ def lookup_thing(uid)
124
+ logger.trace("Looking up thing '#{uid}'")
125
+ uid = uid.to_s if uid.is_a?(Symbol)
94
126
 
95
- if name.is_a?(String)
96
- # Thing UIDs have at least 3 segments, separated by `_`
97
- return if name.count("_") < 2
127
+ uid = Things::ThingUID.new(uid) unless uid.is_a?(Things::ThingUID)
128
+ thing = $things.get(uid)
129
+ return unless thing
98
130
 
99
- # Convert from _ syntax to :
100
- name = name.tr("_", ":")
131
+ logger.trace("Retrieved Thing(#{thing}) from registry for uid: #{uid}")
132
+ Things::Proxy.new(thing)
101
133
  end
102
- lookup_thing(name)
103
- end
104
134
 
105
- #
106
- # Lookup OpenHAB items in item registry
107
- #
108
- # @!visibility private
109
- #
110
- # @param [String] name of item to lookup
111
- #
112
- # @return [GenericItem, nil]
113
- #
114
- def self.lookup_item(name)
115
- logger.trace("Looking up item '#{name}'")
116
- name = name.to_s if name.is_a?(Symbol)
117
- item = $ir.get(name)
118
- Items::Proxy.new(item) unless item.nil?
135
+ #
136
+ # Looks up a Thing in the openHAB registry replacing `_` with `:`
137
+ #
138
+ # @!visibility private
139
+ #
140
+ # @param [String] name of Thing to lookup in Thing registry
141
+ #
142
+ # @return [Things::Thing, nil]
143
+ #
144
+ def lookup_thing_const(name)
145
+ name = name.to_s if name.is_a?(Symbol)
146
+
147
+ if name.is_a?(String)
148
+ # Thing UIDs have at least 3 segments, separated by `_`
149
+ return if name.count("_") < 2
150
+
151
+ # Convert from _ syntax to :
152
+ name = name.tr("_", ":")
153
+ end
154
+ lookup_thing(name)
155
+ end
156
+
157
+ #
158
+ # Lookup openHAB items in item registry
159
+ #
160
+ # @!visibility private
161
+ #
162
+ # @param [String] name of item to lookup
163
+ #
164
+ # @return [Item, nil]
165
+ #
166
+ def lookup_item(name)
167
+ logger.trace("Looking up item '#{name}'")
168
+ name = name.to_s if name.is_a?(Symbol)
169
+ item = $ir.get(name)
170
+ Items::Proxy.new(item) unless item.nil?
171
+ end
119
172
  end
120
173
  end
121
174
  end
122
175
  end
123
176
 
124
177
  #
125
- # Implements const_missing to return OpenHAB items or things if mapping to missing name if they exist
178
+ # Implements const_missing to return openHAB items or things if mapping to missing name if they exist
126
179
  #
127
180
  # @param [String] name Capital string that was not set as a constant and to be looked up
128
181
  #
129
- # @return [Object] OpenHAB Item or Thing if their name exist in OpenHAB item and thing regestries
182
+ # @return [Object] openHAB Item or Thing if their name exist in openHAB item and thing regestries
130
183
  #
131
184
  def Object.const_missing(name)
132
- OpenHAB::Core::EntityLookup.lookup_entity(name) || super
185
+ OpenHAB::Core::EntityLookup.lookup_entity(name,
186
+ create_dummy_items: Thread.current[:openhab_create_dummy_items]) || super
133
187
  end
@@ -7,7 +7,7 @@ module OpenHAB
7
7
 
8
8
  # Strictly speaking this class isn't an event, but it's accessed from an AbstractItemChannelLinkEvent
9
9
 
10
- # Adds methods to core OpenHAB ItemChannelLinkDTO to make it more natural in Ruby
10
+ # Adds methods to core openHAB ItemChannelLinkDTO to make it more natural in Ruby
11
11
  class ItemChannelLinkDTO
12
12
  #
13
13
  # @!attribute [r] item_name
@@ -17,7 +17,7 @@ module OpenHAB
17
17
 
18
18
  #
19
19
  # @!attribute [r] item
20
- # @return [GenericItem] The item that was linked or unlinked
20
+ # @return [Item] The item that was linked or unlinked
21
21
  #
22
22
  def item
23
23
  EntityLookup.lookup_item(itemName)
@@ -7,7 +7,7 @@ module OpenHAB
7
7
  module Events
8
8
  java_import org.openhab.core.items.events.ItemCommandEvent
9
9
 
10
- # Adds methods to core OpenHAB ItemCommandEvent to make it more natural in Ruby
10
+ # Adds methods to core openHAB ItemCommandEvent to make it more natural in Ruby
11
11
  class ItemCommandEvent < ItemEvent
12
12
  # @!attribute [r] command
13
13
  # @return [Type] The command sent to the item.
@@ -6,12 +6,12 @@ module OpenHAB
6
6
  java_import org.openhab.core.items.events.ItemEvent
7
7
 
8
8
  #
9
- # Adds methods to core OpenHAB ItemEvent to make it more natural in Ruby
9
+ # Adds methods to core openHAB ItemEvent to make it more natural in Ruby
10
10
  #
11
11
  class ItemEvent < AbstractEvent
12
12
  #
13
13
  # @!attribute [r] item
14
- # @return [GenericItem] The item that triggered this event.
14
+ # @return [Item] The item that triggered this event.
15
15
  #
16
16
  def item
17
17
  EntityLookup.lookup_item(item_name)
@@ -8,7 +8,7 @@ module OpenHAB
8
8
  java_import org.openhab.core.items.events.ItemStateChangedEvent
9
9
 
10
10
  #
11
- # Adds methods to core OpenHAB ItemStateChangedEvent to make it more natural in Ruby
11
+ # Adds methods to core openHAB ItemStateChangedEvent to make it more natural in Ruby
12
12
  #
13
13
  class ItemStateChangedEvent < ItemEvent
14
14
  include ItemState
@@ -7,7 +7,7 @@ module OpenHAB
7
7
 
8
8
  # Strictly speaking this class isn't an event, but it's accessed from an AbstractThingRegistryEvent
9
9
 
10
- # Adds methods to core OpenHAB AbstractThingDTO to make it more natural in Ruby
10
+ # Adds methods to core openHAB AbstractThingDTO to make it more natural in Ruby
11
11
  class AbstractThingDTO
12
12
  # @!method uid
13
13
  # The thing's UID
@@ -13,12 +13,12 @@ module OpenHAB
13
13
  end
14
14
 
15
15
  module AcceptedDataTypes
16
- # @see GenericItem#accepted_command_types
16
+ # @see Item#accepted_command_types
17
17
  def accepted_command_types
18
18
  super.map { |k| k.is_a?(java.lang.Class) ? k.ruby_class : k }
19
19
  end
20
20
 
21
- # @see GenericItem#accepted_data_types
21
+ # @see Item#accepted_data_types
22
22
  def accepted_data_types
23
23
  super.map { |k| k.is_a?(java.lang.Class) ? k.ruby_class : k }
24
24
  end
@@ -18,7 +18,7 @@ module OpenHAB
18
18
  #
19
19
  # @example
20
20
  # rule 'Log state of all doors on system startup' do
21
- # on_start
21
+ # on_load
22
22
  # run do
23
23
  # Doors.each do |door|
24
24
  # case door.state
@@ -48,7 +48,7 @@ module OpenHAB
48
48
  #
49
49
  # @example
50
50
  # rule 'Dim a switch on system startup over 100 seconds' do
51
- # on_start
51
+ # on_load
52
52
  # 100.times do
53
53
  # run { DimmerSwitch.dim }
54
54
  # delay 1.second
@@ -57,7 +57,7 @@ module OpenHAB
57
57
  #
58
58
  # @example
59
59
  # rule 'Dim a switch on system startup by 5, pausing every second' do
60
- # on_start
60
+ # on_load
61
61
  # 100.step(-5, 0) do |level|
62
62
  # run { DimmerSwitch << level }
63
63
  # delay 1.second