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

Separate Devices Running MQTT IO Are Recognized as a Single Device in Home Assistant #344

Open
dolai1 opened this issue Jan 19, 2024 · 3 comments

Comments

@dolai1
Copy link
Contributor

dolai1 commented Jan 19, 2024

I appreciate the software; this is letting me pull my remote Raspberry Pi GPIOs into HA cleanly.

I have an issue though. I have two separate instances of MQTT IO running right now on two Raspberry Pis (more to come), but they get merged into a single device in HA (Mosquitto) with all of the entities under it.

I am guessing that I need to change my ha_discovery settings, but not sure how right now.

Each instance has its own MQTT user, it's own topic prefix, and a unique name under mqtt.ha_discovery. The device name is the one that connected most recently and, with MQTT Explorer, I confirmed that the two instances have different unique IDs.

Any idea what I need to change in my configs to get the two to be recognized as separate devices in Home Assistant? Thank you.

@dolai1
Copy link
Contributor Author

dolai1 commented Jan 29, 2024

I think that I figured this out, in case anyone else is running into the same issue:
It looks like MQTT IO reports two identifiers when it makes its availability report to HA via MQTT: the device name, and, separately, “mqtt-io”. It looks like HA gets confused with multiple devices reporting the same identifier, even if there are unique IDs that accompany the duplicated one.

So, my workaround involves deleting
"mqtt-io",
from the “identifiers” line in
<python virtual environment location>/lib/python3.11/site-packages/mqtt_io/home_assistant.py

It seems like this could have some unintended consequences, so I’d appreciate the input of anyone with more experience on this.
If not, could we change the code to reflect this?

@quidquid
Copy link

quidquid commented Nov 4, 2024

@dolai1 Thanks for the hack! I also ran into this using two instances and spent some time untangling the devices in HA. Seems like a bug to me too: the "discovery name" option leads me to think two instances with different names should show up in HA as two devices. But they smoosh into each other as one confused MQTT device, overwriting the name and accumulating IDs.

@dolai1
Copy link
Contributor Author

dolai1 commented Nov 5, 2024

@quidquid You are welcome; glad that it helped you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants