Hello. First post here. I have installed MQTT but am having issues. I started with an ESP8266 project to send temp and humidity. I seems to work and the device even shows up in hassio in history but has no data. Then I used both the built in subscribe and the MQTT lens and nothing. In the logs it appears that clients are all connecting and being shown, but no data is being allowed.
Here’s my MQTT config, i opted for anonymous connections:
logins: []
anonymous: true
customize:
active: false
folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false
in config.yaml i did this:
mqtt:
broker: 192.168.1.140
Here are the logs to MQTT. 192.168.1.155 is the ESP, MQTT Lens is .206L
[13:55:50] INFO: Setup mosquitto configuration
[13:55:50] WARNING: SSL not enabled - No valid certs found!
[13:55:50] INFO: No local user available
[13:55:50] INFO: Initialize Hass.io Add-on services
[13:55:50] INFO: Initialize Home Assistant discovery
[13:55:50] INFO: Start Mosquitto daemon
1592762150: mosquitto version 1.6.3 starting
1592762150: Config loaded from /etc/mosquitto.conf.
1592762150: Loading plugin: /usr/share/mosquitto/auth-plug.so
1592762150: |-- *** auth-plug: startup
1592762150: ├── Username/password checking enabled.
1592762150: ├── TLS-PSK checking enabled.
1592762150: └── Extended authentication not enabled.
1592762150: Opening ipv4 listen socket on port 1883.
1592762150: Opening ipv6 listen socket on port 1883.
1592762150: Opening websockets listen socket on port 1884.
1592762150: Warning: Mosquitto should not be run as root/administrator.
1592762152: New connection from 192.168.1.155 on port 1883.
1592762152: New client connected from 192.168.1.155 as esp8266-0df3e7 (p2, c1, k15).
1592762156: New connection from 192.168.1.206 on port 1883.
1592762156: New client connected from 192.168.1.206 as lens_KkF0AIho7ZNicIpbqMbXr4Bm5TC (p1, c1, k120).
1592762205: New connection from 172.30.32.1 on port 1883.
[INFO] found homeassistant on local database
1592762205: New client connected from 172.30.32.1 as auto-C00F93AF-8EED-A0C8-72C1-D9BC84AE4BD7 (p2, c1, k60, u’homeassistant’).
1592763951: Saving in-memory database to /data/mosquitto.db.
If you use MQTT Lens to publish a payload to a topic then MQTT Lens, and every other connected MQTT client, should indicate that the topic received the payload.
If this is not happening, then MQTT Lens isn’t actually connected to the broker. It’s that simple.
I suggest you use MQTT Explorer. Upon connecting to the broker, it will list all topics managed by the broker. Payloads published to any topic are easily visible.
Ok, tried it. Nothing listed, no topics. However, MQTT on hass says it’s connected - same as others. Connects, but no data.
Here is the MQTT recent log:
1592767553: Saving in-memory database to /data/mosquitto.db.
1592769354: Saving in-memory database to /data/mosquitto.db.
1592771155: Saving in-memory database to /data/mosquitto.db.
1592772956: Saving in-memory database to /data/mosquitto.db.
1592774757: Saving in-memory database to /data/mosquitto.db.
1592775348: New connection from 192.168.1.206 on port 1883.
1592775348: New client connected from 192.168.1.206 as mqtt-explorer-a51ab068 (p2, c1, k60).
Ok, i reinstalled and now I’m getting kind of the opposite thing. External clients can now see topics, subscribe and publish to them. However, hass doesn’t work or see it. I’m getting this now:
Ok, it appears I’ve got it running. I had to delete the integration and reinstall it. I used the mqtt user and passwd. I don’t think that’s how it’s supposed to work exactly but it works.
Now I’ve got more of a config question. The entitiy i think appears now (MQTT-temp-test) but the temp doesn’t show up inside of it. It’s in an unknown state. Says it doesn’t have a unique ID or something. How do I get the temp to show up so I can see it on glance cards and such?
It may have something to do with the config.yaml file. Do i have to add more to this for that to happen? Also, I’d like to have the humidity also appear in it there but it says I can;t do two subscriptions in one (temp is esp/dht/temperature and humidity is esp/dht/humidity.
I’ve never considered re-installing an Add-On or integration as a “solution”. It simply masks the actual cause of the problem which may have been a simple misconfiguration. Anyway, glad to hear it works now.