如何修复 HomeAssistant [homeassistant.components.mqtt] Unable to connect to the MQTT broker: Connection Refused: not authorised
问题:
启动 HomeAssistant 时,例如使用 docker-compose up,你看到此错误消息:
homeassistant_log.txt
homeassistant | 2021-12-27 19:55:46 WARNING (Recorder) [homeassistant.components.recorder.util] The system could not validate that the sqlite3 database at //config/home-assistant_v2.db was shutdown cleanly
homeassistant | 2021-12-27 19:55:47 ERROR (Thread-3) [homeassistant.components.mqtt] Unable to connect to the MQTT broker: Connection Refused: not authorised.
homeassistant | 2021-12-27 19:55:47 WARNING (Thread-3) [homeassistant.components.mqtt] Disconnected from MQTT server 127.0.0.1:1883 (5)解决方案
你的 configuration.yml 没有为你的 MQTT 服务器设置正确的用户名和/或密码。
如果 MQTT 服务器有正确的用户,这是一个有效的示例部分:
homeassistant_mqtt_config.yaml
mqtt:
broker: "127.0.0.1"
username: "homeassistant"
password: "ep2ooy8di3avohn1Ahm6eegheiResh"还要检查 MQTT 服务器(如 Mosquitto)是否有正确密码的正确用户。
Check out similar posts by category:
HomeAssistant, MQTT
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow