GithubHelp home page GithubHelp logo

dotwee / docker-alsa2mqtt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dersimn/alsa2mqtt

1.0 1.0 0.0 46 KB

Control alsa audio devices on (remote) hosts using mqtt

Home Page: https://hub.docker.com/r/dotwee/alsa2mqtt

JavaScript 85.07% Dockerfile 14.93%
alsa mqtt smarthome docker docker-image

docker-alsa2mqtt's Introduction

github status github activity github open issues docker pulls

  • 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/dotwee/docker-alsa2mqtt
cd docker-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

Docker

Get the container image

$ docker pull dotwee/alsa2mqtt:latest
$ docker pull ghcr.io/dotwee/alsa2mqtt:latest

available tags

  • linux/arm/v7
  • linux/arm64
  • linux/amd64

or build it locally from source

If you don't want to use the public container image from Docker Hub, build the image locally:

$ docker build --tag dotwee/aksa2mqtt:latest github.com/dotWee/docker-alsa2mqtt

Run the image

Simply run docker run --rm -v "$ALSA_STATUS_FILE:ALSA_STATUS_FILE" dotwee/aksa2mqtt:latest and append your arguments.

Replace make sure to mount the alsa status file! Replace $$ALSA_STATUS_FILE to whatever value --alsa-status-file gets set.

Example:

$ docker run --rm -v "/proc/asound/card1/pcm0p/sub0/status:/proc/asound/card1/pcm0p/sub0/status" dotwee/aksa2mqtt:latest -v debug -u mqtt://10.1.1.100 -m Line --alsa-status-file /proc/asound/card1/pcm0p/sub0/status

Running the image without providing arguments will run with --help by default:

$ docker run --rm dotwee/aksa2mqtt:latest                                                 
alsa2mqtt 0.0.2
Control ALSA volume from MQTT

Usage: index.js [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]

Credits

docker-alsa2mqtt's People

Contributors

dependabot[bot] avatar dersimn avatar dotwee avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.