I know there are plenty of threads relating to MQTT setup but most are outdated or doesn’t apply to my case. I use Hassio Docker Container with Mosquitto MQTT Broker add-on installed within the Home Assistant Interface.
My default MQTT configuration with nothing’s changed:
logins: []
anonymous: false
customize:
active: false
folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false
My configuration.yaml under /usr/share/hassio/homeassistant/:
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
# base_url: example.duckdns.org:8123
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
homeassistant:
customize: !include customize.yaml
mqtt:
broker: 192.168.10.10
username: !secret mqtt_user
password: !secret mqtt_password
I get the following error under Mosquitto logs:
1589686818: Socket error on client <unknown>, disconnecting.
1589686829: New connection from <ip_address> on port 1883.
1589686829: Socket error on client <unknown>, disconnecting.
1589686840: New connection from <ip_address> on port 1883.
1589686840: Socket error on client <unknown>, disconnecting.
However, if I add the username and password Mosquitto configuration UI, it started working.
logins:
- username: mqtt_username
password: mqtt_password
anonymous: false
customize:
active: false
folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false
Why can’t I specified the mqtt username and password under configuration.yaml file? This used to work when I was running off the Raspberry Pi.