From a7a3c1a673f8b23ccf5d948faa62d2a2aa509ec0 Mon Sep 17 00:00:00 2001 From: Scott Rushworth Date: Thu, 27 Feb 2020 03:48:13 -0500 Subject: [PATCH] Added missing preset variables (#1104) * Added missing preset variables Signed-off-by: Scott Rushworth * Cleaned up blank lines, fixed table, and added file name for SimpleRule Signed-off-by: Scott Rushworth --- configuration/jsr223.md | 82 ++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/configuration/jsr223.md b/configuration/jsr223.md index ddb0a6ac92..a4167220f0 100644 --- a/configuration/jsr223.md +++ b/configuration/jsr223.md @@ -147,7 +147,7 @@ For example, with the following scripts and directory structure... To faciliate JSR223 scripting, several openHAB-related variables are automatically predefined within `ScriptExtension` presets. They can be loaded into the script context using `scriptExtension.importPreset(String preset)`, e.g. `scriptExtension.importPreset("RuleSimple")`. -The Default preset is preloaded, so it does not require importing. +The `default` preset is preloaded, so it does not require importing. - [`Default`](#default_presets) - [`RuleSimple`](#rulesimple_presets) @@ -159,19 +159,16 @@ The Default preset is preloaded, so it does not require importing. #### Default Preset (`importPreset` not required) | Variable | Description | -|---------|-------------| -| `State` | `org.eclipse.smarthome.core.types.State` | -| `Command` | `org.eclipse.smarthome.core.types.State` | +|----------|-------------| | `DateTime` | `org.joda.time.DateTime` (if Jodatime is available) | | `LocalTime` | `org.joda.time.LocalTime` (if Jodatime is available) | +| `State` | `org.eclipse.smarthome.core.types.State` | +| `Command` | `org.eclipse.smarthome.core.types.State` | | `StringUtils` | `org.apache.commons.lang.StringUtils` | | `URLEncoder` | `java.net.URLEncoder` | | `FileUtils` | `org.apache.commons.io.FileUtils` | | `FilenameUtils` | `org.apache.commons.io.FilenameUtils` | | `File` | `java.io.File` | -| `UnDefType` | `org.eclipse.smarthome.core.library.types.UnDefType` | -| `NULL` | `UnDefType` enum item | -| `UNDEF` | `UnDefType` enum item | | `IncreaseDecreaseType` | `org.eclipse.smarthome.core.library.types.IncreaseDecreaseType` | | `DECREASE` | `IncreaseDecreaseType` enum item | | `INCREASE` | `IncreaseDecreaseType` enum item | @@ -184,34 +181,46 @@ The Default preset is preloaded, so it does not require importing. | `StopMoveType` | `org.eclipse.smarthome.core.library.types.StopMoveType` | | `STOP` | `StopMoveType` enum item | | `MOVE` | `StopMoveType` enum item | -| `RewindFastforwardType` | `org.eclipse.smarthome.core.library.types.RewindFastforwardType` | -| `REWIND` | `RewindFastforwardType` enum item | -| `FASTFORWARD` | `RewindFastforwardType` enum item | +| `UpDownType` | `org.eclipse.smarthome.core.library.types.UpDownType` | +| `UP` | `UpDownType` enum item | +| `DOWN` | `UpDownType` enum item | +| `UnDefType` | `org.eclipse.smarthome.core.library.types.UnDefType` | +| `NULL` | `UnDefType` enum item | +| `UNDEF` | `UnDefType` enum item | +| `RefreshType` | `org.eclipse.smarthome.core.library.types.RefreshType` | +| `REFRESH` | `RefreshType` enum item | | `NextPreviousType` | `org.eclipse.smarthome.core.library.types.NextPreviusType` | | `NEXT` | `NextPreviousType` enum item | | `PREVIOUS` | `NextPreviousType` enum item | | `PlayPauseType` | `org.eclipse.smarthome.core.library.types.PlayPauseType` | | `PLAY` | `PlayPauseType` enum item | | `PAUSE` | `PlayPauseType` enum item | -| `UpDownType` | `org.eclipse.smarthome.core.library.types.UpDownType` | -| `UP` | `UpDownType` enum item | -| `DOWN` | `UpDownType` enum item | -| `DecimalType` | `org.eclipse.smarthome.core.library.types.DecimalType` | +| `RewindFastforwardType` | `org.eclipse.smarthome.core.library.types.RewindFastforwardType` | +| `REWIND` | `RewindFastforwardType` enum item | +| `FASTFORWARD` | `RewindFastforwardType` enum item | | `QuantityType` | `org.eclipse.smarthome.core.library.types.QuantityType` | +| `StringListType` | `org.eclipse.smarthome.core.library.types.StringListType` | +| `RawType` | `org.eclipse.smarthome.core.library.types.RawType` | +| `DateTimeType` | `org.eclipse.smarthome.core.library.types.DateTimeType` | +| `DecimalType` | `org.eclipse.smarthome.core.library.types.DecimalType` | | `HSBType` | `org.eclipse.smarthome.core.library.types.HSBType` | | `PercentType` | `org.eclipse.smarthome.core.library.types.PercentType` | | `PointType` | `org.eclipse.smarthome.core.library.types.PointType` | | `StringType` | `org.eclipse.smarthome.core.library.types.StringType` | -| `StringListType` | `org.eclipse.smarthome.core.library.types.StringListType` | -| `RawType` | `org.eclipse.smarthome.core.library.types.RawType` | -| `items` | Instance of `java.util.Map<String, State>` | -| `itemRegistry` | Instance of `org.eclipse.smarthome.core.items.ItemRegistry` | +| `SIUnits` | `org.eclipse.smarthome.core.library.unit.SIUnits` | +| `ImperialUnits` | `org.eclipse.smarthome.core.library.unit.SmartHomeUnits` | +| `MetricPrefix` | `org.eclipse.smarthome.core.library.unit.SmartHomeUnits` | +| `SmartHomeUnits` | `org.eclipse.smarthome.core.library.unit.SmartHomeUnits` | +| `BinaryPrefix` | `org.eclipse.smarthome.core.library.unit.SmartHomeUnits` | +| `items` | Instance of `java.util.Map<String, State>` | | `ir` | Alias for `itemRegistry` | +| `itemRegistry` | Instance of `org.eclipse.smarthome.core.items.ItemRegistry` | | `things` | Instance of `org.eclipse.smarthome.core.thing.ThingRegistry` | | `rules` | Instance of `org.openhab.core.automation.RuleRegistry` | +| `events` | (internal) Used to send events, post commands, etc. [Details](#event_operations) below] | +| `actions` | Instance of `org.eclipse.smarthome.core.thing.binding.ThingActions` | | `scriptExtension` | (internal) For loading script presets. | | `se` | Alias for `scriptExtension` | -| `events` | (internal) Used to send events, post commands, etc. [Details](#event_operations) below] | @@ -232,7 +241,7 @@ The Default preset is preloaded, so it does not require importing. #### RuleSimple Preset -These variables are loaded using: +These variables and classes are loaded using: ```python scriptExtension.importPreset("RuleSimple") @@ -242,22 +251,22 @@ The primary usage of this preset is for defining rule (`SimpleRule`) subclasses. See language-specific documentation for examples. | Variable | Description | -|----------|------|-------| -| SimpleRule | Base class for Jython Rules | +|----------|-------------| +| ActionType | `org.openhab.core.automation.type.ActionType` | +| ConfigDescriptionParameter | `org.eclipse.smarthome.config.core.ConfigDescriptionParameter` | +| ModuleType | `org.openhab.core.automation.type.ModuleType` | | SimpleActionHandler | `org.openhab.core.automation.module.script.rulesupport.shared.simple.SimpleActionHandler` | | SimpleConditionHandler | `org.openhab.core.automation.module.script.rulesupport.shared.simple.SimpleConditionHandler` | +| SimpleRule | Base class for Jython Rules `org.openhab.core.automation.module.script.rulesupport.shared.simple.SimpleRule` | | SimpleTriggerHandler | `org.openhab.core.automation.module.script.rulesupport.shared.simple.SimpleTriggerHandler` | | TriggerType | `org.openhab.core.automation.type.TriggerType` | -| ConfigDescriptionParameter | `org.eclipse.smarthome.config.core.ConfigDescriptionParameter` | -| ModuleType | `org.openhab.core.automation.type.ModuleType` | -| ActionType | `org.openhab.core.automation.type.ActionType` | | Visibility | `org.openhab.core.automation.Visibility` enum | #### `RuleSupport` Preset -These variables are loaded using: +These variables and classes are loaded using: ```python scriptExtension.importPreset("RuleSupport") @@ -265,12 +274,17 @@ scriptExtension.importPreset("RuleSupport") | Variable | Description | |----------|-------------| -| automationManager | Instance for managing rules and other openHAB module instances. (e.g., `addRule`) | -| Configuration | `org.eclipse.smarthome.config.core.Configuration` | -| Action | `org.openhab.core.automation.Action` | -| Condition | `org.openhab.core.automation.Condition` | +| Action | `org.openhab.core.automation.Action` | +| ActionBuilder | `org.openhab.core.automation.ActionBuilder` | +| Condition | `org.openhab.core.automation.Condition` | +| ConditionBuilder | `org.openhab.core.automation.ConditionBuilder` | +| Configuration | `org.eclipse.smarthome.config.core.Configuration` | +| ModuleBuilder | `org.openhab.core.automation.ModuleBuilder` | +| Rule | `org.openhab.core.automation.Rule` (use `SimpleRule` for defining rules) | | Trigger | `org.openhab.core.automation.Trigger` | -| Rule | `org.openhab.core.automation.Rule` (use `SimpleRule` for defining rules) | +| TriggerBuilder | `org.openhab.core.automation.TriggerBuilder` | +| automationManager | Instance for managing rules and other openHAB module instances. (e.g., `addRule`) | +| ruleRegistry | `org.openhab.core.automation.Rule` | @@ -287,12 +301,6 @@ scriptExtension.importPreset("RuleFactories") | `ActionHandlerFactory` | `org.openhab.core.automation.module.script.rulesupport.shared.factories.ScriptedActionHandlerFactory` | | `ConditionHandlerFactory` | `org.openhab.core.automation.module.script.rulesupport.shared.factories.ScriptedConditionHandlerFactory` | | `TriggerHandlerFactory` | `org.openhab.core.automation.module.script.rulesupport.shared.factories.ScriptedTriggerHandlerFactory` | -| `TriggerType` | `org.openhab.core.automation.type.TriggerType` | -| `ConfigDescriptionParameter` | `org.eclipse.smarthome.config.core.ConfigDescriptionParameter` | -| `ModuleType` | `org.openhab.core.automation.type.ModuleType` | -| `ActionType` | `org.openhab.core.automation.type.ActionType` | -| `Visibility` | `org.openhab.core.automation.Visibility` enum | -