openhab-scripting 2.16.2 → 2.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/lib/openhab.rb +12 -16
  3. data/lib/openhab/core/entity_lookup.rb +173 -0
  4. data/lib/openhab/core/openhab_setup.rb +31 -0
  5. data/lib/openhab/core/osgi.rb +61 -0
  6. data/lib/openhab/dsl/actions.rb +105 -0
  7. data/lib/openhab/dsl/dsl.rb +49 -0
  8. data/lib/openhab/{core/dsl → dsl}/gems.rb +0 -1
  9. data/lib/openhab/dsl/group.rb +100 -0
  10. data/lib/openhab/dsl/items/datetime_item.rb +97 -0
  11. data/lib/openhab/dsl/items/items.rb +46 -0
  12. data/lib/openhab/dsl/items/number_item.rb +352 -0
  13. data/lib/openhab/dsl/items/rollershutter_item.rb +179 -0
  14. data/lib/openhab/dsl/items/string_item.rb +120 -0
  15. data/lib/openhab/dsl/monkey_patch/actions/actions.rb +4 -0
  16. data/lib/openhab/dsl/monkey_patch/actions/script_thing_actions.rb +32 -0
  17. data/lib/openhab/dsl/monkey_patch/events/events.rb +5 -0
  18. data/lib/openhab/dsl/monkey_patch/events/item_command.rb +23 -0
  19. data/lib/openhab/dsl/monkey_patch/events/item_state_changed.rb +35 -0
  20. data/lib/openhab/dsl/monkey_patch/events/thing_status_info.rb +33 -0
  21. data/lib/openhab/dsl/monkey_patch/items/contact_item.rb +61 -0
  22. data/lib/openhab/dsl/monkey_patch/items/dimmer_item.rb +193 -0
  23. data/lib/openhab/dsl/monkey_patch/items/group_item.rb +37 -0
  24. data/lib/openhab/dsl/monkey_patch/items/items.rb +133 -0
  25. data/lib/openhab/dsl/monkey_patch/items/metadata.rb +281 -0
  26. data/lib/openhab/dsl/monkey_patch/items/persistence.rb +70 -0
  27. data/lib/openhab/dsl/monkey_patch/items/switch_item.rb +95 -0
  28. data/lib/openhab/dsl/monkey_patch/ruby/number.rb +39 -0
  29. data/lib/openhab/dsl/monkey_patch/ruby/range.rb +47 -0
  30. data/lib/openhab/dsl/monkey_patch/ruby/ruby.rb +8 -0
  31. data/lib/openhab/dsl/monkey_patch/ruby/string.rb +41 -0
  32. data/lib/openhab/dsl/monkey_patch/ruby/time.rb +32 -0
  33. data/lib/openhab/dsl/monkey_patch/types/decimal_type.rb +70 -0
  34. data/lib/openhab/dsl/monkey_patch/types/on_off_type.rb +51 -0
  35. data/lib/openhab/dsl/monkey_patch/types/open_closed_type.rb +36 -0
  36. data/lib/openhab/dsl/monkey_patch/types/percent_type.rb +32 -0
  37. data/lib/openhab/dsl/monkey_patch/types/quantity_type.rb +69 -0
  38. data/lib/openhab/dsl/monkey_patch/types/types.rb +9 -0
  39. data/lib/openhab/dsl/monkey_patch/types/up_down_type.rb +33 -0
  40. data/lib/openhab/dsl/persistence.rb +25 -0
  41. data/lib/openhab/dsl/rules/automation_rule.rb +342 -0
  42. data/lib/openhab/dsl/rules/guard.rb +134 -0
  43. data/lib/openhab/dsl/rules/property.rb +102 -0
  44. data/lib/openhab/dsl/rules/rule.rb +116 -0
  45. data/lib/openhab/dsl/rules/rule_config.rb +151 -0
  46. data/lib/openhab/dsl/rules/triggers/changed.rb +143 -0
  47. data/lib/openhab/dsl/rules/triggers/channel.rb +53 -0
  48. data/lib/openhab/dsl/rules/triggers/command.rb +104 -0
  49. data/lib/openhab/dsl/rules/triggers/cron.rb +177 -0
  50. data/lib/openhab/dsl/rules/triggers/trigger.rb +124 -0
  51. data/lib/openhab/dsl/rules/triggers/updated.rb +98 -0
  52. data/lib/openhab/dsl/states.rb +61 -0
  53. data/lib/openhab/dsl/things.rb +91 -0
  54. data/lib/openhab/dsl/time_of_day.rb +232 -0
  55. data/lib/openhab/dsl/timers.rb +77 -0
  56. data/lib/openhab/dsl/types/datetime.rb +326 -0
  57. data/lib/openhab/dsl/types/quantity.rb +290 -0
  58. data/lib/openhab/dsl/units.rb +39 -0
  59. data/lib/openhab/log/configuration.rb +21 -0
  60. data/lib/openhab/log/logger.rb +172 -0
  61. data/lib/openhab/version.rb +1 -1
  62. metadata +60 -58
  63. data/lib/openhab/configuration.rb +0 -16
  64. data/lib/openhab/core/cron.rb +0 -27
  65. data/lib/openhab/core/debug.rb +0 -34
  66. data/lib/openhab/core/dsl.rb +0 -51
  67. data/lib/openhab/core/dsl/actions.rb +0 -107
  68. data/lib/openhab/core/dsl/entities.rb +0 -147
  69. data/lib/openhab/core/dsl/group.rb +0 -102
  70. data/lib/openhab/core/dsl/items/items.rb +0 -51
  71. data/lib/openhab/core/dsl/items/number_item.rb +0 -323
  72. data/lib/openhab/core/dsl/items/string_item.rb +0 -122
  73. data/lib/openhab/core/dsl/monkey_patch/actions/actions.rb +0 -4
  74. data/lib/openhab/core/dsl/monkey_patch/actions/script_thing_actions.rb +0 -22
  75. data/lib/openhab/core/dsl/monkey_patch/events.rb +0 -5
  76. data/lib/openhab/core/dsl/monkey_patch/events/item_command.rb +0 -13
  77. data/lib/openhab/core/dsl/monkey_patch/events/item_state_changed.rb +0 -25
  78. data/lib/openhab/core/dsl/monkey_patch/events/thing_status_info.rb +0 -26
  79. data/lib/openhab/core/dsl/monkey_patch/items/contact_item.rb +0 -54
  80. data/lib/openhab/core/dsl/monkey_patch/items/dimmer_item.rb +0 -182
  81. data/lib/openhab/core/dsl/monkey_patch/items/group_item.rb +0 -27
  82. data/lib/openhab/core/dsl/monkey_patch/items/items.rb +0 -132
  83. data/lib/openhab/core/dsl/monkey_patch/items/metadata.rb +0 -283
  84. data/lib/openhab/core/dsl/monkey_patch/items/persistence.rb +0 -72
  85. data/lib/openhab/core/dsl/monkey_patch/items/switch_item.rb +0 -87
  86. data/lib/openhab/core/dsl/monkey_patch/ruby/number.rb +0 -41
  87. data/lib/openhab/core/dsl/monkey_patch/ruby/range.rb +0 -47
  88. data/lib/openhab/core/dsl/monkey_patch/ruby/ruby.rb +0 -7
  89. data/lib/openhab/core/dsl/monkey_patch/ruby/string.rb +0 -43
  90. data/lib/openhab/core/dsl/monkey_patch/types/decimal_type.rb +0 -60
  91. data/lib/openhab/core/dsl/monkey_patch/types/on_off_type.rb +0 -41
  92. data/lib/openhab/core/dsl/monkey_patch/types/open_closed_type.rb +0 -25
  93. data/lib/openhab/core/dsl/monkey_patch/types/percent_type.rb +0 -23
  94. data/lib/openhab/core/dsl/monkey_patch/types/quantity_type.rb +0 -58
  95. data/lib/openhab/core/dsl/monkey_patch/types/types.rb +0 -8
  96. data/lib/openhab/core/dsl/persistence.rb +0 -27
  97. data/lib/openhab/core/dsl/property.rb +0 -96
  98. data/lib/openhab/core/dsl/rule/automation_rule.rb +0 -345
  99. data/lib/openhab/core/dsl/rule/guard.rb +0 -136
  100. data/lib/openhab/core/dsl/rule/rule.rb +0 -117
  101. data/lib/openhab/core/dsl/rule/rule_config.rb +0 -153
  102. data/lib/openhab/core/dsl/rule/triggers/changed.rb +0 -145
  103. data/lib/openhab/core/dsl/rule/triggers/channel.rb +0 -55
  104. data/lib/openhab/core/dsl/rule/triggers/command.rb +0 -106
  105. data/lib/openhab/core/dsl/rule/triggers/cron.rb +0 -160
  106. data/lib/openhab/core/dsl/rule/triggers/trigger.rb +0 -126
  107. data/lib/openhab/core/dsl/rule/triggers/updated.rb +0 -100
  108. data/lib/openhab/core/dsl/states.rb +0 -63
  109. data/lib/openhab/core/dsl/things.rb +0 -93
  110. data/lib/openhab/core/dsl/time_of_day.rb +0 -231
  111. data/lib/openhab/core/dsl/timers.rb +0 -79
  112. data/lib/openhab/core/dsl/types/quantity.rb +0 -292
  113. data/lib/openhab/core/dsl/units.rb +0 -41
  114. data/lib/openhab/core/log.rb +0 -170
  115. data/lib/openhab/core/patch_load_path.rb +0 -7
  116. data/lib/openhab/core/startup_delay.rb +0 -23
  117. data/lib/openhab/osgi.rb +0 -59
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'java'
4
+
5
+ # Import Imperial and SI Units overriding provided values
6
+ %i[Units ImperialUnits SIUnits].each do |type|
7
+ Object.send(:remove_const, type)
8
+ java_import "org.openhab.core.library.unit.#{type}"
9
+ end
10
+
11
+ Object.send(:remove_const, :QuantityType)
12
+ java_import org.openhab.core.library.types.QuantityType
13
+
14
+ module OpenHAB
15
+ module DSL
16
+ #
17
+ # Provides support for interacting with OpenHAB Units of Measurement
18
+ #
19
+ module Units
20
+ java_import 'tec.uom.se.format.SimpleUnitFormat'
21
+
22
+ #
23
+ # Sets a thread local variable to the supplied unit such that classes operating inside the block
24
+ # can perform automatic conversions to the supplied unit for NumberItems
25
+ #
26
+ # @param [Object] unit OpenHAB Unit or String representing unit
27
+ # @yield [] Block executed in context of the supplied unit
28
+ #
29
+ #
30
+ def unit(unit)
31
+ unit = SimpleUnitFormat.instance.unitFor(unit) if unit.is_a? String
32
+ Thread.current.thread_variable_set(:unit, unit)
33
+ yield
34
+ ensure
35
+ Thread.current.thread_variable_set(:unit, nil)
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenHAB
4
+ # Supports Logging
5
+ module Log
6
+ # This module holds global configuration values
7
+ module Configuration
8
+ # -*- coding: utf-8 -*-
9
+ LOG_PREFIX = 'jsr223.jruby'
10
+
11
+ #
12
+ # Gets the log prefix
13
+ #
14
+ # @return [String] Prefix for all log entries
15
+ #
16
+ def self.log_prefix
17
+ LOG_PREFIX
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,172 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'openhab/log/configuration'
4
+ require 'java'
5
+ require 'pp'
6
+
7
+ module OpenHAB
8
+ #
9
+ # Provides access to the OpenHAB logging using a Ruby logging methods
10
+ #
11
+ module Log
12
+ #
13
+ # Ruby Logger that forwards messages at appropriate levels to OpenHAB Logger
14
+ #
15
+ class Logger
16
+ java_import org.slf4j.LoggerFactory
17
+
18
+ # @return [Array] Supported logging levels
19
+ LEVELS = %i[TRACE DEBUG WARN INFO ERROR].freeze
20
+
21
+ #
22
+ # Create a new logger
23
+ #
24
+ # @param [String] name of the logger
25
+ #
26
+ def initialize(name)
27
+ @sl4fj_logger = LoggerFactory.getLogger(name)
28
+ end
29
+
30
+ # Dynamically define the methods for each level as identified by the levels constant
31
+ # This creates a method for each level that looks like this
32
+ # def <level>(msg=nil, &block)
33
+ # log(severity: <level>, msg: msg, &block)
34
+ # end
35
+ LEVELS.each do |level|
36
+ method = level.to_s.downcase
37
+ define_method(method.to_s) do |msg = nil, &block|
38
+ log(severity: level, msg: msg, &block)
39
+ end
40
+ end
41
+
42
+ private
43
+
44
+ #
45
+ # Log a message to the OpenHAB Logger
46
+ #
47
+ # @param [Symbol] severity Severity to log message at
48
+ # @param [Object] msg to log, if no msg supplied and a block is provided,
49
+ # the msg is taken from the result of the block
50
+ #
51
+ def log(severity:, msg: nil)
52
+ severity = severity.to_sym
53
+
54
+ raise ArgumentError, "Unknown Severity #{severity}" unless LEVELS.include? severity
55
+
56
+ # Dynamically check enablement of underlying logger, this expands to "is_<level>_enabled"
57
+ return unless @sl4fj_logger.send("is_#{severity.to_s.downcase}_enabled")
58
+
59
+ # Process block if no message provided
60
+ msg = yield if msg.nil? && block_given?
61
+
62
+ msg = message_to_string(msg: msg)
63
+
64
+ # Dynamically invoke underlying logger, this expands to "<level>(message)"
65
+ @sl4fj_logger.send(severity.to_s.downcase, msg)
66
+ end
67
+
68
+ #
69
+ # Conver the supplied message object to a String
70
+ #
71
+ # @param [object] msg object to convert
72
+ #
73
+ # @return [String] Msg object as a string
74
+ #
75
+ def message_to_string(msg:)
76
+ case msg
77
+ when ::String
78
+ msg
79
+ when ::Exception
80
+ "#{msg.message} (#{msg.class})\n#{msg.backtrace&.join("\n")}"
81
+ else
82
+ msg.inspect
83
+ end
84
+ end
85
+ end
86
+
87
+ @loggers = {}
88
+
89
+ # Return a logger with the configured log prefix plus the calling scripts name
90
+
91
+ #
92
+ # Create a logger for the current class
93
+ #
94
+ # @return [Logger] for the current class
95
+ #
96
+ def logger
97
+ Log.logger(self.class.name)
98
+ end
99
+
100
+ class << self
101
+ #
102
+ # Injects a logger into the base class
103
+ #
104
+ # @param [String] name of the logger
105
+ #
106
+ # @return [Logger] for the supplied name
107
+ #
108
+ def logger(name)
109
+ name ||= self.class.name
110
+ @loggers[name] ||= Log.logger_for(name)
111
+ end
112
+
113
+ #
114
+ # Configure a logger for the supplied class name
115
+ #
116
+ # @param [String] classname to configure logger for
117
+ #
118
+ # @return [Logger] for the supplied classname
119
+ #
120
+ def logger_for(classname)
121
+ configure_logger_for(classname)
122
+ end
123
+
124
+ private
125
+
126
+ #
127
+ # Configure a logger for the supplied classname
128
+ #
129
+ # @param [String] classname to create logger for
130
+ #
131
+ # @return [Logger] Logger for the supplied classname
132
+ #
133
+ def configure_logger_for(classname)
134
+ log_prefix = Configuration.log_prefix
135
+ log_prefix += if classname
136
+ ".#{classname}"
137
+ else
138
+ ".#{log_caller}"
139
+ end
140
+ Logger.new(log_prefix)
141
+ end
142
+
143
+ #
144
+ # Figure out the log prefix
145
+ #
146
+ # @return [String] Prefix for log messages
147
+ #
148
+ def log_caller
149
+ caller_locations.map(&:path)
150
+ .grep_v(%r{openhab/core/})
151
+ .grep_v(/rubygems/)
152
+ .grep_v(%r{lib/ruby})
153
+ .first
154
+ .yield_self { |caller| File.basename(caller, '.*') }
155
+ end
156
+ end
157
+
158
+ #
159
+ # Add logger method to the object that includes this module
160
+ #
161
+ # @param [Object] base Object to add method to
162
+ #
163
+ #
164
+ def self.included(base)
165
+ class << base
166
+ def logger
167
+ Log.logger(self.class.name)
168
+ end
169
+ end
170
+ end
171
+ end
172
+ end
@@ -5,5 +5,5 @@
5
5
  #
