npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

airtunes2mqtt

v1.2.3

Published

This is a little daemon that can retrieve an audio stream via TCP socket or from a Alsa Loopback device and stream it to Airplay/Airtunes compatible receivers. Via Web UI or MQTT you can control the receivers volume and enable/disable the receivers.

Downloads

86

Readme

airtunes2mqtt

mqtt-smarthome NPM version dependencies Status Build Status XO code style License

Multi-Room Audio based on Airplay/Airtunes with MQTT support 🔈

This is a little daemon that can retrieve an audio stream via TCP socket or from a Alsa Loopback device and stream it to one or more Airplay/Airtunes compatible receivers. Via its Web UI or MQTT you can control the receivers volume and enable/disable the receivers. I'm using it in conjunction with Mopidy to create a Multiroom Smart Home integrated audio playback system with several Airplay Speakers.

Based on lperrins node_airtunes - all credits belong to him. Also thanks to Adam Duncan for creating a fork that works with recent versions of Node.js.

Installation

Prerequisite: Node.js >= 6

$ sudo npm install -g airtunes2mqtt
$ airtunes2mqtt --help

I suggest to use pm2 to manage the airtunes2mqtt process (start on system boot, manage log files, ...).

Command Line Options

Usage: airtunes2mqtt [options]

Options:
  --disable-web    disable web server
  --web-port       web server listening port                     [default: 8096]
  --version        Show version number                                 [boolean]
  -h, --help       Show help                                           [boolean]
  -u, --mqtt-url   mqtt broker url. May contain user/password
                                                   [default: "mqtt://127.0.0.1"]
  -s, --speaker    name:host:port or name:host:portStart:portEnd of speaker. May
                   be repeated.                                       [required]
  -n, --name       instance name. used as mqtt client id and as prefix for
                   connected topic                         [default: "airtunes"]
  -v, --verbosity  possible values: "error", "warn", "info", "debug"
                                                               [default: "info"]
  -p, --port       TCP Listen port for audio reception          [default: 12346]
  -l, --loopback   Use Alsa loopback device instead of TCP listener    [boolean]
  -d, --device     Alsa loopback device               [default: "hw:Loopback,1"]

Example Command Line

$ airtunes2mqtt -s LivingRoom:192.168.2.100:5000 Kitchen:192.168.2.103:5000 -s SoundFly:192.168.2.105:1024:1032 -v debug

Example Mopidy Configuration

[audio]
output = audioconvert ! audio/x-raw,format=S16LE,rate=44100,channels=2,layout=interleaved ! tcpclientsink host=127.0.0.1 port=12346

Web UI

Airtunes2mqtt offers a simple user interface (web app capable) to enable/disable speakers and adjust volume:

webapp

Mopidy UI integration

I just added the airtunes2mqtt ui into the frontend of my mopidy server ("musicbox webclient") by removing the original volume slider and adding an iframe:

musicbox /usr/local/lib/python2.7/dist-packages/mopidy_musicbox_webclient/static/index.html

         <li data-icon="false">
-            <div><!-- slider for volume -->
-                <a href="#" onclick="controls.doMute(); return false;"><span title="Toggle mute"><i id="mutebt" class="fa fa-volume-up"></i></span></a>
-                <label for="volumeslider" class="ui-hidden-accessible">Volume</label>
-                <input id="volumeslider" data-highlight="true" name="volumeslider" data-mini="true" type="range" min="0"
-                       value="0" max="100"/>
-            </div>
+            <iframe style="border:0;padding:0;margin:0;height:450px;width:240px;" src="http://192.168.2.100:8096/ui/index.html"></iframe>
         </li>

MQTT Topics

subscribed

  • airtunes/set/<speaker-name>/enable - Enable or disable a speaker (payload can be true, false, 0 or 1)
  • airtunes/set/<speaker-name>/disable - Disable a speaker (payload is irrelevant)
  • airtunes/set/<speaker-name>/volume - Set a speakers volume (payload has to be a number between 0 and 100)

published

  • airtunes/connected - Publishes 1 after airtunes2mqtt started, 2 when a client is connected via tcp socket respectively when the alsa loopback device is connected and 0 as last will.
  • airtunes/status/activeSpeakers - Number of currently enables speakers.
  • airtunes/status/speaker/enable - Actual speaker state.
  • airtunes/status/speaker/volume - Actual speaker volume.

License

MIT Copyright (c) 2015-2018 Sebastian 'hobbyquaker' Raff [email protected]