Skip to main content

A simple Linux-based doorbell, which plays the mp3 bell ringtone upon receiving an MQTT message.

Project description

Simple MQTT Door Bell

A simple Linux-based doorbell, which plays the mp3 bell ringtone upon receiving a MQTT message.

The main idea is to create a system service, which can play an audio file upon receiving the message from the MQTT message broker. This may be useful for configuring sound notifications or alarms in the Home Assistant automations.

Supported platforms

This solution has been tested on Ubuntu 22.04, but most likely will work on other Linux distros, with minor changes.

Prerequisites

  1. Mosquitto MQTT message broker installed and accessible from the deployment machine.

  2. MP3 player utility, which can play mp3 files from the command line, installed on the host machine. I used mpg123 but other options should work as well.

  3. Python verison >= 3.10

Installation

First please ensure all pre-requisites are in place. Testing your MP3 player from the command line on the host where you plan to deploy this tool is the first step - you need to ensure that mp3 files are played as expected.

For example, here is the command for the mpg123 utility:

$ mpg123 -qf32768 -adefault:CARD=Speaker /path/to/ringtone.mp3

In this command, the number after the -qf option represents the volume, which can range from -32767 to 32768.

Second, we need to create a user profile, which will run the mqtt-doorbell service:

$ useradd -M doorbell
$ usermod -L doorbell
$ groupadd doorbell
$ usermod -a -G doorbell,audio doorbell 

Next, clone this repo to some folder on your disk:

$ git clone https://github.com/abratchik/mqtt-doorbell

Configuration

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

mqtt_doorbell-0.1.3.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

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

mqtt_doorbell-0.1.3-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file mqtt_doorbell-0.1.3.tar.gz.

File metadata

  • Download URL: mqtt_doorbell-0.1.3.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.12

File hashes

Hashes for mqtt_doorbell-0.1.3.tar.gz
Algorithm Hash digest
SHA256 7aa9f7a3a9e09c78508a5a0bc1e2207d656a6c577ff26c8cf5cb374cfced5178
MD5 55ceeec0ad5ecec8c6bc43b864d476fd
BLAKE2b-256 590bb706e3484f6234813f57e1ff09ae6c9ebea69f7a228a6214b0f9750384ac

See more details on using hashes here.

File details

Details for the file mqtt_doorbell-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: mqtt_doorbell-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.12

File hashes

Hashes for mqtt_doorbell-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6bf63fe1a346d1cff7150754896d8033f51afa106a43de17a8db5dfecac37f76
MD5 9d580d9d1e5b3173d4dc31430d802f92
BLAKE2b-256 3d86548138373335ddf22736c9ecfb6a4164f220fe433502c1455712d2fb210c

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