ASUS Aura SDK v3.1 Developer's Guide
Python Tutorial

Since AURA SDK v3.1 provides OLE Automation mechanism (IDispatch), it is easy to use functions provided by AURA SDK v3.1 in scripting languages such as Python.

  1. Pywin32 extensions are required to use OLE Automation mechanism in Python. Please follow the instructions in pywin32's official page to install the extensions.
     
  2. The first thing to do in the Python script is to import win32com.client module:
    import win32com.client
     
  3. Use Dispatch() from win32com.client to create instance of AURA SDK. The ProgID aura.sdk.1 is used as the parameter to Dispatch():
    auraSdk = win32com.client.Dispatch("aura.sdk.1")
     
  4. After the instance of AuraSdk is created, we can aquire the control and then enumerated all AURA-compatible devices:

    auraSdk.SwitchMode()
    devices = auraSdk.Enumerate(0) # 0 means ALL

    The parameter passed into Enumerate() means the type of devices that should be enumerated. 0 means all types of devices. You can enumerate specific type of devices by passing other values. For details, please refer to reference of Enumerate() .  

  5. The devices returned by Enumerate() is a "collection" of all devices. Each device can be accessed via for-in loop:
    for dev in devices:
    # ....
     
  6. All LED's of a certain device can be accessed via the Lights property of the corresponding device. The Lights property is also a "collection", so the each LED can be easily accessed similar to the devices in a device collection. Besides that, it can also be accessed by indices, which is shown in the following code snippet.

    Now, lets set all the LED's color to blue by modifying the color property of each light. The data type of color property is 32-bit unsigned integer, and it's format is "0x00GGBBRR", where G equals Green, B equals Blue, and R equals Red. So "blue" should be 0x00FF0000:

    for dev in devices: # Use enumeration
    for i in range(dev.Lights.Count): # Use index
    dev.Lights(i).color = 0x0000FF00

    Note that besides color, there are also Red, Green and Blue properties in light object to set each color directly. Please refer to the reference chapter for more details.  

  7. If the device is a keyboard, we can access each LED by specifying its key code via Key property. The following code snippet set color of 'A', 'U' and 'R' to red:

    for dev in devices:
    # .....
    if dev.Type == 0x80000: # 0x80000 means KEYBOARD_RGB
    dev.Key(0x001E).color = 0x000000FF # 0x001E means A
    dev.Key(0x0016).color = 0x000000FF # 0x0016 means U
    dev.Key(0x0013).color = 0x000000FF # 0x0013 means R

    Please check (Enumerate())[AuraServiceLib::IAuraSdk::Enumerate()] for device type ID's and Appendix A for key code list.  

  8. After setting each LED's color of a device, the Apply() of device should be called to make the new settings take effect:
    for dev in devices:
    # ....
    # ....
    dev.Apply()
     
  9. Now you can run the script. All LED's on all AURA compatible devices (with proper HAL installed) should become blue, except 'A', 'U', 'R' on keyboards which should become red.