Code Monkey home page Code Monkey logo

cue-sdk-python's Introduction

cue-sdk-python

PyPI license PyPI version info PyPI supported Python versions

Intro

This repository is dedicated for a cuesdk package on PyPI

cuesdk package is a ctypes-based CUE SDK binding for Python 3

Requirements

cuesdk can be used on the following platforms:

  • Windows 7 (x64);
  • Windows 8, 8.1 (x64);
  • Windows 10 (x64);
  • Windows 11 (x64);
  • macOS 10.13;
  • macOS 10.14;
  • macOS 10.15;
  • macOS 11;

Prerequisites

  • Python 3.9 or higher. Support for earlier versions of Python is not provided. Python 2.7 or lower is not supported.

Windows

macOS

Installing

You can install the package from PyPI:

   # Windows
   $ py -3 -m pip install -U cuesdk
   # macOS
   $ python3 -m pip install -U cuesdk

Usage

from cuesdk import (CueSdk, CorsairDeviceFilter, CorsairDeviceType, CorsairError)

sdk = CueSdk()

def on_state_changed(evt):
   print(evt.state)

err = sdk.connect(on_state_changed)

details, err = sdk.get_session_details()
print(details)

devices, err = sdk.get_devices(
        CorsairDeviceFilter(device_type_mask=CorsairDeviceType.CDT_Keyboard))
if err == CorsairError.CE_Success:
   for d in devices:
      print(sdk.get_device_info(d.device_id))

cue-sdk-python's People

Contributors

icue-sdk avatar intrueder avatar tim-ats-d avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cue-sdk-python's Issues

MacOS Support

Hi,
I am wondering if there is a plan to allow this python package to install on MacOS.
From what I can tell, the biggest hurdle is distribution of the actual SDK files for MacOS since they need to be packaged in such a way that symbolic links are present (for code signing), which pip apparently does not support.

If this is the only issue, can we just include instructions for installing the SDK and add MacOS support to this package?

Profile Control

I would love the ability to switch iCUE profiles using this sdk.
This has been done in other projects using a variant of the dll that is used in this project.

TypeError: object of type 'int' has no len(). When using get_led_colors_by_device_index

I was trying to run get_led_colors_by_device_index to get the color from my mouse to then send to an LED Strip, but encountered this error:

Traceback (most recent call last):
  File "C:/Users/Modded/Desktop/MagHomeCue.py", line 6, in <module>
    print(sdk.get_led_colors_by_device_index(0, CorsairLedId.M_2))
  File "C:\Users\Modded\PycharmProjects\pythonProject1\venv\lib\site-packages\cuesdk\api.py", line 236, in get_led_colors_by_device_index
    sz = len(led_identifiers)
TypeError: object of type 'int' has no len()

The following is a copy of how I was using the command:

from cuesdk import *

sdk = CueSdk()
sdk.connect()

print(sdk.get_led_colors_by_device_index(0, CorsairLedId.M_2))

TypeError: 'type' object is not subscriptable

Traceback (most recent call last):
  File "C:/Users/Fido_de07/Desktop/DEVELOPMENT/DEVELOPMENT/RGBSynchroner/Windows/tests.py", line 1, in <module>
    from cuesdk import CueSdk
  File "C:\Users\Fido_de07\AppData\Local\Programs\Python\Python38\lib\site-packages\cuesdk\__init__.py", line 2, in <module>
    from .structs import *
  File "C:\Users\Fido_de07\AppData\Local\Programs\Python\Python38\lib\site-packages\cuesdk\structs.py", line 49, in <module>
    class CorsairChannelInfo():
  File "C:\Users\Fido_de07\AppData\Local\Programs\Python\Python38\lib\site-packages\cuesdk\structs.py", line 51, in CorsairChannelInfo
    devices: list[CorsairChannelDeviceInfo]
TypeError: 'type' object is not subscriptable

I imported "from cuesdk import CueSdk". Do things like "import cuesdk" throws the same Exception.

Python Version: 3.8
Keyboard: K55 RGB
iCUE Installed: Yes
sdk.connect() doesn't return False. get_devices() List is empty and get_device_count() is 0.
C++ is installed but another Version (I tryed yours too).

get_led_id_for_key_name <class 'TypeError'>: wrong type

I need soom help.

the code

from cuesdk import CueSdk

sdk = CueSdk()
sdk.connect()

print("get_devices", sdk.get_devices())

print("get_device_count", sdk.get_device_count())

print("get_device_info", sdk.get_device_info(0))

print("get_last_error", sdk.get_last_error())

print("get_led_id_for_key_name", sdk.get_led_id_for_key_name('B'))

the output

get_devices [STRAFE RGB]
get_device_count 1
get_device_info STRAFE RGB
get_last_error CorsairError.Success
Traceback (most recent call last):
File "C:\Users\dingy\OneDrive\Python\cue-sdk-python-master\mysdkexample\sdk_api_print.py", line 25, in
print("get_led_id_for_key_name", sdk.get_led_id_for_key_name('B'))
File "C:\Users\dingy\OneDrive\Python\cue-sdk-python-master\cuesdk\api.py", line 163, in get_led_id_for_key_name
return native.CorsairGetLedIdForKeyName(key_name)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type

Process finished with exit code 1

What is wrong?
Or, how do I use the function get_led_id_for_key_name?

Event Callback Not Working

I ran the example that you gave for events after doing the proper setup (correct python version, etc). The event callback was not ever triggered through keypresses or connecting a corsair device.

I ran the color pulse example and that worked fine, except for that I couldn't press +/- to change the speed either.

I checked for errors during the subscribe_for_events() function, but it reported back as a success.

I enabled Software and game integration as well for both devices, and when I run sdk.get_devices() it returns both of my connected Corsair devices.

Hope this info helps! Thank you!

Cannot run example - SystemExit called on sdk = CueSdk()

Hi,
Thanks for the Python support really glad you guys are doing it.
Just trying to run the sample script but I keep getting a SystemExit called inside CueSDK()

image

Is there anything I'm missing? I have installed VS Redistributable - using Python 3.8.2

AIO Support

Are there any plans on supporting AIO lighting and pump control?

Commander Core XT support

Hi Corsair,
First of all, this repo is awesome! Didn't aware that there is an official SDK, in Python!
So, is supporting Commander Core XT on the plan? I've got one recently and I'd love to have some customization.

Thanks

events.py example file glitch.

events.py example file does not recognise K95 keyboard events after ICUE update. It recognises unplug/replug but no g key inputs.

Ability to reset colour back to transparent

Hi, sorry for bothering you again. but after the discussion in #4, I have another nice-to-have feature to request.

By default, if we just connect to the SDK and do nothing (with the default layer), all the colors that are already set are not changed at all, and the default iCUE animation continues to play. I take this to mean that by default, when the SDK starts, the color that is set is fully transparent (#00000000)

Now, if I run this code:

led = CorsairLedId.K_F12
cols = {}
cols[led] = (255, 255, 255)
sdk.set_led_colors_buffer_by_device_index(0, cols)

This sets the color of the F12 key to white and overrides the default rainbow animation for that key alone while not affecting any other key.

Now, however, there is no way to go back to the state before setting the key and make that key transparent again. It would be nice if there was some functionality (maybe reset_led_colors_by_device_index? Something like cols[led] = None would also work.

In essence, the SDK is overriding the color only for that one key. It would be nice to have the ability to "release" it back to iCUE's control.

Issue with set_led_colors_buffer_by_device_index function

Hey Guys,

I have to be honest I think 0i am somehow being dumb and missing something obvious but I cant see the issue and the traceback seems to come from api.py

`
from cuesdk import CueSdk

      SDK = CueSdk()
      SDK.connect()
      Device_Count = SDK.get_device_count()
      LED_Devices = dict()
      for Device in range(Device_Count):
          
          LED_Devices[Device] = SDK.get_led_positions_by_device_index(Device)
      
          for LED in LED_Devices.keys():
              LED_Devices[Device][LED] = (255,255,255)
      
              print(type(Device))
              print(type(LED_Devices[Device]))
              SDK.set_led_colors_buffer_by_device_index(Device, LED_Devices[Device])
          SDK.set_led_colors_flush_buffer()

`

Alpha blending/Opacity option

Please correct me if I'm wrong but right now there doesn't seem to be any alpha blending/opacity option for the colors that are being set. It would be really nice to have multiple effects stack without one overriding the other.

I also tried messing around with getting the colors set and manually adding an alpha blend but I seem to get the same color that's set by the previous instance of the code rather than color set by other shared instances so it has no effect.

For instance, I would like to have SDK applications that apply their effects without completely turning off/overriding the default iCUE effects. So while having the default rainbow animation, I could override one key to show a status indicator.

Letting us set an alpha value when when setting a color will enable that.

CorsairConnect() doesn't get past CorsairSessionState.CSS_Connecting

I am using iCUE v5.6.98 and have software and games integration enabled; however, upon running the example in the readme all I get is CorsairSessionState.CSS_Connecting. Am I missing a step? I have also tried running this with and without iCUE launched. I'm on Windows 11.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.