About the configuration of mosquitto addon

Hello, about the mosquitto addon of hassio, I don’t understand:

  1. the documentation says that I can add “logins” with this syntax:
"logins": [
    {"username": "local-user", "password": "mypw"}
  ],

Can “local-user” be the first user that I created with the web-interface, during the first login of home assistant?

  1. Do I have to set, in configuration.yaml, “mypw” (the same password used in the mosquitto “logins” line) for the mqtt “password” ? In this yaml file I wrote

mqtt:
broker: 127.0.0.1
password: “mypw”

Thanks for your replies

If you are using a Home Assistant user then you don’t need to define any local user at all. My MQTT broker is just set as defaults. You will then need to make sure your devices use that same username and password.

You also don’t need ANYTHING about MQTT in your config yaml. Use the MQTT integration.

I don’t understand yet… If I don’t set anything, as you say:

  1. If mosquitto is used with the addon, does home assistant shut-down the embedded broker and use the mosquitto one, on localhost, instead? (so I don’t need to configure any host for the broker)

You need the Mosquitto Addon and the MQTT Integration. Leave the addon at it’s defaults. When you add the integration, tick the box to enable MQTT Discovery.

Then in the devices where you configure the username and password for the broker, use the username and password for a Home Assistant User.

That’s it.

ok, thanks, now something is starting to work.
I can see, in the mosquitto addon console that my dev connects correctly:

1549580654: New connection from 192.168.1.3 on port 1883.
[INFO] found test-hass on Home Assistant
1549580654: New client connected from 192.168.1.3 as McLighting01 (c1, k10, u’test-hass’).

However, I don’t see it in the webUI. home-assistant.log says:

2019-02-08 00:04:29 ERROR (MainThread) [homeassistant.setup] Setup failed for mqtt: Component failed to initialize.
2019-02-08 00:04:29 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of light.mqtt. Setup failed for dependencies: mqtt
2019-02-08 00:04:29 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform light.mqtt: Could not set up all dependencies.

I don’t want to use the MQTT auto discovery…

And this is the configuration for the light I just added:

light:

  • platform: mqtt
    schema: json
    name: “NeoPixel LEDs”
    state_topic: “home/McLighting01_ha/state/out”
    command_topic: “home/McLighting01_ha/state/in”
    on_command_type: ‘first’
    effect: true
    effect_list:
    • “Static”
    • “Blink”
    • “Breath”
    • “Color Wipe”
    • “Color Wipe Inverse”
    • “Color Wipe Reverse”
    • “Color Wipe Reverse Inverse”
    • “Color Wipe Random”
    • “Random Color”
    • “Single Dynamic”
    • “Multi Dynamic”
    • “Rainbow”
    • “Rainbow Cycle”
    • “Scan”
    • “Dual Scan”
    • “Fade”
    • “Theater Chase”
    • “Theater Chase Rainbow”
    • “Running Lights”
    • “Twinkle”
    • “Twinkle Random”
    • “Twinkle Fade”
    • “Twinkle Fade Random”
    • “Sparkle”
    • “Flash Sparkle”
    • “Hyper Sparkle”
    • “Strobe”
    • “Strobe Rainbow”
    • “Multi Strobe”
    • “Blink Rainbow”
    • “Chase White”
    • “Chase Color”
    • “Chase Random”
    • “Chase Rainbow”
    • “Chase Flash”
    • “Chase Flash Random”
    • “Chase Rainbow White”
    • “Chase Blackout”
    • “Chase Blackout Rainbow”
    • “Color Sweep Random”
    • “Running Color”
    • “Running Red Blue”
    • “Running Random”
    • “Larson Scanner”
    • “Comet”
    • “Fireworks”
    • “Fireworks Random”
    • “Merry Christmas”
    • “Fire Flicker”
    • “Fire Flicker (soft)”
    • “Fire Flicker (intense)”
    • “Circus Combustus”
    • “Halloween”
    • “Bicolor Chase”
    • “Tricolor Chase”
    • “ICU”
    • “E131”
      brightness: true
      color_temp: true
      rgb: true
      optimistic: false
      qos: 0
      retain: true

Where can be the problem?

This is a little problematic, since there is no device listed. I would like to use the intregrated broker as the default broker, even for things not to see in the HomeAssi.
How can one use the broker with the hassio - user without putting plaintext passwords into configs ?

The docs are a freaking nightmare.
A simpel question how to enter a username and password gives you a freaking sh** load of posts with questions not related to the OP instead of a awnser related to OP.
OP asked for something. If you dont know the awnser. Please shut te F up.
There is not anyone here with a simple awnser. It is frustrating.
The word offtopic has no meaning here.
Even the form here is a nightmare // END RANT

This is what you need to set in the config page via addon under mosquitto.

After install, restart home assistant all the time.
Create a snapshot all the time.
Because 99% of the time you will end with a broken installation.

6 Likes

I want to clarify some things about this that I learned/tested recently, and post them here for future reference if that can help.

  1. Yes you can, but in this case you don’t need to: If the account is a HA user defined in HA you don’t need it in the addon configuration (thus not exposing a password).
    If you create a specific HA account for use to connect to the broker, you will have to allow it to connect to HA in order to set a password (which, once more, you do not need to configure in the broked/addon)
    If you want to use a local account (i.e. the account needed for a client to connect to the broker), you can define here a mqtt client username and password

  2. if you installed th MQTT integration, everything is configured during this integration configuration, no need to change yaml configuration files. In this integration configuration, you can use the local account you configured for the addon as a mqtt client user/password, or leave the default homeassistant/long_randomly_generated_password.

Basically you just need an username/password only if you need to connect to the broker with another client such as MQTT Explorer. The MQTT integration acts as a client to the addon/broker (amongst other things) with no additional configuration.