LogiLed#
Important
All function listed here return True if succeeds. The function will return False if the connection with Logitech Gaming Software was lost.
- class logi_led.LogitechLed[source]#
Note
The following class is the main class of library
- flash_lighting(red_percentage: int, green_percentage: int, blue_percentage: int, ms_duration: int, ms_interval: int)[source]#
Plays the flashing effect on the targeted devices by combining the RGB percentages, for a defined duration in milliseconds with a given interval.
- Parameters:
red_percentage (int) – Amount of red. Range is 0 to 100.
green_percentage (int) – Amount of green. Range is 0 to 100.
blue_percentage (int) – Amount of blue. Range is 0 to 100.
ms_duration (int) – Duration of effect in millisecond.
ms_interval (int) – Interval duration between each effect in millisecond.
- Raises:
RangeError – Raised if color percentage range is not correct
TypeError – Raised if bad type is passed as parameter
Tip
Specifying a ms_duration to 0 will cause the effect to be infinite until reset
- pulse_lighting(red_percentage: int, green_percentage: int, blue_percentage: int, ms_duration: int, ms_interval: int)[source]#
Pulses the lighting color of the combined RGB percentages, for a defined duration in milliseconds with a given interval.
- Parameters:
red_percentage (int) – Amount of red. Range is 0 to 100.
green_percentage (int) – Amount of green. Range is 0 to 100.
blue_percentage (int) – Amount of blue. Range is 0 to 100.
ms_duration (int) – Duration of effect in millisecond.
ms_interval (int) – Interval duration between each effect in millisecond.
- Raises:
RangeError – Raised if color percentage range is not correct
TypeError – Raised if bad type is passed as parameter
Tip
Specifying a ms_duration to 0 will cause the effect to be infinite until reset
- save_current_lighting()[source]#
Saves the current lighting so that it can be restored after a temporary effect is finished.
Note
On per-key backlighting supporting devices, this function will save the current state for each key.
- set_lighting(red_percentage: int, green_percentage: int, blue_percentage: int)[source]#
Sets the lighting on connected and supported devices.
- Parameters:
red_percentage (int) – Amount of red. Range is 0 to 100.
green_percentage (int) – Amount of green. Range is 0 to 100.
blue_percentage (int) – Amount of blue. Range is 0 to 100.
- Raises:
RangeError – Raised if color percentage range is not correct
TypeError – Raised if bad type is passed as parameter
- set_lighting_for_target_zone(zone: int, red_percentage: int, green_percentage: int, blue_percentage: int)[source]#
Sets lighting on a specific zone for all connected zonal devices that match the device type
- Parameters:
zone (int) – Zone id on target device
red_percentage (int) – Amount of red. Range is 0 to 100.
green_percentage (int) – Amount of green. Range is 0 to 100.
blue_percentage (int) – Amount of blue. Range is 0 to 100.
- Raises:
RangeError – Raised if color percentage range is not correct
TypeError – Raised if bad type is passed as parameter
- stop_effects()[source]#
Stops any of the presets effects (started from
flash_lighting()orpulse_lighting()).
Important
The following class contains a list of untested functions due to a lack of compatible hardware.
I can’t guarantee the proper functioning, but you can test them and report the errors meet through an issue
- class logi_led.NotTested[source]#
Warning
A list of untested functions, which can be used but for which we are not sure of the correct operation.
- flash_single_key(key_name: int, red_percentage: int, green_percentage: int, blue_percentage: int, ms_duration: int, ms_interval: int)[source]#
Plays the flashing effect on the key passed as parameter, by combining the RGB percentages, for a defined duration in milliseconds with a given interval.
Warning
This function only affects per-key backlighting featured connected devices.
- Parameters:
key_name (int) – The key to restore the color on.
red_percentage (int) – Amount of red. Range is 0 to 100.
green_percentage (int) – Amount of green. Range is 0 to 100.
blue_percentage (int) – Amount of blue. Range is 0 to 100.
ms_duration (int) – Duration of effect in millisecond.
ms_interval (int) – Interval duration between each effect in millisecond.
- Raises:
RangeError – Raised if color percentage range is not correct
TypeError – Raised if bad type is passed as parameter
Tip
Specifying a ms_duration to 0 will cause the effect to be infinite until reset
- pulse_single_key(key_name: int, red_percentage_start: int, green_percentage_start: int, blue_percentage_start: int, ms_duration: int, is_infinite: bool = False, red_percentage_end: int = 0, green_percentage_end: int = 0, blue_percentage_end: int = 0)[source]#
Starts a pulsing effect on the key passed as parameter. The key will be pulsing with from start color to finish color for msDuration milliseconds.
Warning
This function only affects per-key backlighting featured connected devices.
- Parameters:
key_name (int) – The key to restore the color on.
red_percentage_start (int) – Amount of red in the start color of the effect. Range is 0 to 100.
green_percentage_start (int) – Amount of green in the start color of the effect. Range is 0 to 100.
blue_percentage_start (int) – Amount of blue in the start color of the effect. Range is 0 to 100.
ms_duration (int) – Duration of effect in millisecond.
is_infinite (bool) – If set to True, it will loop infinitely until stopped with a called to
stop_effects_on_key()orstop_effectsred_percentage_end (int) – Amount of red in the finish color of the effect. Range is 0 to 100.
green_percentage_end (int) – Amount of green in the finish color of the effect. Range is 0 to 100.
blue_percentage_end (int) – Amount of blue in the finish color of the effect. Range is 0 to 100.
- Raises:
RangeError – Raised if color percentage range is not correct
TypeError – Raised if bad type is passed as parameter
- restore_lighting()[source]#
Restores the last saved lighting. It should be called after a temporary effect is finished.
Note
On per-key backlighting supporting devices, this function will restore the saved state for each key
- restore_lighting_for_key(key_name: int)[source]#
Restores the saved color on the key passed as argument. Use this function with the
save_lighting_for_key()to preserve the state of a key before applying any effect.Warning
This function only affects per-key backlighting featured connected devices.
- Parameters:
key_name (int) – The key to restore the color on.
- Raises:
TypeError – Raised if bad type is passed as parameter
- save_lighting_for_key(key_name: int)[source]#
Saves the current color on the keycode passed as argument. Use this function with the
restore_lighting_for_key()to preserve the state of a key before applying any effect.Warning
This function only affects per-key backlighting featured connected devices.
- Parameters:
key_name (int) – The key to save the color for.
- Raises:
TypeError – Raised if bad type is passed as parameter
- set_lighting_for_key_with_hid_code(key_code: int, red_percentage: int, green_percentage: int, blue_percentage: int)[source]#
Sets the key identified by the hid code passed as parameter to the desired color.
Warning
This function only affects per-key backlighting featured connected devices.
- Parameters:
key_code (int) – The hid-code of the key to set
red_percentage (int) – Amount of red. Range is 0 to 100.
green_percentage (int) – Amount of green. Range is 0 to 100.
blue_percentage (int) – Amount of blue. Range is 0 to 100.
- Raises:
RangeError – Raised if color percentage range is not correct
TypeError – Raised if bad type is passed as parameter
- set_lighting_for_key_with_key_name(key_name: int, red_percentage: int, green_percentage: int, blue_percentage: int)[source]#
Sets the key identified by the code passed as parameter to the desired color.
Warning
This function only affects per-key backlighting featured connected devices.
- Parameters:
key_name (int) – The name of the key to set
red_percentage (int) – Amount of red. Range is 0 to 100.
green_percentage (int) – Amount of green. Range is 0 to 100.
blue_percentage (int) – Amount of blue. Range is 0 to 100.
- Raises:
RangeError – Raised if color percentage range is not correct
TypeError – Raised if bad type is passed as parameter
- set_lighting_for_key_with_quartz_code(key_code: int, red_percentage: int, green_percentage: int, blue_percentage: int)[source]#
Sets the key identified by the quartz code passed as parameter to the desired color
Warning
This function only affects per-key backlighting featured connected devices.
- Parameters:
key_code (int) – The quartz-code of the ket to set
red_percentage (int) – Amount of red. Range is 0 to 100.
green_percentage (int) – Amount of green. Range is 0 to 100.
blue_percentage (int) – Amount of blue. Range is 0 to 100.
- Raises:
RangeError – Raised if color percentage range is not correct
TypeError – Raised if bad type is passed as parameter
- set_lighting_for_key_with_scan_code(key_code: int, red_percentage: int, green_percentage: int, blue_percentage: int)[source]#
Sets the key identified by the scancode passed as parameter to the desired color
Warning
This function only affects per-key backlighting featured connected devices.
- Parameters:
key_code (int) – The scan-code of the ket to set
red_percentage (int) – Amount of red. Range is 0 to 100.
green_percentage (int) – Amount of green. Range is 0 to 100.
blue_percentage (int) – Amount of blue. Range is 0 to 100.
- Raises:
RangeError – Raised if color percentage range is not correct
TypeError – Raised if bad type is passed as parameter
- set_lighting_from_bitmap(bitmap: bytes)[source]#
Sets the array of bytes passed as parameter as colors.
Warning
This function only affects per-key backlighting featured connected devices.
- Parameters:
bitmap (bytes) – An unsigned char array containing the colors to assign to each key
- Raises:
TypeError – Raised if bad type is passed as parameter
- set_target_device(target_device: int)[source]#
The function sets the target device type for future calls. By default, target device is all logitech device, therefore, if no call is made to LogiLedSetTargetDevice the SDK will apply any function to all the connected devices.
- Parameters:
target_device (int) –
- Raises:
TypeError – Raised if bad type is passed as parameter
- stop_effects_on_key(key_name: int)[source]#
Stops any ongoing effect on the key passed in as parameter.
- Parameters:
key_name (int) – The ket to sto the efects on
- Raises:
TypeError – Raised if bad type is passed as parameter
Warning
This function only affects per-key backlighting featured connected devices.