diff --git a/CHANGELOG.md b/CHANGELOG.md index 316c8bf4c..21283a7c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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). diff --git a/README.md b/README.md index 1dc4a370d..0660e89f6 100644 --- a/README.md +++ b/README.md @@ -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(); diff --git a/actions.js b/actions.js index 301fee17a..27e698b2d 100644 --- a/actions.js +++ b/actions.js @@ -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 Sends a broadcast notification @@ -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. * @@ -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 @@ -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 @@ -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. * @@ -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 * @@ -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. * @@ -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. * @@ -190,14 +190,15 @@ 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 closure) + * ScriptExecution.createTimer​(ZonedDateTime instant, callbackFunction) + * ScriptExecution.createTimer​(String identifier, ZonedDateTime instant, callbackFunction) + * ScriptExecution.createTimerWithArgument​(ZonedDateTime instant, Object arg1, callbackFunction) * * @name ScriptExecution * @memberof actions @@ -205,7 +206,7 @@ const Ping = Java.type('org.openhab.core.model.script.actions.Ping'); 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. * @@ -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. * @@ -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. * diff --git a/types/actions.d.ts b/types/actions.d.ts index 8f982ae98..4264afc61 100644 --- a/types/actions.d.ts +++ b/types/actions.d.ts @@ -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. * @@ -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 @@ -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 @@ -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. * @@ -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 * @@ -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. * @@ -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. * @@ -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 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. * @@ -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. * @@ -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. * diff --git a/types/actions.d.ts.map b/types/actions.d.ts.map index c3b60a38a..a3134f6fd 100644 --- a/types/actions.d.ts.map +++ b/types/actions.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../actions.js"],"names":[],"mappings":"AAkCA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAuE;AAEvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,2BAA6E;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,4BAA+E;AAE/E;;;;;;;;;;;GAWG;AACH,uBAAqE;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,uBAAqE;AAErE;;;;;;;;;;;;;GAaG;AACH,6BAAyE;AAEzE;;;;;;;;;;GAUG;AACH,uBAAqE;AAErE;;;;;;;;;;;;GAYG;AACH,kCAA2F;AAE3F;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4BAA+E;AAE/E;;;;;;;;;;;GAWG;AACH,gCAA+E;AAE/E;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAuE;AAEvE;;;;;;;;;;;;;;;GAeG;AACH,mCAAuB;AAsBT,iDAAiC;AAUxB,+EAA+D"} \ No newline at end of file +{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../actions.js"],"names":[],"mappings":"AAkCA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAuE;AAEvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,2BAA6E;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,4BAA+E;AAE/E;;;;;;;;;;;GAWG;AACH,uBAAqE;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,uBAAqE;AAErE;;;;;;;;;;;;;GAaG;AACH,6BAAyE;AAEzE;;;;;;;;;;GAUG;AACH,uBAAqE;AAErE;;;;;;;;;;;;;GAaG;AACH,kCAA2F;AAE3F;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4BAA+E;AAE/E;;;;;;;;;;;GAWG;AACH,gCAA+E;AAE/E;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAuE;AAEvE;;;;;;;;;;;;;;;GAeG;AACH,mCAAuB;AAsBT,iDAAiC;AAUxB,+EAA+D"} \ No newline at end of file