Using MQTT for comm between Domoticz instances

For devices supporting the Auto Discovery feature. Like ZWaveJS2MQTT, Zigbee2MQTT.

Moderator: leecollings

FlyingDomotic
Posts: 388
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Using MQTT for comm between Domoticz instances

Post by FlyingDomotic »

Carefully reviewing your conf file, you're using the same MQTT server for both client and slave. It's possible to set Domoticz up like this BUT you have to differentiate both instances, for example naming one domoticz-master and the other domoticz-slave (giving domoticz-master/out and domoticz-slave/out). This way, you don't intermix things that are by essence different, and avoid some amazing side effect...

Or, you may have better to declare one MQTT broker on master and one other on slave. This way, they can have the same topics, as they are fully separated. In addition, having a local instance on slave helps when master crashes.
User avatar
waltervl
Posts: 5886
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Using MQTT for comm between Domoticz instances

Post by waltervl »

Having 2 mqtt servers in your network seems a little bit strange... Better have them to write to different topics (like the examples you have given domoticz-master/out and domoticz-slave/out)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
FlyingDomotic
Posts: 388
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Using MQTT for comm between Domoticz instances

Post by FlyingDomotic »

waltervl wrote: Monday 14 July 2025 16:32 Having 2 mqtt servers in your network seems a little bit strange... Better have them to write to different topics (like the examples you have given domoticz-master/out and domoticz-slave/out)
Not so strange: I have one for production, one for tests, and sometimes one other to do specific things. Having them separated helps (and probably avoid some catastrophes).

In addition, as I have multiples machines, I do prefer having a local instance, to help having a good availability when network or remote serverhas an issue.
User avatar
waltervl
Posts: 5886
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Using MQTT for comm between Domoticz instances

Post by waltervl »

I understand for test purposes but for syncing production data you normally use 1 MQTT server in your network to connect to.

For communication between Domoticz instances in your network it is even easier is to use the out-of-the-box device sharing without MQTT.... ;-)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
willemd
Posts: 659
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Using MQTT for comm between Domoticz instances

Post by willemd »

FlyingDomotic wrote: Monday 14 July 2025 16:09 Carefully reviewing your conf file, you're using the same MQTT server for both client and slave. It's possible to set Domoticz up like this BUT you have to differentiate both instances, for example naming one domoticz-master and the other domoticz-slave (giving domoticz-master/out and domoticz-slave/out). This way, you don't intermix things that are by essence different, and avoid some amazing side effect...

Or, you may have better to declare one MQTT broker on master and one other on slave. This way, they can have the same topics, as they are fully separated. In addition, having a local instance on slave helps when master crashes.
I was just following installation guidelines .... ;-) and also in this thread here your mentioned you could use one single server and use the same config, because depending on whether it is slave or master they use a specific part of the config file and ignore another part (which to me also seemed the most logical).

Anyway it is clear to me know and maybe others in future can benefit from this thread and the issues encountered/solved. Thanks.
FlyingDomotic
Posts: 388
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Using MQTT for comm between Domoticz instances

Post by FlyingDomotic »

Doc is probably not so clear. I'll add a paragraph to avoid misadventure you had.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests