Giter Club home page Giter Club logo

alsa2mqtt's Introduction

  • Syncs ALSA volume (same volume slider as in alsamixer) with MQTT
  • Publishes state of device to MQTT usually from /proc/asound/card0/pcm0p/sub0/status

Use this to react to changes in volume or to change the ALSA volume by external events.

Topics

dersimn/SoundPi/online → true

dersimn/SoundPi/status/device-in-use → {
      "val": true,
      "state": "RUNNING"
    }

dersimn/SoundPi/status/volume → 21

dersimn/SoundPi/set/volume ← 42

Install

apt install build-essential git libasound2-dev

git clone https://github.com/dersimn/alsa2mqtt
cd alsa2mqtt
npm i

Usage

See node index --help

alsa2mqtt 0.0.2
Control ALSA volume from MQTT

Usage: index [options]

Options:
      --prefix                                      [default: "dersimn/SoundPi"]
      --alsa-card                                           [default: "default"]
      --polling-interval  polling interval (in ms) for status updates
                                                                 [default: 3000]
      --version           Show version number                          [boolean]
  -h, --help              Show help                                    [boolean]
  -v, --verbosity         Possible values: "error", "warn", "info", "debug"
  -u, --mqtt-url          mqtt broker url. See
                          https://github.com/mqttjs/MQTT.js#connect-using-a-url
  -m, --alsa-mixer                                                    [required]
  -s, --alsa-status-file                                              [required]

Example:

node index -v debug -u mqtt://10.1.1.100 -m Line -s /proc/asound/card1/pcm0p/sub0/status

Install as systemd service

Copy alsa2mqtt.service to /etc/systemd/system/alsa2mqtt.service, and edit parameters in ExecStart, then:

systemctl daemon-reload
systemctl enable alsa2mqtt.service 
systemctl start alsa2mqtt.service

Credits

alsa2mqtt's People

Contributors

dersimn avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

dotwee

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.