Connect to embedded MQTT broker via ubuntu on local win7 VM

Hey guys,

I am trying to figure out a tasmota issue i have on my HASSio
So i ended up setting up a VM with ubuntu on my windows machine installing all the mosquitto stuff needed (i think).
I set up the VM to be in the same subnet as my other machines (i can ping stuff around).
Also, several other devices do connect normally with the settings below.

Unfortunately i cannot subscribe to my hassio’s mqtt broker.

When running this:

$ mosquitto_sub -h [hassio ip] -p 1883 -u homeassistant -P [hassio pw] -d -t cmnd/+/power

I get a log spam of these:

Client mosqsub/22618-username- sending CONNECT
Client mosqsub/22618-username- sending CONNECT
Client mosqsub/22618-username- sending CONNECT
Client mosqsub/22618-username- sending CONNECT

The server is supposed to respond CONNACK right?
What am i missing here?

Thanks in advance.
k.

Could you post the config of the mqtt addon?
I assume the ubuntu vm can ping hassio. How does an nmap of hassio look like?

My configuration.yaml:

mqtt:

:smile:

Yes, the VM can ping Hassio successfully.

What is nmap? :slight_smile:

So you want to use the embedded broker? Not hassio addon? Then I belive the dfault port ist 8080 and not 1883

Nope, using the embedded broker.
Anything else would be very advanced for me :smiley:

All the devices subscribe to 1883, according to the documentation

Will i need to use the websocket port?

take a lool here at the section about the embedded brooker

oh no crap
But is the embedded broker reachable from outside?

No 8080 was my bad, its 1883 sry

What do you mean outside? If it is exposed online?
Why would i need that? all the devices are within my local network.

Tried with 8080 as port, now i am getting just one line of

Client mosqsub/1849-username-V sending CONNECT

The second line appears ~1 minute later, so… that tells us something?

Sry for making so much confusion. Outside I mean another machine then the one Hassio is running on, and an VM is aready another machine. But I think the embedded broker is reachable from another machine

If you have an Ubuntu machine, open a terminal and type:

sudo apt install nmap
nmap hassio

and post the output
This will port scan your hassio server and tells us if there is something running at port 1883 of the server.

I used to use the embedded mqtt broker, but I never used an API password (always behind a firewall, and the frontend is behind a reverse proxy with authentication).

I would try disabling the api password and seeing if mosquitto will connect. If that doesn’t work, it means something in your network is blocking port 1883. Either your hass.io is not allowing it in (you say you have devices already running, so probably not), or your Windows/UbuntuVM firewall is blocking the outgoing request.

Great, will try both options, as I am out of the buyer right now.

I guess both will let us know if it is an issue of port being blocked

For clarification, I already have 4-5 mqtt switches perfectly connecting to hassio.

Could I run the same or similar commands from the RPi itself?
I have set up developers access through ssh for another issue I had.
Could I check from resinOS?

I don’t use hass.io, but the default homeassistant install has hbmqtt_sub installed by default and it lives in the same directory as the hass executable (python script, but it is the command line interface for HA).

On my machine I can use /srv/homeassistant/bin/hbmqtt_sub --url mqtt://localhost -t "#" -d and it will print out the payloads and topics, but it is pretty messy compared to mosquitto.

Okay, then I think we can exclude port issue. Next step then would be you ubuntu vm. Can it be that it can not connect to hassio? I mean pinging sometimes goes through but ports don’t. How have you setted up your VM? Do you use VirtualBox or Windows Hyper-V or something else? What is the network settings of the Ubuntu VM?

So, it’s set up on VirtualBox, Network is set as Bridged Adapter, i have set up a static ip /mask/etc through the ubuntu network settings.

When running nmap on the hassio’s IP address i get the following:
image

What i am ultimately trying to run are the commands described here, as i have a problem with my sonoffs not obeying their PowerOnStatus commands.

Your VM Settings sound good.
From her it looks like, there is no open port on hassio @ port 1833. But there is also nothing on 8123 hmmm. I think the Ha web fronted should show up there.

Would you be willing to try the mosquitto addon for HA? I don’t know if it helps but maybe its worth a shot. You can istall it with the HA webfrontend under:

Hassio, then on the little bag in the top right, then mosquitto. About the configuration, you can find some information here: https://home-assistant.io/addons/mosquitto/

Hey @deisi,
My whole HA installation suddenly failed yesterday (corrupted sd? idk)
Anyway, i did a fresh install and enabled mosquitto instead of embedded mqtt as you suggested.

I have not tried to access it through the VM as it seems to have failed me aswell, wont boot :slight_smile:

On the other hand, i have found out that those commands are also available through the rpi’s own ssh connection to resinOS, so no need for an extra terminal, i could have just typed them on my existing putty app through windows.