Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[actions] Update docs for naming timers #160

Merged
merged 3 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
| Type | Namespace | Description | Reference | Breaking |
|-------------|------------|--------------------------------------------------------------------------|--------------------------------------------------------|----------|
| Enhancement | `triggers` | Add DateTime Trigger | [#154](https://github.com/openhab/openhab-js/pull/154) | No |
| Enhancement | `items` | ItemHistory: Add missing methods & Enable type defs | [#158](https://github.com/openhab/openhab-js/pull/158) | No |
| Docs | `actions` | Update docs for naming timers | [#160](https://github.com/openhab/openhab-js/pull/160) | No |


Also see the [Release Milestone](https://github.com/openhab/openhab-js/milestone/4).

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,11 @@ let now = time.ZonedDateTime.now();

// Function to run when the timer goes off.
function timerOver () {
logger.info('The timer is over.');
console.info('The timer is over.');
}

// Create the Timer.
this.myTimer = actions.ScriptExecution.createTimer(now.plusSeconds(10), timerOver);
this.myTimer = actions.ScriptExecution.createTimer('My Timer', now.plusSeconds(10), timerOver);

// Cancel the timer.
this.myTimer.cancel();
Expand Down
29 changes: 15 additions & 14 deletions actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Actions namespace.
* This namespace provides access to openHAB actions. All available actions can be accessed as direct properties of this
* This namespace provides access to openHAB actions. {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/package-summary.html All available actions} can be accessed as direct properties of this
* object (via their simple class name).
*
* @example <caption>Sends a broadcast notification</caption>
Expand Down Expand Up @@ -33,7 +33,7 @@ actionServices.forEach(function (item) {
});

/**
* Audio Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/audio Audio} Actions
*
* The static methods of this class are made available as functions in the scripts. This allows a script to use audio features.
*
Expand All @@ -58,7 +58,7 @@ actionServices.forEach(function (item) {
const Audio = Java.type('org.openhab.core.model.script.actions.Audio');

/**
* BusEvent Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/busevent BusEvent} Actions
*
* The static methods of this class are made available as functions in the scripts. This gives direct write access to the openHAB event bus from within scripts. Items should not be updated directly (setting the state property), but updates should be sent to the bus, so that all interested bundles are notified.
* @example
Expand All @@ -79,7 +79,7 @@ const Audio = Java.type('org.openhab.core.model.script.actions.Audio');
const BusEvent = Java.type('org.openhab.core.model.script.actions.BusEvent');

/**
* Ephemeris Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/ephemeris Ephemeris} Actions
*
* The static methods of this class are made available as functions in the scripts. This allows a script to use ephemeris features.
* @example
Expand Down Expand Up @@ -119,7 +119,7 @@ const BusEvent = Java.type('org.openhab.core.model.script.actions.BusEvent');
const Ephemeris = Java.type('org.openhab.core.model.script.actions.Ephemeris');

/**
* Exec Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/exec Exec} Actions
*
* This class provides static methods that can be used in automation rules for executing commands on command line.
*
Expand All @@ -133,7 +133,7 @@ const Ephemeris = Java.type('org.openhab.core.model.script.actions.Ephemeris');
const Exec = Java.type('org.openhab.core.model.script.actions.Exec');

/**
* HTTP Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/HTTP.html HTTP} Actions
*
* This class provides static methods that can be used in automation rules for sending HTTP requests
*
Expand Down Expand Up @@ -161,7 +161,7 @@ const Exec = Java.type('org.openhab.core.model.script.actions.Exec');
const HTTP = Java.type('org.openhab.core.model.script.actions.HTTP');

/**
* Log Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/Log.html Log} Actions
*
* The static methods of this class are made available as functions in the scripts. This allows a script to log to the SLF4J-Log.
*
Expand All @@ -177,7 +177,7 @@ const HTTP = Java.type('org.openhab.core.model.script.actions.HTTP');
const LogAction = Java.type('org.openhab.core.model.script.actions.Log');

/**
* Ping Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/Ping.html Ping} Actions
*
* This Action checks the vitality of the given host.
*
Expand All @@ -190,22 +190,23 @@ const LogAction = Java.type('org.openhab.core.model.script.actions.Log');
const Ping = Java.type('org.openhab.core.model.script.actions.Ping');

/**
* ScriptExecution Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/scriptexecution ScriptExecution} Actions
*
* The static methods of this class are made available as functions in the scripts. This allows a script to call another script, which is available as a file.
*
* @example
* ScriptExecution.callScript​(String scriptName)
* ScriptExecution.createTimer​(ZonedDateTime instant, org.eclipse.xtext.xbase.lib.Procedures.Procedure0 closure)
* ScriptExecution.createTimerWithArgument​(ZonedDateTime instant, Object arg1, org.eclipse.xtext.xbase.lib.Procedures.Procedure1<Object> closure)
* ScriptExecution.createTimer​(ZonedDateTime instant, callbackFunction)
* ScriptExecution.createTimer​(String identifier, ZonedDateTime instant, callbackFunction)
* ScriptExecution.createTimerWithArgument​(ZonedDateTime instant, Object arg1, callbackFunction)
*
* @name ScriptExecution
* @memberof actions
*/
const ScriptExecution = Java.type('org.openhab.core.model.script.actions.ScriptExecution');

/**
* Semantics Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/Semantics.html Semantics} Actions
*
* The static methods of this class are made available as functions in the scripts. This allows a script to use Semantics features.
*
Expand All @@ -227,7 +228,7 @@ const ScriptExecution = Java.type('org.openhab.core.model.script.actions.ScriptE
const Semantics = Java.type('org.openhab.core.model.script.actions.Semantics');

/**
* Things Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/Things.html Things} Actions
*
* This class provides static methods that can be used in automation rules for getting thing's status info.
*
Expand All @@ -241,7 +242,7 @@ const Semantics = Java.type('org.openhab.core.model.script.actions.Semantics');
const ThingsAction = Java.type('org.openhab.core.model.script.actions.Things');

/**
* Voice Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/Voice.html Voice} Actions
*
* The static methods of this class are made available as functions in the scripts. This allows a script to use voice features.
*
Expand Down
27 changes: 14 additions & 13 deletions types/actions.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Audio Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/audio Audio} Actions
*
* The static methods of this class are made available as functions in the scripts. This allows a script to use audio features.
*
Expand All @@ -23,7 +23,7 @@
*/
export const Audio: any;
/**
* BusEvent Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/busevent BusEvent} Actions
*
* The static methods of this class are made available as functions in the scripts. This gives direct write access to the openHAB event bus from within scripts. Items should not be updated directly (setting the state property), but updates should be sent to the bus, so that all interested bundles are notified.
* @example
Expand All @@ -43,7 +43,7 @@ export const Audio: any;
*/
export const BusEvent: any;
/**
* Ephemeris Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/ephemeris Ephemeris} Actions
*
* The static methods of this class are made available as functions in the scripts. This allows a script to use ephemeris features.
* @example
Expand Down Expand Up @@ -82,7 +82,7 @@ export const BusEvent: any;
*/
export const Ephemeris: any;
/**
* Exec Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/exec Exec} Actions
*
* This class provides static methods that can be used in automation rules for executing commands on command line.
*
Expand All @@ -95,7 +95,7 @@ export const Ephemeris: any;
*/
export const Exec: any;
/**
* HTTP Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/HTTP.html HTTP} Actions
*
* This class provides static methods that can be used in automation rules for sending HTTP requests
*
Expand All @@ -122,7 +122,7 @@ export const Exec: any;
*/
export const HTTP: any;
/**
* Log Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/Log.html Log} Actions
*
* The static methods of this class are made available as functions in the scripts. This allows a script to log to the SLF4J-Log.
*
Expand All @@ -137,7 +137,7 @@ export const HTTP: any;
*/
declare const LogAction: any;
/**
* Ping Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/Ping.html Ping} Actions
*
* This Action checks the vitality of the given host.
*
Expand All @@ -149,21 +149,22 @@ declare const LogAction: any;
*/
export const Ping: any;
/**
* ScriptExecution Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/scriptexecution ScriptExecution} Actions
*
* The static methods of this class are made available as functions in the scripts. This allows a script to call another script, which is available as a file.
*
* @example
* ScriptExecution.callScript​(String scriptName)
* ScriptExecution.createTimer​(ZonedDateTime instant, org.eclipse.xtext.xbase.lib.Procedures.Procedure0 closure)
* ScriptExecution.createTimerWithArgument​(ZonedDateTime instant, Object arg1, org.eclipse.xtext.xbase.lib.Procedures.Procedure1<Object> closure)
* ScriptExecution.createTimer​(ZonedDateTime instant, callbackFunction)
* ScriptExecution.createTimer​(String identifier, ZonedDateTime instant, callbackFunction)
* ScriptExecution.createTimerWithArgument​(ZonedDateTime instant, Object arg1, callbackFunction)
*
* @name ScriptExecution
* @memberof actions
*/
export const ScriptExecution: any;
/**
* Semantics Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/Semantics.html Semantics} Actions
*
* The static methods of this class are made available as functions in the scripts. This allows a script to use Semantics features.
*
Expand All @@ -184,7 +185,7 @@ export const ScriptExecution: any;
*/
export const Semantics: any;
/**
* Things Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/Things.html Things} Actions
*
* This class provides static methods that can be used in automation rules for getting thing's status info.
*
Expand All @@ -197,7 +198,7 @@ export const Semantics: any;
*/
declare const ThingsAction: any;
/**
* Voice Actions
* {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/Voice.html Voice} Actions
*
* The static methods of this class are made available as functions in the scripts. This allows a script to use voice features.
*
Expand Down
2 changes: 1 addition & 1 deletion types/actions.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.