Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ERR Could not connect to MQTT. error="invalid topic prefix" #376

Open
psiho opened this issue Jan 5, 2025 · 2 comments
Open

[BUG] ERR Could not connect to MQTT. error="invalid topic prefix" #376

psiho opened this issue Jan 5, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@psiho
Copy link

psiho commented Jan 5, 2025

Go Hass Agent Version
v11.0.0

Describe the bug
On two separate machines, fresh first install and config of MQTT, I get error: Could not connect to MQTT. error="invalid topic prefix", and agent is not visible in Hass MQTT integration.

To Reproduce
Steps to reproduce the behaviour:

  1. Install using Arch AUR
  2. Config on initial run
  3. run from terminal to see output... above error is displayed and HASS MQTT integration does not have agent
  4. Check MQTT server log... no logged attempts to login
  5. Enter any other (false) address of MQTT server... same thing

Expected behaviour
I'd expect a successful connect to MQTT or at least different error message. Because, entering completely wrong MQTT server in config produces the same error.

Logs

1:47PM DBG Adding subscription for topic. topic=homeassistant/button/go_hass_agent/_reboot/press
1:47PM DBG Adding subscription for topic. topic=homeassistant/button/go_hass_agent/_suspend/press
1:47PM DBG Adding subscription for topic. topic=homeassistant/button/go_hass_agent/_hibernate/press
1:47PM DBG Adding subscription for topic. topic=homeassistant/button/go_hass_agent/_poweroff/press
1:47PM DBG Adding subscription for topic. topic=homeassistant/button/go_hass_agent/_start_camera/press
1:47PM DBG Adding subscription for topic. topic=homeassistant/button/go_hass_agent/_stop_camera/press
1:47PM DBG Adding subscription for topic. topic=homeassistant/number/go_hass_agent/_volume/set
1:47PM DBG Adding subscription for topic. topic=homeassistant/switch/go_hass_agent/_mute/set
1:47PM DBG Adding subscription for topic. topic=gohassagent//dbuscommand
1:47PM ERR Could not connect to MQTT. error="invalid topic prefix"

Desktop (please complete the following information):

  • OS: Linux
  • Distribution: Arch
@psiho psiho added the bug Something isn't working label Jan 5, 2025
@psiho
Copy link
Author

psiho commented Jan 5, 2025

After setting topic_prefix manually in the config, I'm getting another error. There is not "topic_prefix" in GUI config. I don't see in docs, so it's a bit confusing.

Anyway, new error is now more descriptive: ERR Error establishing MQTT connection. error="failed to connect to tcp://192.168.1.9:1883: EOF"

MQTT now logs attempot to conenct with Invalid protocol version 5 in CONNECT from 192.168.1.34.
... so I guess it's clear now, although I think this requirement for MQTT protocol v5 (and the above config too) should be more clear in the docs.

@joshuar
Copy link
Owner

joshuar commented Jan 6, 2025

Hey thanks for reporting, I believe this is the same problem as #375. I've issued a patch release to fix it, see my comment on the issue. You've figured out the workaround though, so you shouldn't need to do the re-register step I've mentioned after upgrading.

Thanks for the note on the MQTT v5 requirement. That wasn't intentional but is unfortunately due to the underlying library used for MQTT connectivity. I'll add a note in the README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants