Rules in KRL can be thought of as the body of an if statement, with the "select when" being the condition.
Rules are used to;
- modify Picos states by setting entity variables and app variables.
- raise and send events with updated attributes.
KRL rule structure;
- "Select when"
- First control of logic, when this event assures do ....
- "pre block"
- used to make calculations for the if then conditions
- "action block"
- This block can include an if then statement.
- if this condition is met do some combination of actions.
- actions can include sending directives or events, things that have to happen as a result of this event.
This block can be, always, fired, notfired, else.
- this is where you set entity variables