RulesΒΆ

Warning

Make sure pilight is not running before editing your configuration or else all changes will be lost.

Since pilight version 6, eventing has been introduced. To use events, you need to first define rules inside the pilight configuration.

The basic pilight rule structure for the configuration looks like this:

1
2
3
4
5
6
7
8
{
  "rules": {
    "rule_name": {
      "rule": "IF switch.state == on THEN switch DEVICE switch.state TO off",
      "active": 1
    }
  }
}

As you can see, a rules object consists of various elements:

  1. Each rule is placed in its own object with a unique identifier.
  2. Each rule consists of the actual rule placed in the rule field.
  3. Each rule consists of an active field that tells pilight if the rule is active or not.

You can of course define as many rules as you like.