Skip to content

bostrum/mqtts-speaker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

mqtts-speaker

Listening for messages from MQTT broker to alert as audio on speaker.
Currently using it with Home Assistant to send voice alerts when my coffee is done brewing ☕

Prerequisites

  • MQTT Broker like Mosquitto setup.
  • Integration of some kind to send messages, Home Assistant etc.
  • Device with a speaker that can run Python.

Getting started

  1. Check that all prerequisites are prepared and setup.
  2. Install libraries paho and gtts using pip or other package manager.
  3. Clone the repository.
  4. Edit the .py file and change variables under '# Configuration' where needed.
  5. MQTT_BROKER and AUDIO_DEVICE most likely. Run below to find your speaker.
aplay -l
  1. Setup .py with systemd for example to run on start.

Example

  • Mosquitto Broker installed on server or add-on in Home Assistant.
  • HA Automation for sending MQTT message to the broker on trigger. YAML example here.
  • Raspberry Pi and this speaker.
image

Dependencies

  • Python libraries
    • paho (MQTT Client for subscribing to broker)
    • gtts (Google Text-to-Speech) !Needs internet unfortunately
  • Binaries
    • mpg321 (For playing audio file)

About

Listening for messages from MQTT broker to alert on speaker. Currently using it with Home Assistant to send voice alerts when my coffee is done brewing.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages