Skip to content

Babelpod as a service #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
djehrenr opened this issue May 13, 2018 · 3 comments
Closed

Babelpod as a service #3

djehrenr opened this issue May 13, 2018 · 3 comments

Comments

@djehrenr
Copy link

djehrenr commented May 13, 2018

Not sure if my issue is like others or as result of making Babelpod a service, but basically after a minute or two I have to reconnect to airplay device.

Here is how I setup Babelpod and got it running as a service on Pi Zero.

Installed Raspberry Lite

Installed Node this way:
wget https://nodejs.org/dist/v8.9.0/node-v8.9.0-linux-armv6l.tar.gz
tar -xzf node-v8.9.0-linux-armv6l.tar.gz
cd node-v6.11.1-linux-armv6l/
sudo cp -R * /usr/local/
Check version node -v

Followed rest of afaden's instructions for AirTunes and Babelpod.

Created a service by doing this:
sudo nano /etc/systemd/system/babelpod.service

Add:

[Service]
#Couldn't get BP to work as a service unless /usr/local/bin/node
ExecStart=/usr/local/bin/node /home/pi/babelpod/index.js
StandardOutput=journal

Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

sudo systemctl daemon-reload
sudo systemctl enable babelpod
sudo systemctl start babelpod
sudo system status babelpod

Should see something like this:
CGroup: /system.slice/babelpod.service
├─446 /usr/local/bin/node /home/pi/babelpod/index.js
├─452 bash
└─454 bluetoothctl

May 13 14:33:51 raspberrypi systemd[1]: Started babelpod.service.
May 13 14:33:56 raspberrypi node[446]: listening on *:3000
May 13 14:33:56 raspberrypi node[446]: bluetooth controller exists
May 13 14:33:58 raspberrypi node[446]: a user connected

@djehrenr
Copy link
Author

Not sure if this helpful, but when audio is playing to the HomePod this is the journalctl output:

pi@raspberrypi:~ $ journalctl -u babelpod.service -e
May 13 22:19:39 raspberrypi node[439]: needDrain: true,
May 13 22:19:39 raspberrypi node[439]: ending: false,
May 13 22:19:39 raspberrypi node[439]: ended: false,
May 13 22:19:39 raspberrypi node[439]: finished: false,
May 13 22:19:39 raspberrypi node[439]: destroyed: false,
May 13 22:19:39 raspberrypi node[439]: decodeStrings: true,
May 13 22:19:39 raspberrypi node[439]: defaultEncoding: 'utf8',
May 13 22:19:39 raspberrypi node[439]: length: 22096,
May 13 22:19:39 raspberrypi node[439]: writing: true,
May 13 22:19:39 raspberrypi node[439]: corked: 0,
May 13 22:19:39 raspberrypi node[439]: sync: false,
May 13 22:19:39 raspberrypi node[439]: bufferProcessing: false,
May 13 22:19:39 raspberrypi node[439]: onwrite: [Function: bound onwrite],
May 13 22:19:39 raspberrypi node[439]: writecb: [Function: nop],
May 13 22:19:39 raspberrypi node[439]: writelen: 12,
May 13 22:19:39 raspberrypi node[439]: bufferedRequest:
May 13 22:19:39 raspberrypi node[439]: { chunk: <Buffer 66 6d 74 20 10 00 00 00 01 00 02 00 44 ac 00 00 10 b1 02 00 04 00 10 00 64 61 74 61 00 00 00 80>,
May 13 22:19:39 raspberrypi node[439]: encoding: 'buffer',
May 13 22:19:39 raspberrypi node[439]: isBuf: true,
May 13 22:19:39 raspberrypi node[439]: callback: [Function: nop],
May 13 22:19:39 raspberrypi node[439]: next: [Object] },
May 13 22:19:39 raspberrypi node[439]: lastBufferedRequest:
May 13 22:19:39 raspberrypi node[439]: { chunk: <Buffer 97 07 97 07 9f 07 9f 07 c1 07 c1 07 89 07 89 07 b0 07 b0 07 df 07 df 07 cb 07 cb 07 70 07 70 07 92 07 92 07 a5 07 a5 07
May 13 22:19:39 raspberrypi node[439]: encoding: 'buffer',
May 13 22:19:39 raspberrypi node[439]: isBuf: true,
May 13 22:19:39 raspberrypi node[439]: callback: [Function: nop],
May 13 22:19:39 raspberrypi node[439]: next: null },
May 13 22:19:39 raspberrypi node[439]: pendingcb: 3,
May 13 22:19:39 raspberrypi node[439]: prefinished: false,
May 13 22:19:39 raspberrypi node[439]: errorEmitted: false,
May 13 22:19:39 raspberrypi node[439]: bufferedRequestCount: 2,
May 13 22:19:39 raspberrypi node[439]: corkedRequestsFree:
May 13 22:19:39 raspberrypi node[439]: { next: null,
May 13 22:19:39 raspberrypi node[439]: entry: null,
May 13 22:19:39 raspberrypi node[439]: finish: [Function: bound onCorkedFinish] } },
May 13 22:19:39 raspberrypi node[439]: writable: true,
May 13 22:19:39 raspberrypi node[439]: _events: {},
May 13 22:19:39 raspberrypi node[439]: _eventsCount: 0,
May 13 22:19:39 raspberrypi node[439]: _maxListeners: undefined }
May 13 22:19:39 raspberrypi node[439]: stopped airplay device
May 13 22:19:39 raspberrypi node[439]: adding device: 192.168.1.116:7000
May 13 22:19:39 raspberrypi node[439]: airplay status: ready

