An excellent video. At last someone who doesn't assume the audience is an IT illiterate fool who struggles to set their oven clock. I usually watch HA videos with a copious amount of right arrow clicking so I can find the relevant information. I watched your video intently. Thank you, subscribed.
Thanks for the kind words. While it makes my videos a bit longer than most, I do try to include the "why" as well as the "how" in my videos so that those with less experience can understand why I'm doing steps A, B and C and not just blindly repeat my steps. If you liked this video, I do have an entire playlist of Home Assistant 101 and related videos: ruclips.net/p/PLqjDNeOVHOkflCfZDY2vJnVHud0m3n0Vz&si=BNcnR4wN4sYG2bqV Thanks for watching and thanks for the sub. Welcome to the channel!
You are welcome. Glad you find them helpful. MQTT was initially hard for me to get my head wrapped around, but now I routinely make use of it for my DIY projects. I wanted to try to share a little info for others that might be new to the concepts. Thanks for watching and taking a moment to leave a comment!
Haha, HA "101", NOT even close, more like 301, templates 201. This video is so over do by anyone! You really knocked it out of the park. I'll be using this as a reference for a LONG time. I'm glad you DID do this in YAML. Your explanation of the relationship of the indented items/options helps make the documentation easier to understand! Nice add showing how different devices have different option names that do the same thing. Showing the case with the template argument, brought that one home too!! YAML made no since to me in the beginning coming from the world were everything was a "record", ie, pre-objects. And widgets were something used in a business class project or X11. Thanks for the clear and thought out explanation!
YAML can definitely be a little difficult at first. Fortunately (well for some anyway), Home Assistant doesn't require a new user to create and modify nearly as much YAML as it did just a few years ago... when you had to do pretty much everything in YAML. But since that's the way I learned, I do try to share a little of my experience with YAML for those that might just be getting started. Thanks for watching.
Looking forward to learning about auto discovery as it’s the one big thing missing from my current project (HUB75 display driven off a Pico W etc). MQTT is awesome. Thanks for the video!
You are welcome. Right now, my schedule calls for having that MQTT discovery video out in a couple of weeks... if nothing else changes or gets in the way between now and then! Thanks for watching... and the comment.
Thank you. I've almost got everything for my home built water tank level sensor going. Next up is the mtqq discovery video. HA yaml is taking a bit to learn :)
You are welcome. Glad my videos are helping out a bit. It is true that getting a handle on YAML can take a bit (it drove me crazy when I first started), but it becomes easier after a while. A note on the MQTT discovery: Release 2024.11 made some changes in how the MQTT payload is structured for device discovery. So the original video will cover all the details, its just the portion on creating a device with multiple entities that is slightly different. I covered the changes in a recent update video. While the older method still works (for now), the new method is recommended moving forward. So you may wish to watch the original video, then the much shorter update video for the changes just introduced in Home Assistant MQTT Discovery. And of course, just let me know if you have any questions along the way. Thanks for the comment!
Very helpful video. The list shown at 08:13 with all the valid entities, I cannot find that anywhere. Can you share where to find this list? Thank you :)
You can find that list on this page: www.home-assistant.io/integrations/mqtt/ On the page, simply drop down the box that says "Configuration of MQTT components via MQTT discovery" to see a list of the types of components that can be discovered.
You are welcome! I know that I kind of just provided a quick overview in the original video and a lot of viewers had asked me to provide more specific details on the how the integration works on the Home Assistant side. Thanks for watching and taking a few minutes to comment!
Thanks to this video I was trying to figure out where the heck I can manually add LaCrosse-TX141THBv2 sensor to the configuration file and get it structured properly. I am using SDR running on my ODroid C4 board to send whatever it finds on the 433Mhz freq to MQTT broker and used MQTT Explorer to find my outdoor temperature and humidity sensor. It's amazing to see what this SDR (RTL-433 Debian package) can find in my area including my neighbor's tire pressure sensors. 🤣 Thanks so much! Now have to work on getting those fancy icons and widgets for the dashboard. 😁
Glad my video was able to help out a bit. I love MQTT and its simplicity... especially adding it to my own Arduino/DIY projects to allow me to integrate those devices into Home Assistant. Now, if the Home Assistant devs would quit futzing with how MQTT is configured and used... it seems like nearly every month, there is some sort of breaking change (oh... now called "backward-incompatible" changes) related to MQTT. Thanks for watching and for the comment!
Nice that you explain what MQTT is used for, just for those who are still learning. I still forget that not everyone knows what every each part is and what it does or even what the acronym stands for.
That's why I repeatedly referenced my other video ( ruclips.net/video/Q0S0xOW35k8/видео.html ) that talks about what MQTT is, the basics of how it works and some of the general terms like topics, payloads, retained flags, etc. And I started out with the 'prerequisites' section that says that you should have this basic understanding to follow this video. If not, then you should probably watch the above video first. This video was made as a follow-up to the first video based on numerous requests from viewers that did watch the first video, but wanted more details on the actual Home Assistant integration part. It isn't meant to be an MQTT tutorial as I pretty much covered that in the prior video.
Thank you very much, most helpful in getting on my way to implement HA / MQTT for a heating system. Have hardware created, loaded the system with sensors, created software (micropython) and now facing the integration step. Being an absolute beginner in HA, I am afraid you lost me when - around 11:30 - you state that you did a mqtt reload and had the newly defined sensors appear on your dashboard. I have reloaded yaml, mqtt even restarted HA but to no avail. May I ask what (action) I seem to be missing here ? Thx a lot !
OK... just to be sure we are on the same page, the new entities do not get 'automatically' added to a dashboard. I had to add those to a dashboard (a new sample dashboard for this video). So first, can you find the entities listed via the Developer Tools -> States? Use the filter to search by the entities by name. If you find the entities there, then you can add whatever sort of display you want (e.g. graph, entity card, etc.) to your dashboard to display the state of those entities. If you do not find your entities under the developer tools, then something isn't integrating properly. Let me know if that is the case and we can try to troubleshoot further. But unless you create a new default dashboard (which will add ALL your entities), any entities that are added to Home Assistant do not automatically appear on a dashboard... that's something you have to do yourself.
awesome tutorials. i am a begiiner with HA & MQTT but was able to follow certain things and get working. THANK YOU very much i used part of the MQTT auto-discovery code and have components working perfectly on their own. issue is that if i connect 2 devices, they screw up with MQTT and control. is there any other vids or assistance you can give???
Well, if adding a second device messes with the first one, that is probably because you are using something like the same Unique ID or Object ID. Not only does each entity need to have a unique name, when using discovery, each discovered object must use unique/object IDs. If you reuse an ID, then it updates the original device/entity instead of creating a new one. I have a number of other MQTT/HA videos, but the one that might be most helpful in the one about discovery as it goes into some detail about unique IDs: ruclips.net/video/VHiCtZqllU8/видео.html Do note that a recent change to Home Assistant discovery, there is a slight change in how a device with multiple entities are created. If you look at the comments for the above video, I've been an update comment with a link to an update video. Congrats on getting MQTT working. In my opinion, it is the best and easiest way to integrate DIY devices into Home Assistant. Don't hesitate to reach back out with further questions.
Glad you found it helpful. I do have some additional MQTT-related videos that approach the subject in a bit more detail from both the perspective of Home Assistant and from MQTT on an external device. Thanks for watching and taking a moment to post a comment. I appreciate it!
@@ResinChemTech As a practical for myself are you able to provide a simple Arduino code for either ESP8285 and/ or ESP32 code that I can just flash and apply to my current mqtt setup so I can see mqtt in action - I have never ever been able to see it in practical actions
I don't really have any "sample" or "test" MQTT Arduino files. But I have a number of my projects that use MQTT in my Github: github.com/Resinchem?tab=repositories Most of these are built around projects, but maybe you could take one of the more simple projects, like the FM-Receiver, and adapt it to create your own sample file. Note that a lot of these projects also have wikis and sections on the MQTT topics and payloads for that project. Looking at some of those may be helpful as well. Sorry, but I really don't have anything that is a simple "test" file for MQTT.
Glad you found it helpful. I know that my initial introductory video on MQTT and Home Assistant just showed a brief overview of the YAML configuration on the Home Assistant side. I heard from a number of viewers that wanted to see the step-by-step details of how to integrate the MQTT device within Home Assistant. Hopefully this video provides enough detail that someone could at least get an MQTT device working in Home Assistant. Thanks for watching and taking a moment to post a comment!
Looking for the auto discovery video as well… While not necessarily an auto discovery function, but is one able to publish all devices/entities out of Home Assistant into MQTT devices?
The auto-discovery video is scheduled for this upcoming Saturday. As far as exporting Home Assistant entities, you can certainly export the value/state of those entities via MQTT and those values can be 'read' or imported into an MQTT device. In fact, I do that with most of my MQTT devices... for example, publishing a temperature or other value from a sensor in Home Assistant and using or displaying that value on an MQTT device. As far as exporting an actual entity itself (like a sensor) and not the entity's value or state? I suppose it would be possible to 'reverse' the process and publish the necessary entity values (like name, type of entity, etc.) in something like a JSON payload and then the MQTT device could read that info and do something with it. But if you are talking about the value of an entity, you can easily publish that via MQTT in something like an automation. I think I show some examples of that either here or in my previous MQTT video as well as examples in the related blog articles.
If you want to use the Home Assistant add-on MQTT broker, you can add that by going to Settings, Add-Ons and then clicking on the Add-On Store button. You will see the Mosquitto broker add-on, which you can install from there directly into Home Assistant. If you want to have an independent broker, then you will need to download that from the broker's web site and install it on a machine that is always-on and connected to the same network as Home Assistant and your MQTT devices. I recommend the Mosquitto broker for best compatibility with Home Assistant, but other options are available. Do note that whichever broker option you select, this is independent from the Home Assistant MQTT integration, which must be installed separately, via Settings, Devices and Services. Use the Add Integration button to search for and add the MQTT integration.
Ahhh, now I see some differences between my perception and reality. MQTT is still off in my future, but I now have a much more firm understanding and I am sure I'll return to this video when my turn in the barrel comes up. If it does not offend you I will take this opportunity to say Merry Christmas and Happy New Year!
Hi Rodney! Glad this video cleared things up a bit... even if you aren't quite ready for MQTT. The original video was a little scant on the Home Assistant detail side, so I created this video at the request of some viewers. Even if you don't use it now, having an understanding of how it works could help with other things, like Tasmota, that although it has a native integration, it still uses MQTT in the background. And a very Merry Christmas and Happy New Year to you as well! And here's to a new year of wonderful DIY projects!
@@ResinChemTech I noticed in one of the other comments a mention of Tasmota and using MQTT in the background. This gives rise to two more questions for me. First does that (MQTT in the background) also apply to Tuya devices, the mini splits in my condo are Tuya and I'd love to redo their interface. Secondly, would you mind adding that discussion of MQTT behind Tasmota to an upcoming video?
I don't have any native Tuya devices, but it does look like their development docs contain information on MQTT. Any Tuya-based devices that I use have all been converted to Tasmota. As far as Tasmota, right out of their documentation on Home Assistant integration, they state: "Tasmota communicates with Home Assistant using MQTT. Before going any further, make sure MQTT is properly set up in Home Assistant and Tasmota." That's also why I mentioned it (or put text on the screen) multiple times in the video and related blog article. While I use Tasmota MQTT topics and payloads as examples, it is no longer necessary to do this manual configuration for Tasmota device if you install the integration. But MQTT is still required. The integration works because they are using something called Home Assistant MQTT Discovery... which happens to be the subject of my next video! So stay tuned.... and I'll try to remember to mention Tasmota in that video as well.
I actually cover the step-by-step process for creating a device with multiple entities in the follow-up to this video: ruclips.net/video/VHiCtZqllU8/видео.html While this video is from the device/MQTT side, the same process can be used on the YAML side by adding a device key and name/ID values to each of the entities you wish to group into a device. So just take the JSON examples from the video and 'reverse' them back into YAML in your entity definitions in Home Assistant. Let me know if you have any follow up questions.
Hello, great video. I have a question about the configuration file. In my configuration.yaml file for HA, I have default_config enabled by default. Do I need to comment out the default_config and build my own configuration.yaml with the integrations I need? Thanks in advance.
Well, the 'default_config' was introduced after I started using Home Assistant, so I've never had it. But according to this documentation: www.home-assistant.io/integrations/default_config/ the mqtt: integration is not one of the integrations included as part of the default_config. So, I believe you should be able to add the mqtt: integration and any entities under it while keeping the default_config. If you remove or comment out the default_config, then you'll need to manually add back any of the default integrations listed in the above document that you utilize. But this can easily be done by just adding the integration and a colon, left-justified in the config files, such as: input_select: timer: etc. If you are just looking at adding MQTT, I'd try adding the integration while keeping the default_config first and see if that causes any errors. However, if you ever wish to manually add entities to any of the default_config integrations, you'll probably have to remove it anyway. I will have a video coming out in a couple of weeks on splitting the Home Assistant configuration that might shine a little more light on this subject.
Great video. This one and the next one about mqtt discovery sure would have been helpful to me when I was trying to set my esp32 test device up using mqtt discovery. I managed to work my way through it but did get bit by the aduinojson limit of 256 byte payload. I had to change it in the library header to a larger size to get my payload to send to the broker. Thanks for the videos, I have learned heaps from you. Thank you sir. Joe
Well, in the process of making the next video on Home Assistant MQTT discovery (probably out in a couple of weeks), I discovered the same thing you did. I spent forever trying to figure out why some payloads were working and others weren't. I thought I was doing something wrong in the JSON serialization. Turns out that it was the default 256 byte limit on the size of the buffer in the PubSub library. Once I increased that, everything started working! I'll definitely be mentioning that fact in the video/blog on discovery. Sorry my videos are coming a bit late in the game for you, but hopefully they will be able to help out some others (and maybe even avoid some of the issues that we ran into!). But thanks for watching and taking a minute to comment.
@@ResinChemTech well, I am not new to learning things the hard way. Sometimes it's better that way, because I tend to retain it longer. Now, even though I figured it out, your videos do help to clear a few of the nagging questions so in the end are a huge help. As a matter of fact, I think it was your clock sketch that helped me out quite a bit too. Thanks for sharing that.
Well, one thing I figured out in the making of this next video was how to use MQTT discovery to create a single device with multiple entities... as opposed to just creating a bunch of separate, yet unrelated, entities in Home Assistant (like I did with the clock). Having it discovered as a device has a lot of advantages, including having device info, like developer, hw/sw version, URL for configuration, etc. I don't know if you've done this with MQTT discovery, but it gives you a nice single page in Home Assistant that looks just like other 'native' integrated devices that show the separate controls, sensors and diagnostic entities. But the inclusion of this device config info is what ended up pushing my payloads to greater than the original 256 byte limit. So, the next video will show the publishing of individual entities, but will also cover how to use discovery to create a device with multiple entities. I'm still somewhat new to Arduino coding, so I'm sure there are experts out there that could code things much more efficiently than I do, but I generally figure out a way to make something work!
@@ResinChemTech I was excited to see my project show up as a single device in the mqtt integration with multiple entities. Definitely makes it easier to visualize when they are all in one spot. I too am new to arduino and esp devices. As a matter of fact, I blame you for it all. Haha. We just had out first two grandchildren in October. They were three days apart, now that was a busy week. Well I was thinking to myself that next Christmas would be quite fun. They will be 14 months and inquisitive by then. So I told my wife that I wanted to figure out the animated light stuff. Well with all your videos on it, I though now this guy is going to be my mentor. One of my sons had a couple devkit v1, esp32 boards he gave me to play with. Haven't made lights yet, still waiting on bits to arrive so in the mean time I though I may as well learn what I could. Between your mqtt videos and source code and extensive googling, I got my little basic project off the ground. A switch, led and dht11. First just wanting to make it work on the board, then add wifi and a mqtt broker, then add it manually to home assistant. Then figured out mqtt discovery. It has been a long road, by pretty gratifying for this old man. I really do owe you the credit though. You been a huge help. I even thought about adding something on mqtt discovery on my channel, but now that you are doing it, all the better. Not sure I could break it down as nicely as you do. Even though I understood how the broker works with subscriptions, publishing and other stuff, I thought you post office analogy was very well done, and I think anyone can understand the basic principles if they watch it. Joe
You have to look at the documentation for the firmware you are planning on using. For example, Tasmota does not currently show support for theTM1638. If you are writing or developing your own code... or using code provided by someone else... then it is up to the developer to decide what to expose and how. For example, in my custom ILI9341 Arduino code, I did opt to expose all of the buttons, LEDs and the individual segments. But ESPHome implements it a bit differently, using the 7-segment display as a single display (although ESPHome uses a native API and not MQTT). So it all depends upon the developer and how (or if) they opt to expose certain entities. That was way I mentioned that you should look at the documentation to see what topics and payloads are available for a given device or project.
Seems like "state_on" and "state_off" no longer is valid arguments under light-integration, when I try to use them. Am I doing it wrong, or has it changed since this video was published?
Unfortunately, changes are introduced each month. But if you are using MQTT, I believe the parameters should be "payload_on" and "payload_off". I recommend that you always check the latest documentation as it (usually) reflects the latest changes: www.home-assistant.io/integrations/light.mqtt/
Hello, very useful video! Tell me how to correctly make "MQTT.number" "command_template". The example from the documentation gives the error "invalid key: "{'value': None}""
While I haven't actually used MQTT numbers, I'm assuming the documentation you are referring to is the Home Assistant MQTT number documentation? The error message you are seeing is generally due to a malformed or incorrect template. Try pasting your template string (without quotes) into the template builder under the Developer Tools. Once you have a working template defined here (and returning the expected value), take that template and put it back into your YAML, surrounding the string with quotes. That's about all I can tell from the information provided. The error points with something being incorrect with your template syntax so you need to assure you have a valid template.
Well, you publish an MQTT payload to a topic expected by the device/other system from Home Assistant. This can be done via script or automation (or even manually). I have a couple of other Home Assistant/MQTT videos that cover the Home Assistant publishing in a bit more detail. This one might have the info you are looking for: ruclips.net/video/Q0S0xOW35k8/видео.html
I was just thinking that XML had some kind of schema that you could embed and look up and that YAML and Jason and MQTT should also and then you mentioned Auto Discovery, so I'm looking forward to that video. It would be nice if an editor for Home Assistant could lookup these formats schemas and offer a little help like the ESPHome YAML editor. I want to spend my time adding my own logic, not figuring out someone else's logic.
i think a split configuration video would be useful... for example, what about if you have a custom integration with sensors, input_booleans, and so on... and what if the include file for something is put after some entity is created by the integration... is there a reconcile loop, which redo the trip until everything is fine? is the order relevant or not? So, please, do it! :)
Thanks for the feedback. I've added a video on both split configuration and packages to my list. I have a few other videos in the hopper first, so not sure when I'll get to this one... but I've put it in the queue.
Couldn't get configuration to work in this way or via discovery mode. configuration entry mqtt: sensor: - state_topic: "stat/HouseMonitor/outsideTemperature" unit_of_measurement: "°C" name: "outsideTemperature" It keeps reporting entity is non- numeric -- some please.
What exactly is "it" when saying it keeps reporting entity is non-numeric? The configuration check, the HA logs, a card on the dashboard? Your YAML looks OK (as best as I can tell from posting it here in the comments). Can you see your entity in the Developer Tools -> States? What state is it reporting? Does it list what appears to be a numeric value? You should be able to see a sensor.outsidetemperature listed. If it is there and you are seeing the non-numeric entity on a dashboard control or are trying to use it as a numeric value in an automation, then the payload from the MQTT device is not publishing a number. Perhaps instead of publishing 19.3, it is publishing 19.3°C which isn't numeric and can't be treated as a numeric for automations, dashboards, etc. You can also use an MQTT utility like MQTT Explorer to look at the actual value published to the /stat/HouseMonitor/outsideTemperature topic.
@@ResinChemTech State sensor.housemonitor_outside_temperature ( I changed the name )reports unknown I see a card relating to outsider temperature , I put the unit of measurement to % just a known unit to no avail. BTW perhaps it would better in I did this email or whatsapp ?
If you are seeing 'unknown', then the device isn't publishing a value on the topic you specified for the state_topic "stat/HouseMonitor/outsideTemperature". Use something like MQTT Explorer to look a the contents in the MQTT broker for that topic and any value/payload. Also note that topics are case-sensitive. So if you entered the state topic as above, but the device is publishing to something all lower-case, like stat/housemonitor/outsidetemperature, those are two different topics. But the gist is that Home Assistant isn't getting a value on the listed topic, so the value is 'unknown'.
Sir your videos are very informative....and I am able to survive my home assistant journey only by watching your viedos .....but it seems I am stuck....I have configured mqtt in split file configration but only 4 mqtt switch out of 8 is working nd rest is not working
I would recommend carefully checking your state topics (and command topics if applicable) and also using a utility like MQTT Explorer to assure that you are using the correct topics and receiving the payloads you expect. A non-working MQTT entity in Home Assistant is usually due to the fact that the MQTT device is publishing on a different topic (or not publishing at all) or is sending a payload in a different format than expected... like sending text values when your Home Assistant entity is expecting numeric values. But use something like MQTT Explorer to carefully check both the topics and payloads that are published to the broker by the MQTT device, and then make sure you have those defined exactly the same in your YAML configuration for those entities.
Does your Victron device have MQTT? A quick search for Home Assistant Victron shows a number of results where others have integrated it... but it doesn't look like it is via MQTT. If the device doesn't offer MQTT (and you aren't the one writing the device's firmware), then it simply won't be possible to use MQTT to bring it into Home Assistant. But MQTT is only one of numerous other ways to integrate a device. You might try searching for Home Assistant Victron if you haven't already given that a shot.
Thanks... but it should be there. The clickable card shows up just a bit later than the thumbnail... around 1:30 or so. At least I'm seeing it pop up on my end. It's also linked down in the video description. But thanks for the heads-up. It wouldn't be the first time I referenced something and then forgot to include the link!
Ha! My wife definitely lets me know if something isn't working as expected in Home Assistant. Yeah... this video does have some prerequisites as I mentioned at the start... namely that you have at least a basic understanding of MQTT (and I linked to another video that provides a basic MQTT overview). But it also helps if you have some familiarity with using YAML configuration files in Home Assistant. Not too far in the past you had to do everything in YAML... so knowing YAML was required for doing much of anything in Home Assistant. Later versions have made the use of YAML much less necessary, but there are still situations where some things can still only be done in YAML. This video was made at the request of a number of viewers who wanted to know exactly how to do this particular YAML integration. Regardless, thanks for watching and I appreciate that you took a few moments to post a comment.
An excellent video. At last someone who doesn't assume the audience is an IT illiterate fool who struggles to set their oven clock. I usually watch HA videos with a copious amount of right arrow clicking so I can find the relevant information. I watched your video intently. Thank you, subscribed.
Thanks for the kind words. While it makes my videos a bit longer than most, I do try to include the "why" as well as the "how" in my videos so that those with less experience can understand why I'm doing steps A, B and C and not just blindly repeat my steps.
If you liked this video, I do have an entire playlist of Home Assistant 101 and related videos: ruclips.net/p/PLqjDNeOVHOkflCfZDY2vJnVHud0m3n0Vz&si=BNcnR4wN4sYG2bqV
Thanks for watching and thanks for the sub. Welcome to the channel!
Thank you for all the MQTT videos, super helpful channel overall! Keep it up!!
You are welcome. Glad you find them helpful. MQTT was initially hard for me to get my head wrapped around, but now I routinely make use of it for my DIY projects. I wanted to try to share a little info for others that might be new to the concepts.
Thanks for watching and taking a moment to leave a comment!
Finally the one who clearly explained how to read and control mqtt devices. Thanks a lot!
You are welcome. Glad you found it helpful. Thanks for the comment.
Haha, HA "101", NOT even close, more like 301, templates 201. This video is so over do by anyone! You really knocked it out of the park. I'll be using this as a reference for a LONG time. I'm glad you DID do this in YAML. Your explanation of the relationship of the indented items/options helps make the documentation easier to understand! Nice add showing how different devices have different option names that do the same thing. Showing the case with the template argument, brought that one home too!! YAML made no since to me in the beginning coming from the world were everything was a "record", ie, pre-objects. And widgets were something used in a business class project or X11. Thanks for the clear and thought out explanation!
YAML can definitely be a little difficult at first. Fortunately (well for some anyway), Home Assistant doesn't require a new user to create and modify nearly as much YAML as it did just a few years ago... when you had to do pretty much everything in YAML. But since that's the way I learned, I do try to share a little of my experience with YAML for those that might just be getting started.
Thanks for watching.
Looking forward to learning about auto discovery as it’s the one big thing missing from my current project (HUB75 display driven off a Pico W etc). MQTT is awesome. Thanks for the video!
You are welcome. Right now, my schedule calls for having that MQTT discovery video out in a couple of weeks... if nothing else changes or gets in the way between now and then!
Thanks for watching... and the comment.
You definitely earned a subscribe here. Thank you!
Thanks... and welcome to the channel!
Thank you. I've almost got everything for my home built water tank level sensor going. Next up is the mtqq discovery video. HA yaml is taking a bit to learn :)
You are welcome. Glad my videos are helping out a bit. It is true that getting a handle on YAML can take a bit (it drove me crazy when I first started), but it becomes easier after a while.
A note on the MQTT discovery: Release 2024.11 made some changes in how the MQTT payload is structured for device discovery. So the original video will cover all the details, its just the portion on creating a device with multiple entities that is slightly different. I covered the changes in a recent update video. While the older method still works (for now), the new method is recommended moving forward. So you may wish to watch the original video, then the much shorter update video for the changes just introduced in Home Assistant MQTT Discovery.
And of course, just let me know if you have any questions along the way. Thanks for the comment!
Very helpful video. The list shown at 08:13 with all the valid entities, I cannot find that anywhere. Can you share where to find this list? Thank you :)
You can find that list on this page: www.home-assistant.io/integrations/mqtt/ On the page, simply drop down the box that says "Configuration of MQTT components via MQTT discovery" to see a list of the types of components that can be discovered.
Thank you for providing such a nice explanation.
You are welcome! I know that I kind of just provided a quick overview in the original video and a lot of viewers had asked me to provide more specific details on the how the integration works on the Home Assistant side.
Thanks for watching and taking a few minutes to comment!
Thanks to this video I was trying to figure out where the heck I can manually add LaCrosse-TX141THBv2 sensor to the configuration file and get it structured properly. I am using SDR running on my ODroid C4 board to send whatever it finds on the 433Mhz freq to MQTT broker and used MQTT Explorer to find my outdoor temperature and humidity sensor. It's amazing to see what this SDR (RTL-433 Debian package) can find in my area including my neighbor's tire pressure sensors. 🤣
Thanks so much! Now have to work on getting those fancy icons and widgets for the dashboard. 😁
Glad my video was able to help out a bit. I love MQTT and its simplicity... especially adding it to my own Arduino/DIY projects to allow me to integrate those devices into Home Assistant. Now, if the Home Assistant devs would quit futzing with how MQTT is configured and used... it seems like nearly every month, there is some sort of breaking change (oh... now called "backward-incompatible" changes) related to MQTT.
Thanks for watching and for the comment!
Hello, it was a very nice and explanatory video, as always, thank you very much.
You are very welcome. Glad you found it helpful.
Thanks for the comment!
Nice that you explain what MQTT is used for, just for those who are still learning.
I still forget that not everyone knows what every each part is and what it does or even what the acronym stands for.
That's why I repeatedly referenced my other video ( ruclips.net/video/Q0S0xOW35k8/видео.html ) that talks about what MQTT is, the basics of how it works and some of the general terms like topics, payloads, retained flags, etc. And I started out with the 'prerequisites' section that says that you should have this basic understanding to follow this video. If not, then you should probably watch the above video first.
This video was made as a follow-up to the first video based on numerous requests from viewers that did watch the first video, but wanted more details on the actual Home Assistant integration part. It isn't meant to be an MQTT tutorial as I pretty much covered that in the prior video.
Highly valuable in getting me going with MQTT. Thank you
You are welcome. Glad you found it helpful.
Thank you very much, most helpful in getting on my way to implement HA / MQTT for a heating system. Have hardware created, loaded the system with sensors, created software (micropython) and now facing the integration step. Being an absolute beginner in HA, I am afraid you lost me when - around 11:30 - you state that you did a mqtt reload and had the newly defined sensors appear on your dashboard. I have reloaded yaml, mqtt even restarted HA but to no avail. May I ask what (action) I seem to be missing here ? Thx a lot !
OK... just to be sure we are on the same page, the new entities do not get 'automatically' added to a dashboard. I had to add those to a dashboard (a new sample dashboard for this video). So first, can you find the entities listed via the Developer Tools -> States? Use the filter to search by the entities by name. If you find the entities there, then you can add whatever sort of display you want (e.g. graph, entity card, etc.) to your dashboard to display the state of those entities.
If you do not find your entities under the developer tools, then something isn't integrating properly. Let me know if that is the case and we can try to troubleshoot further. But unless you create a new default dashboard (which will add ALL your entities), any entities that are added to Home Assistant do not automatically appear on a dashboard... that's something you have to do yourself.
thx for (quick) response. Yes, I can find them under states and will see if I can "collect" them in a new dashboard. Wbr,
awesome tutorials.
i am a begiiner with HA & MQTT but was able to follow certain things and get working.
THANK YOU very much
i used part of the MQTT auto-discovery code and have components working perfectly on their own.
issue is that if i connect 2 devices, they screw up with MQTT and control.
is there any other vids or assistance you can give???
Well, if adding a second device messes with the first one, that is probably because you are using something like the same Unique ID or Object ID. Not only does each entity need to have a unique name, when using discovery, each discovered object must use unique/object IDs. If you reuse an ID, then it updates the original device/entity instead of creating a new one.
I have a number of other MQTT/HA videos, but the one that might be most helpful in the one about discovery as it goes into some detail about unique IDs: ruclips.net/video/VHiCtZqllU8/видео.html
Do note that a recent change to Home Assistant discovery, there is a slight change in how a device with multiple entities are created. If you look at the comments for the above video, I've been an update comment with a link to an update video.
Congrats on getting MQTT working. In my opinion, it is the best and easiest way to integrate DIY devices into Home Assistant. Don't hesitate to reach back out with further questions.
thanks for an excellent video
You are welcome. Thanks for taking time to leave a comment!
This Video is pure gold! Thank you so much! 🙏
You are very welcome. Glad you found it helpful.
this is definitely a reference point for me - it has put mqtt into prospective for me....and into action and practical....
Glad you found it helpful. I do have some additional MQTT-related videos that approach the subject in a bit more detail from both the perspective of Home Assistant and from MQTT on an external device.
Thanks for watching and taking a moment to post a comment. I appreciate it!
@@ResinChemTech As a practical for myself are you able to provide a simple Arduino code for either ESP8285 and/ or ESP32 code that I can just flash and apply to my current mqtt setup so I can see mqtt in action - I have never ever been able to see it in practical actions
I don't really have any "sample" or "test" MQTT Arduino files. But I have a number of my projects that use MQTT in my Github: github.com/Resinchem?tab=repositories
Most of these are built around projects, but maybe you could take one of the more simple projects, like the FM-Receiver, and adapt it to create your own sample file. Note that a lot of these projects also have wikis and sections on the MQTT topics and payloads for that project. Looking at some of those may be helpful as well.
Sorry, but I really don't have anything that is a simple "test" file for MQTT.
This is extremely helpful to a noob like myself.
Glad you found it helpful. I know that my initial introductory video on MQTT and Home Assistant just showed a brief overview of the YAML configuration on the Home Assistant side. I heard from a number of viewers that wanted to see the step-by-step details of how to integrate the MQTT device within Home Assistant. Hopefully this video provides enough detail that someone could at least get an MQTT device working in Home Assistant.
Thanks for watching and taking a moment to post a comment!
Looking for the auto discovery video as well… While not necessarily an auto discovery function, but is one able to publish all devices/entities out of Home Assistant into MQTT devices?
The auto-discovery video is scheduled for this upcoming Saturday. As far as exporting Home Assistant entities, you can certainly export the value/state of those entities via MQTT and those values can be 'read' or imported into an MQTT device. In fact, I do that with most of my MQTT devices... for example, publishing a temperature or other value from a sensor in Home Assistant and using or displaying that value on an MQTT device.
As far as exporting an actual entity itself (like a sensor) and not the entity's value or state? I suppose it would be possible to 'reverse' the process and publish the necessary entity values (like name, type of entity, etc.) in something like a JSON payload and then the MQTT device could read that info and do something with it. But if you are talking about the value of an entity, you can easily publish that via MQTT in something like an automation. I think I show some examples of that either here or in my previous MQTT video as well as examples in the related blog articles.
Thank you for your explane the mqtt, my quistion where to add the mqtt broker?
If you want to use the Home Assistant add-on MQTT broker, you can add that by going to Settings, Add-Ons and then clicking on the Add-On Store button. You will see the Mosquitto broker add-on, which you can install from there directly into Home Assistant.
If you want to have an independent broker, then you will need to download that from the broker's web site and install it on a machine that is always-on and connected to the same network as Home Assistant and your MQTT devices. I recommend the Mosquitto broker for best compatibility with Home Assistant, but other options are available.
Do note that whichever broker option you select, this is independent from the Home Assistant MQTT integration, which must be installed separately, via Settings, Devices and Services. Use the Add Integration button to search for and add the MQTT integration.
really great video ! Thanks
You are welcome. Thanks for watching!
Thank you Amazing explanation!
You are very welcome. I appreciate the comment and kind words.
Ahhh, now I see some differences between my perception and reality. MQTT is still off in my future, but I now have a much more firm understanding and I am sure I'll return to this video when my turn in the barrel comes up. If it does not offend you I will take this opportunity to say Merry Christmas and Happy New Year!
Hi Rodney! Glad this video cleared things up a bit... even if you aren't quite ready for MQTT. The original video was a little scant on the Home Assistant detail side, so I created this video at the request of some viewers. Even if you don't use it now, having an understanding of how it works could help with other things, like Tasmota, that although it has a native integration, it still uses MQTT in the background.
And a very Merry Christmas and Happy New Year to you as well! And here's to a new year of wonderful DIY projects!
@@ResinChemTech I noticed in one of the other comments a mention of Tasmota and using MQTT in the background.
This gives rise to two more questions for me.
First does that (MQTT in the background) also apply to Tuya devices, the mini splits in my condo are Tuya and I'd love to redo their interface.
Secondly, would you mind adding that discussion of MQTT behind Tasmota to an upcoming video?
I don't have any native Tuya devices, but it does look like their development docs contain information on MQTT. Any Tuya-based devices that I use have all been converted to Tasmota.
As far as Tasmota, right out of their documentation on Home Assistant integration, they state: "Tasmota communicates with Home Assistant using MQTT. Before going any further, make sure MQTT is properly set up in Home Assistant and Tasmota."
That's also why I mentioned it (or put text on the screen) multiple times in the video and related blog article. While I use Tasmota MQTT topics and payloads as examples, it is no longer necessary to do this manual configuration for Tasmota device if you install the integration. But MQTT is still required. The integration works because they are using something called Home Assistant MQTT Discovery... which happens to be the subject of my next video! So stay tuned.... and I'll try to remember to mention Tasmota in that video as well.
Thanks grate Video. How to get multiple sensors (entities) into one HA device ? I would like to group them together.
I actually cover the step-by-step process for creating a device with multiple entities in the follow-up to this video: ruclips.net/video/VHiCtZqllU8/видео.html
While this video is from the device/MQTT side, the same process can be used on the YAML side by adding a device key and name/ID values to each of the entities you wish to group into a device. So just take the JSON examples from the video and 'reverse' them back into YAML in your entity definitions in Home Assistant.
Let me know if you have any follow up questions.
Hello, great video. I have a question about the configuration file. In my configuration.yaml file for HA, I have default_config enabled by default. Do I need to comment out the default_config and build my own configuration.yaml with the integrations I need? Thanks in advance.
Well, the 'default_config' was introduced after I started using Home Assistant, so I've never had it. But according to this documentation: www.home-assistant.io/integrations/default_config/ the mqtt: integration is not one of the integrations included as part of the default_config.
So, I believe you should be able to add the mqtt: integration and any entities under it while keeping the default_config. If you remove or comment out the default_config, then you'll need to manually add back any of the default integrations listed in the above document that you utilize. But this can easily be done by just adding the integration and a colon, left-justified in the config files, such as:
input_select:
timer:
etc.
If you are just looking at adding MQTT, I'd try adding the integration while keeping the default_config first and see if that causes any errors. However, if you ever wish to manually add entities to any of the default_config integrations, you'll probably have to remove it anyway. I will have a video coming out in a couple of weeks on splitting the Home Assistant configuration that might shine a little more light on this subject.
@@ResinChemTech I will have to test it tomorrow, but it seems logical to just try and see. Thanks for the swift reply!
Great video. This one and the next one about mqtt discovery sure would have been helpful to me when I was trying to set my esp32 test device up using mqtt discovery. I managed to work my way through it but did get bit by the aduinojson limit of 256 byte payload. I had to change it in the library header to a larger size to get my payload to send to the broker. Thanks for the videos, I have learned heaps from you. Thank you sir.
Joe
Well, in the process of making the next video on Home Assistant MQTT discovery (probably out in a couple of weeks), I discovered the same thing you did. I spent forever trying to figure out why some payloads were working and others weren't. I thought I was doing something wrong in the JSON serialization. Turns out that it was the default 256 byte limit on the size of the buffer in the PubSub library. Once I increased that, everything started working! I'll definitely be mentioning that fact in the video/blog on discovery.
Sorry my videos are coming a bit late in the game for you, but hopefully they will be able to help out some others (and maybe even avoid some of the issues that we ran into!). But thanks for watching and taking a minute to comment.
@@ResinChemTech well, I am not new to learning things the hard way. Sometimes it's better that way, because I tend to retain it longer. Now, even though I figured it out, your videos do help to clear a few of the nagging questions so in the end are a huge help. As a matter of fact, I think it was your clock sketch that helped me out quite a bit too. Thanks for sharing that.
Well, one thing I figured out in the making of this next video was how to use MQTT discovery to create a single device with multiple entities... as opposed to just creating a bunch of separate, yet unrelated, entities in Home Assistant (like I did with the clock). Having it discovered as a device has a lot of advantages, including having device info, like developer, hw/sw version, URL for configuration, etc. I don't know if you've done this with MQTT discovery, but it gives you a nice single page in Home Assistant that looks just like other 'native' integrated devices that show the separate controls, sensors and diagnostic entities. But the inclusion of this device config info is what ended up pushing my payloads to greater than the original 256 byte limit.
So, the next video will show the publishing of individual entities, but will also cover how to use discovery to create a device with multiple entities.
I'm still somewhat new to Arduino coding, so I'm sure there are experts out there that could code things much more efficiently than I do, but I generally figure out a way to make something work!
@@ResinChemTech I was excited to see my project show up as a single device in the mqtt integration with multiple entities. Definitely makes it easier to visualize when they are all in one spot.
I too am new to arduino and esp devices. As a matter of fact, I blame you for it all. Haha. We just had out first two grandchildren in October. They were three days apart, now that was a busy week. Well I was thinking to myself that next Christmas would be quite fun. They will be 14 months and inquisitive by then. So I told my wife that I wanted to figure out the animated light stuff. Well with all your videos on it, I though now this guy is going to be my mentor. One of my sons had a couple devkit v1, esp32 boards he gave me to play with. Haven't made lights yet, still waiting on bits to arrive so in the mean time I though I may as well learn what I could.
Between your mqtt videos and source code and extensive googling, I got my little basic project off the ground. A switch, led and dht11. First just wanting to make it work on the board, then add wifi and a mqtt broker, then add it manually to home assistant. Then figured out mqtt discovery. It has been a long road, by pretty gratifying for this old man. I really do owe you the credit though. You been a huge help. I even thought about adding something on mqtt discovery on my channel, but now that you are doing it, all the better. Not sure I could break it down as nicely as you do. Even though I understood how the broker works with subscriptions, publishing and other stuff, I thought you post office analogy was very well done, and I think anyone can understand the basic principles if they watch it.
Joe
what about devices like the tm1638 if integrated in tasmota? do they expose all their buttons, leds, etc, to HA?
You have to look at the documentation for the firmware you are planning on using. For example, Tasmota does not currently show support for theTM1638. If you are writing or developing your own code... or using code provided by someone else... then it is up to the developer to decide what to expose and how.
For example, in my custom ILI9341 Arduino code, I did opt to expose all of the buttons, LEDs and the individual segments. But ESPHome implements it a bit differently, using the 7-segment display as a single display (although ESPHome uses a native API and not MQTT). So it all depends upon the developer and how (or if) they opt to expose certain entities. That was way I mentioned that you should look at the documentation to see what topics and payloads are available for a given device or project.
@@ResinChemTech actually tm1638 is supported by tasmota... if it's exposed via mqtt or via ha integration, i've to check, it seems :)
Seems like "state_on" and "state_off" no longer is valid arguments under light-integration, when I try to use them.
Am I doing it wrong, or has it changed since this video was published?
Unfortunately, changes are introduced each month. But if you are using MQTT, I believe the parameters should be "payload_on" and "payload_off". I recommend that you always check the latest documentation as it (usually) reflects the latest changes: www.home-assistant.io/integrations/light.mqtt/
Hello, very useful video! Tell me how to correctly make "MQTT.number" "command_template". The example from the documentation gives the error "invalid key: "{'value': None}""
While I haven't actually used MQTT numbers, I'm assuming the documentation you are referring to is the Home Assistant MQTT number documentation?
The error message you are seeing is generally due to a malformed or incorrect template. Try pasting your template string (without quotes) into the template builder under the Developer Tools. Once you have a working template defined here (and returning the expected value), take that template and put it back into your YAML, surrounding the string with quotes.
That's about all I can tell from the information provided. The error points with something being incorrect with your template syntax so you need to assure you have a valid template.
thank you
You are very welcome. Thanks for the comment!
MQTT 'in' how about out? Actions of a switch of sensor that are under Home Assistant's control, how to get MQTT events out to another system?
Well, you publish an MQTT payload to a topic expected by the device/other system from Home Assistant. This can be done via script or automation (or even manually). I have a couple of other Home Assistant/MQTT videos that cover the Home Assistant publishing in a bit more detail. This one might have the info you are looking for: ruclips.net/video/Q0S0xOW35k8/видео.html
I was just thinking that XML had some kind of schema that you could embed and look up and that YAML and Jason and MQTT should also and then you mentioned Auto Discovery, so I'm looking forward to that video. It would be nice if an editor for Home Assistant could lookup these formats schemas and offer a little help like the ESPHome YAML editor. I want to spend my time adding my own logic, not figuring out someone else's logic.
i think a split configuration video would be useful... for example, what about if you have a custom integration with sensors, input_booleans, and so on... and what if the include file for something is put after some entity is created by the integration... is there a reconcile loop, which redo the trip until everything is fine? is the order relevant or not? So, please, do it! :)
And also a 101 on packages
Thanks for the feedback. I've added a video on both split configuration and packages to my list. I have a few other videos in the hopper first, so not sure when I'll get to this one... but I've put it in the queue.
@@ResinChemTech thanks!
Couldn't get configuration to work in this way or via discovery mode.
configuration entry
mqtt:
sensor:
- state_topic: "stat/HouseMonitor/outsideTemperature"
unit_of_measurement: "°C"
name: "outsideTemperature"
It keeps reporting entity is non- numeric -- some please.
What exactly is "it" when saying it keeps reporting entity is non-numeric? The configuration check, the HA logs, a card on the dashboard? Your YAML looks OK (as best as I can tell from posting it here in the comments).
Can you see your entity in the Developer Tools -> States? What state is it reporting? Does it list what appears to be a numeric value? You should be able to see a sensor.outsidetemperature listed. If it is there and you are seeing the non-numeric entity on a dashboard control or are trying to use it as a numeric value in an automation, then the payload from the MQTT device is not publishing a number. Perhaps instead of publishing 19.3, it is publishing 19.3°C which isn't numeric and can't be treated as a numeric for automations, dashboards, etc. You can also use an MQTT utility like MQTT Explorer to look at the actual value published to the /stat/HouseMonitor/outsideTemperature topic.
@@ResinChemTech
State sensor.housemonitor_outside_temperature ( I changed the name )reports unknown
I see a card relating to outsider temperature , I put the unit of measurement to % just a known unit to no avail.
BTW perhaps it would better in I did this email or whatsapp ?
If you are seeing 'unknown', then the device isn't publishing a value on the topic you specified for the state_topic "stat/HouseMonitor/outsideTemperature". Use something like MQTT Explorer to look a the contents in the MQTT broker for that topic and any value/payload. Also note that topics are case-sensitive. So if you entered the state topic as above, but the device is publishing to something all lower-case, like stat/housemonitor/outsidetemperature, those are two different topics. But the gist is that Home Assistant isn't
getting a value on the listed topic, so the value is 'unknown'.
Sir your videos are very informative....and I am able to survive my home assistant journey only by watching your viedos .....but it seems I am stuck....I have configured mqtt in split file configration but only 4 mqtt switch out of 8 is working nd rest is not working
I would recommend carefully checking your state topics (and command topics if applicable) and also using a utility like MQTT Explorer to assure that you are using the correct topics and receiving the payloads you expect. A non-working MQTT entity in Home Assistant is usually due to the fact that the MQTT device is publishing on a different topic (or not publishing at all) or is sending a payload in a different format than expected... like sending text values when your Home Assistant entity is expecting numeric values.
But use something like MQTT Explorer to carefully check both the topics and payloads that are published to the broker by the MQTT device, and then make sure you have those defined exactly the same in your YAML configuration for those entities.
I want to get my Victron data into HA with MQTT, but I'm still lost, LOL!
Does your Victron device have MQTT? A quick search for Home Assistant Victron shows a number of results where others have integrated it... but it doesn't look like it is via MQTT. If the device doesn't offer MQTT (and you aren't the one writing the device's firmware), then it simply won't be possible to use MQTT to bring it into Home Assistant. But MQTT is only one of numerous other ways to integrate a device. You might try searching for Home Assistant Victron if you haven't already given that a shot.
finally🙏👋
Seems you forgot to add the MQTT 101 card in the video.
It showed up for me
Thanks... but it should be there. The clickable card shows up just a bit later than the thumbnail... around 1:30 or so. At least I'm seeing it pop up on my end. It's also linked down in the video description. But thanks for the heads-up. It wouldn't be the first time I referenced something and then forgot to include the link!
where write this script you are so hard to undertand ! example where you save this new1.yaml ?
Help!!!!!!!!!!!!!
My home assistant is my wife lol Y’all lost me on this one… programming and coding aren’t my thing. But the vid was interesting
Ha! My wife definitely lets me know if something isn't working as expected in Home Assistant. Yeah... this video does have some prerequisites as I mentioned at the start... namely that you have at least a basic understanding of MQTT (and I linked to another video that provides a basic MQTT overview). But it also helps if you have some familiarity with using YAML configuration files in Home Assistant. Not too far in the past you had to do everything in YAML... so knowing YAML was required for doing much of anything in Home Assistant. Later versions have made the use of YAML much less necessary, but there are still situations where some things can still only be done in YAML. This video was made at the request of a number of viewers who wanted to know exactly how to do this particular YAML integration.
Regardless, thanks for watching and I appreciate that you took a few moments to post a comment.