Skip to main content

Control mopidy music server through MQTT broker

Project description

Based on mopidy-mqtt

Mopiqtt

MQTT interface for Mopidy music server. Allows easy integration with Node Red or any MQTT client. This package is mainly useful to Node Red users, who can embed in their flows a full control over Mopidy by simple mqtt-in or mqtt-out nodes. See Node Red examples. Of course, it can be used by any other MQTT client too.

Installation

Using pip:

[sudo] python3 -m pip install Mopiqtt

(If you are running Mopidy as a service, use sudo)

Configuration

Add the following section to your mopidy's configuration file: /etc/mopidy/mopidy.conf

[mopiqtt]
host = <mqtt broker address>
port = 1883
topic = mopidy
username =
password =

Note: Remember to also supply username and password options if your MQTT broker requires authentication. If not, just leave blank the two values.

Note: Restart Mopidy with sudo service mopidy restart

To check Mopidy log run sudo tail -f /var/log/mopidy/mopidy.log

Features

  • Sends information about Mopidy state on any change
    • Playback status
    • Volume
    • Track description
    • Playlists list
    • Artwork
    • Track index
  • Reacts to control commands
    • Playback control
    • Tracklist control
    • Volume control
    • Load & play a playlist (straight or shuffle)
    • Request playlists list
    • Refresh playlists
    • Get tracklist
    • Search for artist/album/track name

MQTT protocol

Topics

Default top level topic: mopidy.

Control topic: mopidy/cmnd.

Information topic mopidy/stat.

Messages to subscribe to (mopidy/stat/<msg>)

Subtopic Values
Playback State /plstate paused / stop / playing
Volume /vol <level(int)>
Current track /trk <artist(str)> - <title(str)> - <album(str)> or
List of playlists /plists <array of playlists name:uri>
Track Artwork (*) /artw <url of image to download>
Track uri (*) /trk_uri <track uri (string)>
Playing track index (*) /trk-index {current: x, last: y}
Playlists have been refreshed /refreshed
List of tracks in the queue(**) /trklist <array of tracks name:uri>
List of URI schemes Mopidy can handle in search(***) /uri_schemes <array of schemes (str)>
Search results /search_results <array of objects {name: .. , uri:...}>

(*) Published after any track started playback. Local artwork is NOT supported
(**) Published after any tracklist change
(***)Published after a request queryschemes

Messages to publish to (mopidy/cmnd/<msg>)

Subtopic Parameters
Playback control /plb play / stop / pause / resume / toggle / prev / next
Volume control /vol =<int> or -<int> or +<int>
Clear queue /clr
Add to queue /add <uri(str)>
Load and play playlist (straight) /pload <uri(str)>
Load and play playlist (shuffle) /ploadshfl <uri(str)>
Request list of playlists /plist
Load and play a radio stream (or a single track) /pstream <uri(str)>
Refresh one or all playlists(*) /plrefresh <uri_scheme> or None
Change current playing track(**) /chgtrk <uri(str)>
Query URI schemes Mopidy can handle in search /queryschemes
Search for any string (artist, track, album) /search <JSON {"search": [list of strings], "uri_schemes": [list of schemes]}>

(*) If uri_scheme is None, all backends are asked to refresh. If uri_scheme is an URI scheme handled by a backend, only that backend is asked to refresh.
(**) Note that the track must already be in the tracklist.

Contribute

You can contribute to Mopiqtt by:

paypal

Credits

Based on previous works of:

Project resources

Downloads

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mopiqtt-1.2.1.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mopiqtt-1.2.1-py2.py3-none-any.whl (13.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file mopiqtt-1.2.1.tar.gz.

File metadata

  • Download URL: mopiqtt-1.2.1.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for mopiqtt-1.2.1.tar.gz
Algorithm Hash digest
SHA256 978841243e8262286c9e1bf32e47a354f65912ea8f7dfb32d1fb78d9590b2470
MD5 a4024bbece4d45e7f4da6119631fa195
BLAKE2b-256 34e54a78952a329de8b1750cfb91c96009eb1ff35d7854596bef2b4e93262cfc

See more details on using hashes here.

File details

Details for the file mopiqtt-1.2.1-py2.py3-none-any.whl.

File metadata

  • Download URL: mopiqtt-1.2.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for mopiqtt-1.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 102f4fdbca75e3b2ecb45753e8d9b57970c8f3ee82228c5a87ba309b7804ca80
MD5 f938e2798b52ff9acf8f4c299376a75c
BLAKE2b-256 40784942a6e25aaef8b513f37b34d5ff812b048ef310e501acb6a662682757ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page