Package: tc420
TC420 LED Controller Python Library and Command Line InterfaceTC420 is a LED dimmer/controller mainly used for aquarium lightning. There is an attached software, PLED, you can use for programming it, but it is not very well written, and not good for automation tasks. Also it is Windows only.
You can found more information on its fun (not official) site:https://www.tc420.net/.I reverse engineered the USB protocol the device uses and wrote this library and CLI tool for making endless possibilities from this device. I successfully implemented all the functions PLED.exe have.The library is cross platform, works everywhere wherelibusbworks. But because it is a HID device, and MacOS does not allow to detach kernel drivers of HID devices, on MacOS it is extremely hard to make it work in current form. But I tested onWindowsandLinux, and works fine there. It works on (all kinds of) Raspberry Pi.
(Actually there is a python library for HID devices, so theoretically it is possible to rewrite the lib using hidapi, and then it could work on MacOS as well, pull requests are welcome...)It has a full featuredCLI, which can act as a reference for the libray. Also you can use it for automation, or just for fun.Possibilities / ideasYou can program your device in shell scripts / batch files, or with Python programsYou can run immediate scenes, e.g. a sunset or sunrise by a click to attract your guestsIt is possible to access the device remotely by e.g. a Raspberry Pi Zero WA web / mobile application can be written to start scenes, or modify program of device (not yet written by myself)Different color themes on sunny/rainy/cloudy days, by using online weather sourcesReal sunset and sunrise program every day by using sunset/sunrise database....InstallLinuxInstall the library:pip3installtc420Install libusb if not installed. On Raspberry pi it is installed by default.Create aplugdevgroup if not exists, it exists by default in all Debian based distros.Enable the access of the device by users in plugdev group with an udev rule found here:99-tc420.rules.
Put that (by root user) in/etc/udev/rules.d/, then replug your device.Put yourself into theplugdevgroup then relogin:sudoadduseryour_user_nameplugdevWindowsInstall Python 3.6+ if not installed:https://docs.python.org/3/using/windows.htmlInstall the library:pip install tc420Install latest libusb, which is kinda tricky:this Stackoverflow answer worked for meFrom sourceThis description works without modification on Linux, on Windows, you may need to usepipinstead ofpip3andpythoninstead ofpython3. And the activate.bat is in theScriptsfolder insidevenv.Clone package from GitHub:git clone https://github.com/wallneradam/tc420.gitInstall virtualenv (globally) if not yet installed:sudo -H pip3 install virtualenvCreate a VirtualEnv inside the cloned directory:virtualenv -p python3 venvActivate it:./venv/bin/activateInstall package with requirements:pip install -e .Now you have tc420 command in your virtual environment.UsageBoth the library and the CLI tool is documented and the source code is commented, so you can find all information inside them.CLIYou can have the help oftc420command by running:tc420 --helpThis will only give you brief information about all commands.
You can have full description of every commands by running:tc420 [command] --helpe.g.:tc420 mode --helpGetting startedFor checking if everything is working you can sync the clock:tc420 time-syncOr you can run the demo which randomly fades in-out all channels:tc420 demoIf something is not working, you probably not installed libusb well, or you need to check if you have permissions to access the device.