Overview
The goal of this guide is to show simple and useful use cases of the automation system handlers via the Automation Built-in Handlers Demo. It contains 5 rules and each of them is designed to use a combination of different triggers, conditions and actions in order to show how to build useful rules.
There are rules which help us to save money from heating, to make our home more comfortable, or just to provide us with more free time.
All of the rules operate on items which can be found in most of the smart homes and to do things like:
The rule definitions can be found in src/main/resources/OSGI-INF/automation/rules.
The functional items are defined in com.prosyst.mbs.demo.automation.builtin.handlers.items.
Trigger Handler Factories
Event Trigger
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
topicFilter |
GENERIC |
[java.lang.String] |
Required |
Event Topic Filter |
Defines event topic filter. |
propertiesFilter |
GENERIC |
[java.lang.String] |
Optional |
Event Properties LDAP Filter |
Defines event properties LDAP filter. |
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
topic |
GENERIC |
[java.lang.String] |
Required |
Event Topic |
Provides the dispatched event topic. |
properties |
ANY |
[java.util.Map, *] |
Required |
Event Properties |
Provides the dispatched event properties. |
The trigger.Event handler can be explored in the TurnOnLights.json file from the Automation Built-in Handlers Demo, placed in ../osgi/demo/com.prosyst.mbs.automation.builtin.handlers-demo/src/main/resources/OSGI-INF/automation/rules folder.
Sun Position Trigger
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
event |
ENUM |
[java.lang.String] |
Required |
Sun Event |
Defines sun event – sunrise or sunset. Options:
|
offset |
GENERIC |
[java.lang.String] |
Optional |
Time Offset |
Defines time offset, relative to sunset or sunrise. The format is '+/-HH:mm:ss'. Pattern: |
The trigger.SunPosition handler can be explored in the WaterLawn.json file from the Automation Built-in Handlers Demo, placed in ../osgi/demo/com.prosyst.mbs.automation.builtin.handlers-demo/src/main/resources/OSGI-INF/automation/rules folder.
Repeating Time Trigger
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
frequency |
ENUM |
[java.lang.String] |
Required |
Frequency |
Defines repeating time events based on interval of minute, hour, day, week, month or year. Options:
|
seconds |
NUMERIC |
[java.util.Set, java.lang.Integer] |
Optional |
Seconds |
Defines a set of seconds within a minute:
|
minutes |
NUMERIC |
[java.util.Set, java.lang.Integer] |
Optional |
Minutes |
Defines a set of minutes within an hour:
|
hours |
NUMERIC |
[java.util.Set, java.lang.Integer] |
Optional |
Hours |
Defines a set of hours of a day:
|
months |
NUMERIC |
[java.util.Set, java.lang.Integer] |
Optional |
Months |
Defines a set of months of a year.
|
daysOfWeek |
ENUM |
[java.util.Set, java.lang.String] |
Optional |
Days of Week |
Defines a set of days of a week. Options:
|
daysOfMonth |
NUMERIC |
[java.util.Set, java.lang.Integer] |
Optional |
Days of Month |
Defines a set of days of a month:
|
The trigger.RepeatingTime handler can be explored in the TurnOffHeating.json file from the Automation Built-in Handlers Demo, placed in ../osgi/demo/com.prosyst.mbs.automation.builtin.handlers-demo/src/main/resources/OSGI-INF/automation/rules folder.
Item Property Changed Trigger
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
uid |
GENERIC |
[java.lang.String] |
Optional |
Item UID |
Defines item UID for the filter. |
name |
GENERIC |
[java.lang.String] |
Optional |
Item Name |
Defines item name for the filter. |
tags |
GENERIC |
[java.util.Set, java.lang.String] |
Optional |
Item Tags |
Defines item tags for the filter. |
objectClass |
GENERIC |
[java.lang.String] |
Optional |
Item Object Class |
Defines item object class for the filter. |
propertyName |
GENERIC |
[java.lang.String] |
Required |
Item Property Name |
Defines item property name. |
attributes |
ANY |
[java.util.Map, *] |
Optional |
Item Attributes |
Defines item attributes for the filter. |
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
uid |
GENERIC |
[java.lang.String] |
Required |
Item UID |
Provides Item UID. |
name |
GENERIC |
[java.lang.String] |
Required |
Item Name |
Provides item name. |
tags |
GENERIC |
[java.util.Set, java.lang.String] |
Required |
Item Tags |
Provides item tags. |
objectClass |
GENERIC |
[java.util.List, java.lang.String] |
Required |
Item Object Class |
Provides item object classes. |
propertyName |
GENERIC |
[java.lang.String] |
Required |
Item Property Name |
Provides item property name from property changed event. |
attributes |
ANY |
[java.util.Map, *] |
Required |
Item Attributes |
Provides item attributes. |
newValue |
ANY |
[*] |
Required |
Item Property New Value |
Provides item property new value from property changed event. |
oldValue |
ANY |
[*] |
Required |
Item Property Old Value |
Provides item property old value from property changed event. |
The trigger.ItemPropertyChanged handler can be explored in the CloseBlinds.json file from the Automation Built-in Handlers Demo, placed in ../osgi/demo/com.prosyst.mbs.automation.builtin.handlers-demo/src/main/resources/OSGI-INF/automation/rules folder.
Item Operation Executed Trigger
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
uid |
GENERIC |
[java.lang.String] |
Optional |
Item UID |
Defines item UID for the filter. |
name |
GENERIC |
[java.lang.String] |
Optional |
Item Name |
Defines item name for the filter. |
tags |
GENERIC |
[java.util.Set, java.lang.String] |
Optional |
Item Tags |
Defines item tags for the filter. |
objectClass |
GENERIC |
[java.lang.String] |
Optional |
Item Object Class |
Defines item object class for the filter. |
operationName |
GENERIC |
[java.lang.String] |
Required |
Item Event Operation Name |
Defines item event operation name. |
attributes |
ANY |
[java.util.Map, *] |
Optional |
Item Attributes |
Defines item attributes for the filter. |
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
uid |
GENERIC |
[java.lang.String] |
Required |
Item UID |
Provides item UID. |
name |
GENERIC |
[java.lang.String] |
Required |
Item Name |
Provides item name. |
tags |
GENERIC |
[java.util.Set, java.lang.String] |
Required |
Item Tags |
Provides item tags. |
objectClass |
GENERIC |
[java.util.List, java.lang.String] |
Required |
Item Object Class |
Provides item object classes. |
operationName |
GENERIC |
[java.lang.String] |
Required |
Item Operation Name |
Provides item operation name from operation executed event. |
attributes |
ANY |
[java.util.Map, *] |
Required |
Item Attributes |
Provides item attributes. |
The trigger.ItemOperationExecuted handler can be explored in the DimLights.json file from the Automation Built-in Handlers Demo, placed in ../osgi/demo/com.prosyst.mbs.automation.builtin.handlers-demo/src/main/resources/OSGI-INF/automation/rules folder.
Condition Handlers
Sun Position Condition
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
event |
ENUM |
[java.lang.String] |
Required |
Sun Event |
Defines sun event – sunrise or sunset. Options:
|
offset |
GENERIC |
[java.lang.String] |
Optional |
Time Offset |
Defines time offset, relative to sunset or sunrise. The format is '+/-HH.mm.ss'. Pattern: |
operation |
ENUM |
[java.lang.String] |
Required |
Operation |
Defines when condition is satisfied –- before or after sunrise or sunset. Options:
|
The condition.SunPosition handler can be explored in the TurnOnLights.json file from the Automation Built-in Handlers Demo, placed in ../osgi/demo/com.prosyst.mbs.automation.builtin.handlers-demo/src/main/resources/OSGI-INF/automation/rules folder.
Script Condition
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
source |
GENERIC |
[java.lang.String] |
Required |
Source |
Defines script path or expression. If there are expressions using a "context" binding, consider changing them accordingly, since this binding is going to be deprecated and removed soon. |
arguments |
ANY |
[*] |
Optional |
Arguments |
Defines the script arguments. |
language |
GENERIC |
[java.lang.String] |
Optional |
Language |
Defines which script engine will be used for execution. |
external |
GENERIC |
boolean |
Optional |
External |
Defines if a source is a script path or an expression. |
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
result |
ANY |
[*] |
Optional |
Result |
Provides the executed script result. |
Comparator Condition
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
operation |
ENUM |
[java.lang.String] |
Required |
Operation |
Defines comparable operation. Options:
|
leftOperand |
ANY |
[*] |
Required |
Left Operand |
Provides left operand. |
rightOperand |
ANY |
[*] |
Required |
Right Operand |
Provides right operand. |
The condition.Comparator handler can be explored in the CloseBlinds.json and DimLights.json files from the Automation Built-in Handlers Demo, placed in ../osgi/demo/com.prosyst.mbs.automation.builtin.handlers-demo/src/main/resources/OSGI-INF/automation/rules folder.
Repeating Time Condition
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
seconds |
NUMERIC |
[java.util.Set, java.lang.Integer] |
Optional |
Seconds |
Defines a set of seconds within a minute:
|
minutes |
NUMERIC |
[java.util.Set, java.lang.Integer] |
Optional |
Minutes |
Defines a set of minutes within an hour:
|
hours |
NUMERIC |
[java.util.Set, java.lang.Integer] |
Optional |
Hours |
Defines a set of hours of a day:
|
months |
NUMERIC |
[java.util.Set, java.lang.Integer] |
Optional |
Months |
Defines a set of months of year:
|
daysOfMonth |
NUMERIC |
[java.util.Set, java.lang.Integer] |
Optional |
Days of Months |
Defines a set of days of month:
|
daysOfWeek |
ENUM |
[java.util.Set, java.lang.String] |
Optional |
Days of Week |
Defines a set of days of week. Options:
|
The condition.RepeatingTime handler can be explored in the WaterLawn.json file from the Automation Built-in Handlers Demo, placed in ../osgi/demo/com.prosyst.mbs.automation.builtin.handlers-demo/src/main/resources/OSGI-INF/automation/rules folder.
Action Handlers
Item Get Property Action
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
uid |
GENERIC |
[java.lang.String] |
Optional |
Item UID |
Defines item UID for the filter. |
name |
GENERIC |
[java.lang.String] |
Optional |
Item Name |
Defines item name for the filter. |
tags |
GENERIC |
[java.util.Set, java.lang.String] |
Optional |
Item Tags |
Defines item tags for the filter. |
objectClass |
GENERIC |
[java.lang.String] |
Optional |
Item Object Class |
Defines item object class for the filter. |
attributes |
ANY |
[java.util.Map, *] |
Optional |
Item Attributes |
Defines item attributes for the filter. |
propertyName |
GENERIC |
[java.lang.String] |
Required |
Item Property |
Defines item property name. |
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
uid |
GENERIC |
[java.lang.String] |
Required |
Item UID |
Provides item UID. |
name |
GENERIC |
[java.lang.String] |
Required |
Item Name |
Provides item name. |
tags |
GENERIC |
[java.util.Set, java.lang.String] |
Required |
Item Tags |
Provides item tags. |
objectClass |
GENERIC |
[java.util.List, java.lang.String] |
Required |
Item Object Class |
Provides item object classes. |
attributes |
ANY |
[java.util.Map, *] |
Required |
Item Attributes |
Provides item attributes. |
value |
ANY |
[*] |
Required |
Item Property Value |
Provides item property value. |
The action.ItemGetProperty handler can be explored in the DimLights.json file from the Automation Built-in Handlers Demo, placed in ../osgi/demo/com.prosyst.mbs.automation.builtin.handlers-demo/src/main/resources/OSGI-INF/automation/rules folder.
Item Invoke Operation Action
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
uid |
GENERIC |
[java.lang.String] |
Optional |
Item UID |
Defines UID for the filter. |
name |
GENERIC |
[java.lang.String] |
Optional |
Item Name |
Defines item name for the filter. |
tags |
GENERIC |
[java.util.Set, java.lang.String] |
Optional |
Item Tags |
Defines item tags for the filter. |
objectClass |
GENERIC |
[java.lang.String] |
Optional |
Item Object Class |
Defines item object class for the filter. |
attributes |
ANY |
[java.util.Map, *] |
Optional |
Item Attributes |
Defines item attributes for the filter. |
operationName |
GENERIC |
[java.lang.String] |
Required |
Item Operation |
Defines item operation name |
arguments |
ANY |
*[] |
Optional |
Item Operation Arguments |
Defines array of arguments. |
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
uid |
GENERIC |
[java.lang.String] |
Required |
Item UID |
Provides item UID. |
name |
GENERIC |
[java.lang.String] |
Required |
Item name |
Provides item name. |
tags |
GENERIC |
[java.util.Set, java.lang.String] |
Required |
Item Tags |
Provides item tags. |
objectClass |
GENERIC |
[java.util.List, java.lang.String] |
Required |
Item Object Class |
Provides item object class. |
attributes |
ANY |
[java.util.Map, *] |
Required |
Item Attributes |
Provides item attributes. |
result |
ANY |
[*] |
optional |
Item Operation Result |
Provides the item operation result. |
The action.ItemInvokeOperation handler can be explored in the CloseBlinds.json , TurnOffHeating.json, TurnOnLights.json, and in the WaterLawn.json files from the Automation Built-in Handlers Demo, placed in ../osgi/demo/com.prosyst.mbs.automation.builtin.handlers-demo/src/main/resources/OSGI-INF/automation/rules folder.
History Remove Entry Action
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
startId |
NUMERIC |
[long] |
Optional |
Query Start Identifier |
Defines the selection first entry unique identifier, inclusive.
|
endId |
NUMERIC |
[long] |
Optional |
Query End Identifier |
Defines the selection last entry unique identifier, inclusive.
|
startTime |
NUMERIC |
[long] |
Optional |
Query Start Time |
Defines the selection start time, inclusive.
|
endTime |
NUMERIC |
[long] |
Optional |
Query End Time |
Defines the selection end time, inclusive.
|
limit |
NUMERIC |
[int] |
Optional |
Query Limit |
Defines maximum number of entries to be removed.
|
namespaceFilter |
GENERIC |
[java.lang.String] |
Required |
Query Namespace Filter |
Defines history entries namespace filter. It can start with a prefix and end with *. |
tokensFilter |
GENERIC |
[java.lang.String] |
Optional |
Query Tokens Filter |
Defines the tokens LDAP filter of the removed entries. |
orderBy |
ENUM |
[java.lang.String[]] |
Optional |
Query Order By |
Defines the order by the option of the removed entries: Options:
|
Item Set Property Action
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
uid |
GENERIC |
[java.lang.String] |
Optional |
Item UID |
Defines item UID for the filter. |
name |
GENERIC |
[java.lang.String] |
Optional |
Item Name |
Defines item name for the filer. |
tags |
GENERIC |
[java.util.Set, java.lang.String] |
Optional |
Item Tags |
Defines item tags for the filter. |
objectClass |
GENERIC |
[java.lang.String] |
Optional |
Item Object Class |
Defines item object class for the filter. |
attributes |
ANY |
[java.util.Map, *] |
Optional |
Item Attributes |
Defines item attributes for the filter. |
propertyName |
GENERIC |
[java.lang.String] |
Required |
Item Property |
Defines item property name |
value |
ANY |
[*] |
Required |
Item Property Value |
Defines item property value. |
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
uid |
GENERIC |
[java.lang.String] |
Required |
Item UID |
Provides item UID. |
name |
GENERIC |
[java.lang.String] |
Required |
Item Name |
Provides item name. |
tags |
GENERIC |
[java.util.Set, java.lang.String] |
Required |
Item tags. |
Provides item tags. |
objectClass |
GENERIC |
[java.util.List, java.lang.String] |
Required |
Item Object Class |
Provides item object classes. |
attributes |
ANY |
[java.util.Map, *] |
Required |
Item Attributes |
Provides item attributes. |
The action.ItemSetProperty handler can be explored in the DimLights.json file from the Automation Built-in Handlers Demo, placed in ../osgi/demo/com.prosyst.mbs.automation.builtin.handlers-demo/src/main/resources/OSGI-INF/automation/rules folder.
Script Action
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
source |
GENERIC |
[java.lang.String] |
Required |
Source |
Defines the script path or expression. If there are expressions using a "context" binding, consider changing them accordingly, since this binding is going to be deprecated and removed soon. |
arguments |
ANY |
[*] |
Optional |
Arguments |
Defines the script arguments. |
language |
GENERIC |
[java.lang.String] |
Optional |
Language |
Defines which script engine will be used for execution. |
external |
GENERIC |
boolean |
Optional |
External |
Defines if the source is a script path or an expression. |
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
result |
ANY |
[*] |
Optional |
Result |
Provides the executed script result. |
History Add Entry Action
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
value |
ANY |
[*] |
Required |
History Entry Value |
Defines history entry values. |
timestamp |
NUMERIC |
[long] |
Optional |
History Entry Timestamp |
Defines the timestamp when this entry is added.
|
namespace |
GENERIC |
[java.lang.String] |
Required |
History Entry Namespace |
Defines history entry namespace. Pattern: |
tokens |
GENERIC |
[java.util.Map, java.lang.String] |
Optional |
History Entry Tokens |
Defines the tokens as a Map<String, String> of the new entry. |
ID |
Type |
Classes |
Required / |
Name |
Description |
|---|---|---|---|---|---|
id |
NUMERIC |
[long] |
Required |
History Entry Identifier |
Provides the added entry unique identifier.
|