Hi,
I had the same issue since yesterday upgrade to MQTT ver 4.1.
I solved by creating the ACL files as per indication from [xmegapixelx]…but after spending few hours on debugging the issue, including disassembly of my custom ESP8266 relay board which controls my outdoor lights and provide remote temperature - because I suspected a hardware failure of the temp/humidity sensor :-)))
It works now with Mosquitto broker 4.1 version but I disabled the auto-update!
this is my working setup:
1- create a user Home Assistant and define a password;
2- configure add.on with the user & password with anonymous off and active as true:
{
“logins”: [
{
“username”: “my user”,
“password”: “my password”
}
],
“anonymous”: false,
“customize”: {
“active”: true,
“folder”: “mosquitto”
},
“certfile”: “fullchain.pem”,
“keyfile”: “privkey.pem”
}
3- Create “mosquitto” folder in /share
4- Create two files there: acl.conf and accesscontrollist
5- In acl.conf add line
6- acl_file /share/mosquitto/accesscontrollist
7- In accesscontrollist add this 2 lines:
user my user
topic readwrite #
Log output:
1552422490: New client connected from 10.0.0.157 as sensore07 (c1, k10, u’my user’).
1552422490: |-- mosquitto_auth_unpwd_check(my user)
1552422490: |-- ** checking backend http
1552422490: |-- url=http://127.0.0.1:8080/login
1552422490: |-- data=username=my user&password=user password&topic=&acc=-1&clientid=[INFO] found on local database
1552422492: |-- getuser(my user) AUTHENTICATED=1 by http
I create a new home assistant user and password. Those credentials are are what my mqtt clients use to authenticate to the broker.
There is no mqtt: config. I went to configuration > integrations and the broker was discovered by HA. I checked the box for mqtt discovery and hit submit.
We were on mosquitto 1.4 and this is 1.5.6 https://mosquitto.org/blog/
I think the logs have seen more changes and become more verbose through all the version we have…missed.
Yes I just noticed that too because I was skimming older updates and working backwards.
Fix clients being disconnected when ACLs are in use. This only affects the case where a client connects using a username, and the anonymous ACL list is defined but specific user ACLs are not defined. Closes #1162.
I tagged @pvizeli in the other thread… hopefully he can shed some light on it.
I am using a Home Assistant User and someone else said they have it working if they define a local user for MQTT… Dunno… I always assume I’m screwing something up but maybe not.
Don’t need to create custom files.
An you need to create your MQTT users in ‘Configuration -> Users’ section. Restart Mosquitto Browser add-on and voila!
Good God I don’t think I’ve ever had a good experience from hitting the Update button for a Hassio addon.
I also updated to 4.1, lost all MQTT control, ensured I had the config set correctly (set up a user, correct configuration.yaml, used the Integrations page etc) but no joy.
Thankfully I had a snapshot to restore 4.0, so I’m back in business. Will wait 6 - 8 weeks upon the next addon update before I proceed with the update myself.
The addon works exactly like it did before unless you try and use the acl and set active to true… then it falls in a hole unless you are using a local user for some reason.
I have the below configuration, if I put on a device the HASSIO users/password (those setup under Configuration/Users) as MQTT user/password, the device is not connecting
Is this a bug? (I know I should not use “”, but I have a couple of devices already flashed like this and for me is very difficult to reflash them)
Strange thing is that if I put the USer/Password (of Configuration/User) also in the HASSIO Aaddon config, I receive a different error, but still an error
1552645566: New connection from 192.168.1.3 on port 1883.
1552645566: |-- mosquitto_auth_unpwd_check(xxx)
1552645566: |-- ** checking backend http
1552645566: |-- url=http://127.0.0.1:8080/login
1552645566: |-- data=username=xxx&password=yyy&topic=&acc=-1&clientid=
/bin/auth_srv.sh: line 37: LOCAL_DB["${username}"]: bad array subscript
2019/03/15 11:26:06 socat[36] E waitpid(): child 37 exited with status 1
1552645870: |-- http req fail url=http://127.0.0.1:8080/login re=Server returned nothing (no headers, no data)
1552645870: |-- getuser(test) AUTHENTICATED=0 by none
1552645870: |-- getuser(test) AUTHENTICATED=N HAS_ERROR=Y => ERR_UNKNOWN
You don’t need to reflash them to change the username and password… in any case, most likely, your problem is that you have active set to true… try false and delete the username/password as you have anonymous setup.
Then, put in a real username and password in everything!
If I use in the device my Configuration/User password xxx/yyy) I recieve another type of error
1552653357: New client connected from 192.168.1.176 as oven (c1, k10, u'xxx').
1552653357: |-- mosquitto_auth_acl_check(..., client id not available, xxx, tele/oven/LWT, MOSQ_ACL_WRITE)
1552653357: |-- url=http://127.0.0.1:8080/superuser
1552653357: |-- data=username=xxx&password=&topic=&acc=-1&clientid=
1552653357: |-- aclcheck(xxx, tele/oven/LWT, 2) SUPERUSER=Y by http
1552653357: |-- Cached [49BB42F66FDED0458ABA68CE158C9B794D5375FF] for (client id not available,xxx,2)