MQTT Broker not publishing or subscribing from outside Hass.io dashboard

Hello, I have just installed Hass.io, I was using Home Assistant till now. Due to frequent disconnection problem I have to remove that and now I am on Hass.io.

I have setup my MQTT broker with following configuration in add on and also change the port from 1883 to 8873:

{
  "logins": [],
  "anonymous": true,
  "quiet_logs": true,
  "customize": {
    "active": false,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}

I have my entities mentioned as below:

light:
  - platform: mqtt
    name: "Spot Light"
    state_topic: "home/nehulroom/spotlight"
    command_topic: "home/nehulroom/spotlight"
    payload_on: "on"
    payload_off: "off"
    retain: true
  - platform: mqtt
    name: Big Lights
    state_topic: "home/nehulroom/biglights"
    command_topic: "home/nehulroom/biglights"
    payload_on: "on"
    payload_off: "off"
    retain: true
  - platform: mqtt
    name: Small Lights
    state_topic: "home/nehulroom/smalllights"
    command_topic: "home/nehulroom/smalllights"
    payload_on: "on"
    payload_off: "off"
    retain: true

I can see these entities on my Hass.io dashboard. But the entities are not actually Publishing the messages to the subscriber. I am listening to all the messages like this :

mosquitto_sub -v -h 192.168.1.150 -p 8873 -t '#'

Even on listening I can not see any messages or request going. I am not sure where the problem is.

Here is how I am publishing the message:

mosquitto_pub -h 192.168.1.150 -p 8873 -t "home/nehulroom/spotlight" -m "on"

  • Does hass.io use any default username and password. Is it mandatory to have username and password?
  • I can not find the core files of MQTT broker or Hass.io. Can you please suggest a path where I can find it? nor I can find MQTT mosquito.conf file anywhere.

Here are my Mosquitto log which is shown on “Hass.io” tab under MQTT broker add-on.

[INFO] Setup mosquitto configuration
[WARN] SSL not enabled - No valid certs found!
[INFO] No local user available
[INFO] Initialize Hass.io Add-on services
[INFO] Initialize Home Assistant discovery
[INFO] Start Mosquitto daemon
1557350612: mosquitto version 1.5.6 starting
1557350612: Config loaded from /etc/mosquitto.conf.
1557350612: |-- *** auth-plug: startup
1557350612: Opening ipv4 listen socket on port 1883.
1557350612: Opening ipv6 listen socket on port 1883.
1557350612: Opening websockets listen socket on port 1884.
1557350612: Warning: Mosquitto should not be run as root/administrator.
1557350612: New connection from 192.168.1.243 on port 1883.
1557350612: New connection from 172.30.32.1 on port 1883.
1557350612: New client connected from 192.168.1.243 as ESP8266Client_mainboard (c1, k15).
1557350613: New connection from 192.168.1.240 on port 1883.
1557350613: New client connected from 192.168.1.240 as ESP8266_dressingroom_bathroom (c1, k15).
1557350613: New connection from 192.168.1.237 on port 1883.
1557350613: New client connected from 192.168.1.237 as ESP8266_livingroom_mainboard (c1, k15).
1557350613: Socket error on client <unknown>, disconnecting.
1557350613: New connection from 172.30.32.1 on port 1883.
[INFO] found homeassistant on local database
1557350614: New client connected from 172.30.32.1 as d892f8e3-5b1e-4680-81ef-8b7fe86f690d (c1, k60, u'homeassistant').
1557350616: New connection from 192.168.1.242 on port 1883.
1557350616: New client connected from 192.168.1.242 as projector-borard-esp (c1, k15).
1557350643: Socket error on client ESP8266_livingroom_mainboard, disconnecting.
1557350643: New connection from 192.168.1.237 on port 1883.
1557350643: New client connected from 192.168.1.237 as ESP8266_livingroom_mainboard (c1, k15).
1557350648: New connection from 192.168.1.237 on port 1883.
1557350648: Client ESP8266_livingroom_mainboard already connected, closing old connection.
1557350648: Socket error on client ESP8266_livingroom_mainboard, disconnecting.
1557350648: New client connected from 192.168.1.237 as ESP8266_livingroom_mainboard (c1, k15).

This looks like a very strange configuration issue. But not sure where is the mistake.

Any thing you can suggest I should try to fix this issue?

Is there something to do with Supervisor. As I have a different IP address on supervisor. So I am not sure. Where to go and what to do. For a while in between I just it debug for few seconds then it was disappear after sometime.

I am super excited to solve this problem. Yet don’t have any clue. Already wasted more then 4 hours for the same.

Thank you!

I got it solved by creating a new user and then integrate it with Mosquitto credentials. Its mandatory I guess to use a username and password in MQTT add-on in hass.io package.