Rules
A Rule consists of a Name, a unique ID and optional Triggers, Conditions and Actions. Rules are the fundament for Scenes and Time based actions.

A binding or service, installed via the Add-ons screen, might add more Triggers, Conditions or Actions to the table.
Triggers
Defines the events when the Rule will trigger. Triggers may have Outputs. You can connect those to Inputs of Conditions and Actions.
Some triggers are part of the core installation
Trigger Type | What it does |
---|---|
A trigger channel fires | Triggers a Rule when a Channel trigger fires such as is used in the Dash Button binding or Astro binding for astronomical events. Both the Channel and the event can be defined. |
An item state changes | Triggers the Rule when the selected Item changes state. One can optionally define the previous state and new state. |
An item receives a command | Triggers the Rule when the selected Item receives a command. One can optionally define the command received. |
An item state is updated | Triggers the Rule when the selected Item receives an update. One can optionally define the update received. |
It is a fixed time of day | Sets the Rule to trigger at a specific time of day every day. |
The rule is activated | Triggers when a rule is activated the first time. This causes the Rule to trigger when it is first loaded by OH. |
Conditions
Defines the conditions under which the Rule will run when triggered. If you define more than one condition, all conditions have to pass.
Some conditions are part of the core installation
Condition Type | What it does |
---|---|
An item has a given state | Select the Item, comparison operator, and the value to compare against. For example, MyTemperature Item >= (is greater or equal to) 20. |
A given script* evaluates to true | A script to execute whose last line evaluates true or false. If the that line is true, the rule will be allowed to run (assuming all the other defined conditions are also true). Currently only JavaScript is supported. Everything available to the Action Script is available here as well. The Script just needs to return true or false. |
It is a certain day of the week | Allows one to select the day of the week that it must be for the Rule to run. This combined with “it is a fixed time of day” allows one to write Rules that trigger at a certain time on certain days. |
Actions
Defines what actions the Rule takes when it runs. Actions are performed in the order they are listed in the Rule. Actions may have Outputs. You can connect those to Inputs of other Actions, that are executed later in the execution order.
Some actions are part of the core installation
Action Type | What it does |
---|---|
Send a command | Allows one to send a command to an Item when the Rule runs. This can be very useful for creating links between proxy Items and device Items. |
Run rules | Allows the triggering of other Rule(s) to run when this Rule triggers. |
Enables or disable rules | Enable or disable Rule(s). This is useful to create “away mode” type Rule sets as they can be enabled/disabled based on events. |
Execute a given script* | Define a Script to execute when the Rule runs. |
Play a sound | Send a sound to the selected audio sink. |
Say something | Send Text-to-speech to the selected audio sink. The text is statically defined but you can generate dynamic text in a script. |
You can list, create and modify Rules on the Rules page.
Scripts in Rules
With Rules, Profiles and Transformations you can handle about 98% of your automation needs. Very advanced, unusual or complex scenarios might require a scripted solution though.
A Script is more powerful, but also harder to edit, maintain and process for openHAB. Multiple programming languages are supported: Jython (Python 2.6 dialect), JavaScript, or Groovy (Java dialect).