thingsx
- Description:
Things namespace
This namespace provides access to external devices and services, which is usually functionality provided by bindings.
- Source:
Classes
Methods
(static) createReEnableThingWithItemRule(itemName, thingUID)
- Description:
Creates a rule that re-enables a Thing on command ON to a given Item.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
itemName |
string | |
thingUID |
string |
(static) createThingStatusNotificationRule(thingUID, recipientsopt, offlineDurationopt, onlineDurationopt, offlineMessageopt, onlineMessageopt)
- Description:
Creates a rule that sends a notification if a Thing goes offline and another one if it goes back online.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
thingUID |
string | |||
recipients |
Array.<string> |
<optional> |
the recipients of the notification: leave empty to send a broadcast notification or put the email addresses of the openHAB Cloud users to receive the notification |
|
offlineDuration |
number |
<optional> |
60
|
the duration to wait for the Thing to come back online before sending the offline notification |
onlineDuration |
number |
<optional> |
30
|
the duration to wait for the Thing to stay online before sending the online notification |
offlineMessage |
string |
<optional> |
'WARNUNG: %LABEL nicht mehr erreichbar (%STATUS)!'
|
the message to send when the Thing goes offline: use %UID, %LABEL, and %STATUS as placeholders for the respective values |
onlineMessage |
string |
<optional> |
'%LABEL wieder erreichbar.'
|
the message to send when the Thing goes back online: use %UID and %LABEL as placeholders for the respective values |
(static) createThingStatusToItemRule(groupName, patterns, replacements)
- Description:
Creates a rule that posts Thing statuses to String Items. The rule takes the name of a group of String Items, generates a Thing UID for each member Item using string replace operations, and then posts the Thing status on every Thing status change to the Items. The rule also runs when start level 100 is reached and regularly (every 5 minutes, starting with minute 0).
- Source:
Example
thingsx.createThingStatusRule('gYamahaState', ['_state', '_'], ['', ':']);
// This removes "_state" fromt the Item name and replaces all "_" with ":" to get the Thing UID from the members of the "gYamahaState" group members.
Parameters:
Name | Type | Description |
---|---|---|
groupName |
string | |
patterns |
string | Array.<string> | Pattern(s) to replace. |
replacements |
string | Array.<string> | String(s) that is/are used for replacing. |
(static) reEnableThing(thingUID)
- Description:
Re-enables a Thing by disabling, and then enabling it again.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
thingUID |
string |