Why is this so dam unreliable?

Of course the altenative is to change the topic. So if you were to change from sonoff-3 to mycleanslatedevice1 or whatever, you’ll achieve the same result as cleaning the mqtt broker. Of course you’ll need to update the topic across your hass config.

Look for MQTT Explorer and stop being so belligerent and you will get much more help.

1 Like

Sorry. I’ve been banging my head against this issue for over a month now and getting nowhere. Everywhere I turn there seems to be conflicting, erroneous or out of date information.
It’s extremely frustrating.

Once you get over the initial learning curve, you might actually come to love MQTT.

Two resources that are the “bible” on MQTT are https://www.hivemq.com/mqtt-essentials/ and Theo Arendst’s https://github.com/arendst/Sonoff-Tasmota/wiki/Commands

Try changing the topic as I suggested and you’ll be fine.

1 Like

I understand the frustration.
Are you using the same username for all sonoffs? If you tell me the username I will show you what to put in the accesscontrollist

Get mqtt explorer here

1 Like

MQTT_USER
I know, not very original.
Thank you. Again, I apologize getting so bent out of shape on this.

Stop looking at videos, they go out of date quicker than women’s shoes.

If the official home assistant docs are wrong, there is a facility to submit changes on every page, or refer us to the particular bit you are looking at.

So /share/mosquitto/accesscontrollist should look like this:

user MQTT_USER
topic readwrite #
user homeassistant
topic readwrite #
1 Like

Well, I’m stuck, again, before even getting started. I can’t find these folders:
/share has no sub-folders
The Mosquitto docs (https://www.home-assistant.io/addons/mosquitto/) says the /share folder can be found under /usr/share/hassio/share
But there is no hassio folder under /usr/share
core-ssh:~# cd /usr/share
core-ssh:/usr/share# ls
apk cmake man pkgconfig
applications doc misc terminfo
bash-completion git-core nano vim
ca-certificates icons perl5 zoneinfo

it won’t exist - you need to create it. You have a share directory in explorer I assume? Just go into share and make a mosquitto directory and create accesscontrollist and acl.conf in there

Ok. Thanks.
Yes, I have a top-level /share folder in Configurator explorer

In samba (accessing from windows 10, yeah I know) there is a directory called share. This seems to map to /share when I am ssh’d in to hassio.

1 Like

You mentioned you are using Tasmota, I find the instructions on the Tasmota Wiki are better:

Done.
Folder mosquitto created in /share
File acl.conf created with:

acl_file /share/mosquitto/accesscontrollist

File accesscontrollist created with:

user MQTT_USER
topic readwrite #
user homeassistant
topic readwrite #

And updated MQTT Config:

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

And going to rename all my devices and reboot everything…
Actually rename the topics of my switches

And the Switch Stays ON after unplugging and plugging it back in!!!
And its stays OFF if its unplugged while Off and plugged back in!!!
THANK YOU ALL!!!
I feel more confident that it will actually stay on (or off) if it fails to respond to a Keepalive and then reconnects.
Now, as you have all pointed out, and rightfully so, I have A TON of reading up to do. I thought this was plug-n-play…its not. But now after this progress, I feel much more enthusiastic about continuing with this.
Thanks to all again!!!

2 Likes

I struggled with this forever and got so fed up that I changed all of my 43 sonoff switches firmware to ESPHOME! You won’t regret it. Gamechanger, you are not uploading the same firmware to every switch but rather it compiles a specific bin file based on which gpio pins and sensors you use. And it supports a lot of ESP chips/boards and sensors. You can code automations, delayed responses and even covers directly on the firmware so the cover with its open/close sensor on the same switch gets imported to HA already set up. Nice dashboard where you can edit firmware code, view logs, validate code and upload. I have however had wifi issues with the the Sonoff Basic switches, where you have to flash them a few times before they connect, but after that they have never failed. Best yet, you can use the Tasmota Web UI to upload the ESPHOME compiled bin files created via the Dashboard!

Just a thought :slight_smile:

Hi. Thanks for the topic.
before i do it, can ESPhome good for dimmer switch and shatter switch also?

Refael

Hi, haven’t tried that. I use Philips Hue lights. But please look on esphome.io, it shows all the components that are supported… Don’t see why they wouldn’t have components for that

just in short: that’s because you can’t set tasmota correctly not mosquitto nor homeasssitant - sorry dude

Are your clients set to login to the Mqtt server with the username homeassistant?