MQTT Integration not picking up devices

So I’ve just recently started afresh with Hassio on a Pi4 and I’m having an issue getting the devices discovered by the Mosquitto broker to be picked up in the integration.

I’ve now removed the add-on and the integration. Then reinstalled the add-on which prompted me, when I returned to the Integrations window, to activate the ‘MQTT: Mosquitto Broker’ but it’s still reporting “This integration has no devices.”

I’ve been into the ‘Configuration > Users’ and created a user that matches the config in the add-on details. I guess I have miss understood the documentation?

{
  "logins": [
    {
      "username": "MqttUser",
      "password": "MqttPassword"
    }
  ],
  "anonymous": false,
  "customize": {
    "active": false,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "require_certificate": false
}

I’m sure I’m missing something and I can see a number of other people having issues with MQTT but this appears to be when some devices are showing and not new ones.

Based on that I have been and checked my entities and none of them are listed there.

I can see the devices authenticating successfully in the add-on logs.

Thanks in advance.

In the integration (not the addon) did you enable discovery?

Yes, I’ve also toggled this off and back on.

Did you check under Developer Tools-> States whether your entities are there or not? Did you try whether the Mosquitto broker works by subscribing/publishing messages?

Sorry for the delay in responding, I’m clearly missing something. I’ve been through a number of posts on here and adjusted a number of bits but I’m still struggling.

This is my config within the Mosquitto broker:


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

Created the necessary files for the ACL files

I’ve created the user ‘Mqtt’ in Home Assistant.

Reconfigured the multiple Sonoff switches and I can see them successfully connecting in the Log for the Mosquito broker:


[21:58:44] INFO: Setup mosquitto configuration
[21:58:44] WARNING: SSL not enabled - No valid certs found!
[21:58:44] INFO: No local user available
[21:58:45] INFO: Initialize Hass.io Add-on services
[21:58:45] INFO: Initialize Home Assistant discovery
[21:58:45] INFO: Start Mosquitto daemon
1576706326: Loading config file /share/mosquitto/acl.conf
1576706326: mosquitto version 1.6.3 starting
1576706326: Config loaded from /etc/mosquitto.conf.
1576706326: Loading plugin: /usr/share/mosquitto/auth-plug.so
1576706326: |-- *** auth-plug: startup
1576706326:  ├── Username/password checking enabled.
1576706326:  ├── TLS-PSK checking enabled.
1576706326:  └── Extended authentication not enabled.
1576706326: Opening ipv4 listen socket on port 1883.
1576706326: Opening ipv6 listen socket on port 1883.
1576706326: Opening websockets listen socket on port 1884.
1576706326: Warning: Mosquitto should not be run as root/administrator.
1576706333: New connection from 192.168.1.245 on port 1883.
[INFO] found Mqtt on Home Assistant
1576706333: New client connected from 192.168.1.245 as KitchenLightSwitch (p2, c1, k30, u'Mqtt').
1576706333: New connection from 192.168.1.190 on port 1883.
1576706333: New client connected from 192.168.1.190 as BackDoor (p2, c1, k30, u'Mqtt').
1576706334: New connection from 192.168.1.246 on port 1883.
1576706334: New client connected from 192.168.1.246 as DiningRoom3 (p2, c1, k30, u'Mqtt').
1576706334: New connection from 192.168.1.244 on port 1883.
1576706334: New client connected from 192.168.1.244 as DiningRoom2 (p2, c1, k30, u'Mqtt').
1576706334: New connection from 192.168.1.79 on port 1883.
1576706334: New client connected from 192.168.1.79 as LivingRoom_Rear (p2, c1, k30, u'Mqtt').
1576706337: New connection from 192.168.1.101 on port 1883.
1576706337: New client connected from 192.168.1.101 as LivingRoomFront (p2, c1, k10, u'Mqtt').
1576706348: New connection from 172.30.32.1 on port 1883.
[INFO] found homeassistant on local database
1576706348: New client connected from 172.30.32.1 as auto-777A3999-1399-0F96-028E-79F7C8A6D429 (p2, c1, k60, u'homeassistant').

Am I right in thinking that the last line is homeassistant successfully connection? As that is working successfully I’m assuming that the credentials are correct and thus the ACL file etc is configured correctly?

If so why do I still see nothing in my ‘MQTT: Mosquitto broker’ integration.

I’ve tried SetOption19 on one of my Sonoff’s but nothing.

Any help would be much appreciated.

I’ve checked my entities and they’re not listed.

So after much fighting with it I reimaged the SD card in my Pi and started again. All worked fine this time :wink:

did you do any changes after re-imaging this time? did you use the default config? I am having the same issue as you did :frowning:

So it worked initially as I was able to add a couple of Sonoff basics and the Sonoff tx switches. A week back I tried to add my first Shelly device and another Sonoff TX switch but while both are seen in the integration log as successfully authenticated and recognises the device names they aren’t added to the integration.
During the intervening time, I’ve added a fair few Xiaomi Zigbee sensors and they’re working.
I’m now trying to move away from the Raspberry Pi to host as I’d like some historical data to refer to.

I have the same issue now, for some reason when I add a new device to HA everything works fine and as soon as the device is recognised, it is added to the devices list and entities list, but when I remove an existing device and I try to add it again, the device is not added to neither of them (devices or entities list).

I had the exact same issue and solved it by executing this command on the Tasmota-device, in my case a WEMOS:

SetOption19 1

With command switches discovery-mode to on.

2 Likes

THANKS!! Banged my head around this for hours, your reply really saved me! :slight_smile:

Despite the clear instructions here? Home Assistant - Tasmota

Ha Ha, yes… Despite those very short, clear and current instructions…

1 Like