MQTT Broker没有收到任何消息

时间:2020-01-24 20:37:53

标签: mqtt iot mosquitto

我正在尝试将我的Tasmota交换机连接到mqtt。我已经在虚拟机上安装了mosquitto,这里是配置:

/etc/mosquitto/mosquitto.conf

# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example

pid_file /var/run/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d

/ etc / mosquitto / acl

# weewx readwrite to the loop
user tasmota 
#topic weather/#

/etc/mosquitto/conf.d/myconfig.conf

allow_anonymous true
password_file /etc/mosquitto/passwd
persistence false 
protocol mqtt
acl_file /etc/mosquitto/acl

服务正在运行,端口已启动

这是我的交换机的配置

enter image description here

我正尝试用

查看消息
mosquitto_sub  -h 10.11.0.106 -t '#'

还尝试添加用户名和密码,但是我没有得到任何输出

我可以在日志中看到已建立连接

1579896351: Config loaded from /etc/mosquitto/mosquitto.conf.
1579896351: Opening ipv4 listen socket on port 1883.
1579896351: Opening ipv6 listen socket on port 1883.
1579896351: New connection from 10.10.0.137 on port 1883.
1579896351: New client connected from 10.10.0.137 as mosqsub|19705-warmachin (c1, k60).
1579896358: Socket error on client mosqsub|19705-warmachin, disconnecting.
1579896358: New connection from 10.10.0.137 on port 1883.
1579896358: New client connected from 10.10.0.137 as mosqsub|19775-warmachin (c1, k60).
1579896361: New connection from 10.11.1.51 on port 1883.
1579896361: New client connected from 10.11.1.51 as DVES_6CA231 (c1, k30, u'tasmota').
1579896361: New connection from 10.11.1.52 on port 1883.
1579896361: New client connected from 10.11.1.52 as DVES_301DDC (c1, k30, u'tasmota').
1579896362: New connection from 10.11.1.54 on port 1883.
1579896362: New client connected from 10.11.1.54 as DVES_350992 (c1, k30, u'tasmota').

我错过了什么还是我误会了完全错误的事情?

请帮助

1 个答案:

答案 0 :(得分:0)

正如注释中所述,您的ACL文件缺少anonymous用户或tasmota用户的所有已启用主题。

如果启用ACL,则需要定义希望用户能够访问的所有主题。