Using MQTT for comm between Domoticz instances

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

Moderator: leecollings

FlyingDomotic
Posts: 383
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 »

DiaDomo wrote: Sunday 01 September 2024 8:21
2024-09-01 08:16:51.892 Error: MQTT Sync: File "/home/xxx/domoticz/plugins/MqttSync/plugin.py", line 668, in askForDeviceList
2024-09-01 08:16:51.892 Error: MQTT Sync: authorizationText += ":" + variables.domoticzPassword
2024-09-01 08:16:51.892 Error: MQTT Sync: TypeError: can only concatenate str (not "NoneType") to str

Can you advice?
This was a bug, fixed with last version of plugin.
DiaDomo wrote: Sunday 01 September 2024 9:36 When I add my domoticz username & password for the master in the URL, I get the following error in the domoticz log:

Code: Select all

2024-09-01 09:34:00.677 Error: MQTT Sync: name2idx::onMessage: Error 401 returned by HTTP
Error 401 is "Unauthorized", meaning (if you gave both username and password), that they're not the right ones. Could you check them?
DiaDomo
Posts: 37
Joined: Saturday 28 March 2020 13:55
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Using MQTT for comm between Domoticz instances

Post by DiaDomo »

1) I updated the plugin.
2) Removed user&password in the master URL (I think these are not necessary).
Errors in the log:

Code: Select all

2024-09-01 13:23:38.718 Error: MQTT Sync: Call to function 'onConnect' failed, exception details:
2024-09-01 13:23:38.734 Error: MQTT Sync: Traceback (most recent call last):
2024-09-01 13:23:38.734 Error: MQTT Sync: File "/home/xxx/domoticz/plugins/MqttSync/plugin.py", line 1097, in onConnect
2024-09-01 13:23:38.734 Error: MQTT Sync: onHttpConnected(Connection)
2024-09-01 13:23:38.734 Error: MQTT Sync: File "/home/xxx/domoticz/plugins/MqttSync/plugin.py", line 796, in onHttpConnected
2024-09-01 13:23:38.734 Error: MQTT Sync: askForDeviceList(Connection)
2024-09-01 13:23:38.734 Error: MQTT Sync: File "/home/xxx/domoticz/plugins/MqttSync/plugin.py", line 669, in askForDeviceList
2024-09-01 13:23:38.734 Error: MQTT Sync: authorization = base64.b64encode(authorizationText.encode('ascii')).decode("UTF_8")
2024-09-01 13:23:38.734 Error: MQTT Sync: AttributeError: 'NoneType' object has no attribute 'encode'
2024-09-01 13:23:45.884 Error: MQTT Sync: Call to function 'onConnect' failed, exception details:
2024-09-01 13:23:45.899 Error: MQTT Sync: Traceback (most recent call last):
2024-09-01 13:23:45.900 Error: MQTT Sync: File "/home/xxx/domoticz/plugins/MqttSync/plugin.py", line 1097, in onConnect
2024-09-01 13:23:45.900 Error: MQTT Sync: onHttpConnected(Connection)
2024-09-01 13:23:45.900 Error: MQTT Sync: File "/home/xxx/domoticz/plugins/MqttSync/plugin.py", line 796, in onHttpConnected
2024-09-01 13:23:45.900 Error: MQTT Sync: askForDeviceList(Connection)
2024-09-01 13:23:45.900 Error: MQTT Sync: File "/home/xxx/domoticz/plugins/MqttSync/plugin.py", line 669, in askForDeviceList
2024-09-01 13:23:45.900 Error: MQTT Sync: authorization = base64.b64encode(authorizationText.encode('ascii')).decode("UTF_8")
2024-09-01 13:23:45.900 Error: MQTT Sync: AttributeError: 'NoneType' object has no attribute 'encode'
3) Re-added the username & password in the master URL (format: http://<username>:<password>@IP:port)
Domoticz log error:

Code: Select all

2024-09-01 13:30:56.940 Error: MQTT Sync: name2idx::onMessage: Error 401 returned by HTTP
Is the format OK?
Raspberry PI 2 & 3 & 4 | RFlink | MySensors | ESP32 | Homebridge | Tasmota Sonoff | Zigbee2Mqtt | ADS-B
FlyingDomotic
Posts: 383
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 »

DiaDomo wrote: Sunday 01 September 2024 13:31 2024-09-01 13:23:38.734 Error: MQTT Sync: authorization = base64.b64encode(authorizationText.encode('ascii')).decode("UTF_8")
2024-09-01 13:23:38.734 Error: MQTT Sync: AttributeError: 'NoneType' object has no attribute 'encode'
Fixed in last version too. You should normally try without user/password.

Concerning 401 error, it means either that you don't gave user/password while needed, or user/password is not the right one.

User and password are extracted from Domoticz URL with general format http://username:password@ipAddressorName:port
DiaDomo
Posts: 37
Joined: Saturday 28 March 2020 13:55
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Using MQTT for comm between Domoticz instances

Post by DiaDomo »

Thx, it's running now after the plugin update! (no username / password required)
Raspberry PI 2 & 3 & 4 | RFlink | MySensors | ESP32 | Homebridge | Tasmota Sonoff | Zigbee2Mqtt | ADS-B
FlyingDomotic
Posts: 383
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 »

We're never protected against chance :D
willemd
Posts: 655
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: Wednesday 28 August 2024 10:44 I just wrote a new Python plugin synchronizing a master (local) instance of Domoticz to a slave (remote) one at https://github.com/FlyingDomotic/domoti ... ync-plugin

You just have to get list of IDX (or names) of devices you want to synchronize on master, and that's it. Everything is automatically created on slave, and updates are propagated from master to slave when they occurs. You can even propagate changes from slave to master, if you allow device to do so.

Connections are established by master to slave, avoiding opening something incoming at home.

Paranoiacs can even create a dedicated user to protect against accidentally configuring a device as being synchronized.

In addition to one master speaking to one slave, you can also have one master connected to multiple slaves, one slave connected to multiple masters, multiple masters connected to multiple slaves. Cascades also supported.

This may be useful if Telegram disappears one day, after its creator being arrested in France, for example ;-)
Thanks, this is exactly what I was looking for. I want to connect my OpenThermGateway and some 1-wire temperature sensors to one Raspberry Pi and then sync those values to my main Domoticz installation.

Everytime you think you have to build something yourselve, just do a search and discover someone else has already done the work. That's great. Thanks.

Three questions:
1) I assume I still have to install the MQTT broker/server first before installing the plugin as per your description?
2) Does it matter on which Raspberry the broker is installed?
3) In your terminology for this plugin, the sending device is the master and the receiving device is the slave?
FlyingDomotic
Posts: 383
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 »

willemd wrote: Tuesday 08 July 2025 11:10 Three questions:
1) I assume I still have to install the MQTT broker/server first before installing the plugin as per your description?
2) Does it matter on which Raspberry the broker is installed?
3) In your terminology for this plugin, the sending device is the master and the receiving device is the slave?
1) MQTT broker should be installed and running when starting plug-in. Installation order is not important.

2) You should connect on MQTT broker(s) attached to each Domoticz instance you want to synchronize, whatever it/they should be. Usually, we use a local instance for each Domoticz instance, but this is not mandatory.

3) Master is defined in configuration file. Master instance is where device reference is taken, salve where this master device is copied to. However, devices for which you define "allowSlaveUpdate" to True will also update master when they change.
willemd
Posts: 655
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 »

Just to share my experience here. It worked on the first try !!

What I did:
1) Install a new Raspberry Pi with Domoticz and two 1-wire temperature sensors. This one is the master, i.e. data provider.
2) Install Mosquitto broker on this system.
3) Install the plugin and add it into the Domoticz hardware list.
4) Create a configuration file (to be placed in the folder of the plugin : ~/domoticz/plugins/MqttSync ). To share a real life example it is shown below.
5) Install the plugin on the main domoticz system and add it to the hardware list. This is the slave, i.e. the data receiver.
6) Put the same configuration file in the folder of the plugin, so it will use the broker already installed on the master.

restart both system and voila.... two sensors were created on the main system and values were synchronised.

thanks again for your plugin.

Code: Select all

{
        "settings": {
                "configVersion": "V1.0.2",
                "masterName": "master",
                "masterMqttHost": "192.168.178.254",
                "masterMqttPort": "1883",
                "masterMqttUser": "",
                "masterMqttPassword": "",
                "masterDomoticzOutTopic": "domoticz/out",
                "masterDomoticzUrl": "http://192.168.178.254:8080",
                "slaveName": "slave",
                "slaveMqttHost": "192.168.178.254",
                "slaveMqttPort": "1883",
                "slaveMqttUser": "",
                "slaveMqttPassword": "",
                "slaveDomoticzUrl": "http://192.168.178.218:8080",
                "slaveDevicePrefix": "BoilerPi:"
        },
        "mapping": [
                {"idx": 1},
                {"idx": 2}
        ]
}
FlyingDomotic
Posts: 383
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 »

We're never protected against chance :D
willemd
Posts: 655
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 »

I was cheering a bit too early...

It now seems that the synchronisation only occurs once.

If I restart the master, either with a reboot, or a domoticz restart, or a plugin restart (either disable/enable or update the logging) then the values are arriving at the slave without problems, but only once.

I see no error messages in the Domoticz log. I ran the plugin on the master with more logging (debug or extra verbose) and as far as I can interpret it is not sending further values after the intial once after startup. I checked the sensors themselves on master also, they are updated no problem, so it should send updates.

I also tried manually to subscribe to domoticz/out but don't see anything happening, not even the first time when the sync is succesfull. When I send a message to domoticz/out I see it in the manually subscribed terminal window. Addition: If I subscribe to mqttSync/master2slave/masterParameters/1 or mqttSync/master2slave/masterValues/1 then I see exactly one update being published, again only one.

Any idea?

This is what I see in the log after the initial update when I set logging to extra verbose.

Code: Select all

2025-07-10 20:05:26.018 mqtt sync: Pushing 'onHeartbeatCallback' on to queue
2025-07-10 20:05:26.068 mqtt sync: Processing 'onHeartbeatCallback' message
2025-07-10 20:05:26.069 mqtt sync: Calling message handler 'onHeartbeat' on 'module' type object.
2025-07-10 20:05:26.069 mqtt sync: onHeartbeat:
2025-07-10 20:05:26.069 mqtt sync: Pushing 'WriteDirective' on to queue
2025-07-10 20:05:26.069 mqtt sync: Pushing 'WriteDirective' on to queue
2025-07-10 20:05:26.069 mqtt sync: Processing 'WriteDirective' message
2025-07-10 20:05:26.070 mqtt sync: Sending 2 bytes of data
2025-07-10 20:05:26.070 mqtt sync: c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �
2025-07-10 20:05:26.070 mqtt sync: Processing 'WriteDirective' message
2025-07-10 20:05:26.070 mqtt sync: Sending 2 bytes of data
2025-07-10 20:05:26.070 mqtt sync: c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �
2025-07-10 20:05:26.071 mqtt sync: Pushing 'ReadEvent' on to queue
2025-07-10 20:05:26.071 mqtt sync: Pushing 'ReadEvent' on to queue
2025-07-10 20:05:26.121 mqtt sync: Processing 'ReadEvent' message
2025-07-10 20:05:26.121 mqtt sync: Received 2 bytes of data
2025-07-10 20:05:26.122 mqtt sync: d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. Ю
2025-07-10 20:05:26.122 mqtt sync: Pushing 'onMessageCallback' on to queue
2025-07-10 20:05:26.122 mqtt sync: Processing 'ReadEvent' message
2025-07-10 20:05:26.122 mqtt sync: Received 2 bytes of data
2025-07-10 20:05:26.123 mqtt sync: d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. Ю
2025-07-10 20:05:26.123 mqtt sync: Pushing 'onMessageCallback' on to queue
2025-07-10 20:05:26.123 mqtt sync: Processing 'onMessageCallback' message
2025-07-10 20:05:26.124 mqtt sync: Calling message handler 'onMessage' on 'module' type object.
2025-07-10 20:05:26.124 mqtt sync: Processing 'onMessageCallback' message
2025-07-10 20:05:26.124 mqtt sync: Calling message handler 'onMessage' on 'module' type object.
And this is what I see during the very first sync.

Code: Select all

