Volumio-buddy

Has anyone seen or tested this? Or is the author maybe here on the forums?
github.com/foxey/volumio-buddy

Looks quite promising. Rotary encoder, OLED display support…

Hi Rolo,

I’m the author. I have the script working on my DIY project.
Here’s a small movie demonstrating the setup.

It consists of a Pi3 + a DIY proto hat + a DigiAMP+ from IQAudio.

The display is a SSD1306 compatible OLED screen that you’ll find all over Ebay. It’s connected with the I2C interface. The rotary encoders come from IQAudio as well. They are connected on the proto hat using a 1kOhm current limiting resistor and a 10kOhm pull-down resistor (example here). A 100nF condensator over the switches serves as a HW debouncer. For the pushbuttons, SW debouncing is sufficient, but for the rotary switches, I found HW debouncing to work better.

The audio is entirely managed by Volumio. I use the Python script only to control an RGB LED, the display and read out the rotary encoders (that also act as a push button). Volumio is controlled over the websocket interface, which is also the source of information to update the display.

The current code is a bit hacky, because I got segmentation faults when I tried to wait for callbacks on the websocket client in one thread and for button events in a second thread. This is probably an issue with thread safeness in one of the libraries I’m using, but I don’t have time to dive into the details. As a workaround, I split the websocket client and the GPIO event listeners in two separate processes and use a pipe to communicate between them. It’s really ugly, but it does the job. If you have more time/Python knowledge, I’m happy to get some advice.

Best regards, Michiel

HI Michiel,

just came across your plugin when looking fo a way to connect a rotary encoder for volume control to my RPi3 running Volumio 2. Looks very promising!
I followed the instructions on github, but when trying to run the script, I get the following error messages:Traceback (most recent call last): File "/usr/local/bin/volumio-buddy.py", line 4, in <module> __import__('pkg_resources').run_script('volumio-buddy==0.3.0', 'volumio-budd y.py') File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 534, in run_scr ipt self.require(requires)[0].run_script(script_name, ns) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1438, in run_sc ript execfile(script_filename, namespace, namespace) File "/usr/local/lib/python2.7/dist-packages/volumio_buddy-0.3.0-py2.7.egg/EGG -INFO/scripts/volumio-buddy.py", line 121, in <module> display = Display(RESET_PIN) File "/usr/local/lib/python2.7/dist-packages/volumio_buddy-0.3.0-py2.7.egg/vol umio_buddy/volumio_buddy.py", line 196, in __init__ self._display.begin() File "build/bdist.linux-armv7l/egg/Adafruit_SSD1306/SSD1306.py", line 148, in begin File "build/bdist.linux-armv7l/egg/Adafruit_SSD1306/SSD1306.py", line 247, in _initialize File "build/bdist.linux-armv7l/egg/Adafruit_SSD1306/SSD1306.py", line 129, in command File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/I2C.py", line 115, in write8 File "build/bdist.linux-armv7l/egg/Adafruit_PureIO/smbus.py", line 236, in wri te_byte_data IOError: [Errno 121] Remote I/O error

No idea what to do with it, can you help me out?

Furthermore, I would like to use this kind of rotary encoder, connected directly to the GPIO on the Pi.
Can you tell me which pins to use?

Thanks a lot in advance!

Cheers,
Lars

Hi Lars,

You probably don’t have a display connected, that’s the reason for the IO error. If you just want to use the rotary encoder, remove all references to the display from github.com/foxey/volumio-buddy/ … o-buddy.py

The 1st reference is ‘display = Display(RESET_PIN)’ on line 121.

Cheers, Michiel

hello,
thanks for the great script. is there any way to adjust the adress of the diplay?
best regards

paul

Can this be edited easily to support an LCD display? I’ve commented out all the display sections in the hopes of using it purely for the rest of the code, however I’m getting this error and don’t seem to be able to find where status should be being defined:

File "volumio-buddy.py", line 78, in <module> if status <> prev_status: NameError: name 'status' is not defined

Hope you can help!

Has anyone tried to install this with the latest version of Volumio (VERSION: 2.344) ?

On “apt-get install -y python-dev libjpeg9-dev libfreetype6-dev swig”

I’m getting :-

E: Package ‘python-dev’ has no installation candidate
E: Unable to locate package libjpeg9-dev
E: Unable to locate package libfreetype6-dev
E: Unable to locate package swig

Discovered I needed to update the package list first :-

apt-get update -y

was then able to install python-dev libjpeg9-dev libfreetype6-dev swig Ok and do

git clone github.com/foxey/volumio-buddy
cd volumio-buddy

OK but then :-

python ./setup.py install

results in the following towards the end :-

