# Trigger từ keypad điều khiển

**Using a 3rd Party Lighting Controller Keypad to Control Services**

**State Trigger Programming Guide - Application Note**

| Document Date:     | December 2014  |
| ------------------ | -------------- |
| Document Supports: | da Vinci 7.0.1 |

**Overview**

The following document provides an example for programming third party lighting controller keypad buttons to control volume up and down. Lutron lighting controllers are a common use case for this, but other third party lighting controllers use the same procedure. To control services using a Savant lighting system, see [Keypad Manager: RacePoint Blueprint Programming Guide](https://community.savant.com/Customers/articles/Support_Article/Keypad-Manager-RacePoint-Blueprint-Programming-Guide-1424474387282).

There will be four (4) triggers created for each service.

* **VolumeUp**: Press and release for incrementing the volume up by one (1).
* **VolumeDown**: Press and release for incrementing the volume down by one (1).
* **VolumeUpRamp**: Press and hold to ramp the volume up while the button is being held.
* **VolumeDownRamp**: Press and hold to ramp the volume down while the button is being held.

**Example: Controlling Volume for a Service**

In this example we will create a trigger to control the volume of a service including the ability to ramp the volume up or down. After following this example, control of other services can be configured by creating more triggers.

**Determining Button State**

The example in this document, will use the available states for a particular lighting system. While all lighting systems contain states that can be used, the name in the example may be different or the state may not exist. System Monitor can be used to determine the states that are available.

1. Open the Savant Application Manager (SAM).
2. Select and activate the release that matches the one running on the system host.
3. Select **System Monitor** in the right menu.
4. In the open **System Monitor** window, double click on a host in the list.
5. Select **System State** in the left menu.
6. Scroll through the list of states and locate the state for the lighting controller.
7. Locate the state for button presses and record the names.
8. If creating a trigger to ramp the volume (press and hold), write down the state value for a **CurrentButtonState** or equivalent name.

**Creating a Press and Release Trigger (Volume Step)**

Use these steps to create triggers to increase and decrease the volume of a service with a press and release of a keypad button. The volume of the service will be raised or lowered by a single step each time the button is pressed.

Triggers are created in the **State Trigger** dialog located in the **Tools > Review** menu within Blueprint. For more information on the use of this dialog, see [State Trigger Overview: State Trigger Programming Guide](https://community.savant.com/Customers/articles/Support_Article/State-Trigger-Overview-State-Trigger-Programming-Guide-1423469857424).

1. Create a trigger with the name **MediaVolumeUp**. Replace **Media** with the service being used for this trigger. Example: **CDVolumeUp**
2. Add the state of the keypad button to the **if (rules)**
3. In the SRS upper list, navigate to: **Component > Lighting Controller**
4. In the SRS lower list, select **IsButtonPressed** in the States. Replace **IsButtonPressed** with the state name that was recorded during the Determining Button State process.
5. In the **Identifier** panel, double click **Value** for **Button Number** and enter the appropriate value.
6. In the **Identifier** panel, double click **Value** for **Station Number** and enter the appropriate value.

!\[Graphical user interface, text, application, chat or text message

Description automatically generated]\(<https://4108119883-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Faicontrol%2F-MlOqIT9IXHnBHlXfCPB%2F-MlOrESccOaxV3D4PW4j%2F0.png?generation=1633595226611562\\&alt=media>)

1. Drag the state into the **if (rules)** list.

!\[Graphical user interface, text, application, chat or text message

Description automatically generated]\(<https://4108119883-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Faicontrol%2F-MlOqIT9IXHnBHlXfCPB%2F-MlOrESdY4uaB56fWjJn%2F1.png?generation=1633595226609114\\&alt=media>)

1. Set **Test Condition** to **is true**.
2. Add the Volume Up service to the **Then** actions list.
3. In the SRS upper list, navigate to: **Service > \[Component to Control]**
4. In the SRS lower list, select **VolumeUp** in the in the **States** tab and drag it into the **Then** action list.
5. Repeat steps 1 to 3 to create a **MediaVolumeDown** trigger.
6. Click **Save** to save the trigger and close the **State Triggers** dialog.

**Creating a Press and Hold Trigger (Volume Ramping)**

Use these steps to create triggers to raise and lower the volume of a service with a press and hold of a keypad button. The volume of the service will ramp up or down for as long as the button is held.

1. Create a trigger with the name **MediaVolumeUpRamp**. Replace **Media** with the service being used for this trigger. Example: **CDVolumeUpRamp**
2. Add the state of the keypad button to the **if (rules)**
3. In the SRS upper list, navigate to: **Component > Lighting Controller**
4. In the SRS lower list, select **CurrentButtonState** in the States. Replace **CurrentButtonState** with the state name that was discovered during the Determining Button State process.
5. In the **Identifier** panel, double click **Value** for **Button Number** and enter the appropriate value.
6. In the **Identifier** panel, double click **Value** for **Station Number** and enter the appropriate value.

!\[Graphical user interface, text, application, chat or text message

Description automatically generated]\(<https://4108119883-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Faicontrol%2F-MlOqIT9IXHnBHlXfCPB%2F-MlOrESebflQ64slsYfg%2F2.png?generation=1633595226588722\\&alt=media>)

1. Drag the state into the if (rules) list.

!\[Graphical user interface, text, application, chat or text message

Description automatically generated]\(<https://4108119883-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Faicontrol%2F-MlOqIT9IXHnBHlXfCPB%2F-MlOrESfiJvr09McFm2w%2F3.png?generation=1633595226594646\\&alt=media>)

1. Set **Test Condition** to **Is Equal** and **Value** to **HELD**. Replace HELD with the state value for the current button state that was recorded during the **Determining Button State** process.
2. Add the **Volume Up** service to the **Then** actions.
3. In the SRS upper list, navigate to: **Service > \[Component to Control]**
4. In the SRS lower list, select **VolumeUp** in the States.
5. In order to have the volume ramp, monitoring of the **CurrentButtonState** needs to be repeated until the button is no longer pressed. Set **Run the Following Actions** to **Repeat every/until false** and a repeat time in the **every:** field. The time for the repeat will vary from system to system. Start with **.2** and increase or decrease as needed.

![](https://4108119883-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Faicontrol%2F-MlOqIT9IXHnBHlXfCPB%2F-MlOrESgJzCHB7lLTglt%2F4.png?generation=1633595226593012\&alt=media)

1. Repeat steps 1 to 3 to create a **MediaVolumeDownRamp** trigger.
2. Click **Save** to save the trigger and close the **State Triggers** dialog.
