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.1.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.1-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mqtt_doorbell-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 ec717dd690c9be48e6f35d9660e0273c5866d0ddc5616aec9a5878f000d8c4bf
MD5 c0fce62c25e4dbf350b40db059acf387
BLAKE2b-256 569dec874c3f166e696026d0dc8c12c5a82aba33209672dc0de527811c726721

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mqtt_doorbell-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bb8c2fac125ef3532735960ed76ad2bf2af1968e385dcd010e4b589a6a9d95e8
MD5 1029b5e6c698b0a3d5bbe5b29ff3dc0d
BLAKE2b-256 9e47c6e6b23c88a38ad2c1b3e5b277875a9764c2804a255a83dab5430d43ea2d

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