(SOVED) HA - problems subscribing to Mosquitto MQTT (Add-On) topics

Hi all, this is a re-write of a different post. I have done a lot to test.

Basically, I’m not able to subscribe to topics I see is available om MQTT Server.

This is what I’ve done:

  1. Deleted entire MQTT Add-on
  2. Removed MQTT from ‘configuration.yaml’
  3. Rebooted HA
  4. Created a new user in HA called “mqttuser” with pwd “password” (as an example)
  5. Re-installed Mosquitto Add-on, using default configuration (nothing changed)
  6. Configuration->Integration, clicked the new MQTT Integration and also selected ‘Discovery’
  7. Not added anything about MQTT in ‘configration.yaml’

Remotely I have a RPi with an MQTT client publishing data to my HA server with Mosquitto.
I can see in the logs there connection, here is an example:

1561459571: New client connected from 192.168.11.112 as kontor6488 (c1, k60, u'mqtt_thestigh').
1561459571: Client kontor6488 disconnected.
1561459571: New connection from 192.168.11.112 on port 1883.
[INFO] found mqtt_thestigh on Home Assistant
1561459571: New client connected from 192.168.11.112 as kontor6490 (c1, k60, u'mqtt_thestigh').
1561459571: Client kontor6490 disconnected.

If I start an SSH session to HA and run following, I get nothing:

mosquitto_sub -h 127.0.0.1 -u mqttuser -P password -v -t location/kontor

If I then change it and run like this, I see the publications from the remote MQTT:

mosquitto_sub -h 127.0.0.1 -u mqttuser -P password -v -t location/#

To confirm, I tested with MQTT-Explorer and can also here see the topic:
mqtt-expl


The really strange thing, is if I in HA SSH change back to:

mosquitto_sub -h 127.0.0.1 -u mqttuser -P password -v -t location/kontor

… and within MQTT-Explorer make a publish:
mqtt-expl-pub

… I can see the message in SSH
mqtt-sub-ok

What is wrong, can anybody please help me?

You have to add an access control list (ACL) see the puke yellow warning here:

Hi @tom_l, I already did.

If I change my subscriber in HA via SSH to

mosquitto_sub -h 127.0.0.1 -u mqttuser -P password -v -t location/kontor/#

(added # after kontor/ ) I do get results, but my sensor does appear as unknown.

  - platform: mqtt
    state_topic: 'location/kontor/d0:d7:xx:xx:xx:xx'
    value_template: '{{ value_json.confidence }}'
    unit_of_measurement: '%'

I don’t know what to search for now… :frowning:

Nice to actually read, search, try - and finally discover and learn - myself :slight_smile:

Case solved; but looking at the logs from the sender I suddenly discover that as I’ve put the mac in the known_static_addresses of the sender I could not use state_topic: location/kontor/MAC_ADDRESS but had to replace MAC_ADDRESS with the alias from known_static_addresses.

DOUHH.