NathanLaan/litra-control

Multiple Litra Devices

Opened this issue · 0 comments

Hi! I have multiple Litra Beams, and I changed some lines to accommodate this, since it just controls one at a time.
There may be a more elegant/universal solution than this, since it requires pulling the exact device ID.

Step 1 - change litrabase line 17-19 to the below to have the device selected by the DevSrvsID

function hidapi() {
  "./hidapitester" --open-path $1 --length 20 --send-output $2
}

Step 2 - Pull device ID using hidapitester --list-detail in terminal and then copying the DevSrvsID for each Litra device you want to control.

Step 3 - In the litrabeam file (or litraglow, depending on device you have) change to the below, and update lines 10 and 11 to reflect the left/right devices:

#!/usr/bin/env bash

#
# Logitech Litra Beam
#   Vendor ID:	0x046D
#   Product ID:	0xC901
#

# change the below using the values you got from 'hidapitester --list-detail'

#

const_litrabeam_min=0x11,0xFF,0x04,0x4c,0x00,0x1E
const_litrabeam_mid=0x11,0xFF,0x04,0x4C,0x00,0x32
const_litrabeam_max=0x11,0xFF,0x04,0x4C,0x00,0x64

#
# Help: Show command options.
#
function help() {
cat <<EOF
Use:
    $(basename $0) [OPTIONS]
Options:
    on    Turn the Logitech Litra Beam on.
    off   Turn the Logitech Litra Beam off.
    min   Set the Logitech Litra Beam to min brightness.
    mid   Set the Logitech Litra Beam to mid brightness.
    max   Set the Logitech Litra Beam to max brightness.
    warm  Set the Logitech Litra Beam colour temp to 2700k.
    cold  Set the Logitech Litra Beam colour temp to 6500k.
EOF
}

function litrabasesh() {
  "./litrabase" $1 $2 $3
}

function on() {
  litrabasesh on $const_litrabeam_right
  litrabasesh on $const_litrabeam_left
}
function off() {
  litrabasesh off $const_litrabeam_right
  litrabasesh off $const_litrabeam_left
}

function min() {
  litrabasesh min $const_litrabeam_right $const_litrabeam_min
  litrabasesh min $const_litrabeam_left $const_litrabeam_min

}
function mid() {
  litrabasesh mid $const_litrabeam_right $const_litrabeam_mid
  litrabasesh min $const_litrabeam_left $const_litrabeam_min

}
function max() {
  litrabasesh max $const_litrabeam_right $const_litrabeam_max
  litrabasesh max $const_litrabeam_left $const_litrabeam_max

}

function cold() {
  litrabasesh cold $const_litrabeam_right
  litrabasesh cold $const_litrabeam_left

}
function warm() {
  litrabasesh warm $const_litrabeam_right
  litrabasesh warm $const_litrabeam_left
}

#
# Call help() and exit() with no options.
#
[ $# -eq 0 ] && help && exit

#
# Call functions specified in options.
#
for arg in "$@"
do
  $arg
done