openhab-scripting 4.47.0 → 5.0.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/actions/audio.rb +47 -0
- data/lib/openhab/core/actions/ephemeris.rb +39 -0
- data/lib/openhab/core/actions/exec.rb +51 -0
- data/lib/openhab/core/actions/http.rb +80 -0
- data/lib/openhab/core/actions/ping.rb +30 -0
- data/lib/openhab/core/actions/transformation.rb +32 -0
- data/lib/openhab/core/actions/voice.rb +36 -0
- data/lib/openhab/core/actions.rb +82 -0
- data/lib/openhab/core/dependency_tracking.rb +34 -0
- data/lib/openhab/core/dto/item_channel_link.rb +33 -0
- data/lib/openhab/core/dto/thing.rb +27 -0
- data/lib/openhab/core/dto.rb +11 -0
- data/lib/openhab/core/entity_lookup.rb +152 -70
- data/lib/openhab/core/events/abstract_event.rb +18 -0
- data/lib/openhab/core/events/abstract_item_registry_event.rb +36 -0
- data/lib/openhab/core/events/abstract_thing_registry_event.rb +40 -0
- data/lib/openhab/core/events/item_command_event.rb +78 -0
- data/lib/openhab/core/events/item_event.rb +22 -0
- data/lib/openhab/core/events/item_state_changed_event.rb +75 -0
- data/lib/openhab/core/events/item_state_event.rb +79 -0
- data/lib/openhab/core/events/thing_status_info_event.rb +55 -0
- data/lib/openhab/core/events.rb +10 -0
- data/lib/openhab/core/items/accepted_data_types.rb +29 -0
- data/lib/openhab/core/items/color_item.rb +52 -0
- data/lib/openhab/core/items/contact_item.rb +52 -0
- data/lib/openhab/core/items/date_time_item.rb +59 -0
- data/lib/openhab/core/items/dimmer_item.rb +148 -0
- data/lib/openhab/core/items/generic_item.rb +292 -0
- data/lib/openhab/core/items/group_item.rb +176 -0
- data/lib/openhab/{dsl → core}/items/image_item.rb +35 -29
- data/lib/openhab/core/items/item.rb +273 -0
- data/lib/openhab/core/items/location_item.rb +34 -0
- data/lib/openhab/core/items/metadata/hash.rb +433 -0
- data/lib/openhab/core/items/metadata/namespace_hash.rb +475 -0
- data/lib/openhab/core/items/metadata/provider.rb +48 -0
- data/lib/openhab/core/items/metadata.rb +11 -0
- data/lib/openhab/core/items/number_item.rb +62 -0
- data/lib/openhab/core/items/numeric_item.rb +22 -0
- data/lib/openhab/core/items/persistence.rb +416 -0
- data/lib/openhab/core/items/player_item.rb +66 -0
- data/lib/openhab/core/items/provider.rb +44 -0
- data/lib/openhab/core/items/proxy.rb +136 -0
- data/lib/openhab/core/items/registry.rb +86 -0
- data/lib/openhab/core/items/rollershutter_item.rb +68 -0
- data/lib/openhab/core/items/semantics/enumerable.rb +177 -0
- data/lib/openhab/core/items/semantics.rb +473 -0
- data/lib/openhab/core/items/state_storage.rb +53 -0
- data/lib/openhab/core/items/string_item.rb +28 -0
- data/lib/openhab/core/items/switch_item.rb +78 -0
- data/lib/openhab/core/items.rb +108 -0
- data/lib/openhab/{dsl → core}/lazy_array.rb +9 -3
- data/lib/openhab/core/profile_factory.rb +132 -0
- data/lib/openhab/core/provider.rb +230 -0
- data/lib/openhab/core/proxy.rb +130 -0
- data/lib/openhab/core/registry.rb +40 -0
- data/lib/openhab/core/rules/module.rb +26 -0
- data/lib/openhab/core/rules/provider.rb +25 -0
- data/lib/openhab/core/rules/registry.rb +76 -0
- data/lib/openhab/core/rules/rule.rb +150 -0
- data/lib/openhab/core/rules.rb +25 -0
- data/lib/openhab/core/script_handling.rb +78 -20
- data/lib/openhab/core/things/channel.rb +48 -0
- data/lib/openhab/core/things/channel_uid.rb +51 -0
- data/lib/openhab/core/things/item_channel_link.rb +33 -0
- data/lib/openhab/core/things/links/provider.rb +78 -0
- data/lib/openhab/core/things/profile_callback.rb +52 -0
- data/lib/openhab/core/things/provider.rb +29 -0
- data/lib/openhab/core/things/proxy.rb +87 -0
- data/lib/openhab/core/things/registry.rb +73 -0
- data/lib/openhab/core/things/thing.rb +194 -0
- data/lib/openhab/core/things.rb +22 -0
- data/lib/openhab/core/timer.rb +148 -0
- data/lib/openhab/{dsl → core}/types/comparable_type.rb +5 -3
- data/lib/openhab/{dsl → core}/types/date_time_type.rb +55 -127
- data/lib/openhab/{dsl → core}/types/decimal_type.rb +50 -48
- data/lib/openhab/{dsl → core}/types/hsb_type.rb +35 -83
- data/lib/openhab/core/types/increase_decrease_type.rb +34 -0
- data/lib/openhab/core/types/next_previous_type.rb +34 -0
- data/lib/openhab/{dsl → core}/types/numeric_type.rb +20 -7
- data/lib/openhab/core/types/on_off_type.rb +46 -0
- data/lib/openhab/core/types/open_closed_type.rb +41 -0
- data/lib/openhab/{dsl → core}/types/percent_type.rb +19 -20
- data/lib/openhab/core/types/play_pause_type.rb +38 -0
- data/lib/openhab/core/types/point_type.rb +117 -0
- data/lib/openhab/core/types/quantity_type.rb +325 -0
- data/lib/openhab/core/types/raw_type.rb +26 -0
- data/lib/openhab/core/types/refresh_type.rb +27 -0
- data/lib/openhab/core/types/rewind_fastforward_type.rb +38 -0
- data/lib/openhab/core/types/stop_move_type.rb +34 -0
- data/lib/openhab/{dsl → core}/types/string_type.rb +17 -28
- data/lib/openhab/{dsl → core}/types/type.rb +42 -40
- data/lib/openhab/core/types/un_def_type.rb +38 -0
- data/lib/openhab/core/types/up_down_type.rb +50 -0
- data/lib/openhab/core/types.rb +82 -0
- data/lib/openhab/{dsl → core}/uid.rb +4 -23
- data/lib/openhab/core/value_cache.rb +188 -0
- data/lib/openhab/core.rb +98 -0
- data/lib/openhab/core_ext/between.rb +32 -0
- data/lib/openhab/core_ext/ephemeris.rb +53 -0
- data/lib/openhab/core_ext/java/class.rb +34 -0
- data/lib/openhab/core_ext/java/duration.rb +142 -0
- data/lib/openhab/core_ext/java/list.rb +436 -0
- data/lib/openhab/core_ext/java/local_date.rb +104 -0
- data/lib/openhab/core_ext/java/local_time.rb +118 -0
- data/lib/openhab/core_ext/java/map.rb +66 -0
- data/lib/openhab/core_ext/java/month.rb +71 -0
- data/lib/openhab/core_ext/java/month_day.rb +119 -0
- data/lib/openhab/core_ext/java/period.rb +103 -0
- data/lib/openhab/core_ext/java/temporal_amount.rb +34 -0
- data/lib/openhab/core_ext/java/time.rb +62 -0
- data/lib/openhab/core_ext/java/unit.rb +15 -0
- data/lib/openhab/core_ext/java/zoned_date_time.rb +213 -0
- data/lib/openhab/core_ext/ruby/array.rb +21 -0
- data/lib/openhab/core_ext/ruby/date.rb +96 -0
- data/lib/openhab/core_ext/ruby/date_time.rb +55 -0
- data/lib/openhab/core_ext/ruby/module.rb +15 -0
- data/lib/openhab/core_ext/ruby/numeric.rb +195 -0
- data/lib/openhab/core_ext/ruby/range.rb +70 -0
- data/lib/openhab/core_ext/ruby/symbol.rb +7 -0
- data/lib/openhab/core_ext/ruby/time.rb +108 -0
- data/lib/openhab/core_ext.rb +18 -0
- data/lib/openhab/dsl/debouncer.rb +259 -0
- data/lib/openhab/dsl/events/watch_event.rb +18 -0
- data/lib/openhab/dsl/events.rb +9 -0
- data/lib/openhab/dsl/gems.rb +1 -1
- data/lib/openhab/dsl/items/builder.rb +578 -0
- data/lib/openhab/dsl/items/ensure.rb +73 -82
- data/lib/openhab/dsl/items/timed_command.rb +214 -159
- data/lib/openhab/dsl/rules/automation_rule.rb +126 -115
- data/lib/openhab/dsl/rules/builder.rb +1935 -0
- data/lib/openhab/dsl/rules/guard.rb +51 -114
- data/lib/openhab/dsl/rules/name_inference.rb +66 -25
- data/lib/openhab/dsl/rules/property.rb +48 -75
- data/lib/openhab/dsl/rules/rule_triggers.rb +22 -27
- data/lib/openhab/dsl/rules/terse.rb +58 -14
- data/lib/openhab/dsl/rules/triggers/changed.rb +48 -94
- data/lib/openhab/dsl/rules/triggers/channel.rb +9 -40
- data/lib/openhab/dsl/rules/triggers/command.rb +14 -63
- data/lib/openhab/dsl/rules/triggers/conditions/duration.rb +34 -69
- data/lib/openhab/dsl/rules/triggers/conditions/proc.rb +6 -14
- data/lib/openhab/dsl/rules/triggers/cron/cron.rb +48 -82
- data/lib/openhab/dsl/rules/triggers/cron/cron_handler.rb +30 -47
- data/lib/openhab/dsl/rules/triggers/trigger.rb +7 -28
- data/lib/openhab/dsl/rules/triggers/updated.rb +21 -45
- data/lib/openhab/dsl/rules/triggers/watch/watch_handler.rb +257 -102
- data/lib/openhab/dsl/rules/triggers.rb +12 -0
- data/lib/openhab/dsl/rules.rb +8 -0
- data/lib/openhab/dsl/things/builder.rb +299 -0
- data/lib/openhab/{core → dsl}/thread_local.rb +27 -17
- data/lib/openhab/dsl/timer_manager.rb +204 -0
- data/lib/openhab/dsl/version.rb +9 -0
- data/lib/openhab/dsl.rb +979 -0
- data/lib/openhab/log.rb +355 -0
- data/lib/openhab/osgi.rb +68 -0
- data/lib/openhab/rspec/configuration.rb +56 -0
- data/lib/openhab/rspec/example_group.rb +132 -0
- data/lib/openhab/rspec/helpers.rb +458 -0
- data/lib/openhab/rspec/hooks.rb +113 -0
- data/lib/openhab/rspec/jruby.rb +46 -0
- data/lib/openhab/rspec/karaf.rb +851 -0
- data/lib/openhab/rspec/mocks/bundle_install_support.rb +25 -0
- data/lib/openhab/rspec/mocks/bundle_resolver.rb +30 -0
- data/lib/openhab/rspec/mocks/event_admin.rb +146 -0
- data/lib/openhab/rspec/mocks/instance_method_stasher.rb +22 -0
- data/lib/openhab/rspec/mocks/persistence_service.rb +155 -0
- data/lib/openhab/rspec/mocks/safe_caller.rb +40 -0
- data/lib/openhab/rspec/mocks/space.rb +23 -0
- data/lib/openhab/rspec/mocks/synchronous_executor.rb +63 -0
- data/lib/openhab/rspec/mocks/thing_handler.rb +76 -0
- data/lib/openhab/rspec/mocks/timer.rb +134 -0
- data/lib/openhab/rspec/openhab/core/actions.rb +38 -0
- data/lib/openhab/rspec/openhab/core/items/proxy.rb +15 -0
- data/lib/openhab/rspec/openhab/core/things/proxy.rb +27 -0
- data/lib/openhab/rspec/shell.rb +31 -0
- data/lib/openhab/rspec/suspend_rules.rb +50 -0
- data/lib/openhab/rspec.rb +26 -0
- data/lib/openhab/yard/base_helper.rb +19 -0
- data/lib/openhab/yard/cli/stats.rb +23 -0
- data/lib/openhab/yard/code_objects/group_object.rb +23 -0
- data/lib/openhab/yard/code_objects/java/base.rb +31 -0
- data/lib/openhab/yard/code_objects/java/class_object.rb +11 -0
- data/lib/openhab/yard/code_objects/java/field_object.rb +15 -0
- data/lib/openhab/yard/code_objects/java/interface_object.rb +15 -0
- data/lib/openhab/yard/code_objects/java/package_object.rb +11 -0
- data/lib/openhab/yard/code_objects/java/proxy.rb +23 -0
- data/lib/openhab/yard/coderay.rb +17 -0
- data/lib/openhab/yard/handlers/jruby/base.rb +58 -0
- data/lib/openhab/yard/handlers/jruby/class_handler.rb +18 -0
- data/lib/openhab/yard/handlers/jruby/constant_handler.rb +18 -0
- data/lib/openhab/yard/handlers/jruby/java_import_handler.rb +30 -0
- data/lib/openhab/yard/handlers/jruby/mixin_handler.rb +23 -0
- data/lib/openhab/yard/html_helper.rb +78 -0
- data/lib/openhab/yard/markdown_helper.rb +148 -0
- data/lib/openhab/yard/tags/constant_directive.rb +20 -0
- data/lib/openhab/yard/tags/group_directive.rb +24 -0
- data/lib/openhab/yard/tags/library.rb +3 -0
- data/lib/openhab/yard.rb +38 -0
- metadata +475 -106
- data/lib/openhab/core/item_proxy.rb +0 -29
- data/lib/openhab/core/load_path.rb +0 -19
- data/lib/openhab/core/openhab_setup.rb +0 -29
- data/lib/openhab/core/osgi.rb +0 -58
- data/lib/openhab/core/services.rb +0 -24
- data/lib/openhab/dsl/actions.rb +0 -114
- data/lib/openhab/dsl/between.rb +0 -25
- data/lib/openhab/dsl/channel.rb +0 -43
- data/lib/openhab/dsl/dsl.rb +0 -59
- data/lib/openhab/dsl/group.rb +0 -54
- data/lib/openhab/dsl/imports.rb +0 -21
- data/lib/openhab/dsl/items/color_item.rb +0 -76
- data/lib/openhab/dsl/items/comparable_item.rb +0 -62
- data/lib/openhab/dsl/items/contact_item.rb +0 -41
- data/lib/openhab/dsl/items/date_time_item.rb +0 -65
- data/lib/openhab/dsl/items/dimmer_item.rb +0 -65
- data/lib/openhab/dsl/items/generic_item.rb +0 -229
- data/lib/openhab/dsl/items/group_item.rb +0 -127
- data/lib/openhab/dsl/items/item_equality.rb +0 -59
- data/lib/openhab/dsl/items/item_registry.rb +0 -54
- data/lib/openhab/dsl/items/items.rb +0 -109
- data/lib/openhab/dsl/items/location_item.rb +0 -59
- data/lib/openhab/dsl/items/metadata.rb +0 -326
- data/lib/openhab/dsl/items/number_item.rb +0 -17
- data/lib/openhab/dsl/items/numeric_item.rb +0 -87
- data/lib/openhab/dsl/items/persistence.rb +0 -307
- data/lib/openhab/dsl/items/player_item.rb +0 -58
- data/lib/openhab/dsl/items/rollershutter_item.rb +0 -51
- data/lib/openhab/dsl/items/semantics/enumerable.rb +0 -91
- data/lib/openhab/dsl/items/semantics.rb +0 -227
- data/lib/openhab/dsl/items/string_item.rb +0 -51
- data/lib/openhab/dsl/items/switch_item.rb +0 -70
- data/lib/openhab/dsl/monkey_patch/actions/actions.rb +0 -4
- data/lib/openhab/dsl/monkey_patch/actions/script_thing_actions.rb +0 -39
- data/lib/openhab/dsl/monkey_patch/events/events.rb +0 -7
- data/lib/openhab/dsl/monkey_patch/events/item_command.rb +0 -85
- data/lib/openhab/dsl/monkey_patch/events/item_event.rb +0 -28
- data/lib/openhab/dsl/monkey_patch/events/item_state.rb +0 -61
- data/lib/openhab/dsl/monkey_patch/events/item_state_changed.rb +0 -60
- data/lib/openhab/dsl/monkey_patch/events/thing_status_info.rb +0 -33
- data/lib/openhab/dsl/monkey_patch/java/java.rb +0 -4
- data/lib/openhab/dsl/monkey_patch/java/local_time.rb +0 -44
- data/lib/openhab/dsl/monkey_patch/java/time_extensions.rb +0 -50
- data/lib/openhab/dsl/monkey_patch/java/zoned_date_time.rb +0 -45
- data/lib/openhab/dsl/monkey_patch/ruby/number.rb +0 -104
- data/lib/openhab/dsl/monkey_patch/ruby/ruby.rb +0 -6
- data/lib/openhab/dsl/monkey_patch/ruby/string.rb +0 -47
- data/lib/openhab/dsl/monkey_patch/ruby/time.rb +0 -61
- data/lib/openhab/dsl/openhab.rb +0 -30
- data/lib/openhab/dsl/persistence.rb +0 -27
- data/lib/openhab/dsl/rules/item_event.rb +0 -19
- data/lib/openhab/dsl/rules/rule.rb +0 -160
- data/lib/openhab/dsl/rules/rule_config.rb +0 -147
- data/lib/openhab/dsl/rules/triggers/generic.rb +0 -31
- data/lib/openhab/dsl/rules/triggers/triggers.rb +0 -11
- data/lib/openhab/dsl/rules/triggers/watch/watch.rb +0 -81
- data/lib/openhab/dsl/states.rb +0 -89
- data/lib/openhab/dsl/things.rb +0 -147
- data/lib/openhab/dsl/time/month_day.rb +0 -180
- data/lib/openhab/dsl/time/time_of_day.rb +0 -235
- data/lib/openhab/dsl/timers/manager.rb +0 -119
- data/lib/openhab/dsl/timers/reentrant_timer.rb +0 -38
- data/lib/openhab/dsl/timers/timer.rb +0 -132
- data/lib/openhab/dsl/timers.rb +0 -77
- data/lib/openhab/dsl/types/increase_decrease_type.rb +0 -23
- data/lib/openhab/dsl/types/next_previous_type.rb +0 -23
- data/lib/openhab/dsl/types/on_off_type.rb +0 -28
- data/lib/openhab/dsl/types/open_closed_type.rb +0 -29
- data/lib/openhab/dsl/types/play_pause_type.rb +0 -27
- data/lib/openhab/dsl/types/point_type.rb +0 -180
- data/lib/openhab/dsl/types/quantity_type.rb +0 -265
- data/lib/openhab/dsl/types/refresh_type.rb +0 -18
- data/lib/openhab/dsl/types/rewind_fastforward_type.rb +0 -33
- data/lib/openhab/dsl/types/stop_move_type.rb +0 -23
- data/lib/openhab/dsl/types/types.rb +0 -83
- data/lib/openhab/dsl/types/un_def_type.rb +0 -22
- data/lib/openhab/dsl/types/up_down_type.rb +0 -32
- data/lib/openhab/dsl/units.rb +0 -45
- data/lib/openhab/log/configuration.rb +0 -21
- data/lib/openhab/log/logger.rb +0 -282
- data/lib/openhab/version.rb +0 -9
- data/lib/openhab.rb +0 -38
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'openhab/log/logger'
|
4
|
-
require 'openhab/core/services'
|
5
|
-
|
6
|
-
module OpenHAB
|
7
|
-
#
|
8
|
-
# Core support for OpenHAB JRuby Library
|
9
|
-
#
|
10
|
-
module Core
|
11
|
-
include OpenHAB::Log
|
12
|
-
|
13
|
-
# @return [Integer] Number of seconds to wait between checks for automation manager
|
14
|
-
CHECK_DELAY = 10
|
15
|
-
private_constant :CHECK_DELAY
|
16
|
-
|
17
|
-
#
|
18
|
-
# Wait until OpenHAB engine ready to process
|
19
|
-
#
|
20
|
-
def self.wait_till_openhab_ready
|
21
|
-
logger.trace('Checking readiness of OpenHAB')
|
22
|
-
until OpenHAB::Core.automation_manager
|
23
|
-
logger.trace("Automation manager not loaded, checking again in #{CHECK_DELAY} seconds.")
|
24
|
-
sleep CHECK_DELAY
|
25
|
-
end
|
26
|
-
logger.trace 'Automation manager instantiated, OpenHAB ready for rule processing.'
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/lib/openhab/core/osgi.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'java'
|
4
|
-
require 'openhab/log/logger'
|
5
|
-
|
6
|
-
module OpenHAB
|
7
|
-
module Core
|
8
|
-
#
|
9
|
-
# OSGI services interface
|
10
|
-
#
|
11
|
-
class OSGI
|
12
|
-
include OpenHAB::Log
|
13
|
-
|
14
|
-
java_import org.osgi.framework.FrameworkUtil
|
15
|
-
|
16
|
-
#
|
17
|
-
# @param name [String] The service name
|
18
|
-
#
|
19
|
-
# @return [Service]
|
20
|
-
#
|
21
|
-
def self.service(name)
|
22
|
-
ref = bundle_context.getServiceReference(name)
|
23
|
-
service = bundle_context.getService(ref) if ref
|
24
|
-
logger.trace "OSGI service(#{service}) found for '#{name}' using OSGI Service Reference #{ref}"
|
25
|
-
|
26
|
-
service
|
27
|
-
end
|
28
|
-
|
29
|
-
#
|
30
|
-
# @param name [String] The service name
|
31
|
-
# @param filter [String] Filter for service names. See https://docs.osgi.org/javadoc/r4v43/core/org/osgi/framework/Filter.html
|
32
|
-
#
|
33
|
-
# @return [Array] An array of services
|
34
|
-
#
|
35
|
-
def self.services(name, filter: nil)
|
36
|
-
bundle_context.getServiceReferences(name, filter)&.map do |reference|
|
37
|
-
bundle_context.getService(reference)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
#
|
42
|
-
# Get the bundle context
|
43
|
-
#
|
44
|
-
# @return [java::org::osgi::framework::BundleContext] OSGI bundle context
|
45
|
-
#
|
46
|
-
def self.bundle_context
|
47
|
-
@bundle_context ||= bundle.getBundleContext
|
48
|
-
end
|
49
|
-
private_class_method :bundle_context
|
50
|
-
|
51
|
-
# Get the OSGI Bundle for ScriptExtension Class
|
52
|
-
def self.bundle
|
53
|
-
@bundle ||= FrameworkUtil.getBundle($scriptExtension.class)
|
54
|
-
end
|
55
|
-
private_class_method :bundle
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module OpenHAB
|
4
|
-
#
|
5
|
-
# Core support for OpenHAB JRuby Library
|
6
|
-
#
|
7
|
-
module Core
|
8
|
-
#
|
9
|
-
# Access OpenHAB services
|
10
|
-
#
|
11
|
-
|
12
|
-
# Get the OpenHAB automation manager
|
13
|
-
# @return [AutomationManager] OpenHAB Automation manager
|
14
|
-
def self.automation_manager
|
15
|
-
$scriptExtension.get('automationManager')
|
16
|
-
end
|
17
|
-
|
18
|
-
# Get the OpenHAB rule registry
|
19
|
-
# @return [Registory] OpenHAB rule registry
|
20
|
-
def self.rule_registry
|
21
|
-
$scriptExtension.get('ruleRegistry')
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
data/lib/openhab/dsl/actions.rb
DELETED
@@ -1,114 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'java'
|
4
|
-
require 'openhab/core/osgi'
|
5
|
-
|
6
|
-
module OpenHAB
|
7
|
-
module DSL
|
8
|
-
#
|
9
|
-
# Module to import and streamline access to OpenHAB actions
|
10
|
-
#
|
11
|
-
module Actions
|
12
|
-
include OpenHAB::Log
|
13
|
-
|
14
|
-
OpenHAB::Core::OSGI.services('org.openhab.core.model.script.engine.action.ActionService')&.each do |service|
|
15
|
-
java_import service.actionClass.to_s
|
16
|
-
logger.trace("Loaded ACTION: #{service.actionClass}")
|
17
|
-
end
|
18
|
-
# Import common actions
|
19
|
-
%w[Exec HTTP Ping].each { |action| java_import "org.openhab.core.model.script.actions.#{action}" }
|
20
|
-
|
21
|
-
module_function
|
22
|
-
|
23
|
-
#
|
24
|
-
# Return an OpenHAB Action object for the given scope and thing
|
25
|
-
#
|
26
|
-
# @param scope [String] The action scope
|
27
|
-
# @param thing_uid [String] Thing UID
|
28
|
-
#
|
29
|
-
# @return [Object] OpenHAB action
|
30
|
-
#
|
31
|
-
def actions(scope, thing_uid)
|
32
|
-
$actions.get(scope, thing_uid)
|
33
|
-
end
|
34
|
-
|
35
|
-
#
|
36
|
-
# Gets the list of action objects associated with a specific ThingUID
|
37
|
-
#
|
38
|
-
# @param [org.openhab.core.thing.ThingUID] thing_uid to get associated actions for
|
39
|
-
#
|
40
|
-
# @return [Array] of action objects associated with thing_uid, may be empty
|
41
|
-
#
|
42
|
-
def actions_for_thing(thing_uid)
|
43
|
-
thing_uid = thing_uid.to_s
|
44
|
-
action_keys = $actions.action_keys
|
45
|
-
logger.trace("Registered actions: '#{action_keys}' for thing '#{thing_uid}'")
|
46
|
-
action_keys.map { |action_key| action_key.split('-', 2) }
|
47
|
-
.select { |action_pair| action_pair.last == thing_uid }
|
48
|
-
.map(&:first)
|
49
|
-
.map { |scope| actions(scope, thing_uid) }
|
50
|
-
end
|
51
|
-
|
52
|
-
#
|
53
|
-
# Send notification to an email or broadcast
|
54
|
-
#
|
55
|
-
# @param msg [String] The notification message to send
|
56
|
-
# @param email [String] The email address to send to. If nil, the message will be broadcasted
|
57
|
-
#
|
58
|
-
# @return [void]
|
59
|
-
#
|
60
|
-
def notify(msg, email: nil)
|
61
|
-
unless defined? NotificationAction
|
62
|
-
raise NoMethodError, 'NotificationAction is not available. Please install the OpenHAB cloud addon'
|
63
|
-
end
|
64
|
-
|
65
|
-
if email
|
66
|
-
NotificationAction.sendNotification email.to_s, msg.to_s
|
67
|
-
else
|
68
|
-
NotificationAction.sendBroadcastNotification msg.to_s
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
#
|
73
|
-
# Say text via OpenHAB Text-To-Speech service, Voice.say()
|
74
|
-
#
|
75
|
-
# @param text [String] The text to say
|
76
|
-
# @param voice [String] Specify a particular voice to use
|
77
|
-
# @param sink [String] Specify a particular sink to output the speech
|
78
|
-
# @param volume [PercentType] Specify the volume for the speech
|
79
|
-
#
|
80
|
-
# @return [void]
|
81
|
-
#
|
82
|
-
def say(text, voice: nil, sink: nil, volume: nil)
|
83
|
-
volume = Types::PercentType.new(volume) unless volume.is_a?(Types::PercentType) || volume.nil?
|
84
|
-
Voice.say text.to_s, voice&.to_s, sink&.to_s, volume
|
85
|
-
end
|
86
|
-
|
87
|
-
#
|
88
|
-
# Play an audio file via OpenHAB sound service, Audio.playSound()
|
89
|
-
#
|
90
|
-
# @param filename [String] The sound file to play
|
91
|
-
# @param sink [String] Specify a particular sink to output the speech
|
92
|
-
# @param volume [PercentType] Specify the volume for the speech
|
93
|
-
#
|
94
|
-
# @return [void]
|
95
|
-
#
|
96
|
-
def play_sound(filename, sink: nil, volume: nil)
|
97
|
-
volume = Types::PercentType.new(volume) unless volume.is_a?(Types::PercentType) || volume.nil?
|
98
|
-
Audio.playSound sink&.to_s, filename.to_s, volume
|
99
|
-
end
|
100
|
-
|
101
|
-
#
|
102
|
-
# Play an audio stream from an URL to the given sink(s). Set url to nil if streaming should be stopped
|
103
|
-
#
|
104
|
-
# @param [String] url The URL of the audio stream
|
105
|
-
# @param [String] sink The audio sink, or nil to use the default audio sink
|
106
|
-
#
|
107
|
-
# @return [void]
|
108
|
-
#
|
109
|
-
def play_stream(url, sink: nil)
|
110
|
-
Audio.playStream sink&.to_s, url
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
data/lib/openhab/dsl/between.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'time/time_of_day'
|
4
|
-
require_relative 'time/month_day'
|
5
|
-
|
6
|
-
module OpenHAB
|
7
|
-
module DSL
|
8
|
-
# Supports between range syntax
|
9
|
-
module Between
|
10
|
-
module_function
|
11
|
-
|
12
|
-
# Creates a range that can be compared against time of day/month days or strings
|
13
|
-
# to see if they are within the range
|
14
|
-
# @since 2.4.0
|
15
|
-
# @return Range object representing a TimeOfDay Range
|
16
|
-
def between(range)
|
17
|
-
raise ArgumentError, 'Supplied object must be a range' unless range.is_a? Range
|
18
|
-
|
19
|
-
return OpenHAB::DSL::Between::MonthDayRange.range(range) if OpenHAB::DSL::Between::MonthDayRange.range?(range)
|
20
|
-
|
21
|
-
OpenHAB::DSL::Between::TimeOfDay.between(range)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/lib/openhab/dsl/channel.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'forwardable'
|
4
|
-
|
5
|
-
module OpenHAB
|
6
|
-
module DSL
|
7
|
-
java_import org.openhab.core.thing.Channel
|
8
|
-
java_import org.openhab.core.thing.ChannelUID
|
9
|
-
|
10
|
-
# Adds methods to core OpenHAB Channel to make it more natural in Ruby
|
11
|
-
class Channel
|
12
|
-
extend Forwardable
|
13
|
-
|
14
|
-
delegate %i[thing item items] => :uid
|
15
|
-
end
|
16
|
-
|
17
|
-
# Adds methods to core OpenHAB ChannelUID to make it more natural in Ruby
|
18
|
-
class ChannelUID
|
19
|
-
# Return the thing this channel is associated with.
|
20
|
-
#
|
21
|
-
# @return [Thing] The thing associated with this channel or nil
|
22
|
-
def thing
|
23
|
-
things[thing_uid]
|
24
|
-
end
|
25
|
-
|
26
|
-
# Return the item if this channel is linked with an item. If a channel is linked to more than one item,
|
27
|
-
# this method only returns the first item.
|
28
|
-
#
|
29
|
-
# @return [GenericItem] The item associated with this channel or nil
|
30
|
-
def item
|
31
|
-
items.first
|
32
|
-
end
|
33
|
-
|
34
|
-
# Returns all of the channel's linked items.
|
35
|
-
#
|
36
|
-
# @return [Array<GenericItem>] An array of things or an empty array
|
37
|
-
def items
|
38
|
-
registry = OpenHAB::Core::OSGI.service('org.openhab.core.thing.link.ItemChannelLinkRegistry')
|
39
|
-
registry.get_linked_items(self).to_a
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
data/lib/openhab/dsl/dsl.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'imports'
|
4
|
-
|
5
|
-
OpenHAB::DSL.import_presets
|
6
|
-
|
7
|
-
require 'openhab/log/logger'
|
8
|
-
|
9
|
-
# the order of these is important
|
10
|
-
require_relative 'types/types'
|
11
|
-
require_relative 'items/items'
|
12
|
-
|
13
|
-
require_relative 'monkey_patch/ruby/ruby'
|
14
|
-
require_relative 'monkey_patch/java/java'
|
15
|
-
require_relative 'monkey_patch/events/events'
|
16
|
-
require_relative 'monkey_patch/actions/actions'
|
17
|
-
|
18
|
-
require_relative 'rules/rule'
|
19
|
-
require_relative 'rules/terse'
|
20
|
-
require_relative 'actions'
|
21
|
-
require_relative 'channel'
|
22
|
-
require_relative 'timers'
|
23
|
-
require_relative 'group'
|
24
|
-
require_relative 'things'
|
25
|
-
require_relative 'between'
|
26
|
-
require_relative 'gems'
|
27
|
-
require_relative 'persistence'
|
28
|
-
require_relative 'uid'
|
29
|
-
require_relative 'units'
|
30
|
-
require_relative 'states'
|
31
|
-
require_relative 'openhab'
|
32
|
-
|
33
|
-
module OpenHAB
|
34
|
-
#
|
35
|
-
# Module to be extended to access the OpenHAB Ruby DSL
|
36
|
-
#
|
37
|
-
module DSL
|
38
|
-
# Extend the calling module/class with the DSL
|
39
|
-
# Disabling method length because they are all includes
|
40
|
-
# rubocop:disable Metrics/MethodLength
|
41
|
-
def self.extended(base)
|
42
|
-
base.send :include, OpenHAB::DSL::Actions
|
43
|
-
base.send :include, OpenHAB::DSL::Between
|
44
|
-
base.send :include, OpenHAB::DSL::Core
|
45
|
-
base.send :include, OpenHAB::DSL::Groups
|
46
|
-
base.send :include, OpenHAB::DSL::Items
|
47
|
-
base.send :include, OpenHAB::DSL::Persistence
|
48
|
-
base.send :include, OpenHAB::DSL::Rules::Rule
|
49
|
-
base.send :include, OpenHAB::DSL::Rules::TerseRule
|
50
|
-
base.send :include, OpenHAB::DSL::States
|
51
|
-
base.send :include, OpenHAB::DSL::Things
|
52
|
-
base.send :include, OpenHAB::DSL::Timers
|
53
|
-
base.send :include, OpenHAB::DSL::Between
|
54
|
-
base.send :include, OpenHAB::DSL::Types
|
55
|
-
base.send :include, OpenHAB::DSL::Units
|
56
|
-
end
|
57
|
-
# rubocop:enable Metrics/MethodLength
|
58
|
-
end
|
59
|
-
end
|
data/lib/openhab/dsl/group.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'singleton'
|
4
|
-
|
5
|
-
require 'openhab/core/entity_lookup'
|
6
|
-
require 'openhab/dsl/lazy_array'
|
7
|
-
|
8
|
-
module OpenHAB
|
9
|
-
module DSL
|
10
|
-
#
|
11
|
-
# Provides access to OpenHAB Groups
|
12
|
-
#
|
13
|
-
module Groups
|
14
|
-
module_function
|
15
|
-
|
16
|
-
#
|
17
|
-
# Retrieve all OpenHAB groups
|
18
|
-
#
|
19
|
-
# @return [Set] of OpenHAB Groups
|
20
|
-
#
|
21
|
-
def groups
|
22
|
-
OpenHAB::DSL::Support::Groups.instance
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
module Support
|
27
|
-
#
|
28
|
-
# Provide access to groups as a set
|
29
|
-
#
|
30
|
-
class Groups
|
31
|
-
include LazyArray
|
32
|
-
include Singleton
|
33
|
-
|
34
|
-
#
|
35
|
-
# Get a OpenHAB Group by name
|
36
|
-
# @param [String] name of the group to retrieve
|
37
|
-
#
|
38
|
-
# @return [Set] of OpenHAB Groups
|
39
|
-
#
|
40
|
-
def [](name)
|
41
|
-
group = OpenHAB::Core::EntityLookup.lookup_item(name)
|
42
|
-
group.is_a?(OpenHAB::DSL::Items::GroupItem) ? group : nil
|
43
|
-
end
|
44
|
-
alias include? []
|
45
|
-
alias key? include?
|
46
|
-
|
47
|
-
# explicit conversion to array
|
48
|
-
def to_a
|
49
|
-
$ir.items.grep(org.openhab.core.items.GroupItem)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
data/lib/openhab/dsl/imports.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module OpenHAB
|
4
|
-
module DSL
|
5
|
-
include OpenHAB::Log
|
6
|
-
#
|
7
|
-
# Import required java classes
|
8
|
-
#
|
9
|
-
def self.import_presets # rubocop:disable Metrics/AbcSize
|
10
|
-
return if Object.const_get(:ZonedDateTime).is_a?(Class)
|
11
|
-
|
12
|
-
# Fix the import problem in OpenHAB 3.2 addon. Not required in 3.3+
|
13
|
-
[java.time.Duration,
|
14
|
-
java.time.ZonedDateTime,
|
15
|
-
java.time.ZoneId,
|
16
|
-
java.time.temporal.ChronoUnit].each do |klass|
|
17
|
-
Object.const_set(klass.java_class.simple_name.to_sym, klass)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'forwardable'
|
4
|
-
|
5
|
-
require_relative 'comparable_item'
|
6
|
-
require 'openhab/dsl/types/hsb_type'
|
7
|
-
|
8
|
-
module OpenHAB
|
9
|
-
module DSL
|
10
|
-
module Items
|
11
|
-
java_import org.openhab.core.library.items.ColorItem
|
12
|
-
|
13
|
-
# Adds methods to core OpenHAB ColorItem type to make it more natural in
|
14
|
-
# Ruby
|
15
|
-
class ColorItem < DimmerItem
|
16
|
-
extend Forwardable
|
17
|
-
include ComparableItem
|
18
|
-
|
19
|
-
# !@visibility private
|
20
|
-
def ==(other)
|
21
|
-
# need to check if we're referring to the same item before
|
22
|
-
# forwarding to <=> (and thus checking equality with state)
|
23
|
-
return true if equal?(other) || eql?(other)
|
24
|
-
|
25
|
-
super
|
26
|
-
end
|
27
|
-
|
28
|
-
#
|
29
|
-
# Type Coercion
|
30
|
-
#
|
31
|
-
# Coerce object to a HSBType
|
32
|
-
#
|
33
|
-
# @param [Types::HSBType, String] other object to coerce to a
|
34
|
-
# HSBType
|
35
|
-
#
|
36
|
-
# @return [[Types::HSBType, Types::HSBType]]
|
37
|
-
#
|
38
|
-
def coerce(other)
|
39
|
-
logger.trace("Coercing #{self} as a request from #{other.class}")
|
40
|
-
return [other, nil] unless state?
|
41
|
-
return [other, state] if other.is_a?(Types::HSBType) || other.respond_to?(:to_str)
|
42
|
-
end
|
43
|
-
|
44
|
-
# any method that exists on {Types::HSBType} gets forwarded to +state+
|
45
|
-
delegate (Types::HSBType.instance_methods - instance_methods) => :state
|
46
|
-
|
47
|
-
# string commands aren't allowed on ColorItems, so try to implicitly
|
48
|
-
# convert it to an HSBType
|
49
|
-
# @!visibility private
|
50
|
-
def format_type(command)
|
51
|
-
return format_hash(command.to_hash) if command.respond_to?(:to_hash)
|
52
|
-
return Types::HSBType.new(command) if command.respond_to?(:to_str)
|
53
|
-
|
54
|
-
super
|
55
|
-
end
|
56
|
-
|
57
|
-
private
|
58
|
-
|
59
|
-
# Mapping of hash values sets to conversion methods
|
60
|
-
HASH_KEYS = { %i[r g b] => :from_rgb,
|
61
|
-
%i[red green blue] => :from_rgb,
|
62
|
-
%i[h s b] => :from_hsb,
|
63
|
-
%i[hue saturation brightness] => :from_hsb }.freeze
|
64
|
-
|
65
|
-
def format_hash(hash)
|
66
|
-
hash = hash.transform_keys(&:to_sym)
|
67
|
-
HASH_KEYS.each do |key_set, method|
|
68
|
-
values = hash.values_at(*key_set).compact
|
69
|
-
return Types::HSBType.public_send(method, *values) if values.length == 3
|
70
|
-
end
|
71
|
-
raise ArgumentError, "Supplied hash (#{hash}) must contain one of the following keysets #{keys.keys}"
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module OpenHAB
|
4
|
-
module DSL
|
5
|
-
module Items
|
6
|
-
# Mixin for implementing the comparison operator for Item types that
|
7
|
-
# support it
|
8
|
-
module ComparableItem
|
9
|
-
#
|
10
|
-
# Comparison
|
11
|
-
#
|
12
|
-
# @param [GenericItem, Types::Type, Object, GenericItemObject] other object to
|
13
|
-
# compare to
|
14
|
-
#
|
15
|
-
# When comparing GenericItemObject on either side, perform object comparison
|
16
|
-
# return 0 if the object is equal, or nil otherwise.
|
17
|
-
#
|
18
|
-
# If this item is +NULL+ or +UNDEF+, and +other+ is nil, they are
|
19
|
-
# considered equal
|
20
|
-
#
|
21
|
-
# If this item is +NULL+ or +UNDEF+, and other is a {GenericItem}, they
|
22
|
-
# are only considered equal if the other item is in the exact same
|
23
|
-
# state (i.e. +NULL+ != +UNDEF+)
|
24
|
-
#
|
25
|
-
# Otherwise, the state of this item is compared with +other+
|
26
|
-
#
|
27
|
-
# @return [Integer, nil] -1, 0, +1 depending on whether +other+ is
|
28
|
-
# less than, equal to, or greater than self
|
29
|
-
#
|
30
|
-
# nil is returned if the two values are incomparable
|
31
|
-
#
|
32
|
-
def <=>(other)
|
33
|
-
logger.trace("(#{self.class}) #{self} <=> #{other} (#{other.class})")
|
34
|
-
|
35
|
-
if is_a?(OpenHAB::DSL::GenericItemObject) || other.is_a?(OpenHAB::DSL::GenericItemObject)
|
36
|
-
return eql?(other) ? 0 : nil
|
37
|
-
end
|
38
|
-
|
39
|
-
# if we're NULL or UNDEF, implement special logic
|
40
|
-
return nil_comparison(other) unless state?
|
41
|
-
|
42
|
-
# delegate to how the state compares to the other object
|
43
|
-
state <=> other
|
44
|
-
end
|
45
|
-
|
46
|
-
# Special logic for NULL/UNDEF state comparison
|
47
|
-
# @!visibility private
|
48
|
-
def nil_comparison(other)
|
49
|
-
# if comparing to nil, consider ourselves equal
|
50
|
-
return 0 if other.nil?
|
51
|
-
|
52
|
-
# if the other object is an Item, only consider equal if we're
|
53
|
-
# in the same _kind_ of UnDefType state
|
54
|
-
return raw_state == other.raw_state if other.is_a?(GenericItem) && !other.state?
|
55
|
-
|
56
|
-
# otherwise, it's a non-nil thing comparing to nil, which is undefined
|
57
|
-
nil
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module OpenHAB
|
4
|
-
module DSL
|
5
|
-
#
|
6
|
-
# Patches OpenHAB items
|
7
|
-
#
|
8
|
-
module Items
|
9
|
-
java_import org.openhab.core.library.items.ContactItem
|
10
|
-
|
11
|
-
# Alias class for ContactItem
|
12
|
-
::Contact = ContactItem
|
13
|
-
|
14
|
-
# Adds methods to core OpenHAB ContactItem type to make it more natural
|
15
|
-
# in Ruby
|
16
|
-
class ContactItem < GenericItem
|
17
|
-
remove_method :==
|
18
|
-
|
19
|
-
#
|
20
|
-
# Return the inverted state of the contact: +CLOSED+ if the contact is
|
21
|
-
# +OPEN+, +UNDEF+ or +NULL+; +OPEN+ if the contact is +CLOSED+
|
22
|
-
#
|
23
|
-
# @return [Types::OpenClosedType] Inverted state
|
24
|
-
#
|
25
|
-
def !
|
26
|
-
return !state if state?
|
27
|
-
|
28
|
-
CLOSED
|
29
|
-
end
|
30
|
-
|
31
|
-
# @!method open?
|
32
|
-
# Check if the item state == +OPEN+
|
33
|
-
# @return [Boolean]
|
34
|
-
|
35
|
-
# @!method closed?
|
36
|
-
# Check if the item state == +CLOSED+
|
37
|
-
# @return [Boolean]
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'forwardable'
|
4
|
-
require 'time'
|
5
|
-
require 'java'
|
6
|
-
|
7
|
-
require 'openhab/dsl/items/comparable_item'
|
8
|
-
|
9
|
-
module OpenHAB
|
10
|
-
module DSL
|
11
|
-
module Items
|
12
|
-
java_import org.openhab.core.library.items.DateTimeItem
|
13
|
-
java_import java.time.format.DateTimeFormatter
|
14
|
-
|
15
|
-
# Adds methods to core OpenHAB DateTimeItem type to make it more natural
|
16
|
-
# in Ruby
|
17
|
-
class DateTimeItem < GenericItem
|
18
|
-
extend Forwardable
|
19
|
-
include Comparable
|
20
|
-
include ComparableItem
|
21
|
-
|
22
|
-
# !@visibility private
|
23
|
-
def ==(other)
|
24
|
-
# need to check if we're referring to the same item before
|
25
|
-
# forwarding to <=> (and thus checking equality with state)
|
26
|
-
return true if equal?(other) || eql?(other)
|
27
|
-
|
28
|
-
super
|
29
|
-
end
|
30
|
-
|
31
|
-
#
|
32
|
-
# Type Coercion
|
33
|
-
#
|
34
|
-
# Coerce object to a DateTimeType
|
35
|
-
#
|
36
|
-
# @param [Types::DateTimeType, Time] other object to coerce to a
|
37
|
-
# DateTimeType
|
38
|
-
#
|
39
|
-
# @return [[Types::DateTimeType, Types::DateTimeType]]
|
40
|
-
#
|
41
|
-
def coerce(other)
|
42
|
-
logger.trace("Coercing #{self} as a request from #{other.class}")
|
43
|
-
return [other, nil] unless state?
|
44
|
-
return [other, state] if other.is_a?(Types::DateTimeType) || other.respond_to?(:to_time)
|
45
|
-
end
|
46
|
-
|
47
|
-
# any method that exists on DateTimeType, Java's ZonedDateTime, or
|
48
|
-
# Ruby's Time class gets forwarded to state (which will forward as
|
49
|
-
# necessary)
|
50
|
-
delegate ((Types::DateTimeType.instance_methods +
|
51
|
-
java.time.ZonedDateTime.instance_methods +
|
52
|
-
Time.instance_methods) - instance_methods) => :state
|
53
|
-
|
54
|
-
# Time types need formatted as ISO8601
|
55
|
-
# @!visibility private
|
56
|
-
def format_type(command)
|
57
|
-
return command.iso8601 if command.respond_to?(:iso8601)
|
58
|
-
return DateTimeFormatter::ISO_OFFSET_DATE_TIME.format(command) if command.is_a? java.time.ZonedDateTime
|
59
|
-
|
60
|
-
super
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|