Searching for Pillow>=2.6.1
Reading pypi.python.org/simple/Pillow/
Best match: Pillow 4.3.0
Downloading pypi.python.org/packages/e0/82/ … 6cb0cf89cd
Processing Pillow-4.3.0.tar.gz
Writing /tmp/easy_install-foqYBO/Pillow-4.3.0/setup.cfg
Running Pillow-4.3.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-foqYBO/Pillow-4.3.0/egg-dist-tmp-KAtS6r
warning: no files found matching ‘.sh’
no previously-included directories found matching ‘docs/_static’
warning: no previously-included files found matching ‘.coveragerc’
warning: no previously-included files found matching ‘codecov.yml’
warning: no previously-included files found matching ‘.editorconfig’
warning: no previously-included files found matching ‘.landscape.yaml’
warning: no previously-included files found matching ‘.travis’
warning: no previously-included files found matching '.travis/

warning: no previously-included files found matching ‘appveyor.yml’
warning: no previously-included files found matching ‘build_children.sh’
warning: no previously-included files found matching ‘tox.ini’
warning: no previously-included files matching ‘.git*’ found anywhere in distribution
warning: no previously-included files matching ‘.pyc’ found anywhere in distribution
warning: no previously-included files matching '
.so’ found anywhere in distribution

The headers or library files could not be found for zlib,
a required dependency when compiling Pillow from source.

Please see the install instructions at:
pillow.readthedocs.io/en/latest … ation.html

Exception in thread Thread-2:
Traceback (most recent call last):
File “/usr/lib/python2.7/threading.py”, line 810, in __bootstrap_inner
self.run()
File “/usr/lib/python2.7/threading.py”, line 763, in run
self.__target(*self.__args, **self.__kwargs)
File “/usr/lib/python2.7/multiprocessing/pool.py”, line 357, in _handle_tasks
debug(‘task handler got sentinel’)
TypeError: ‘NoneType’ object is not callable

Exception in thread Thread-1:
Traceback (most recent call last):
File “/usr/lib/python2.7/threading.py”, line 810, in __bootstrap_inner
self.run()
File “/usr/lib/python2.7/threading.py”, line 763, in run
self.__target(*self.__args, **self.__kwargs)
File “/usr/lib/python2.7/multiprocessing/pool.py”, line 330, in _handle_workers
debug(‘worker handler exiting’)
TypeError: ‘NoneType’ object is not callable

