Mosquitto - no data seen in logs (but can log in)

Hello,

I’m trying to do the same thing as @michaelenstone @hakj @timcrice here How to add Pimoroni Enviro/Weather sensors - #2 by hakj. However, I think I’m stuck at the stage of enabling mosquitto.

I’ve got hass (supervised) on RPi3, I’ve installed the mosquitto add-on from the store and configured that with user/password. I can submit messages to it via a command-line tool without errors (using the ip address + user/pass).

However, I don’t see anything coming through via the mosquitto logs page - should I? (I’ve enavbled debugging - I can see the successful connection from the command line tool, but not the data submitted.) How do I test mosquitto (i.e., read the data)?

There are two areas that I don’t understand:

(1) The add-on help says “Create a new user for MQTT via your Home Assistant’s frontend Configuration → Users (manage users) , (i.e. not on Mosquitto’s Configuration tab).” - however, that user isn’t mentioned again. What do I do with it? I’ve created a user in the Mosquitto’s config tab, and that user us accepted in the auth above…

(2) In the integration configuration, it says: “Discovery prefix - The prefix a configuration topic for automatic discovery must start with.” Does that mean I have to set up mqtt devices to utilise that prefix?

While I still don’t understand the above issues, basically, it works.

Steps:

  1. From add-on browser (for supervised installs only), install the add-on for mosquitto. Run it.

  2. Under integrations, enable mosquitto. (Should show up as a new integration)

  3. Unter integrations, mosquitto, click configure.

  4. " MQTT settings, Listen to a topic", under “topic to subscribe to” enter “#” (everything). Tap start listening.

You should see, e.g. “Message 1 received on DEVICE at TIME”.

The received data isn’t automatically usable in HA - for this, you may need to add (e.g.) a sensor template.

In config.yaml add

mqtt: !include mqtt.yaml

Then, to mqtt.yaml add your sensor definitions, e.g. as shown here: How to add Pimoroni Enviro/Weather sensors - #2 by hakj.

When you go back to integrations, you’ll now see ‘X entities’ (depending on how many you added) and you can then use those in HA.