Download source PDF Page last generated on 22:11, 27 November 2015 Github 
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 "rules": {
2 "rule_name": {
3 "rule": "IF switch.state IS on THEN switch DEVICE switch.state TO off",
4 "active": 1
5 }
6 }
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.