Sonoff Tasmota will not connect MQTT

Haha, yes you told me once before. I really don’t know why, I use a Ubiquity Amplifi and a TP-link Archer C1200. I will try the 2.5.2 version soon but I am actually getting a lot of positive noises around me for ESPhome or something like that. I might try that in the future as well.

1 Like

I looked every where for 2.4.2 I can’t find it. In the hack box I can find only core 2.6.2. I Already spend 3 hours fighting with mqtt. I can connect via web but my consol and mosquito showing connection fail

Please help.

show config in HA for broker and mqtt

logins:
  - username: myname
    password: password
anonymous: false
customize:
  active: false
  folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false

at consol:

01:47:15 MQT: Connect failed to 10.0.1.36:1883, rc 5. Retry in 10 sec
01:47:26 MQT: Attempting connection...
01:47:26 MQT: Connect failed to 10.0.1.36:1883, rc 5. Retry in 10 sec

log:

1583194997: Socket error on client <unknown>, disconnecting.
1583194997: New connection from 10.0.1.14 on port 1883.
1583194997: Socket error on client <unknown>, disconnecting.

my YAMl:

mqtt:
  discovery: true
  discovery_prefix: homeassistant 
  
  broker: 10.0.1.36
  port: 1883
  username: myname
  password: password



switch 03: 
  - platform: mqtt
    name: "WD Reboot"
    command_topic: "cmnd/sonoff13/POWER"
    state_topic: "stat/sonoff13/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true

If you use a username and password here then you need to set up an ACL.
Better to add the user/pass as a HA user. Then just reset broker to default settings.

If the broker is on the same machine as HA you can delete all of that

You are using MQTT discovery - so delete all that crap as well.

I would also remove the MQTT integration, restart and then add the integration back and on the devices setoption19 On for discovery. They will then appear in HA like magic.

You have also screwed up the retain flag by setting it to true which will have nasty consequences so easiest way to fix that is to delete the broker then after you restart add it back.

So steps:

  1. remove mqtt integration
  2. remove broker (delete it completely)
  3. remove stuff from configuration.yaml
  4. Restart HA
  5. Create user currently used in devices in Home Assistant
  6. Add Broker with default settings
  7. Add MQTT integration
  8. SetOption19 On in Tasmota console for all devices. (use latest Tasmota firmware with core 2.6.x. Core 2.4.2 is shit and no longer available)

I would then restart HA again but you should see the switches appear when you setoption19 on

I understand all the steps but not step 5. I log in to the HA with Legacy API password user.
In the user management I see my “user” account as administrator. Are you saying I should create another user / password.? I tried to create one but I keeps saying unknown error. May be another stupid question but I don’t know why.
Thanks a lot man appreciate the help.

You still use the API password??? OMG.
Can you screenshot the usermanager screen?
What version of HA are you running?

Do you have homeassistant defined as an auth provider?
like this?

homeassistant:
  auth_providers:
    - type: homeassistant

I feel like i belong to the old century!! with OMG lol.
this is what i have. what do you suggest me to do, it wrong then?

homeassistant:
  name: Home
  latitude: 43.2285
  longitude: -77.6558
  unit_system: imperial
  time_zone: America/New_York
# Configure a default setup of Home Assistant (frontend, api, etc)
   

  auth_providers:
   - type: legacy_api_password
     api_password: !secret ssin_password
default_config:

frontend:
  themes: !include themes.yaml
  themes: !include_dir_merge_named themes

you need to add the homeassistant auth provider as I showed in the post above. You can leave the api one as well

I don’t know what happened after i made this change, my HA is not restarting.

auth_providers:
   - type: legacy_api_password
   - type: homeassistant
     api_password: !secret ssin_password
default_config:

You need to move the api_password up above the previous line…

Thanks I was able to get in HA after the change, I am wondering why the config check was checked out OK. I would never guess what was the problem without your help. it took a long time to restart, i was getting scared.

Anyway following your steps above got the MQTT back running and discovered my Tasmotas.
thanks again for spending time and helping the community of HA. how do i buy you coffee.:slight_smile:

1 Like

All good! Pay it forward…