forked from openhab/openhab-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from florian-h05/rules-rework-1
Add Rules Concepts page
- Loading branch information
Showing
1 changed file
with
40 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,53 @@ | ||
# Cover generic rules concepts | ||
# Rules Concepts | ||
|
||
Pull stuff from the Getting Started Tutorial. | ||
openHAB is about home automation, but to create home automation we need to define rules. | ||
|
||
{::options toc_levels="2..4"/} | ||
|
||
- TOC | ||
{:toc} | ||
|
||
## What Are Rules | ||
|
||
You can think of rules as routines or behaviours for your smart home. | ||
|
||
Many people have a routine when they wake up in the morning: make the bed, make coffee, make and eat breakfast, brush their teeth, etc. | ||
Similarly your smart home can have a routine: when the sun rises raise the blinds and adjust the temperature. | ||
Another routine could be to turn off all the lights and turn down the temperature when you leave home: | ||
openHAB can do that for you. | ||
There is no need to open your app and switch of the lights manually. | ||
Do you want to hear your favorite music when you arrive back at home? | ||
No problem, openHAB can do that for you too. | ||
Rules can also remind you of things, for example, that you opened the window hours ago and forgot that it is open? | ||
openHAB can send a notification to your phone. | ||
|
||
## Parts of a Rule | ||
|
||
### Triggers | ||
These rules take the high level form of *When __t__ happens, if __c__ then do __a__*, | ||
where __t__ are the _triggers_ that cause the rule run, | ||
__c__ are the _conditions_ that must be true for the rule to run, and __a__ are _actions_ to perform when the rule is triggered and allowed to run. | ||
Note that both __t__ and __c__ can be optional. | ||
|
||
To work with the *When __t__ happens, if __c__ then do __a__* principle, openHAB rules consist of three parts: | ||
|
||
| Name | Rule Part | Purpose | | ||
|-------------|----------------------|----------------------------------------------------------| | ||
| `Trigger` | *When __t__ happens* | Causes the rule run when the defined event happens. | | ||
| `Condition` | *if __c__* | Which condition has to be met that the rule really runs? | | ||
| `Action` | *then do __a__* | What should be done when the rule runs? | | ||
|
||
### Conditions | ||
Any single rule is not required to have all of these (although a rule without an action is not very sensible). | ||
An individual rule can also have more than one of each. | ||
|
||
### Script Actions | ||
A rule that should always run when triggered will have zero conditions. | ||
An individual rule can respond to several different triggers by having multiple different triggers set up. | ||
|
||
### Available Values | ||
Even though it might not seem sensible first, as the rule would never run on it's own, one can also have a rule with no triggers. | ||
But why would somebody want such a rule? | ||
In some cases, it is useful to have a rule that is only manually triggered. | ||
Sometimes there is advantage in a rule that calls another rule. | ||
In both cases, the rule has no triggers and no conditions. | ||
|
||
formerly implicit variables | ||
|
||
### Helper Libraries | ||
|
||
### Templates | ||
How to find and install. | ||
How to write will be on a later page. | ||
|
||
### Comprehensive Examples |