MQTT Volume Control
The MQTT Volume Control Android app allows you to control the volume levels and mute settings of an Android device from HomeAssistant via MQTT.
The app supports HomeAssistant MQTT auto discovery, so the volume control will automatically appear as number (slider) entities, and mute as switches.
You can configure a few simple things:
- Server address: The server name or IP address of your MQTT broker. You must configure this field for the app to work.
- Port number: The MQTT broker’s port number – the default is 1883.
- Username: If you need a username to log on to your MQTT broker.
- Password: If you need a password to log on to your MQTT broker.
- Connect using SSL/TLS: Connect to the MQTT broker using an encrypted SSL/TLS connection. This will also authenticate the server’s SSL/TLS certificate, unless you disable it (see below).
- Trust any SSL/TLS certificate (insecure): Do not authenticate the MQTT broker’s SSL/TLS certificate, and accept any certificate. This option is strongly discouraged as it makes the MQTT communication insecure, as you cannot truly trust that the server is what it claims to be.
- Automatically connect on app start & reboot: Check this to automatically attempt to connect when the app is started or after a device reboot.
- Reconnect indefinitely: If the connection is lost, try to reconnect indefinitely. If unchecked, retry up to 3 times.
Once you’ve configured this, click Connect and then have a look in HomeAssistant — you should see your volume- and mute settings as new entities.
Google Play Store description
This description is from MQTT Volume Control on Google Play Store:
Remote control the audio volume of the Android device where this app is running – from HomeAssistant via MQTT.
The app solves a home automation issue I’ve had for years: In my house we have a wall-mounted Android tablet in the kitchen. This tablet is used for things like grocery lists, looking up recipes – and as our “internet radio” (via a set of active loudspeakers). However, I couldn’t mute or control the volume while eating at the dinner table – at least not until now. This is the specific problem MQTT Volume Control app solves: Remote control the audio volume in HomeAssistant.
Once the application is connected, it will launch a service that stays connected in the background so you don’t need to keep the app open. The service will try to keep the device alive, so it may cause the power usage to increase. Personally for me, this is fine as the wall-mounted tablet is always connected to a charger. You can also tell the application to automatically start when the device has booted.
The app uses HomeAssistant MQTT auto discovery. This means the volume control entities should automatically appear in HomeAssistant (see screenshot). The app provides volume level controls for the media-, call-, alarm- and notifications audio streams, as well as a mute/unmute for media and notifications – depending on what the particular device supports.
Prerequisites: You will need an MQTT broker and the HomeAssistant home automation application. HomeAssistant must also be configured to use the MQTT broker. If you don’t know what MQTT or HomeAssistant is, this app is probably not for you.
MQTT Volume Control support both unencrypted MQTT, as well as MQTT over SSL/TLS.
MQTT Volume Control supports SSL/TLS encrypted connections, which implies that you’ll need a SSL/TLS certificate installed on your MQTT broker. This basically leaves you with four options:
- Use a proper, trusted certificate. That is, you get your server’s certificate signed by a certificate authority that Google (Android) trusts. A few free options exist, for example https://letsencrypt.org/. This can, unfortunately, be problematic if your home network isn’t publicly available and Let’s Encrypt isn’t able to validate your server.
- Use a self signed certificate. This is what I use in my personal setup. See e.g. http://www.steves-internet-guide.com/mosquitto-tls/ for a guide on how to do this. Note that you’ll need to add your self-signed CA certificate (and possibly also the server certificate) to your Android device.
- Disable authentication using the “Trust any SSL/TLS certificate (insecure)” option. This instructs MQTT Volume Control to ignore any certificates problems, including invalid names, dates, and signatures. You really shouldn’t use this, as this is almost as unsecure as the option below.
- Don’t use SSL/TLS. If you’re on your trusted home network, this might be good enough.
Problems? Suggestions? Comments?
Drop me an email on email@example.com.
Please also leave a review on the Play Store 🙂
The app does not communicate with anything but the configured MQTT broker.
The data you enter (server name, port, username, password, etc.) will be saved on the local Android device, and will be sent to the configured MQTT broker.
The MQTT data contains:
- device identifiers;
- the Android device name (Bluetooth name)
- the Android ID
- device model and manufacturer
- volume control level settings
- volume mute settings
The device identifiers are used for HomeAssistant MQTT auto discovery. Factory resetting your Android device should generate a new Android ID.