Newbie can't get MQTT working on hass.io

Hello,
I’ve setup a pi3b+ and I’m unable to get MQTT working. I subscribe to the broker and get a connection. I publish messages but never see them.

From the addons repo I installed “MQTT Server & Web client”

Here’s the config

ssl: false
certfile: fullchain.pem
keyfile: privkey.pem
broker: true
allow_anonymous: false
mqttusers:

  • username: Squee
    password: xxxxxxx
    readonly: false
    topics:
    topics:
    - ‘#’
    - presence/hassio/jay/
    - presence/hassio/dawn/
    log_level: debug

I installed the mosquito-tools package on my linux box to test with.

I subscribe to the broker using this:
jay@jay-desktop:~/.config$ mosquitto_sub -d -t presence/hassio/jay/
Client mosqsub|12672-jay-deskt sending CONNECT
Client mosqsub|12672-jay-deskt received CONNACK
Client mosqsub|12672-jay-deskt sending SUBSCRIBE (Mid: 1, Topic: presence/hassio/jay/, QoS: 0)
Client mosqsub|12672-jay-deskt received SUBACK
Subscribed (mid: 1): 0

Then try a publish using this:
jay@jay-desktop:~/.config$ mosquitto_pub -d -m foobar -t “presence/hassio/jay/”
Client mosqpub|19771-jay-deskt sending CONNECT
Client mosqpub|19771-jay-deskt received CONNACK
Client mosqpub|19771-jay-deskt sending PUBLISH (d0, q0, r0, m1, ‘presence/hassio/jay/’, … (6 bytes))
Client mosqpub|19771-jay-deskt sending DISCONNECT

The six byte test message isn’t shown on the linux box or in the hivemq web client.

I put the server information in a config file for both pub and sub. They’re identical:

jay@jay-desktop:~/.config$ more mosquitto_pub
-h 192.168.1.234
-P xxxxx
-u Squee

The addon log viewer shows a connection:
1581001225: New connection from 192.168.1.120 on port 1883.
1581001225: New client connected from 192.168.1.120 as mosqpub|19771-jay-deskt (p1, c1, k60, u’Squee’).

Any suggestions?

I saw some messages about an ACL list but that appears to be for a previous/different version of hass.

Thanks,
Jay

System info:
Home Assistant 0.103.4
Path to configuration.yaml: /config
|arch |armv7l|
|dev |false|
|docker |true|
|hassio |true|
|os_name |Linux|
|python_version |3.7.5|
|timezone |CST6CDT|
|version |0.103.4|
|virtualenv |false|

You might want to use the </> code-formatting options to make the indentation of your config code a bit more obvious; it’s a bit tricky debugging YAML without the indentation. Not that I’d probably be much help anyway; I use the official Mosquitto add-on rather than this one.

I do notice, though, that you have two consecutive lines with ‘topics:’ there - is that correct?

Good evening,
I looked for a code formatting option but that one didn’t seem the right choice.
This forum editor user interface is rather odd.

The multiple topics was on purpose. After reading topics didn’t exist until they were subscribed I assumed I had to define all the topics I wanted to use in the config.

I’ll try the official add on. Thanks for the idea :slight_smile:

Thanks for the help. I replaced the non standard add on with the standard one.
The publish/subscribe works now using the mosquito_tools utilities.

1 Like