#Multiple Z2M sharing MQTT
1 messages · Page 1 of 1 (latest)
You can customize the discovery topic for each HA instance, and then point each Z2M instance to its topic
Then give each Z2M instance its own topic for bridge/devices
I'm currently using a single broker to handle two Z2M instances talking to a single HA instance, but changing the discovery topic would also allow multiple HA instances
Thanks! It seems to work ok but changing the subscription in one of the HA instances did not filter on topic. I still got all devices in both. Still the change on topic seems ok to MQTT server. Named then homeassistant and homeassistant2.
You need to change both and they need to match
Yes i did and at least it shows OK in the MQTT brooker.
But when adding the subscription on Main HA i added "Homeassistant", on Slave "Homeassistant2". I still get all devices. Becuse when adding the MQTT integration on slave and conencting to local MQTT device i can initially not filter on subscription. I then get them all.
Changing the subscription to "Homeassistant2" did not refresh the en devices
"MQTT settings" / "Configure MQTT Options"
did you also change that in the Z2M instances?
they can be completely separate
you can use MQTT explorer to see what's publishing and where
Yes according to MQTT explorer im only picking the right devices.
29 devices in main and 1 in slave
But still 29 shows on both in HA
It seems like the devices are not refreshed after changing the subscription
Maybe delete the whole homeassistant topic and everything in it and let it republish
Could be stale
Becuse if i change the subscription topic to "Homy" the 29 devices are still there... like stuck
They should be refreshed right?
The problem is that i cant set the subscripe upon adding the integration. Only IP and port. No config.
I would do the following:
- Change the publish topic for Z2M instance 1 to z2m-1 and the Z2M HA discovery topic to homey1
- Change the publish topic for Z2M instance 2 to z2m-2 and the Z2M HA discovery topic to homey2
- Remove the MQTT integration from both HA instances to remove all existing devices
- Delete the whole homeassistant topic and subtopics using MQTT Explorer to ensure that nothing is in there
- Set up the MQTT integration on both HA instances
- Configure each HA MQTT instance to use the right discovery topic in the Configure section
Im lost but where to change the Z2M publish topic?
And the home assistant integration part in Z2M is that not the same as the discovery topic in the MQTT integration?
if you didn't change Z2M, then that's your problem
base_topic:
that's why I said that you need to point each Z2M instance to a separate topic
ok so base topic is the publish topic? 🙂
yes
But what is the difference setting the discovery topic in the z2m HA integration tab vs what is set in the Mqtt integration?
One is writing to it and the other is reading
MQTT is a broker between the two
Do you understand what MQTT is doing here?
Z2M and HA have to agree on where the data is in the broker
Sure, i publish the z2m messages over a base topic and then define the messages to the HA to a certain discovery topic. It’s like 2 levels of adress for the same messages.
I can then consume the messages in the Mqtt integration but only by discovery topic
Yes
And the messages in the discovery topic point to the Z2M base topic
You can see all of this in MQTT Explorer
What can be a reason that i cant change the settings in Z2M? Trying to submit but nothing. Restarted 3 times now.