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

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> or
List of playlists /plists <array of playlists name:uri>
Track Artwork (*) /artw <url of image to download>
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>

(*) Published after any track started playback
(**) Published after any tracklist change

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>

(*) 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.

Credits

Based on previous works of:

Contribute

You can contribute to Mopiqtt by:

paypal

Changelog

Downloads

1.0.1

  • First release

1.0.2

  • Added mopidy/cmnd/ploadshf to load and play shuffled playlists

1.0.3

  • Better playlist list formatting Breaking change: Now the list is an array of objects
  • Introducing position of current playing track

1.0.4

  • Fixed bug on mopidy/cmnd/add
  • Added mopidy/cmnd/pstream to load and play a radio stream (or any single track)
  • Added mopidy/stat/refreshed event when playlists have been refreshed
  • Added mopidy/stat/plrefresh to refresh one or all playlists

1.0.5

  • Improved error catching
  • Added mopidy/stat/trklist message showing the list of tracks in the queue
  • Added mopidy/cmnd/chgtrk to change current playing track in tracklist

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.0.5.tar.gz (13.8 kB view details)

Uploaded Source

File details

Details for the file Mopiqtt-1.0.5.tar.gz.

File metadata

  • Download URL: Mopiqtt-1.0.5.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.5

File hashes

Hashes for Mopiqtt-1.0.5.tar.gz
Algorithm Hash digest
SHA256 be51cec3f247cd39482c7cee8fbe6ff24d0cc94c4e0cf4170f58353a1988a240
MD5 fd36d15fea8f637ffc0880b2bd82ef7b
BLAKE2b-256 f3be9324e7a267a14e155e3964a9e9a9c7f6417c999869fa91332234636e0fb5

See more details on using hashes here.

Supported by

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