'Advanced' config of Mosquitto addon - how to?

I’m trying to configure the Mosquitto addon of Hassio to provide two listeners,

  • one for my sensors over my home network, which is working fine, and
  • a second listener for Owntracks over the internet, which I want to be secure and ultimately encrypted.
    I’ve searched and found guides to doing this in “normal” Mosquitto. My question is, how to translate that to the Addon - where does the extra config go?
    I tried adding it within the addon, but got errors. Then I tried setting customise: true and including the extra config in a *.conf file as indicated in the addon page of the frontend, but this seemed to be ignored. Finally I noticed in the Mosquitto log a statement that it loaded config from mosquitto.conf, yet no such file exists that I could find. A bit baffling.

Has anyone made this work, and if so could you share how you did it, please?

2 Likes

I am also trying to do something similar. I would like to set the persistence value to true in mosquito.conf but have been unable to find it as well. Would appreciate any guidance that could be offered.

bump…still looking and haven’t found it yet…anyone have any idea where it’s located?

mosquitto.conf

I have configured bridge from local mosquitto to cloudmqtt.

My hass.io mosquitto addon config looks like this:

{
  "plain": true,
  "ssl": false,
  "anonymous": true,
  "logins": [
    {
      "username": "homeassistant",
      "password": "<password>"
    },
    {
      "username": "sensors",
      "password": "<password>"
    }
  ],
  "customize": {
    "active": true,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}

I use the samba addon to allow creation of the mosquitto config file for the bridge.
The config goes here:

\hassio.local\share\mosquitto\

Here’s my cloudmqtt.conf:

connection couldmqtt
  address <your cloudmqtt URL:port>
  topic # in 1
  try_private true
  notifications false
  start_type automatic
  remote_clientid homeassistant
  remote_username homeassistant          <<you need to set this up in cloudmqtt
  remote_password <password>
  keepalive_interval 300
  cleansession true
  bridge_protocol_version mqttv311
  local_clientid homeassistant
  bridge_cafile /etc/ssl/certs/ca-certificates.crt
  bridge_insecure false

Hope this helps…

Thanks, @hijinx (and @bwze for giving it a bump).

I’d given up on Hassio for the time being, and moved over to a manual install of home assistant to try to have more flexibility, but I’ll give this approach a try when I get a chance.

@hijinx Hi I was wondering if you would be able to give me some pointers on setting up mosquitto with hass.io. I previously used the AIO with mqtt with tls and using a ca.crt. Changing to hass.io I am stuck now trying to configure the mosquitto.config file in the /share/mosquitto/ folder. Mosquitto works on my home network and externally using a username/password but I can’t figure out how to use a ca.crt.

cheers

Sorry I can’t help with that as I’m not exposed my internal mosquito to the internet. Instead I’m using bridged cloudmqtt for external clients (OwnTracks) to connect to with tls.