Computer NetworksNETWORKS

MQTT 102: Add Home Assistant Discovery to your Devices

Instead of asking users to manually enter a bunch of YAML to integrate your MQTT device, you can easily add Home Assistant MQTT discovery to your project and integrate your entities straight into Home Assistant. No fancy APIs or coding necessary. Just add a couple of MQTT messages to your device setup. I’ll show you the basics, along with some recommendations for your own projects to make your device as easy to add to Home Assistant as any other native integration.

You can find additional information, along with code snippets and more in the written version of this project:
https://resinchemtech.blogspot.com/2023/12/mqtt-auto-discovery.html

Chapter Links:
=============
00:00 Intro and Requirements
02:33 Discovery Topics and Payloads
06:12 Providing a Discovery Option
07:36 Publishing a Single Entity
10:12 Importance of Unique IDs
13:00 Creating a Home Assistant Device
19:29 Wrap Up and More Info

Additional Links and information:
================================
Written Guide: https://resinchemtech.blogspot.com/2023/12/mqtt-auto-discovery.html
Github Gist of pertinent code used in this video: https://gist.github.com/Resinchem/ecd86dfb52bd699c79acfa80cd348d7b
DIY Home Assistant Integrations: https://youtu.be/Q0S0xOW35k8
Official Home Assistant Doc (including discovery info): https://www.home-assistant.io/integrations/mqtt/

If you’d like to help support this channel, or just say thanks, you can consider buying me a cup of coffee:
https://www.buymeacoffee.com/resinchemtech

#mqtt #homeassistant

source

mac address

Alice AUSTIN

Alice AUSTIN is studying Cisco Systems Engineering. He has passion with both hardware and software and writes articles and reviews for many IT websites.

11 thoughts on “MQTT 102: Add Home Assistant Discovery to your Devices

  • I'm subscribed. The booze LED temptation would make me drink too much booze in the process. I don't keep any in the house. I'm no expert, but in Arduino code (I use PlatformIO) you can obtain the MAC address of the ESP32 and use that (w or w/o prefix or suffix) as the "Unique Address", "Entity ID" or whatever. Coffee + 420 is my poison these days. I jumped too fast on this.

  • That was a great video. I didn't know it was so easy. Thank you.

  • This is another great video, your methodology and descriptions are just what the doctor ordered for me! Excellent coverage of what used to be a pure mystery to me. Still not there yet but I will make it someday and this will be booked marked and waiting when I arrive! Hope that you had a great Christmas and will have a safe and prosperous New Year!👋

  • Fantastic, I can see this coming in handy! Thanks for another great guide!

  • I'll for suer add this code to some of my projects. I had to look up your website to find out more about how you tell the device to turn discovery on and off, but perhaps you can include a quick link to how to handle the post call.

  • Great video; i feel your angle on MQTT, HA, etc. is unique in a fairly crowded field of options and I always learning more about things like MQTT interactions like this video highlights

  • Great explanation. I knew you would do a much better job of explaining it than I ever could!! I am glad you shared the mqtt message size limit problem. That took me a while to figure out. Thanks for sharing. I would love to see some more mqtt stuff. Getting into the weeds of things so to speak. Your videos are a huge help to the rest of us.

    Joe

  • I've used this a month ago on my own device, works great 🙂

  • I JUST found your channel and watched your bed sensor and IR transmitter video not even 30 minutes ago, it was super interesting. This video looks great as well, and I’ll be setting up HA for the first time later today so thank you 😊

  • i'm new to all this home assistant and ESP32 stuff 🙂 i'm loving the vids. currently trying to make my two 8×32 boards as a scoreboard on esp32 and wled… and it's hard 🙁 how can i stop the text from scrolling? i just want static text 🙁

Comments are closed.