A rule is an association between an event
that occurs in a device
and a list of actions to take when the event occurs. Rules can be added to the system by the user from the Elve Management Studio application.
Each device driver
watches it's hardware or virtual device
for state changes known as events
. When an event occurs it scans all associated rules for eligibility based on the rule's whenever parameters
and then executes the rule's action list (or script
) if it is eligible.
Some events have whenever parameters
that can be set to filter when the rule's list of actions are run. For example the SqueezeCenter Driver
event has an optional Power
whenever parameter that can be set to only run the rule's action list when the player's power state has changed to the specified state. Since the Power
whenever parameter is optional, if it is not specified the rule will execute for any power state change. More advanced filtering can be done within the action list using conditions or conditional script statements.
Rules can be run concurrently, meaning multiple rules can be run simultaneously. A rule is run as soon as it's associated event is triggered and the whenever filter criteria matches, so more than one rule can be executing at any given time. The same rule can also be running concurrently with itself multiple times. This depends on when the rule is rune and how long it takes to complete.Examples:
- Set your security keypad text to the currently playing song when a change track event occurs.
- When your alarm system is armed to away mode it could turn all your lights off.
- At 6:30am on weekdays it could announce the days forecast.
- When the garage door is left open after daylight it could announce that.
- Play music when you come home.
- Turn on entryway lighting when you come home.