Global

Members

(constant) ActionBuilder

Description:
Source:

(constant) RuleBuilder

Description:
Source:

Type Definitions

ConditionCallback() → {boolean}

Source:
Returns:

true if the condition is met, otherwise false

Type
boolean

EventObject

Description:
  • When a rule is triggered, the script is provided the event instance that triggered it. The specific data depends on the event type. The EventObject provides several information about that trigger.

    Note: Group****Triggers use the equivalent Item****Trigger as trigger for each member. Time triggers do not provide any event instance, therefore no property is populated.

Source:
Properties:
Name Type Description
oldState string

only for triggers.ItemStateChangeTrigger & triggers.GroupStateChangeTrigger: Previous state of Item or Group that triggered event

newState string

only for triggers.ItemStateChangeTrigger & triggers.GroupStateChangeTrigger: New state of Item or Group that triggered event

receivedState string

only for triggers.ItemStateUpdateTrigger & triggers.GroupStateUpdateTrigger: State that triggered event

receivedCommand string

only for triggers.ItemCommandTrigger, triggers.GroupCommandTrigger, triggers.PWMTrigger & triggers.PIDTrigger : Command that triggered event

itemName string

for all Item-related triggers: name of Item that triggered event

groupName string

for all Group****Triggers: name of the group whose member triggered event

receivedEvent string

only for triggers.ChannelEventTrigger: Channel event that triggered event

channelUID string

only for triggers.ChannelEventTrigger: UID of channel that triggered event

oldStatus string

only for triggers.ThingStatusChangeTrigger: Previous state of Thing that triggered event

newStatus string

only for triggers.ThingStatusChangeTrigger: New state of Thing that triggered event

status string

only for triggers.ThingStatusUpdateTrigger: State of Thing that triggered event

thingUID string

for all Thing-related triggers: UID of Thing that triggered event

cronExpression string

for triggers.GenericCronTrigger: cron expression of the trigger

time string

for triggers.TimeOfDayTrigger: time of day value of the trigger

timeOnly boolean

for triggers.DateTimeTrigger: whether the trigger only considers the time part of the DateTime Item

offset number

for triggers.DateTimeTrigger: offset in seconds added to the time of the DateTime Item

eventType string

for all triggers except triggers.PWMTrigger, triggers.PIDTrigger: Type of event that triggered event (change, command, time, triggered, update, time)

triggerType string

for all triggers except triggers.PWMTrigger, triggers.PIDTrigger: Type of trigger that triggered event

eventName string

for all triggers: simple Java class name of the triggering event

eventClass string

for all triggers: full Java class name of the triggering event

module string

(user-defined or auto-generated) name of trigger

raw *

original contents of the event including data passed from a calling rule

payload *

if provided by event: payload of event in Java data types

When a rule is triggered, the script is provided the event instance that triggered it. The specific data depends on the event type. The EventObject provides several information about that trigger.

Note: Group****Triggers use the equivalent Item****Trigger as trigger for each member. Time triggers do not provide any event instance, therefore no property is populated.

Type:
  • object

ItemConfig

Description:
  • configuration describing an Item

Source:
Properties:
Name Type Attributes Description
type string

the type of the Item

name string

Item name for the Item to create

label string <optional>

the label for the Item

category string <optional>

the category (icon) for the Item

groups Array:.<string:> <optional>

an array of groups the Item is a member of

tags Array:.<string:> <optional>

an array of tags for the Item

group object <optional>

group configuration, only applicable if type is Group

Properties
Name Type Attributes Description
type string

the type of the Group, such as Switch or Number

function string <optional>

the group function, such as 'EQUALITY' or AND

parameters Array:.<string:> <optional>

optional parameters for the group function, e.g. ON and OFF for the AND function

channels string | object <optional>

for single channel link a string or for multiple an object { channeluid: configuration }; configuration is an object

metadata * <optional>

either object { namespace: value } or { namespace: ItemMetadata }

format string <optional>

short form for the stateDescription metadata's pattern configuration

unit string <optional>

short form for the unit metadata's value

autoupdate boolean <optional>

short form for the autoupdate metadata's value

configuration describing an Item

Type:
  • object

RuleCallback(event)

Source:
Parameters:
Name Type Description
event EventObject

RuleConfig

Description:
  • Configuration object for rules.JSRule.

    A note about the `dedicatedContext` option: When this option is enabled, the `execute` callback runs in a separate dedicated context. Therefore, the `execute` callback can **not** access any variables, functions, classes or other objects defined outside the callback function. The benefit of this approach is that the rule does not share the context with any other rule from the same script file and therefore can run at any time without waiting for other rule executions to complete.

Source:
Properties:
Name Type Attributes Default Description
name string

name of the rule (used in UI)

description string <optional>

description of the rule (used in UI)

triggers HostTrigger | Array:.<HostTrigger:> <optional>

which will fire the rule

execute RuleCallback

callback to run when the rule fires

tags Array:.<string:> <optional>

tags for the rule (used in UI)

id string <optional>

UID of the rule, if not provided, one is generated

overwrite boolean <optional>
false

whether to overwrite an existing rule with the same UID

dedicatedContext boolean <optional>
false

whether to run the rule in a separate dedicated context

switchItemName string <optional>

(optional and only for SwitchableJSRule) name of the switch Item, which will get created automatically if it is not existent

ruleGroup string <optional>

(optional and only for SwitchableJSRule) name of an Item group to use for the switch Item, which will get created automatically if it is not existent

Configuration object for rules.JSRule.

A note about the `dedicatedContext` option: When this option is enabled, the `execute` callback runs in a separate dedicated context. Therefore, the `execute` callback can **not** access any variables, functions, classes or other objects defined outside the callback function. The benefit of this approach is that the rule does not share the context with any other rule from the same script file and therefore can run at any time without waiting for other rule executions to complete.

Type:
  • object