Using MQTT for comm between Domoticz instances

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

Moderator: leecollings

FlyingDomotic
Posts: 303
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: 303
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: 303
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
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests