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
-
Mosquitto MQTT message broker installed and accessible from the deployment machine.
-
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.
-
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mqtt_doorbell-0.1.2.tar.gz.
File metadata
- Download URL: mqtt_doorbell-0.1.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a83df194c856dbbd38f59d301bf37b112d66ffaf912df3302a24e20095986826
|
|
| MD5 |
1f4ff82a8e83a838f4c893871b30e2bc
|
|
| BLAKE2b-256 |
69d614884084a07fd24263424f8286172f6c7b8ff050208caea15555dc6d48a4
|
File details
Details for the file mqtt_doorbell-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mqtt_doorbell-0.1.2-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74c8749fe0452b0a48ee74b08029a875199369efb1f732d743e9e412e86f93cb
|
|
| MD5 |
d269c1ba6a799f45bf2e57e868b5255c
|
|
| BLAKE2b-256 |
2f5beaf1576ecbace566ad0595f92c4e8381fb2501e36e272981f16c4eb47613
|