2025-07-10 20:08:44.912 mqtt sync: Slave::onConnect: Status 0, Description Success
2025-07-10 20:08:44.912 mqtt sync: onSlaveConnected:
2025-07-10 20:08:44.912 mqtt sync: MqttClient/Slave::SendId:
2025-07-10 20:08:44.912 mqtt sync: MqttClient/Slave::SendId: ID: Domoticz_domoticz-mqtt-sync_3_Slave_2025-07-10 20:08:43, lwtTopic: mqttSync/master2slave/lwt/slaveOnMaster, lwtData: {"state": "down", "version": "1.0.0"}
2025-07-10 20:08:44.912 mqtt sync: Pushing 'WriteDirective' on to queue
2025-07-10 20:08:44.912 mqtt sync: Processing 'WriteDirective' message
2025-07-10 20:08:44.912 mqtt sync: Sending 150 bytes of data
2025-07-10 20:08:44.912 mqtt sync: 10 93 01 00 04 4d 51 54 54 04 26 00 3c 00 37 44 6f 6d 6f 74 .Ӯ..MQTT.&.<.7Domot
2025-07-10 20:08:44.912 mqtt sync: 69 63 7a 5f 64 6f 6d 6f 74 69 63 7a 2d 6d 71 74 74 2d 73 79 icz_domoticz-mqtt-sy
2025-07-10 20:08:44.912 mqtt sync: 6e 63 5f 33 5f 53 6c 61 76 65 5f 32 30 32 35 2d 30 37 2d 31 nc_3_Slave_2025-07-1
2025-07-10 20:08:44.912 mqtt sync: 30 20 32 30 3a 30 38 3a 34 33 00 27 6d 71 74 74 53 79 6e 63 0.20:08:43.'mqttSync
2025-07-10 20:08:44.912 mqtt sync: 2f 6d 61 73 74 65 72 32 73 6c 61 76 65 2f 6c 77 74 2f 73 6c /master2slave/lwt/sl
2025-07-10 20:08:44.912 mqtt sync: 61 76 65 4f 6e 4d 61 73 74 65 72 00 25 7b 22 73 74 61 74 65 aveOnMaster.%{"state
2025-07-10 20:08:44.912 mqtt sync: 22 3a 20 22 64 6f 77 6e 22 2c 20 22 76 65 72 73 69 6f 6e 22 ":."down",."version"
2025-07-10 20:08:44.912 mqtt sync: 3a 20 22 31 2e 30 2e 30 22 7d .. .. .. .. .. .. .. .. .. .. :."1.0.0"}
2025-07-10 20:08:44.913 mqtt sync: Pushing 'ReadEvent' on to queue
2025-07-10 20:08:44.963 mqtt sync: Processing 'ReadEvent' message
2025-07-10 20:08:44.963 mqtt sync: Received 4 bytes of data
2025-07-10 20:08:44.963 mqtt sync: 20 02 00 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ....
2025-07-10 20:08:44.963 mqtt sync: Pushing 'onMessageCallback' on to queue
2025-07-10 20:08:44.963 mqtt sync: Processing 'onMessageCallback' message
2025-07-10 20:08:44.963 mqtt sync: Calling message handler 'onMessage' on 'module' type object.
2025-07-10 20:08:44.963 mqtt sync: Slave::onMessage: Connection established
2025-07-10 20:08:44.963 mqtt sync: Slave::onSlaveMqttConAck:
2025-07-10 20:08:44.963 mqtt sync: MqttClient/Slave::Publish: mqttSync/master2slave/lwt/slaveOnMaster ({"state": "up", "version": "1.0.0", "since": "2025-07-10 20:08:43"})
2025-07-10 20:08:44.963 mqtt sync: Pushing 'WriteDirective' on to queue
2025-07-10 20:08:44.963 mqtt sync: sendParametersAndValuesToSlave:
2025-07-10 20:08:44.963 mqtt sync: MqttClient/Slave::Publish: mqttSync/master2slave/masterParameters/1 ({"Name": "Temperature1", "Type": 80, "SubType": 5, "SwitchType": 0, "Sequence": "2025-07-10 20:08:43"})
2025-07-10 20:08:44.963 mqtt sync: Pushing 'WriteDirective' on to queue
2025-07-10 20:08:44.963 mqtt sync: MqttClient/Slave::Publish: mqttSync/master2slave/masterParameters/2 ({"Name": "Temperature2", "Type": 80, "SubType": 5, "SwitchType": 0, "Sequence": "2025-07-10 20:08:43"})
2025-07-10 20:08:44.963 mqtt sync: Pushing 'WriteDirective' on to queue
2025-07-10 20:08:44.964 mqtt sync: MqttClient/Slave::Publish: mqttSync/master2slave/masterValues/1 ({"allowSlaveUpdate": true, "nValue": 0, "sValue": "24.4", "LastUpdate": "2025-07-10 20:08:42", "Sequence": "2025-07-10 20:08:43"})
2025-07-10 20:08:44.964 mqtt sync: Pushing 'WriteDirective' on to queue
2025-07-10 20:08:44.964 mqtt sync: MqttClient/Slave::Publish: mqttSync/master2slave/masterValues/2 ({"allowSlaveUpdate": true, "nValue": 0, "sValue": "24.0", "LastUpdate": "2025-07-10 20:08:12", "Sequence": "2025-07-10 20:08:43"})
2025-07-10 20:08:44.964 mqtt sync: Pushing 'WriteDirective' on to queue
2025-07-10 20:08:44.964 mqtt sync: subscribeSlaveValuesFromMaster:
2025-07-10 20:08:44.964 mqtt sync: MqttClient/Slave::Subscribe: mqttSync/master2slave/slaveValues/#
2025-07-10 20:08:44.964 mqtt sync: Pushing 'WriteDirective' on to queue
2025-07-10 20:08:44.964 mqtt sync: Processing 'WriteDirective' message
2025-07-10 20:08:44.964 mqtt sync: Sending 110 bytes of data
2025-07-10 20:08:44.964 mqtt sync: 31 6c 00 27 6d 71 74 74 53 79 6e 63 2f 6d 61 73 74 65 72 32 1l.'mqttSync/master2
2025-07-10 20:08:44.964 mqtt sync: 73 6c 61 76 65 2f 6c 77 74 2f 73 6c 61 76 65 4f 6e 4d 61 73 slave/lwt/slaveOnMas
2025-07-10 20:08:44.964 mqtt sync: 74 65 72 7b 22 73 74 61 74 65 22 3a 20 22 75 70 22 2c 20 22 ter{"state":."up",."
2025-07-10 20:08:44.964 mqtt sync: 76 65 72 73 69 6f 6e 22 3a 20 22 31 2e 30 2e 30 22 2c 20 22 version":."1.0.0",."
2025-07-10 20:08:44.964 mqtt sync: 73 69 6e 63 65 22 3a 20 22 32 30 32 35 2d 30 37 2d 31 30 20 since":."2025-07-10.
2025-07-10 20:08:44.964 mqtt sync: 32 30 3a 30 38 3a 34 33 22 7d .. .. .. .. .. .. .. .. .. .. 20:08:43"}
2025-07-10 20:08:44.964 mqtt sync: Processing 'WriteDirective' message
2025-07-10 20:08:44.965 mqtt sync: Sending 147 bytes of data
2025-07-10 20:08:44.965 mqtt sync: 31 90 01 00 28 6d 71 74 74 53 79 6e 63 2f 6d 61 73 74 65 72 1Ю.(mqttSync/master
2025-07-10 20:08:44.965 mqtt sync: 32 73 6c 61 76 65 2f 6d 61 73 74 65 72 50 61 72 61 6d 65 74 2slave/masterParamet
2025-07-10 20:08:44.965 mqtt sync: 65 72 73 2f 31 7b 22 4e 61 6d 65 22 3a 20 22 54 65 6d 70 65 ers/1{"Name":."Tempe
2025-07-10 20:08:44.965 mqtt sync: 72 61 74 75 72 65 31 22 2c 20 22 54 79 70 65 22 3a 20 38 30 rature1",."Type":.80
2025-07-10 20:08:44.965 mqtt sync: 2c 20 22 53 75 62 54 79 70 65 22 3a 20 35 2c 20 22 53 77 69 ,."SubType":.5,."Swi
2025-07-10 20:08:44.965 mqtt sync: 74 63 68 54 79 70 65 22 3a 20 30 2c 20 22 53 65 71 75 65 6e tchType":.0,."Sequen
2025-07-10 20:08:44.965 mqtt sync: 63 65 22 3a 20 22 32 30 32 35 2d 30 37 2d 31 30 20 32 30 3a ce":."2025-07-10.20:
2025-07-10 20:08:44.965 mqtt sync: 30 38 3a 34 33 22 7d .. .. .. .. .. .. .. .. .. .. .. .. .. 08:43"}
2025-07-10 20:08:44.965 mqtt sync: Processing 'WriteDirective' message
2025-07-10 20:08:44.965 mqtt sync: Sending 147 bytes of data
2025-07-10 20:08:44.965 mqtt sync: 31 90 01 00 28 6d 71 74 74 53 79 6e 63 2f 6d 61 73 74 65 72 1Ю.(mqttSync/master
2025-07-10 20:08:44.965 mqtt sync: 32 73 6c 61 76 65 2f 6d 61 73 74 65 72 50 61 72 61 6d 65 74 2slave/masterParamet
2025-07-10 20:08:44.965 mqtt sync: 65 72 73 2f 32 7b 22 4e 61 6d 65 22 3a 20 22 54 65 6d 70 65 ers/2{"Name":."Tempe
2025-07-10 20:08:44.965 mqtt sync: 72 61 74 75 72 65 32 22 2c 20 22 54 79 70 65 22 3a 20 38 30 rature2",."Type":.80
2025-07-10 20:08:44.965 mqtt sync: 2c 20 22 53 75 62 54 79 70 65 22 3a 20 35 2c 20 22 53 77 69 ,."SubType":.5,."Swi
2025-07-10 20:08:44.965 mqtt sync: 74 63 68 54 79 70 65 22 3a 20 30 2c 20 22 53 65 71 75 65 6e tchType":.0,."Sequen
2025-07-10 20:08:44.965 mqtt sync: 63 65 22 3a 20 22 32 30 32 35 2d 30 37 2d 31 30 20 32 30 3a ce":."2025-07-10.20:
2025-07-10 20:08:44.965 mqtt sync: 30 38 3a 34 33 22 7d .. .. .. .. .. .. .. .. .. .. .. .. .. 08:43"}
2025-07-10 20:08:44.965 mqtt sync: Processing 'WriteDirective' message
2025-07-10 20:08:44.965 mqtt sync: Sending 170 bytes of data
2025-07-10 20:08:44.965 mqtt sync: 31 a7 01 00 24 6d 71 74 74 53 79 6e 63 2f 6d 61 73 74 65 72 1Ǯ.$mqttSync/master
2025-07-10 20:08:44.965 mqtt sync: 32 73 6c 61 76 65 2f 6d 61 73 74 65 72 56 61 6c 75 65 73 2f 2slave/masterValues/
2025-07-10 20:08:44.965 mqtt sync: 31 7b 22 61 6c 6c 6f 77 53 6c 61 76 65 55 70 64 61 74 65 22 1{"allowSlaveUpdate"
2025-07-10 20:08:44.965 mqtt sync: 3a 20 74 72 75 65 2c 20 22 6e 56 61 6c 75 65 22 3a 20 30 2c :.true,."nValue":.0,
2025-07-10 20:08:44.965 mqtt sync: 20 22 73 56 61 6c 75 65 22 3a 20 22 32 34 2e 34 22 2c 20 22 ."sValue":."24.4",."
2025-07-10 20:08:44.965 mqtt sync: 4c 61 73 74 55 70 64 61 74 65 22 3a 20 22 32 30 32 35 2d 30 LastUpdate":."2025-0
2025-07-10 20:08:44.965 mqtt sync: 37 2d 31 30 20 32 30 3a 30 38 3a 34 32 22 2c 20 22 53 65 71 7-10.20:08:42",."Seq
2025-07-10 20:08:44.965 mqtt sync: 75 65 6e 63 65 22 3a 20 22 32 30 32 35 2d 30 37 2d 31 30 20 uence":."2025-07-10.
2025-07-10 20:08:44.965 mqtt sync: 32 30 3a 30 38 3a 34 33 22 7d .. .. .. .. .. .. .. .. .. .. 20:08:43"}
2025-07-10 20:08:44.965 mqtt sync: Processing 'WriteDirective' message
2025-07-10 20:08:44.965 mqtt sync: Sending 170 bytes of data
2025-07-10 20:08:44.965 mqtt sync: 31 a7 01 00 24 6d 71 74 74 53 79 6e 63 2f 6d 61 73 74 65 72 1Ǯ.$mqttSync/master
2025-07-10 20:08:44.965 mqtt sync: 32 73 6c 61 76 65 2f 6d 61 73 74 65 72 56 61 6c 75 65 73 2f 2slave/masterValues/
2025-07-10 20:08:44.966 mqtt sync: 32 7b 22 61 6c 6c 6f 77 53 6c 61 76 65 55 70 64 61 74 65 22 2{"allowSlaveUpdate"
2025-07-10 20:08:44.966 mqtt sync: 3a 20 74 72 75 65 2c 20 22 6e 56 61 6c 75 65 22 3a 20 30 2c :.true,."nValue":.0,
2025-07-10 20:08:44.966 mqtt sync: 20 22 73 56 61 6c 75 65 22 3a 20 22 32 34 2e 30 22 2c 20 22 ."sValue":."24.0",."
2025-07-10 20:08:44.966 mqtt sync: 4c 61 73 74 55 70 64 61 74 65 22 3a 20 22 32 30 32 35 2d 30 LastUpdate":."2025-0
2025-07-10 20:08:44.966 mqtt sync: 37 2d 31 30 20 32 30 3a 30 38 3a 31 32 22 2c 20 22 53 65 71 7-10.20:08:12",."Seq
2025-07-10 20:08:44.966 mqtt sync: 75 65 6e 63 65 22 3a 20 22 32 30 32 35 2d 30 37 2d 31 30 20 uence":."2025-07-10.
2025-07-10 20:08:44.966 mqtt sync: 32 30 3a 30 38 3a 34 33 22 7d .. .. .. .. .. .. .. .. .. .. 20:08:43"}
2025-07-10 20:08:44.966 mqtt sync: Processing 'WriteDirective' message
2025-07-10 20:08:44.966 mqtt sync: Sending 42 bytes of data
2025-07-10 20:08:44.966 mqtt sync: 82 28 00 01 00 23 6d 71 74 74 53 79 6e 63 2f 6d 61 73 74 65 ¨...#mqttSync/maste
2025-07-10 20:08:44.966 mqtt sync: 72 32 73 6c 61 76 65 2f 73 6c 61 76 65 56 61 6c 75 65 73 2f r2slave/slaveValues/
2025-07-10 20:08:44.966 mqtt sync: 23 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. #.
2025-07-10 20:08:45.009 mqtt sync: Pushing 'ReadEvent' on to queue
2025-07-10 20:08:45.016 mqtt sync: Processing 'ReadEvent' message
2025-07-10 20:08:45.016 mqtt sync: Received 5 bytes of data
2025-07-10 20:08:45.016 mqtt sync: 90 03 00 01 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. Ю...
2025-07-10 20:08:45.016 mqtt sync: Pushing 'onMessageCallback' on to queue
2025-07-10 20:08:45.016 mqtt sync: Processing 'onMessageCallback' message
2025-07-10 20:08:45.016 mqtt sync: Calling message handler 'onMessage' on 'module' type object.
willemd
Posts: 655
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 »

I tried to understand the code and the source of the problem.

I could not really determine what the trigger would be for the master to send an update of values. Would it be on the heartbeat or would it be on the update of a value of a device?

I am not sure whether the plugins registers anywhere which devices to monitor (devices list of the master plugin?). Anyway it does not seem to react to updates at all.

For the moment I added a line with call to function
sendParametersAndValuesToSlave()
in the onHeartbeat function on the master.
Then the values get updated every 15 seconds, no problem.
Last edited by willemd on Saturday 12 July 2025 21:18, edited 1 time in total.
FlyingDomotic
Posts: 383
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 »

Having a copy of your configuration file (with personal data replaced by xxx or ***) may help.

Before having it, can you check you correctly defined a mapping section, like in the example :

Code: Select all

{
	"settings": {
		"configVersion": "V1.0.0",
		"masterName": ....
	},
	"mapping": [
		{"idx": 2254, "allowSlaveUpdate": true},
		{"idx": 2255, "allowSlaveUpdate": false},
		{"name": "Thermostat", "allowSlaveUpdate": true}
	]
}
willemd
Posts: 655
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: Saturday 12 July 2025 19:21 Having a copy of your configuration file (with personal data replaced by xxx or ***) may help.

it is in my earlier message here
viewtopic.php?p=327128#p327128

If my config file would be wrong then it would not work on startup either I think.

Additional thought: Could it be because SuppressTriggers is set to True? Or is that only True for slave devices?
FlyingDomotic
Posts: 383
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 »

Sorry not seeing it in previous...

It seems that nothing is sent on domoticz/out.

Did you install "MQTT Client Gateway with LAN interface" on both machines?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest