Hi,
I’d start with a clean slate - re-flash the device (or Tasmota → Configuration → Reset Device), and delete the Mosquitto Add-on and reinstall.
HASS Mosquitto broker Add-In, MQTT integration, Tasmota Integration
Mosquitto broker Add-In
The recommended way to configure uses is shown on the Add-On Documentation tab - e.g. create a HASS user.
http://homeassistant.local:8123/hassio/addon/core_mosquitto/documentation
I personally use additional Mosquitto users, BUT these are configured not by JSON nor configuration.yaml, but again directly from the Mosquitto Add-On Configuration tab:
http://homeassistant.local:8123/hassio/addon/core_mosquitto/config
Here is a sample which can be directly pasted into the Logins text box, before restarting the broker (No JSON, just like this, with a long text password without characters you could mis-type !£$^"@~):
- username: tasmota
password: ChangeThisPasword
HASS MQTT Integration
To get HASS to connect to Mosquitto, you need to install the MQTT integration. This is seperate from the Mosquitto broker Add-On.
This should detect settings automatically, as the broker is local to HASS.
HASS Tasmota integration
The Tasmota project is switching from HASS discovery (quite long winded, uses the MQTT integration), to Tasmota discovery (simpler, less memory) which needs the HASS Tasmota integration.
This should detect settings automatically, as the broker is local to HASS.
Tasmota
For modern Tasmota firmware, I’d recommend:
- Leave Topic and Full Topic as default.
- Under Configuration → Other, change
Device NameandFriendly Name 1to the name you want to see in HASS. - Configure MQTT user and password.
- Go to the Tasmota Console and watch what happens.
Tasmota should connect to Mosquitto on HASS and Just Work™.
If not check user, password, and server host / IP address. No one changes port from 1883. - ONCE THE DEVICE CONNECTS AND WORKS, there are options to set the entity as a switch or light.
- For a light, on the Tasmota console enter
SetOption30 0 - For a switch, on the Tasmota console enter
SetOption30 1(default) - The device SHOULD be set to Tasmota discovery by default
SetOption19 0
- For a light, on the Tasmota console enter
If Tasmota doesn’t connect and you are stuck, try installing a MQTT tool like https://mqtt-explorer.com/ and see if that connects to Mosquitto. This is a great way of seeing how MQTT really works, and maintenance like removing retained configuration messages.
Tasmota advanced configuration
All settings can be entered into the console in one hit using Backlog commands:
# NB now use Tasmota integration so SetOption19 0
Backlog mqtthost 192.168.xxx.xxx; mqttuser tasmota; mqttpassword ChangeThisPasword; topic %topic%; hostname MyTasmotaName; FriendlyName MyTasmotaName; FullTopic %prefix%/%topic%/;SetOption19 0; setoption53 1;
SetOption19 0 # Use Tasmota discovery which requires the Tasmota Integration
SetOption30 0 # switch entities
SetOption30 1 # light entities
More information is in the Tasmota documentation, but is slightly confusing for the non-developer:
https://tasmota.github.io/docs/Home-Assistant/
If this helps,
this post!