Frontend for changing volume


I want to write a simple frontend to controll the volume. However, it seems that I have a general misunderstanding in the frontend concept. I’m expecting that my frontend should be derived from core.PlaybackController to access the volume. However, I don’t get it working:

ERROR    Uncaught exception
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/mopidy/", line 274, in run
    self.start_frontends(config, frontend_classes, core)
  File "/usr/lib/python2.7/site-packages/mopidy/", line 364, in start_frontends
    frontend_class.start(config=config, core=core)
  File "/usr/lib/python2.7/site-packages/pykka/", line 93, in start
    obj = cls(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/Mopidy_Headless-0.0.1-py2.7.egg/mopidy_headless/", line 25, in __init__'Volume: {0}'.format(self.volume))
  File "/usr/lib/python2.7/site-packages/mopidy/core/", line 91, in get_volume
    if self.mixer:
AttributeError: 'InputFrontend' object has no attribute 'mixer'

I wonder why a similar project writes its own backend to change volume: TTS GPIO
Is a frontend not able to change volume or jump to next track?

When I was doing the extension I was not able to change the volume without the use of a backend. Beause of that I use a backend in TTS GPIO. But I also think that it is logical that a fronted could change the volume. I am not sure if there is no way to change the volume from an frontend or I could not find the way to do it.
Maybe someone else can help us to know what is the best way to change the volume.

Anyway I know for sure you can get the volume value and jump to the next track:


You should not subclass core.PlaybackController. All frontends registered in the extension registry will be instantiated with two arguments: the config object and the core object. The core object can be used to get and set volume:

Using the volume property documented at

current_volume = core.playback.volume.get()
core.playback.volume = current_volume + 10

Or using the “hidden” getters and setters (which are the ones that are exposed to JavaScript clients, but also works in Python):

current_volume = core.playback.get_volume().get()
core.playback.set_volume(current_volume + 10)

Thanks, thats what I was missing. Its working now as expected.

@9and3er: Nevertheless, it is a good starting point for me.

1 Like