Exception TypeError: TypeError("‘NoneType’ object does not support item deletion",) in <Finalize object, dead> ignored
Traceback (most recent call last):
File “./setup.py”, line 40, in
‘volumio_buddy’: [’.ttf’, '.ppm’],
File “/usr/lib/python2.7/distutils/core.py”, line 151, in setup
dist.run_commands()
File “/usr/lib/python2.7/distutils/dist.py”, line 953, in run_commands
self.run_command(cmd)
File “/usr/lib/python2.7/distutils/dist.py”, line 972, in run_command
cmd_obj.run()
File “build/bdist.linux-armv7l/egg/setuptools/command/install.py”, line 65, in run
File “build/bdist.linux-armv7l/egg/setuptools/command/install.py”, line 115, in do_egg_install
File “build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py”, line 360, in run
File “build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py”, line 576, in easy_install
File “build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py”, line 627, in install_item
File “build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py”, line 673, in process_distribution
File “build/bdist.linux-armv7l/egg/pkg_resources.py”, line 620, in resolve
if dist is None or (dist not in req and replace_conflicting):
File “build/bdist.linux-armv7l/egg/pkg_resources.py”, line 858, in best_match
suitable distribution is already active. (This may raise
File “build/bdist.linux-armv7l/egg/pkg_resources.py”, line 870, in obtain
for dist in self[req.key]:
File “build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py”, line 595, in easy_install
File “build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py”, line 625, in install_item
File “build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py”, line 813, in install_eggs
File “build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py”, line 1019, in build_and_install
File “build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py”, line 1004, in run_setup
File “build/bdist.linux-armv7l/egg/setuptools/sandbox.py”, line 50, in run_setup
File “build/bdist.linux-armv7l/egg/setuptools/sandbox.py”, line 100, in run
File “build/bdist.linux-armv7l/egg/setuptools/sandbox.py”, line 52, in
File “setup.py”, line 799, in

main.RequiredDependencyException:

The headers or library files could not be found for zlib,

I tried :-

apt-get install zlib

but get :-

Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package zlib

Any ideas ?

Found the solution to this.

Install with pip :-

sudo apt-get install python-pip
sudo pip install volumio-buddy

Has anyone been able to install Volumio-buddy with Volumio Version 2.729

Seems to be a problem with the Adafruit_PureIO package (see below)

sudo pip install volumio-buddy
[sudo] password for volumio:
Downloading/unpacking volumio-buddy
Downloading volumio-buddy-0.4.0.tar.gz (58kB): 58kB downloaded
Running setup.py (path:/tmp/pip-build-YYPnc1/volumio-buddy/setup.py) egg_info for package volumio-buddy

Requirement already satisfied (use --upgrade to upgrade): RPi.GPIO>=0.6.3 in /usr/lib/python2.7/dist-packages (from volumio-buddy)
Downloading/unpacking Adafruit-SSD1306>=1.6.1 (from volumio-buddy)
Downloading Adafruit_SSD1306-1.6.2.tar.gz
Running setup.py (path:/tmp/pip-build-YYPnc1/Adafruit-SSD1306/setup.py) egg_info for package Adafruit-SSD1306

Downloading/unpacking wiringpi2>=2.32 (from volumio-buddy)
Downloading wiringpi2-2.32.3.tar.gz
Running setup.py (path:/tmp/pip-build-YYPnc1/wiringpi2/setup.py) egg_info for package wiringpi2

Requirement already satisfied (use --upgrade to upgrade): Pillow>=2.6.1 in /usr/local/lib/python2.7/dist-packages (from volumio-buddy)
Requirement already satisfied (use --upgrade to upgrade): socketIO-client-2>=0.7.2 in /usr/local/lib/python2.7/dist-packages (from volumio-buddy)
Downloading/unpacking pi-ina219 (from volumio-buddy)
Downloading pi_ina219-1.3.0-py2.py3-none-any.whl
Downloading/unpacking Adafruit-GPIO>=0.6.5 (from Adafruit-SSD1306>=1.6.1->volumio-buddy)
Downloading Adafruit_GPIO-1.0.3.tar.gz
Running setup.py (path:/tmp/pip-build-YYPnc1/Adafruit-GPIO/setup.py) egg_info for package Adafruit-GPIO

Requirement already satisfied (use --upgrade to upgrade): wiringpi>=2.23.1 in /usr/local/lib/python2.7/dist-packages (from wiringpi2>=2.32->volumio-buddy)
Requirement already satisfied (use --upgrade to upgrade): requests in /usr/lib/python2.7/dist-packages (from socketIO-client-2>=0.7.2->volumio-buddy)
Requirement already satisfied (use --upgrade to upgrade): six in /usr/lib/python2.7/dist-packages (from socketIO-client-2>=0.7.2->volumio-buddy)
Requirement already satisfied (use --upgrade to upgrade): websocket-client in /usr/local/lib/python2.7/dist-packages (from socketIO-client-2>=0.7.2->volumio-buddy)
Downloading/unpacking mock (from pi-ina219->volumio-buddy)
Downloading mock-4.0.2.tar.gz (71kB): 71kB downloaded
Running setup.py (path:/tmp/pip-build-YYPnc1/mock/setup.py) egg_info for package mock

Downloading/unpacking adafruit-pureio (from Adafruit-GPIO>=0.6.5->Adafruit-SSD1306>=1.6.1->volumio-buddy)
Downloading Adafruit_PureIO-1.0.4.tar.gz
Running setup.py (path:/tmp/pip-build-YYPnc1/adafruit-pureio/setup.py) egg_info for package adafruit-pureio
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: ‘python_requires’
warnings.warn(msg)
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: ‘long_description_content_type’
warnings.warn(msg)
Traceback (most recent call last):
File “”, line 17, in
File “/tmp/pip-build-YYPnc1/adafruit-pureio/setup.py”, line 43, in
‘Programming Language :: Python :: Implementation :: MicroPython’,
File “/usr/lib/python2.7/distutils/core.py”, line 111, in setup
_setup_distribution = dist = klass(attrs)
File “/usr/lib/python2.7/dist-packages/setuptools/dist.py”, line 266, in init
_Distribution.init(self,attrs)
File “/usr/lib/python2.7/distutils/dist.py”, line 287, in init
self.finalize_options()
File “/usr/lib/python2.7/dist-packages/setuptools/dist.py”, line 301, in finalize_options
ep.load()(self, ep.name, value)
File “build/bdist.linux-x86_64/egg/setuptools_scm/integration.py”, line 9, in version_keyword
File “build/bdist.linux-x86_64/egg/setuptools_scm/version.py”, line 66, in _warn_if_setuptools_outdated
setuptools_scm.version.SetuptoolsOutdatedWarning: your setuptools is too old (<12)
Complete output from command python setup.py egg_info:
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: ‘python_requires’

warnings.warn(msg)

/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: ‘long_description_content_type’

warnings.warn(msg)

Traceback (most recent call last):

File “”, line 17, in

File “/tmp/pip-build-YYPnc1/adafruit-pureio/setup.py”, line 43, in

'Programming Language :: Python :: Implementation :: MicroPython',

File “/usr/lib/python2.7/distutils/core.py”, line 111, in setup

_setup_distribution = dist = klass(attrs)

File “/usr/lib/python2.7/dist-packages/setuptools/dist.py”, line 266, in init

_Distribution.__init__(self,attrs)

File “/usr/lib/python2.7/distutils/dist.py”, line 287, in init

self.finalize_options()

File “/usr/lib/python2.7/dist-packages/setuptools/dist.py”, line 301, in finalize_options

ep.load()(self, ep.name, value)

File “build/bdist.linux-x86_64/egg/setuptools_scm/integration.py”, line 9, in version_keyword

File “build/bdist.linux-x86_64/egg/setuptools_scm/version.py”, line 66, in _warn_if_setuptools_outdated

setuptools_scm.version.SetuptoolsOutdatedWarning: your setuptools is too old (<12)


Cleaning up…
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-YYPnc1/adafruit-pureio
Storing debug log for failure in /root/.pip/pip.log