ksenijas / krakenx Goto Github PK
View Code? Open in Web Editor NEWPython script to control NZXT cooler Kraken X52/X62 in Linux
License: GNU General Public License v2.0
Python script to control NZXT cooler Kraken X52/X62 in Linux
License: GNU General Public License v2.0
Arch Linux 4.17.2
After a fresh restart, with the LED's of my kraken x62 off:
colctl -m solid -c0 50,0,90 successfully changes the LED's from black to purple
immediately after I run:
colctl -m solid -c0 0,0,0 to change the LED's back to black but nothing happens.
no other colctl commands seem to work until I restart again.
If multiple executions of colctl
are done in a short amount of time this error is shown:
$ colctl --status
Device status:
Traceback (most recent call last):
File "/usr/local/bin/colctl", line 121, in <module>
main(parser)
File "/usr/local/bin/colctl", line 115, in main
cooler.print_status()
File "/usr/local/lib/python2.7/dist-packages/krakenx/color_change.py", line 145, in print_status
for k,v in sorted(self._receive_status().items()):
File "/usr/local/lib/python2.7/dist-packages/krakenx/color_change.py", line 149, in _receive_status
raw_status = self.dev.read(0x81, 64)
File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 988, in read
self.__get_timeout(timeout))
File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 851, in intr_read
timeout)
File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 936, in __read
_check(retval)
File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 595, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 110] Operation timed out
Most probably the USB devices is not reset before
Instructions on how to auto run the KrakenX colctl script on bootup. (*)
This is for Linux only
To execute KrakenX script inside a service daemon that gets launched during boot up.
This is very important so you don't have to remember to always run the script after you log in.
With CAM on Windows, everything kicks in when Windows boots up. On Linux however, NZXT provides no driver support or CAM. When Linux boots up, your Kraken AIO will default to a white RGB pump header color and the fans and pump will operate at default settings.
If you want more control than this. KrakenX lets you change this.
What follows are instructions on how to get the latest KrakenX script, install all relevant code, configure your Kraken liquid cooler and administrate the auto run service.
sudo apt install python3
sudo apt-get install python3-usb
sudo apt-get install python3-pip
cd /etc
mkdir colctl
Download Kraken Zip file and copy to /etc/colctl
unzip krakenx-master.zip
cd krakenx-master
python3 -m pip install krakenx (don't sudo or file error with owner cache permission appears)
Verify Your File Structure
Before you proceed, make sure your file structure looks similar to this:
/etc
--/colctl
------colctl
--/krakenx
-----color_change.py
-----init.py
-----profile.py
These are the minimal folder and files you need to run KrakenX. They must be in this layout or the auto run service will not work.
This involves running a text editor (nano in this case) to type some stuff in. You will save the text file in /etc/systemd/service under the filename krakenx.service.
The parameter settings below are set for (*):
Adjust the above to your liking.
cd /etc/systemd/service
sudo nano krakenx.service
[Unit]
Description=Kraken AIO startup service
[Service]
Type=oneshot
User=root
WorkingDirectory=/etc/colctl
ExecStart=/etc/colctl/colctl --mode SpectrumWave --fan_speed "(20,25),(30,60),(40,80),(50,100)" --pump_speed "(20,60),(30,70),(40,80),(50,100)"
[Install]
WantedBy=multi-user.target
sudo chmod 644 krakenx.service (must be 644 or syslog will show errors)
sudo chown root:root krakenx.service
chmod 755 /etc/colctl/colctl
chown root:root /etc/colctl/colctl
Ready? Set. Go!
This first command starts the service and puts it in running state.
The second command enables it so that on next boot, it will run automatically.
sudo systemctl start krakenx.service
sudo systemctl enable krakenx.service
You should now see your Kraken RGB, fans, and pump run at your specified settings.
These are things that you may need to use later to administrate the service. If you make changes to any of the parameter settings above, you need to stop the service, update systemd, and restart the service again.
I leave them here for reference.
To start the service
systemctl start krakenx.service
systemctl enable krakenx.service
To stop the service
systemctl stop krakenx.service
systemctl disable krakenx.service
To restart the service
systemctl restart kraken.service
To reload the service
systemctl reload krakenx.service
To restart and reload the service
systemctl reload-or-restart krakenx.service
To remove the service
systemctl stop krakenx.service
systemctl disable krakenx.service
rm /etc/systemd/system/krakenx.service
rm /etc/systemd/system/krakenx.service (don't forget symlinks)
To update systemd
systemctl daemon-reload
systemctl reset-failed
Status, targets and properties
systemctl get-default or ls -al /lib/systemd/system/default.target
ls -al /lib/systemd/system/runlevel*
systemctl list-unit-files
systemctl list-units --type=target
systemctl is-enabled krakenx.service
systemctl is-failed krakenx.service
systemctl is-active krakenx.service
systemctl show krakenx.service
Hope this helps someone. Feel free to add to the project README.
Note: This was edited several times to arrive at this solution. I do not recommend using cron or setting colctl in shell startup scripts. I had problems getting them to work. This is much cleaner, set and forget solution.
(*) Use at your own risk. I will not be held responsible for anything that may go wrong. This was developed and tested on Ubuntu 18.0.4 desktop.
This repo doesn’t advertise support for the Kraken X42 but has anyone tried it? I’d like to have this control if possible but I don’t want to risk messing up my cooler
Issuing
# colctl --fan_speed 100 --pump_speed 100
makes the fans and the pump to spin up.
This can be confirmed both audibly and through --status
:
# colctl --status
fan_speed 1786
liquid_temperature 28.6
pump_speed 2803
However, after approximately 10 seconds the fans spin down again, and so does the pump:
# colctl --status
Device status:
fan_speed 756
liquid_temperature 28.4
pump_speed 2239
I assume the firmware is reverting back to its defaults for some reason. Have any of you experienced this already or can reproduce it?
Note: I'm running a brand new unit, with firmware version 4.0.2. I'll later boot into Windows and post the firmware version.
If I want to be able to have a white logo paired together with a green circle.
Then the command: sudo colctl --mode marquee --color0 0,255,0 --text_color 255,255,255
Should do the trick, yet the logo is still red (the default color). Even if I enable more than 1 color using the --color_count 2, it won't change it.
Hi
I think my fans are running a bit to hi, I can hear the the fans are a bit loud, maybe is in a Performance mode.
Is there a way to change Control Modes as described in the Website
I would love to have it in SIlent mode when I'm just doing basic stuff and Performance only when I need to.
thank you
We have decided in #11 to switch to the liquidctl driver. I'm opening this issue so that we can track that effort.
Current snapshot: jonasmalacofilho:switch-to-liquidctl-driver (diff)
Obviously we need to:
@KsenijaS has pointed out that we also need to:
I also think we should do a couple of releases for PyPI:
0.0.3
release with the current implementation1.0.0
release to start a cycle with the new driverEDIT: @jneumaier had already thought about and done the release : )
I've just tested this on Kraken X72 and it works. You can add X72 to the list of supported devices.
Awesome program! you've saved me the overhead of running a windows VM to control my x62!
Is implementing the Tai Chi effect a possibility? It is the only effect that cam software offers that this program does not.
Thanks!
I was checking the code and I noticed several violations of the PEP8, PyLint and Mypy rules. Would you be interested in a pull request that address this issues? If you are let me know and I will be happy to make one.
Thank you for bringing this to the linux. I was much much regret that I bought the x73. Huge expensive and do not function well.
In windows cam application, if I started to burn the fpu, the pump and fan would run at full speed.
However, when I use it in linux and started a windows vm for fpu, it will overheat being the liquid temperature going too slow. Is that a way to also incorporate the cpu temperature, or to deduce the cpu utilization for making the cpu / pump curve?
Thank you.
I just want to suggest the use of a udev
rule to avoid the need of having to use sudo
to execute colctl
.
The steps necessary to achieve this are:
/lib/udev/rules.d/60-krakenx.rules
containing the rule SUBSYSTEM=="usb", ATTRS{idVendor}=="1e71", ATTRS{idProduct}=="170e", MODE="0666"
sudo udevadm control --reload-rules
sudo udevadm trigger
After this it should be possible to run colctl
without the need of root permissions.
I think the Windows installation guide should also list a method that does not block CAM from accessing the device.
It would be nice if there was a user-friendly way of install the libusb 1.0 client libraries on Windows. On liquidctl I had to settle for a manual guide to how they should be installed, but that is not optimal.
Anyone willing to write a script that does the necessary steps (download the appropriate release from libusb and copy the dlls to the correct places, taking into account the different ways Python might be installed)?
I've been attempting to get a marquee animation going with matching text color (0,128,255) but no matter how I enter it I always get the color I want on the marquee but not the text (keeps defaulting to a pinkish / purple color).
The commands I have tried are:
colctl --mode marquee -c 0,128,255 -c0 0,128,255 -as 1
or
colctl --mode marquee --text_color 0,128,255 --color0 0,128,255 -as 1
When I try and add a color count to the argument it bypasses the color selection completely and gives me a red marquee with a teal text (no matter what rgb color code I enter).
Am I missing something?
Wenn I try to install krakenx, Python gives me the following:
C:\Users\Toni\Downloads\ASUS\krakenx-master>python -m pip install krankenx
Collecting krankenx
Could not find a version that satisfies the requirement krankenx (from versions: )
No matching distribution found for krankenx
What do I make wrong? I am completely new with Phyton, installed actual version 3.7 with upgrading pip from 10 to 18.
Greetings,
Toni
Error returned when trying to run the demo command on Windows 10.
C:\Users\[redacted]\AppData\Local\Programs\Python\Python36\Scripts>python3 colctl --mode fading --color0 50,0,90 --color1 56,98,0 --color2 20,20,20 --color3 0,90,90 --color_count 4
Traceback (most recent call last):
File "colctl", line 107, in <module>
main()
File "colctl", line 93, in main
devices = list(usb.core.find(idVendor=VENDOR, idProduct=PRODUCT, find_all=True))
File "C:\Users\[redacted]\AppData\Local\Programs\Python\Python36\lib\site-packages\usb\core.py", line 1263, in find
raise NoBackendError('No backend available')
usb.core.NoBackendError: No backend available
Edit: I'm an idiot. I just read that the project is intended to run on Linux.
Hi guys
I set fan and pump speeds using this command
sudo colctl --fan_speed "(20,30),(30,50),(40,90),(45,100)" --mode spectrumwave --animation_speed 3
I would like to reset my settings to defaults?
thank you very much
@KsenijaS: Would you please consider if you would accept additional maintainers / collaborators in this project?
One rule could be that anyone but you may not commit directly to this repository but must create a pull request reviewed by at least one of the other collaborators. It is not an important thing but I got the impression you currently cannot spare much time and I do not see much risk in trying it out. It would also be nice to allow additional PyPi pip package collaborators for package updates.
As discussed in #15 a lower pump speed may be possible.
We have three verified cases with 50% pump speed support for X62.
Can we at least verify this for one other device? Then we might change this limit.
Hello, i get installation error
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/2r/k1g7ls797cn6nl18dl2xvjp40000gn/T/pip-install-z2q1zyc9/hidapi/setup.py'"'"'; __file__='"'"'/private/var/folders/2r/k1g7ls797cn6nl18dl2xvjp40000gn/T/pip-install-z2q1zyc9/hidapi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/2r/k1g7ls797cn6nl18dl2xvjp40000gn/T/pip-wheel-8qdzu2bm --python-tag cp37
cwd: /private/var/folders/2r/k1g7ls797cn6nl18dl2xvjp40000gn/T/pip-install-z2q1zyc9/hidapi/
Complete output (23 lines):
running bdist_wheel
running build
running build_ext
cythoning hid.pyx to hid.c
/private/var/folders/2r/k1g7ls797cn6nl18dl2xvjp40000gn/T/pip-install-z2q1zyc9/hidapi/.eggs/Cython-0.29.13-py3.7-macosx-10.14-x86_64.egg/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /private/var/folders/2r/k1g7ls797cn6nl18dl2xvjp40000gn/T/pip-install-z2q1zyc9/hidapi/hid.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
building 'hid' extension
creating build
creating build/temp.macosx-10.14-x86_64-3.7
creating build/temp.macosx-10.14-x86_64-3.7/hidapi
creating build/temp.macosx-10.14-x86_64-3.7/hidapi/mac
Compiling with an SDK that doesn't seem to exist: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
Please check your Xcode installation
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -framework IOKit -framework CoreFoundation -Ihidapi/hidapi -I/usr/local/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c hid.c -o build/temp.macosx-10.14-x86_64-3.7/hid.o
clang: warning: -framework IOKit: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -framework CoreFoundation: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk' [-Wmissing-sysroot]
In file included from hid.c:4:
/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:25:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for hidapi
An flag to either have a solid color, or none at all on the logo (NZXT text") while maintaining spectrumwave on the ring would be nice.
I would prefer a behaviour where only specified fan/pump profiles/values (profiles currently in development #11) and color schemes are set if executing the colctl command. Currently the update method does it all with no conditions:
self._send_color()
self._send_fan_speed()
self._send_pump_speed()
return self._receive_status()
I think we should change this and include checks for given command values. Addtionally we might also execute print_status by default instead of returning an ignored status value.
Feedback and pull requests welcome :-)
Can you please add a feature to report the status?
status = dev.read(0x81, 64)
liquid_temperature = status[1] + status[2]/10
print(liquid_temperature)
I'm sure array item 4 and 6 have something to do with RPM.
The values of PS and FS shown by -s are only correct up to the first change via -ps xx and/or -fs xx.
Afterwards reading status gives me the correct value of the liquid temperature, but FS and PS always show the same. Physically the fan (and the pump too I hope - cannot hear it, because changing only ps also alters fs(?)) reacts correct.
entered
sudo colctl --mode solid --color0 50,0,90
and got:
Traceback (most recent call last):
File "/usr/local/bin/colctl", line 7, in
import usb.core
ModuleNotFoundError: No module named 'usb'
Awesome work. What do I need to do to get this working when I have 2x Kraken X62's in my system?
'lsusb' reports as:
Bus 003 Device 006: ID 1e71:170e NZXT
Bus 003 Device 008: ID 1e71:170e NZXT
Nevermind... I found the line.
dev = devices[0]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.