6
6
  module OpenHAB
7
7
  # @return [String] Version of OpenHAB helper libraries
8
- VERSION = '2.16.2'
8
+ VERSION = '2.19.0'
9
9
  end
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.16.2
4
+ version: 2.19.0
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 00:00:00.000000000 Z
11
+ date: 2021-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -32,62 +32,64 @@ extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
34
  - lib/openhab.rb
35
- - lib/openhab/configuration.rb
36
- - lib/openhab/core/cron.rb
37
- - lib/openhab/core/debug.rb
38
- - lib/openhab/core/dsl.rb
39
- - lib/openhab/core/dsl/actions.rb
40
- - lib/openhab/core/dsl/entities.rb
41
- - lib/openhab/core/dsl/gems.rb
42
- - lib/openhab/core/dsl/group.rb
43
- - lib/openhab/core/dsl/items/items.rb
44
- - lib/openhab/core/dsl/items/number_item.rb
45
- - lib/openhab/core/dsl/items/string_item.rb
46
- - lib/openhab/core/dsl/monkey_patch/actions/actions.rb
47
- - lib/openhab/core/dsl/monkey_patch/actions/script_thing_actions.rb
48
- - lib/openhab/core/dsl/monkey_patch/events.rb
49
- - lib/openhab/core/dsl/monkey_patch/events/item_command.rb
50
- - lib/openhab/core/dsl/monkey_patch/events/item_state_changed.rb
51
- - lib/openhab/core/dsl/monkey_patch/events/thing_status_info.rb
52
- - lib/openhab/core/dsl/monkey_patch/items/contact_item.rb
53
- - lib/openhab/core/dsl/monkey_patch/items/dimmer_item.rb
54
- - lib/openhab/core/dsl/monkey_patch/items/group_item.rb
55
- - lib/openhab/core/dsl/monkey_patch/items/items.rb
56
- - lib/openhab/core/dsl/monkey_patch/items/metadata.rb
57
- - lib/openhab/core/dsl/monkey_patch/items/persistence.rb
58
- - lib/openhab/core/dsl/monkey_patch/items/switch_item.rb
59
- - lib/openhab/core/dsl/monkey_patch/ruby/number.rb
60
- - lib/openhab/core/dsl/monkey_patch/ruby/range.rb
61
- - lib/openhab/core/dsl/monkey_patch/ruby/ruby.rb
62
- - lib/openhab/core/dsl/monkey_patch/ruby/string.rb
63
- - lib/openhab/core/dsl/monkey_patch/types/decimal_type.rb
64
- - lib/openhab/core/dsl/monkey_patch/types/on_off_type.rb
65
- - lib/openhab/core/dsl/monkey_patch/types/open_closed_type.rb
66
- - lib/openhab/core/dsl/monkey_patch/types/percent_type.rb
67
- - lib/openhab/core/dsl/monkey_patch/types/quantity_type.rb
68
- - lib/openhab/core/dsl/monkey_patch/types/types.rb
69
- - lib/openhab/core/dsl/persistence.rb
70
- - lib/openhab/core/dsl/property.rb
71
- - lib/openhab/core/dsl/rule/automation_rule.rb
72
- - lib/openhab/core/dsl/rule/guard.rb
73
- - lib/openhab/core/dsl/rule/rule.rb
74
- - lib/openhab/core/dsl/rule/rule_config.rb
75
- - lib/openhab/core/dsl/rule/triggers/changed.rb
76
- - lib/openhab/core/dsl/rule/triggers/channel.rb
77
- - lib/openhab/core/dsl/rule/triggers/command.rb
78
- - lib/openhab/core/dsl/rule/triggers/cron.rb
79
- - lib/openhab/core/dsl/rule/triggers/trigger.rb
80
- - lib/openhab/core/dsl/rule/triggers/updated.rb
81
- - lib/openhab/core/dsl/states.rb
82
- - lib/openhab/core/dsl/things.rb
83
- - lib/openhab/core/dsl/time_of_day.rb
84
- - lib/openhab/core/dsl/timers.rb
85
- - lib/openhab/core/dsl/types/quantity.rb
86
- - lib/openhab/core/dsl/units.rb
87
- - lib/openhab/core/log.rb
88
- - lib/openhab/core/patch_load_path.rb
89
- - lib/openhab/core/startup_delay.rb
90
- - lib/openhab/osgi.rb
35
+ - lib/openhab/core/entity_lookup.rb
36
+ - lib/openhab/core/openhab_setup.rb
37
+ - lib/openhab/core/osgi.rb
38
+ - lib/openhab/dsl/actions.rb
39
+ - lib/openhab/dsl/dsl.rb
40
+ - lib/openhab/dsl/gems.rb
41
+ - lib/openhab/dsl/group.rb
42
+ - lib/openhab/dsl/items/datetime_item.rb
43
+ - lib/openhab/dsl/items/items.rb
44
+ - lib/openhab/dsl/items/number_item.rb
45
+ - lib/openhab/dsl/items/rollershutter_item.rb
46
+ - lib/openhab/dsl/items/string_item.rb
47
+ - lib/openhab/dsl/monkey_patch/actions/actions.rb
48
+ - lib/openhab/dsl/monkey_patch/actions/script_thing_actions.rb
49
+ - lib/openhab/dsl/monkey_patch/events/events.rb
50
+ - lib/openhab/dsl/monkey_patch/events/item_command.rb
51
+ - lib/openhab/dsl/monkey_patch/events/item_state_changed.rb
52
+ - lib/openhab/dsl/monkey_patch/events/thing_status_info.rb
53
+ - lib/openhab/dsl/monkey_patch/items/contact_item.rb
54
+ - lib/openhab/dsl/monkey_patch/items/dimmer_item.rb
55
+ - lib/openhab/dsl/monkey_patch/items/group_item.rb
56
+ - lib/openhab/dsl/monkey_patch/items/items.rb
57
+ - lib/openhab/dsl/monkey_patch/items/metadata.rb
58
+ - lib/openhab/dsl/monkey_patch/items/persistence.rb
59
+ - lib/openhab/dsl/monkey_patch/items/switch_item.rb
60
+ - lib/openhab/dsl/monkey_patch/ruby/number.rb
61
+ - lib/openhab/dsl/monkey_patch/ruby/range.rb
62
+ - lib/openhab/dsl/monkey_patch/ruby/ruby.rb
63
+ - lib/openhab/dsl/monkey_patch/ruby/string.rb
64
+ - lib/openhab/dsl/monkey_patch/ruby/time.rb
65
+ - lib/openhab/dsl/monkey_patch/types/decimal_type.rb
66
+ - lib/openhab/dsl/monkey_patch/types/on_off_type.rb
67
+ - lib/openhab/dsl/monkey_patch/types/open_closed_type.rb
68
+ - lib/openhab/dsl/monkey_patch/types/percent_type.rb
69
+ - lib/openhab/dsl/monkey_patch/types/quantity_type.rb
70
+ - lib/openhab/dsl/monkey_patch/types/types.rb
71
+ - lib/openhab/dsl/monkey_patch/types/up_down_type.rb
72
+ - lib/openhab/dsl/persistence.rb
73
+ - lib/openhab/dsl/rules/automation_rule.rb
74
+ - lib/openhab/dsl/rules/guard.rb
75
+ - lib/openhab/dsl/rules/property.rb
76
+ - lib/openhab/dsl/rules/rule.rb
77
+ - lib/openhab/dsl/rules/rule_config.rb
78
+ - lib/openhab/dsl/rules/triggers/changed.rb
79
+ - lib/openhab/dsl/rules/triggers/channel.rb
80
+ - lib/openhab/dsl/rules/triggers/command.rb
81
+ - lib/openhab/dsl/rules/triggers/cron.rb
82
+ - lib/openhab/dsl/rules/triggers/trigger.rb
83
+ - lib/openhab/dsl/rules/triggers/updated.rb
84
+ - lib/openhab/dsl/states.rb
85
+ - lib/openhab/dsl/things.rb
86
+ - lib/openhab/dsl/time_of_day.rb
87
+ - lib/openhab/dsl/timers.rb
88
+ - lib/openhab/dsl/types/datetime.rb
89
+ - lib/openhab/dsl/types/quantity.rb
90
+ - lib/openhab/dsl/units.rb
91
+ - lib/openhab/log/configuration.rb
92
+ - lib/openhab/log/logger.rb
91
93
  - lib/openhab/version.rb
