Skip to content

Instantly share code, notes, and snippets.

@masone
Last active September 13, 2017 19:45
Show Gist options
  • Save masone/7c9badf41f661e5119876b4e5fc6fd79 to your computer and use it in GitHub Desktop.
Save masone/7c9badf41f661e5119876b4e5fc6fd79 to your computer and use it in GitHub Desktop.
Raspberry Pi cheatsheet sonos / flic
# Raspbian jessy https://www.raspberrypi.org/downloads/raspbian/
# For lite, touch ssh file https://www.raspberrypi.org/documentation/remote-access/ssh/
# Install nvm https://github.com/creationix/nvm#installation
git clone https://github.com/50ButtonsEach/fliclib-linux-hci.git
crontab -e
@reboot cd /home/pi/node-sonos-http-api && /home/pi/.nvm/versions/node/v4.7.2/bin/node server.js > /home/pi/node-sonos.log $
@reboot /home/pi/fliclib-linux-hci/flicd --wait-for-hci -d -f /home/pi/fliclib-linux-hci/flic.sqlite -l /home/pi/flicd.log
@reboot cd /home/pi/fliclib-linux-hci/clientlib/nodejs && /home/pi/.nvm/versions/node/v4.7.2/bin/node example.js > /home/pi/node-flic.log $
vim /etc/logrotate.conf
# system-specific logs may be configured here
/home/pi/node-sonos.log {
size 1k
copytruncate
rotate 1
}
/home/pi/node-flic.log {
size 1k
copytruncate
rotate 1
}
/home/pi/flicd.log {
size 1k
copytruncate
rotate 1
}
git clone https://github.com/jishi/node-sonos-http-api.git
vim node-sonos-http-api/presets.json
{
"radio24": {
"favorite": "Radio 24",
"players": [
{
"roomName": "Bathroom",
"volume": 20
}
],
"pauseOthers": false
},
"morning": {
"favorite": "Morning",
"playMode": {
"shuffle": true
},
"players": [
{
"roomName": "Bathroom",
"volume": 30
}
],
"pauseOthers": false
}
}
# add new flic
./fliclib-linux-hci/simpleclient/simpleclient localhost
startScanWizard
# assign button to http request
cd /home/pi/fliclib-linux-hci/clientlib/nodejs
vim example.js
# test http server
http://raspberrypi.local:5005/preset/kitchen_lia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment