Hello Daniel,
Yes I got the same mqtt.conf.
Mqtt explorer shows me this:
In my example I have a topic collectd/OpenWRT.
mqtt.conf file live in /etc/collectd/conf.d If you donāt have this directory, create it.
All you have to do is check in luci that mqtt plugin is enabled in collectd conf and restart collectd service. And that is it. It should start publishing packages in a few seconds.
And this is /etc/collectd.conf
BaseDir "/var/run/collectd"
Include "/etc/collectd/conf.d/*.conf"
PIDFile "/var/run/collectd.pid"
PluginDir "/usr/lib/collectd"
TypesDB "/usr/share/collectd/types.db"
Interval 30
ReadThreads 2
...........
My collect.conf:
BaseDir ā/etc/collectd/ā
Include ā/etc/collectd/conf.d/*.confā
PIDFile ā/var/run/collectd.pidā
PluginDir ā/usr/lib/collectdā
TypesDB ā/usr/share/collectd/types.dbā
Interval 30
ReadThreads 2
ācheck in luci that mqtt plugin is enabledā do you mean the graphs?
Iāll guess everything is working, just they cant connect propably?
Sorry had to log in to my wrt luci to check it. There is no mqtt plugin. For some reason it seems that your topics are not being published. As I set this up a few months ago, I canāt remember all the details and I do experiment a lot with settings.
opkg list-installed | grep collect
collectd - 5.12.0-49
collectd-mod-conntrack - 5.12.0-49
collectd-mod-cpu - 5.12.0-49
collectd-mod-exec - 5.12.0-49
collectd-mod-interface - 5.12.0-49
collectd-mod-iwinfo - 5.12.0-49
collectd-mod-load - 5.12.0-49
collectd-mod-memory - 5.12.0-49
collectd-mod-mqtt - 5.12.0-49
collectd-mod-network - 5.12.0-49
collectd-mod-rrdtool - 5.12.0-49
collectd-mod-snmp - 5.12.0-49
collectd-mod-thermal - 5.12.0-49
collectd-mod-uptime - 5.12.0-49
I donāt remember did I need a mosquitto package for that. I dont think soā¦ but I have it.
opkg list-installed | grep mosquitto
libmosquitto-ssl - 2.0.18-2
mosquitto-client-ssl - 2.0.18-2
It should at least publish topics and you should be able to see it in mqtt explorer.
But you can restart collectd services and see does wrt logs are throwing some error on it with logread.
logread -f | grep collectd
Gives me this:
connected to broker "192.168.1.202:1883"
Wed Jun 26 22:00:33 2024 daemon.err collectd[4806]: mqtt plugin: mosquitto_loop failed: The connection was refused.
Wed Jun 26 22:00:33 2024 daemon.err collectd[4806]: mqtt plugin: publish failed: Connection pending.
Wed Jun 26 22:00:33 2024 daemon.err collectd[4806]: mqtt plugin: successfully reconnected to broker "192.168.1.202:1883"
Wed Jun 26 22:00:33 2024 daemon.err collectd[4806]: mqtt plugin: mosquitto_loop failed: The connection was refused.
Wed Jun 26 22:00:33 2024 daemon.err collectd[4806]: mqtt plugin: publish failed: Connection pending.
Wed Jun 26 22:00:33 2024 daemon.err collectd[4806]: mqtt plugin: successfully reconnected to broker "192.168.1.202:1883"
Wed Jun 26 22:00:33 2024 daemon.err collectd[4806]: mqtt plugin: mosquitto_loop failed: The connection was refused.
Wed Jun 26 22:00:33 2024 daemon.err collectd[4806]: mqtt plugin: publish failed: Connection pending.
Wed Jun 26 22:00:33 2024 daemon.err collectd[4806]: mqtt plugin: successfully reconnected to broker "192.168.1.202:1883"
Wed Jun 26 22:00:33 2024 daemon.err collectd[4806]: mqtt plugin: mosquitto_loop failed: The connection was refused.
Wed Jun 26 22:00:33 2024 daemon.err collectd[4806]: mqtt plugin: publish failed: Connection pending.
Wed Jun 26 22:00:33 2024 daemon.err collectd[4806]: mqtt plugin: successfully reconnected to broker "192.168.1.202:1883"
Mqtt in home assistant gives me this as error:
2024-06-26 22:25:01: New connection from 192.168.1.1:60656 on port 1883.
error: received null username or password for unpwd check
2024-06-26 22:25:01: Client OpenWRT disconnected, not authorised.
2024-06-26 22:25:01: New connection from 192.168.1.1:60672 on port 1883.
error: received null username or password for unpwd check
2024-06-26 22:25:01: Client OpenWRT disconnected, not authorised.
2024-06-26 22:25:20: New connection from 172.30.32.2:60140 on port 1883.
2024-06-26 22:25:20: Client <unknown> closed its connection.
2024-06-26 22:25:31: New connection from 192.168.1.1:49038 on port 1883.
error: received null username or password for unpwd check
2024-06-26 22:25:31: Client OpenWRT disconnected, not authorised.
As i see it you have wrong username and/or password set in your mqtt.conf file on openwrt.
Yesā¦ but i dont know whyā¦
Same username, in both/ same password, I created a user in Home assistant.
Any idea?
My guess is that there is some problem with mqtt authentication or maybe firewall.
I didnāt add anything to home assistant, any user or something like that. I just installed collectd and mqtt plugin, configured mqtt.conf file as people wrote before me and that was it.
Topic was published and I could see it in mqtt explorer. Your topic for some reason isnt even published.
You could maybe try to configure mqtt broker with out password and see will then topic be published.
Further more I did create file mqtt_sensor.yaml and put everything in it, butā¦ you have some other problem.
Ok, thank you very much. I think Iām going to open a new thread here, ācanāt connect to Matt brokerā.
Hi, Iām new to HA, ESPHome, My goal is to send a message from DDWRT to HA that a device re-connected to my router.
This is an old thread, but it is on a subject Iām researching. The question is to set my expectations before I invest time in testing this configuration: Will this work if DDWRT and HA are on different Vlans? My router can open communication with HA but all messages from HA will be dropped.