92
94
  homepage: https://boc-tothefuture.github.io/openhab-jruby/
93
95
  licenses: []
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # This module holds global configuration values
4
- module Configuration
5
- # -*- coding: utf-8 -*-
6
- LOG_PREFIX = 'jsr223.jruby'
7
-
8
- #
9
- # Gets the log prefix
10
- #
11
- # @return [String] Prefix for all log entries
12
- #
13
- def self.log_prefix
14
- LOG_PREFIX
15
- end
16
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module OpenHAB
4
- module Core
5
- #
6
- # Module for Cron related methods
7
- #
8
- module Cron
9
- #
10
- # Retruns a default map for cron expressions that fires every second
11
- # This map is usually updated via merge by other methods to refine cron type triggers.
12
- #
13
- # @return [Map] Map with symbols for :seconds, :minute, :hour, :dom, :month, :dow configured to fire every second
14
- #
15
- def cron_expression_map
16
- {
17
- second: '*',
18
- minute: '*',
19
- hour: '*',
20
- dom: '?',
21
- month: '*',
22
- dow: '?'
23
- }
24
- end
25
- end
26
- end
27
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'pp'
4
- require 'core/log'
5
- require 'core/dsl/things'
6
-
7
- #
8
- # Module to support debugging information about the Ruby or OpenHAB environment
9
- #
10
- module Debug
11
- include Logging
12
- include OpenHAB::Core::DSL::Things
13
-
14
- #
15
- # Print the loadpath, instance and global variables
16
- #
17
- def debug_variables
18
- pp "Instance #{instance_variables}"
19
- pp "Global #{global_variables}"
20
- pp "Load Path #{$LOAD_PATH}"
21
- # pp "Constants #{Module.constants}"
22
- end
23
-
24
- #
25
- # Print information about the OpenHAB instance
26
- #
27
- def debug_openhab
28
- logger.debug { "Things - Count #{things.size}" }
29
- things.each do |thing|
30
- logger.debug { "Thing:(#{thing.label}) UID:(#{thing.uid}) Channels(#{thing.channels.map(&:uid).join(', ')})" }
31
- end
32
- # logger.debug { $things.getAll.join(", ") }
33
- end
34
- end