Code Monkey home page Code Monkey logo

luxafor-python's Introduction

Luxafor Python Script

Script written to modify the Luxafor USB LED indicator via command line using python.

Any and all improvements welcome and appreciated.

Credit to gist by dave-irvine for pyusb code.

Requirements

Linux

  1. Luxafor LED Indicator
  2. Python 2.7+
  3. PyUSB

Windows

  1. Luxafor LED Indicator
  2. Luxafor Software
  3. Python 2.7+
  4. PyWinUSB (installable via pip)

Confirmed Working Operating Systems

  • Windows 10
  • Ubuntu 15.10

Known/Possible Issues

Linux

  • Sometimes first run doesn't work, have to run command a second time

Avoid Sudo Prompt

By default python will not let use usb libs and you will need to run command with sudo everytime. To prevent this you will need to do the following:

1: Create a file, /lib/udev/rules.d/50-luxafor.rules with the following contents:

# Allow Luxafor USB control
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="f372", MODE="660", GROUP="plugdev"

2: Reload the udevadm using the following commands:
sudo udevadm control --reload
sudo udevadm trigger

3: Unplug and reinsert your Luxafor device

Windows

  • Seems the Luxafor app has to be at least running in the tray for commands to persist
  • Opening the Luxafor app switches the color to Green/Red (depeding on last used?)
  • Seems that it doesn't always return to the exact same state it was in before a strobe or pattern is ran

Parameters

-l = LED - 1-6 for specific LED, 65 for front, 66 for back, 0 for all, 255 for all one color
-r = RED value (0-255)
-g = GREEN value (0-255)
-b = BLUE value (0-255)
-s = Speed value - Determines speed of strobe or fade (0-255)
-t = Repeat value - Determines the frequency of strobe or wave (0-255)
-w = Wave value - 5 Different Patterns available (1-5)
-p = Built In Patterns - 8 built in patterns -x = Hex color value - ("#RRGGBB")

Actions

Color

Set the specified LED to the specified color

luxafor-linux.py color -l 255 -r 255 -g 0 -b 0

Hex Color (Linux)

luxafor-linux.py color -x "#F22613"

Fade

luxafor-linux.py fade -l 255 -r 0 -g 255 -b 0

Strobe

luxafor-linux.py strobe -l 255 -r 0 -g 0 -b 255 -s 20 -t 5

Wave

luxafor-linux.py wave -w 4 -r 0 -g 0 -b 255 -s 20 -t 3 

Pattern

luxafor-linux.py pattern -p 2 -r 3

Raw Values

Solid Color

Raw data array posisitions as follows:

  1. Always 0
  2. 1
  3. 1-6 for specific LED, 65 for front, 66 for back, 0 for all, 255 for all one color
  4. RED Value 0-255
  5. GREEN Value 0-255
  6. BLUE Value 0-255
  7. N/A
  8. N/A
  9. N/A

Fade Color

Raw data array posisitions as follows:

  1. Always 0
  2. 2
  3. 1-6 for specific LED, 65 for front, 66 for back, 0 for all, 255 for all one color
  4. RED Value 0-255
  5. GREEN Value 0-255
  6. BLUE Value 0-255
  7. Changing Time (Duration)
  8. N/A
  9. N/A

Strobe Color

Raw data array posisitions as follows:

  1. Always 0
  2. 3
  3. 1-6 for specific LED, 65 for front, 66 for back, 0 for all, 255 for all one color
  4. RED Value 0-255
  5. GREEN Value 0-255
  6. BLUE Value 0-255
  7. Speed (30-40 is a fairly calm value)
  8. N/A
  9. N/A

Wave Color

  1. Always 0
  2. 4
  3. Wave Type
  4. RED Value 0-255
  5. GREEN Value 0-255
  6. BLUE Value 0-255
  7. N/A
  8. Repeat (0-255)
  9. Speed (10 is a fairly good value)

Built In Patterns

  1. Always 0
  2. 6
  3. Pattern Number (1-8)
  4. Repeat (0-255)
  5. N/A
  6. N/A
  7. N/A
  8. N/A
  9. N/A

luxafor-python's People

Contributors

vmitchell85 avatar dmwit avatar

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.