Open dolai1 opened 10 months ago
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?
@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.
@quidquid You are welcome; glad that it helped you.
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.