actions
- Description:
Actions namespace.
This namespace provides access to openHAB actions. All available actions can be accessed as direct properties of this object (via their simple class name).
WARNING: Please be aware that there is, unless otherwise noted, NO type conversion from Java to JavaScript types for the return values of actions. Read the linked JavaDoc to learn about the returned Java types.
Additional actions provided by user installed addons can be accessed using their common name on the actions name space if the addon exports them in a proper way.
- Source:
Example
const { actions, time } = require('openhab');
<caption>Send a broadcast notification</caption>
actions.NotificationAction.sendBroadcastNotification('Hello World!');
<caption>Schedule a function for later execution/Create a timer (advanced)</caption>
actions.ScriptExecution.createTimer('myTimer', time.toZDT().plusMinutes(10), () => { console.log('Hello timer!'); });
Classes
Members
(static) Audio
- Description:
Audio Actions
The static methods of this class are made available as functions in the scripts. This allows a script to use audio features. Refer to openHAB Docs: Audio Actions for more information.
- Source:
Audio Actions
The static methods of this class are made available as functions in the scripts. This allows a script to use audio features. Refer to openHAB Docs: Audio Actions for more information.
(static) BusEvent
- Description:
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. Refer to openHAB Docs: Event Bus Actions for more information.
Instead of using the BusEvent actions, it is recommended to use the
postUpdateandsendCommandmethods ofitems.Item.
- Source:
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. Refer to openHAB Docs: Event Bus Actions for more information.
Instead of using the BusEvent actions, it is recommended to use the postUpdate and sendCommand methods of items.Item.
(static) CoreUtil
- Description:
CoreUtil Actions
This class provides static methods mapping methods from package org.openhab.core.util. Refer to openHAB Docs: Color Utilities for more information.
- Source:
CoreUtil Actions
This class provides static methods mapping methods from package org.openhab.core.util. Refer to openHAB Docs: Color Utilities for more information.
(static) Ephemeris
- Description:
Ephemeris Actions
The static methods of this class are made available as functions in the scripts. This allows a script to use ephemeris features. Refer to openHAB Docs: Ephemeris Actions for more information.
- Source:
Ephemeris Actions
The static methods of this class are made available as functions in the scripts. This allows a script to use ephemeris features. Refer to openHAB Docs: Ephemeris Actions for more information.
(static) Exec
- Description:
Exec Actions
This class provides static methods that can be used in automation rules for executing commands on the command line. Refer to openHAB Docs: Exec Actions for more information.
- Source:
Exec Actions
This class provides static methods that can be used in automation rules for executing commands on the command line. Refer to openHAB Docs: Exec Actions for more information.
(static) HTTP
- Description:
HTTP Actions
This class provides static methods that can be used in automation rules for sending HTTP requests. Refer to openHAB Docs: HTTP Actions for more information.}
- Source:
HTTP Actions
This class provides static methods that can be used in automation rules for sending HTTP requests. Refer to openHAB Docs: HTTP Actions for more information.}
(static) Log
- Description:
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.
- Source:
- Deprecated:
- Use
consolelogging instead.
- Use
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.
(static) NotificationAction
- Description:
Cloud Notification Actions
If the openHAB Cloud Connector add-on is installed, notifications can be sent to registered users/devices.
The static methods of this class are made available as functions in the scripts. This allows a script to send notifications using the openHAB Cloud Connector add-on. See Cloud Notification Action Docs for full documentation.
- Source:
- Deprecated:
- Use the notification builders of
actions.notificationBuilderinstead.
- Use the notification builders of
Cloud Notification Actions
If the openHAB Cloud Connector add-on is installed, notifications can be sent to registered users/devices.
The static methods of this class are made available as functions in the scripts. This allows a script to send notifications using the openHAB Cloud Connector add-on. See Cloud Notification Action Docs for full documentation.
(static) Ping
- Description:
Ping Actions
This Action checks the vitality of the given host.
- Source:
Ping Actions
This Action checks the vitality of the given host.
Example
Ping.checkVitality(String host, int port, int timeout)
(static) Semantics
- Description:
Semantics Actions
The static methods of this class are made available as functions in the scripts. This allows a script to use Semantics features.
- Source:
- Deprecated:
- Use
items.ItemSemanticsavailable through thesemanticsproperty ofitems.Iteminstead.
- Use
Semantics Actions
The static methods of this class are made available as functions in the scripts. This allows a script to use Semantics features.
(static) Things
- Description:
Things Actions
This class provides static methods that can be used in automation rules for getting thing's status info.
- Source:
- Deprecated:
- Use
actions.thingActionsandstatus,statusInfoofthings.Thinginstead.
- Use
Things Actions
This class provides static methods that can be used in automation rules for getting thing's status info.
(static) Voice
- Description:
Voice Actions
The static methods of this class are made available as functions in the scripts. This allows a script to use voice features. Refer to openHAB Docs: Voice Actions for more information.
- Source:
Voice Actions
The static methods of this class are made available as functions in the scripts. This allows a script to use voice features. Refer to openHAB Docs: Voice Actions for more information.
Methods
(static) get(bindingId, thingUid) → {*}
- Description:
Get the ThingActions of a given Thing.
- Source:
- Deprecated:
- Use
actions.thingActionsinstead.
- Use
Parameters:
| Name | Type | Description |
|---|---|---|
bindingId |
string | binding ID |
thingUid |
string | Thing UID |
Returns:
Native Java ThingActions
- Type
- *
(static) notificationBuilder(messageopt) → {NotificationBuilder}
- Description:
Creates a new notification builder for openHAB Cloud notifications, which are sent as push notifications to registered devices.
This requires the openHAB Cloud Connector add-on to be installed.
There are three types of notifications:
Broadcast notifications, which are sent to all openHAB Cloud users, standard notifications, which are sent to a openHAB Cloud users specified by their email addresses, and log notifications, which are only sent to the notification log and not shown as a push notification.
In addition to that, notifications can be updated later be re-using the same reference ID and hidden/removed either by reference ID or tag.
- Source:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
message |
string |
<optional> |
the body of the notification |
Returns:
- Type
- NotificationBuilder
(static) thingActions(bindingId, thingUid) → {*}
- Description:
Get the ThingActions of a given Thing.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
bindingId |
string | binding ID |
thingUid |
string | Thing UID |
Returns:
Native Java ThingActions
- Type
- *