When it stopped, this is what the journalctl looked like:

pi@raspberrypi:~ $ journalctl -u babelpod.service -e
May 13 22:19:39 raspberrypi node[439]: finished: false,
May 13 22:19:39 raspberrypi node[439]: destroyed: false,
May 13 22:19:39 raspberrypi node[439]: decodeStrings: true,
May 13 22:19:39 raspberrypi node[439]: defaultEncoding: 'utf8',
May 13 22:19:39 raspberrypi node[439]: length: 22096,
May 13 22:19:39 raspberrypi node[439]: writing: true,
May 13 22:19:39 raspberrypi node[439]: corked: 0,
May 13 22:19:39 raspberrypi node[439]: sync: false,
May 13 22:19:39 raspberrypi node[439]: bufferProcessing: false,
May 13 22:19:39 raspberrypi node[439]: onwrite: [Function: bound onwrite],
May 13 22:19:39 raspberrypi node[439]: writecb: [Function: nop],
May 13 22:19:39 raspberrypi node[439]: writelen: 12,
May 13 22:19:39 raspberrypi node[439]: bufferedRequest:
May 13 22:19:39 raspberrypi node[439]: { chunk: <Buffer 66 6d 74 20 10 00 00 00 01 00 02 00 44 ac 00 00 10 b1 02 00 04 00 10 00 64 61 74 61 00 00 00 80>,
May 13 22:19:39 raspberrypi node[439]: encoding: 'buffer',
May 13 22:19:39 raspberrypi node[439]: isBuf: true,
May 13 22:19:39 raspberrypi node[439]: callback: [Function: nop],
May 13 22:19:39 raspberrypi node[439]: next: [Object] },
May 13 22:19:39 raspberrypi node[439]: lastBufferedRequest:
May 13 22:19:39 raspberrypi node[439]: { chunk: <Buffer 97 07 97 07 9f 07 9f 07 c1 07 c1 07 89 07 89 07 b0 07 b0 07 df 07 df 07 cb 07 cb 07 70 07 70 07 92 07 92 07 a5 07
May 13 22:19:39 raspberrypi node[439]: encoding: 'buffer',
May 13 22:19:39 raspberrypi node[439]: isBuf: true,
May 13 22:19:39 raspberrypi node[439]: callback: [Function: nop],
May 13 22:19:39 raspberrypi node[439]: next: null },
May 13 22:19:39 raspberrypi node[439]: pendingcb: 3,
May 13 22:19:39 raspberrypi node[439]: prefinished: false,
May 13 22:19:39 raspberrypi node[439]: errorEmitted: false,
May 13 22:19:39 raspberrypi node[439]: bufferedRequestCount: 2,
May 13 22:19:39 raspberrypi node[439]: corkedRequestsFree:
May 13 22:19:39 raspberrypi node[439]: { next: null,
May 13 22:19:39 raspberrypi node[439]: entry: null,
May 13 22:19:39 raspberrypi node[439]: finish: [Function: bound onCorkedFinish] } },
May 13 22:19:39 raspberrypi node[439]: writable: true,
May 13 22:19:39 raspberrypi node[439]: _events: {},
May 13 22:19:39 raspberrypi node[439]: _eventsCount: 0,
May 13 22:19:39 raspberrypi node[439]: _maxListeners: undefined }
May 13 22:19:39 raspberrypi node[439]: stopped airplay device
May 13 22:19:39 raspberrypi node[439]: adding device: 192.168.1.116:7000
May 13 22:19:39 raspberrypi node[439]: airplay status: ready
May 13 22:21:25 raspberrypi node[439]: airplay status: stopped

@afaden
Copy link
Owner

afaden commented Sep 3, 2018

Thanks very much, running it as a service is much more convenient. I've updated the blog post with those instructions. Also, I think I've found a solution to the problem you mentioned where the Airplay device cuts out after a few minutes, please let me know if it works for you.

@afaden afaden closed this as completed Sep 3, 2018
@djehrenr
Copy link
Author

djehrenr commented Sep 9, 2018

The volume solution seems to work great! Using it right now and love the ability to use my record player anywhere in the house!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants