Rule Engine: Overview and Introduction
SharpTools Rule Engine is a visual rule builder that can be used to create simple or powerful automations without any coding skills. Rules created in the Rule Engine can be triggered by events, time schedules or manually run from SharpTools dashboards.
Rule Engine supports multi-triggers, multi-If-conditions and multi-actions for users to create powerful automation in a simple interface.
For a nice introduction and overview to the Rule Engine in video format, check out the following video by SimplySmart on YouTube:
How to create automation rules in Rule Engine?
Rules can be created in the
SharpTools Rule Management page by clicking the "CREATE RULE" button below the rule list. From the rule creation interface, you can can name the rule, provide a description, and choose to disable or enable the rule. The Trigger(s) and Flow sections define how the rule will be kicked off and what actions it will execute.
What is a Trigger?
Triggers determine when to execute a rule. There are several types of triggers available including:
Event Triggers
- Device status change
Ex: light is turned on, motion is active, door is opened, or temperature is changed - Location event
Ex: Mode changed, Hubitat Safety Monitor (HSM) state change, etc - Variable value change
Ex: True/False variable changes state, text or numeric value changes - HTTP / Webhook (learn more)
Ex: Trigger from IFTTT, iOS Shortcuts, Tasker, Home Assistant, etc.
Timer Triggers
- Schedule at specific time of the day and on specific day of the week
- Schedule at sunrise/sunset with offset on specific day of the week
Multiple triggers can be added in the trigger section and when
ANY of the trigger conditions occurs the rule will be executed.
What is the Flow?
The Rule Flow is the set of activities that will occur when the rule is triggered. The Flow can consist of multiple activities including conditions, actions, and delays. There are several activities that can be added in the Flow section:
IF Condition
The IF Condition allows for powerful
If THIS, Then THAT style automations. IF Condition blocks can contain one ore more conditions with the option to specify if
ALL (AND) conditions must match or
ANY (OR) condition matches. If the condition evaluates to true, the rule will continue executing the activities in the
Then path, otherwise if it is false it will execute the activities in the
Else path. There are a variety of conditions that can be added in the IF Condition block:
- Device condition
Check a device attribute's status/value is as specified (is, is not, greater then, greater then or equal to, less than, less than or equal to, and stayed)
Ex: light switch status is on, door contact status has stayed open for 10 minutes, bulb level is greater than 50, or temperature sensor is less than 30 - Location condition
Check if the location's current mode or SHM/HSM status is as specified.
Ex: mode is 'Night', SHM/HSM is 'Armed away', etc - Day of the week
Check if the current day is the specific day of the week - Time of the day
Check if the current time is before or after a specific time or sunset/sunrise - Variable condition
Check if a custom variable or context variable is a specific value
IF Conditions can be added within another IF Condition to create nested condition logic
Action
- Device action
Ex: turn the light on, close the door, set thermostat level, play music to smart speaker and etc. - Location action
Ex: change mode status or change SHM/HSM status. - Notification
Send a SMS (Premium, US only), Twilio SMS (International), Email, Pushbullet, or Pushover notification. - Set Variable
Ex: store the triggering devices name in a variable or store the result of a condition - HTTP / Webhook (learn more)
Call a service on a third party website like IFTTT, WebCoRE, Voice Monkey and more
Delay
Pause the rule execution process for a certain period before continuing the next activity in the flow.