73 lines
1.9 KiB
Markdown
73 lines
1.9 KiB
Markdown
# blinky
|
|
|
|
control your blinkstick via http requests
|
|
|
|
## requirements
|
|
|
|
- nodejs
|
|
- yarn / npm
|
|
- [nvm](https://github.com/nvm-sh/nvm)
|
|
|
|
**the node-hid module is a bit picky about node.js's version - use node.js 8.x or 15.x**
|
|
|
|
## setup (as root)
|
|
|
|
- install nvm
|
|
|
|
- to load nvm restart your terminal or `source ~/.nvm/nvm.sh`
|
|
|
|
- clone the project (to '/opt/blinky')
|
|
`git clone https://git.velvettear.de/velvettear/blinky.git /opt/blinky`
|
|
|
|
- enter the cloned directory
|
|
`cd /opt/blinky`
|
|
|
|
- install and switch to a supported node.js version (automatically done via .nvmrc file)
|
|
`nvm install`
|
|
|
|
- install the required modules
|
|
`npm install`
|
|
|
|
- switch back to your system's default node.js version
|
|
`nvm deactivate`
|
|
|
|
- execute blinky
|
|
`nvm run 15 blinky.js`
|
|
|
|
- if you get this error message on linux:
|
|
`Error: cannot open device with path /dev/hidraw0`
|
|
run:
|
|
`echo "KERNEL==\"hidraw*\", SUBSYSTEM==\"hidraw\", ATTRS{idVendor}==\"20a0\", ATTRS{idProduct}==\"41e5\", MODE=\"0666\"" | sudo tee /etc/udev/rules.d/85-blinkstick-hid.rules`
|
|
and reboot your system
|
|
|
|
|
|
|
|
## systemd
|
|
|
|
**for security reasons it is highly recommended to not run blinky with root permissions!**
|
|
|
|
- create a new system user
|
|
`useradd -U -r -s /usr/bin/nologin node`
|
|
|
|
- make your install of nvm available to the new user
|
|
`cp -R ~/.nvm /opt/nvm`
|
|
`chown -R node /opt/nvm`
|
|
|
|
- symlink the provided systemd-service file
|
|
`ln -s /opt/blinky/blinky.service /etc/systemd/system/blinky.service`
|
|
|
|
- reload systemd-services
|
|
`systemctl daemon-reload`
|
|
|
|
- enable and start blinky as a systemd-service
|
|
`systemctl enable --now blinky`
|
|
|
|
- if you don't use nvm otherwise remove it and remove it from your shell-profile
|
|
`rm -rf ~/.nvm`
|
|
`vim ~/.zshrc`
|
|
|
|
### scripts
|
|
|
|
- blinky-feed.sh
|
|
- gathers various system information (currently temperature only) then converts it to color values and sends it to blinky
|
|
- requirements: bash, bc
|