42 lines
2.1 KiB
Markdown
42 lines
2.1 KiB
Markdown
# temper
|
|
|
|
[](https://github.com/taigrr/temper/releases)
|
|
[](/LICENSE)
|
|
[](https://goreportcard.com/report/taigrr/temper)
|
|
[](https://pkg.go.dev/github.com/taigrr/temper)
|
|
|
|
A zero-dependency library to read USB TEMPer thermometers on Linux.
|
|
|
|
## Configuration
|
|
|
|
On Linux you need to set up some udev rules to be able to access the device as
|
|
a non-root/regular user.
|
|
Edit `/etc/udev/rules.d/99-temper.rules` and add these lines:
|
|
|
|
```
|
|
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="e025", GROUP="plugdev", SYMLINK+="temper%n"
|
|
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7401", GROUP="plugdev", SYMLINK+="temper%n"
|
|
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7402", GROUP="plugdev", SYMLINK+="temper%n"
|
|
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1130", ATTRS{idProduct}=="660c", GROUP="plugdev", SYMLINK+="temper%n"
|
|
```
|
|
Note that there are many versions of the TEMPer USB and your
|
|
`idVendor` and `idProduct` ATTRs may differ.
|
|
|
|
Make sure your user is part of the `plugdev` group and reload the rules with
|
|
`sudo udevadm control --reload-rules`.
|
|
Unplug and replug the device.
|
|
|
|
## Example Code
|
|
|
|
There are examples on how to use this repo in [examples/main.go](/examples/main.go)
|
|
|
|
Additionally, there is a cli-tool available at [temper-cli](https://github.com/taigrr/temper-cli)
|
|
|
|
|
|
## Acknowledgement
|
|
During my development I tested my code against the shell script found in [this article](https://funprojects.blog/2021/05/02/temper-usb-temperature-sensor/).
|
|
|
|
As I only have one TEMPer device, I have sourced the product and vendor IDs for
|
|
other TEMPer devices for the sample `.rules` file (above) from [this repo](https://github.com/edorfaus/TEMPered/blob/master/libtempered/temper_type.c).
|
|
|
|
Full credit to [taigrr](https://github.com/taigrr/temper?tab=readme-ov-file) |