Understanding Mqtt basics

hey guys, trying to get my head around mqtt. I have an Opengarage and I can’t get it to connect to my mqqt broker. what is the cheapest hardware I can get to play around with mqtt? like a shelly one? I tried mqtt explorer and it connected to the broker, but not much else happens.

I install the broker, setup a username and password and it Discovers the integration and nothing else. do I need to use an ACL list?

any help would be much appreciated.

think it as folder(s) and you have things looking at a folder (subscribe to them)

my hall heater has a command folder


if a put a ON of OFF into said folder the hall will turn on/off

once the hall heater turn on/off it put a ON/OFF in the


so lets join the DOTS as this is a switch i put in the switch: part of the config

  - platform: mqtt  # what should python be doing
    name: "Hall Heater"  # its name 
    state_topic: "stat/hallheater/POWER"    # state folder
    command_topic: "cmnd/hallheater/POWER" # the command folder
    payload_on: "ON"   # what we put the folder when ON
    payload_off: "OFF" # what we put the folder when OFF


hey thanks for this, makes sense. So you have a physical switch at your heater that connects to HA via MQTT? You use MQTT because it isn’t natively supported in Home Assistant?

Can the MQTT integration in HA connect to your broker?

Yes its just a smart plug with tasmota on it so when I manualy turn it on it put a ON in the
“stat/hallheater/POWER” which HA see and then updates the switch status

hay bro think your wording is wrong

you dont need the “MQTT integration” to get it working

you only need the

BUT if you have devices that can be autodiscovery

then can add the

1 Like

this is what i am trying to figure out… here is the log from my Mosquitto broker that was installed under >supervisor>add-on store. so i think home assistant is connecting but my opengarage isn’t.

so mqtt is a universal way for you to integrate that smart switch because Home Assistant doesn’t have an integration for it?

and i am confused… i did go into the >supervisor>add-on store and installed Mosquitto broker. After i did that, HA popped up and said it found MQTT integration so I installed that as well. So am i running it twice or running it properly?

The integration talks to the broker, since you didnt get an error when trying to use it it sounds like it is running properly.

The MQTT integration can publish test topics that should then be visible in MQTT explorer

Think of the Broker as the mailroom in an office, and the Integration as the employee which delivers the mail to a specific floor (HomeAssistant). Then you have people sending mail on other floors (devices on the network) and that needs to get delivered to a mailbox on the HA floor (the mqtt sensor)


thanks guys, appreciate this. So i guess to fully test this, i need to get a device that is MQTT enabled. Basically if i don’t have devices setup in the config.yaml, i won’t be able to see anything anyways? Was thinking of getting a sonoff or shelly 1 to play with.

Like your thinking bro

so can someone just confirm why use mqtt? I have a ton of devices and I havent needed it yet.

I use MQTT because it is very convenient to relay information between things.
You could think of MQTT as a REST api but your are only going to one ‘page’ for all the info; more of a combination of REST api and webhooks. There, that explanation is as confusing as possible.

You don’t need MQTT, it is just one of the many communication tools available. I personally like that I have a central repository for information I am sending from my various devices.
I use Zwave2MQTT, which is very…very…very nice to allow me to see ALL the information from my Zwave devices. Before I got any zwave devices, I used and still use MQTT to relay the status of my Outside String Lighting https://github.com/GlennGoddard/Lights and the level of my water softener brine tank https://github.com/GlennGoddard/Salt-Level.

As brought up in the above comments, MQTT Explorer allows you to check the status of your MQTT Broker and all the traffic to it.

MQTT is a simple protocol that is easily integrated into other programs or items. It is extremely easy to retro-actively add MQTT to an existing python script, which is exactly what I did in my two examples above.

thanks for the explanation GlennHA. So you are using MQTT to turn on and off devices too or just report status? Zwave2MQTT is another thing i have to get going as i try to transition off the depreciated Zwave 1.4.

I mainly use it for information, but I do have a couple MQTT switches. I will be add many more soon-ish. I will say that setting up an MQTT switch is a little different, but once you do it once it is very easy to do more.

I have a Zwave plug that I use for monitoring power from my TV for some lighting automation. I also have a Zwave valve operator that I use to transfer to my backup water system during a power outage since I have a generator (which also sends its info to MQTT).

thanks Glenn for the info, appreciate it. maybe i will have another go at getting my opengarage going. I setup the MQTT username and password and my broker and it doesn’t work. I just read a couple posts where people say that MQTT was better as it isn’t constantly polling my opengarage device.

I don’t use any username or password on my MQTT broker, it just makes it easier.
To clarify that, I have my broker in a docker container and is not directly accessible from outside of my LAN; so in my case a username and password just gets in the way.

i would want to open my garage away from home but not sure if mqtt would have to be exposed. my home assistant is exposed but everything else is on my lan.

You can do that. I have Home Assistant that I can control remotely and that in turn communicates with MQTT. I can control my stuff, but MQTT itself is not directly exposed. There is nothing wrong with a password and username, in fact it is probably encouraged; my case, which is my very controlled case, does not require I use them.

1 Like