Skip to content

Colorimeters

Federico Di Pierro edited this page Mar 2, 2022 · 2 revisions

Colorimeters

Clight does not natively support colorimeters hardware.
Instead, its support can be easily achieved through a small script, making use of Clightd Custom sensor.

Thanks to volfyd for providing this trick! One can use spotread (from package argyllcms on Arch) to save the ambient light value to a file every N seconds; then instrument Clight to use that file as sensor.
The following script uses tcl and writes into /tmp/clight-custom-sensor its values, read every 10s:

#!/bin/env tclsh

package require Expect

set timeout 10

spawn spotread -a
expect {
    -re {Result is XYZ: \d+\.\d+ (\d+)\.} {
        set Y $expect_out(1,string)

        set fd [open "/tmp/clight-custom-sensor" "w"]
        puts $fd "$Y\n"
        close $fd

        exp_continue
    }
    timeout {
        exp_send "\n"
        exp_continue
    }
}

Then, you can run Clight using clight --verbose --device=/tmp/clight-custom-sensor -f1, or setting sensor.devname and sensor.captures config values accordingly.

Clone this wiki locally