Hey everyone, I’m thrilled to share my recent journey of integrating custom ESP32 hardware with Home Assistant using MQTT. As a newcomer to the world of home automation, I was both excited and a bit overwhelmed by the possibilities. My goal was to connect a Tank Level Sensor to my dashboard, but the process wasn’t as straightforward as I hoped.
Initially, I faced challenges with the MQTT broker connection. I set up my ESP32 to publish raw text data, but I quickly realized that most examples online relied on JSON formatting. This discrepancy led me to experiment with different configurations in my config.yaml file. After several attempts, I discovered that adjusting the value_template was crucial for parsing the raw text data correctly.
Here’s a snippet of my final configuration:
yaml
sensor:
- platform: mqtt
name: “Tank 2”
unique_id: tank_2_level
state_topic: “Bills_Mesh/master/tank2/level”
unit_of_measurement: “%”
value_template: “{{ state.value.level }}”
The key takeaway for me was understanding that the value_template needed to match the structure of the incoming data. This experience taught me the importance of carefully reviewing data formats and ensuring consistency between the hardware and software configurations.
I’m now successfully monitoring my tank levels, and it’s incredibly satisfying to see this integration working seamlessly within my Home Assistant setup. If anyone else is working on similar projects, I’d be happy to share more details or troubleshoot together. Happy automating! ![]()