In this tutorial, we will guide you through the process of enabling MQTT discovery for your EQSP32 industrial ESP32 IoT controller.
We will also show you how to add an MQTT broker (e.g. Mosquitto MQTT) in your Home Assistant setup. Once Home Assistant (HA) is running with an MQTT broker installed, your device should appear even with basic initialization.
Before we begin, make sure you have completed the quickstart guide to set up your Arduino IDE environment. When the EQSP32 library runs on your IoT controller, it will be discoverable by the EQConnect mobile configuration utility. Using the EQConnect app, you can set up the Wi-Fi network and password, enable MQTT device discovery, and set up the broker username and password.
Prerequisites
Before we begin, ensure you have the following:
- An EQSP32 device.
- The EQConnect app installed on your smartphone. (Check resources)
- Home Assistant installed and running on your network.
How to install MQTT broker in Home Assistant (HA)
Follow these steps to install the Mosquitto MQTT broker in Home Assistant. This setup will allow your EQSP32 device to communicate with Home Assistant via MQTT.
Step 1: Open Home Assistant Settings
- Open Home Assistant and navigate to the Settings menu.
- Click on Add-ons.
Step 2: Add the MQTT Broker
- Click on the Add-on Store button at the bottom right corner.
- In the Add-on Store, search for “MQTT” and select Mosquitto broker.
- Click on the Install button to install the Mosquitto MQTT broker.
Step 3: Configure and Start the MQTT Broker
- After installation, the Mosquitto broker settings should be
Start on bootenabled,Watchdogdisabled andAuto updatedisabled. - Click on the Start button to start the Mosquitto broker.
Step 4: Connect Home Assistant to the MQTT Broker
- Navigate again to the Settings menu and now go to Devices & Services.
- In Discovered section you should see the MQTT service.
- Click on Configure, then Submit and finally Finish.
- You are done!
Now your MQTT broker is installed and running in Home Assistant. You can proceed with setting up your EQSP32 device to communicate with Home Assistant using MQTT.
Upload a simple program to EQSP32
To enable your EQSP32 device to communicate with Home Assistant, we need to upload a program that at least initializes the device and sets up the system ID.
Once the device is initialized with the EQSP32 library, it will become available to EQConnect mobile configuration utility. From our mobile app, we can enable MQTT device discovery and configure the broker’s credentials.
#include <EQSP32.h>
EQSP32 eqsp32;
void setup() {
EQSP32Configs configs;
configs.devSystemID = "MySystemID"; // Replace with your actual system ID
eqsp32.begin(configs, true); // Initialize with verbose mode for debugging
}
void loop() {
delay(1000); // Ensure a small delay for non-blocking operation
}
Enable MQTT device discovery via EQConnect
Now that we have initialized the EQSP32 device, the next step is to enable MQTT device discovery using the EQConnect app.
Step 1: Connect to EQSP32 via Bluetooth
- Launch the EQConnect app on your device.
- Ensure EQSP32’s Bluetooth LED is blinking. If not, shortly press the
Bootbutton. - Ensure the device is within range.
- EQConnect will then automatically connect to your EQSP32.
Step 2: Set Up Wi-Fi Connection
Before enabling MQTT discovery, we first need to allow EQSP32 access to the same network with our Home Assistant (HA).
- Tap on the Wi-Fi icon at the top of the screen.
- Select your Wi-Fi network from the list.
- Enter the Wi-Fi password and tap on Connect.
Step 3: Enable MQTT Device Discovery
- Go back to connection screen.
- Setup the preferred device name. This is the name your EQSP32 device will have in Home Assistant.
- Tap on the advanced settings icon (gear icon) next to the device name.
- Check the MQTT Device Discovery box.
- Enter the username and password for your Home Assistant MQTT broker.
By default these are going to be the same as your Home Assistant username and password.
- Tap on Update to save the settings.
The settings are now saved but will only be applied after reboot. - If you are done configuring EQSP32, tap on Reset & Apply to restart the EQSP32 device and apply the new MQTT settings.
Monitor EQSP32 in Home Assistant (HA)
We have successfully enabled MQTT device discovery for the EQSP32 device using the EQConnect app. If Home Assistant is online and the MQTT broker is running, we will be able to see EQSP32 as an MQTT device.
Even though we have not created any interfacing entities for Home Assistant, EQSP32 will publish its system parameters automatically. We can now monitor the Input & Output supply voltages and WiFi signal strength.
Monitoring EQSP32’s system parameters
- Go to Settings and click on Devices & Services.
- Under the configured integrations, find and click on Device under MQTT.
- You should see your EQSP32 device with 3 entities, Input Voltage, Output Voltage and Signal Strength.
Now our device is discoverable in Home Assistant and we have monitoring access to its system parameters.
In our next tutorial, we will demonstrate how to create interfaces to monitor ADIO pins, custom sensors and send control commands via Home Assistant (HA). This setup creates a powerful and flexible automation system for iot applications.
For more technical information regarding EQSP32, check out EQSP32 datasheet.