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 ☕
- MQTT Broker like Mosquitto setup.
- Integration of some kind to send messages, Home Assistant etc.
- Device with a speaker that can run Python.
- Check that all prerequisites are prepared and setup.
- Install libraries paho and gtts using pip or other package manager.
- Clone the repository.
- Edit the .py file and change variables under '# Configuration' where needed.
- MQTT_BROKER and AUDIO_DEVICE most likely. Run below to find your speaker.
aplay -l
- Setup .py with systemd for example to run on start.
- 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.
- Python libraries
- paho (MQTT Client for subscribing to broker)
- gtts (Google Text-to-Speech) !Needs internet unfortunately
- Binaries
- mpg321 (For playing audio file)