Previous Topic

Next Topic

Book Contents

Book Index

Rules

Rules List

There are three tabs of the Automation Web Console interface and the first of them is Rules. It opens a sortable table with the rule's UID and Name, its Status, Tags, Description, and the allowed Actions to perform on the rule. A rule appears in this list if it is successfully created after:

•   its bundle or file is installed/loaded
•   a REST or JSON-RPC request
•   a Web Console action:
         •   using the Add button mbs_au_adding_v92 under the Actions column
         •   using the Copy button mbs_au_rule_copy_v92 to create a similar rule, which can be easily updated
         •   using the Create rule button mbs_au_templ_rule_v92 from the Template tab

Some rules, provided to the system not via the Web Console, but by a file or a bundle, are updated or removed when the providing file/bundle is updated or uninstalled.

List of Automation Rules

Sort and Filter

To sort by column, click on the column title, if an icon with arrows is placed next to it. To filter rules, write the filtering text in the corresponding field or choose from the drop-down menu for Status, then click on the filter button automation_filter_icon or press Enter. To clear an applied filter, press the clear button automation_remove_icon. The Status descriptions are changed according to the actions applied.

The Web Console provides several buttons in the Actions column to manage the rules – Add, Details, Update, Copy, Create template, Remove, Disable/Enable and Run now. Their action is described in the following sections.

Rule Details

To view the available information of a particular rule click on its UID or on the Details button mbs_au_info_v92 from the end of the rule's raw. The table that opens is not editable. It contains General information and details about the Triggers and the Flow. If a Handler is used, a click on its UID provides more details, including its Inputs/Outputs.

mbs_au_ruleinfo_v10

Creating a Rule

To create a rule via the Web Console:

         •   use the action buttons of Add mbs_au_adding_v92 or Copy mbs_au_rule_copy_v92 under the Actions column of the Rules tab

         •   use the Create rule button mbs_au_templ_rule_v92 from the Templates tab. To learn more about this option refer to "Creating a Rule from a Template" from the Templates guide.

Adding a Rule

Clicking on the mbs_au_add_v92 button right under the Actions column opens up a page to fill in the empty fields for the general information of UID, Name, Description, Tags and with add buttons for adding Triggers and Flow.

mbs_au_add_rule_v10

In case of a wrong data format, an error message appears and the process of adding is not allowed:

mbs_au_rule_add_err_v92

How to add Triggers and Flow is described in the following sections below:

Adding Triggers

Before adding a trigger choose its type from the drop-down menu:

mbs_au_trigger_types_v92

After a click on the Add button mbs_au_adding_v92, a table appears. It corresponds to the type of the selected trigger – with empty input spaces or with available or proposed value and drop-down menus for choosing from existing options:

mbs_au_add_temp_v92

The fields marked with asterisk - *, are mandatory for successful rule execution..

Adding a Flow

To add a flow first choose one of the available Action or Condition handlers from the drop-down menu:

mbs_au_choosehandler_flow_v92

and then click on the Add button mbs_au_adding_v92 , which opens a suitable for editing table. To provide the data, corresponding the selected handler in the right format, use the help of tooltip, where available. The fields marked with asterisk - *, must not be left empty.

mbs_au_add_flow_v92

If more than one Action or Condition handlers are used, move up and down buttons appear for ordering the Flow table in a preferred way. After all data is filled in, a click on the Add button below saves the rule.

mbs_addflowforrule_v92

The fields marked with asterisk - *, are mandatory for successful rule execution.

Copying a Rule

The Web Console facilitates the process of creating new rules via the copying action:

mbs_au_copy_rule_v10.2

It provides the whole information of the original rule as in Add Rule window with an empty UID space for the new rule and with the same ability for adding a Trigger and a Flow as described above.

In case the UID field is left empty, the web console provides a system UID.

mbs_au_rule_copy_v10

If the user added UID is already in the system, an error message appears prompting for unique UID.

Updating a Rule

Every listed rule, created from the Web Console can be updated by using the button on the right side of the Rules tab. Updating a rule is similar to the adding a rule action, except that the UID cannot be changed:

mbs_au_rule_update_v10

Clicking on the Update button saves the operation if the data is provided in the right format, otherwise an error message appears, as mentioned above.

Using a Rule to Create a Template

You can use an existing rule to create a new template and then use it to easily create many similar rules.

In the example below a demo rule is used, which is available after installing the Automation Builtin Handlers Demo – com.prosyst.mbs.automation.builtin.handlers-demo. It appears as the Turn Off Heating rule in the web console:

mbs_template_from_rule_create_v10.2

Pressing the Create template button mbs_au_templ_rule_v92 opens the Create template page where you can:

As a result you will have a new template, which will be listed in the Templates tab. For the JSON representation of the template above, refer to "Turn Off Heating Template Example" section from the Template JSON Examples.

Removing a Rule

To remove a rule use the button. A new window appears prompting for confirmation:

mbs_au_remove_rule_v92

Rule Actions

The possible actions are situated in the column on the far right.

Enable/Disable Rule

To enable/disable a rule, check/uncheck the checkbox automation_ui_enable_disable_icon in the Actions column. The checkbox shows whether a rule is enabled or disabled and the Status is changed accordingly to RESOLVED or DISABLED.

Run Now a Rule

To execute the flow of actions in the rule immediately use the Run now button automation_run_icon.