Tasmoticz icon indicating copy to clipboard operation
Tasmoticz copied to clipboard

Pb Maj Domoticz 2022.2/2023.1

Open kaaw69 opened this issue 1 year ago • 14 comments

Hello, I have been using TASMOTICZ latest version under windows for quite a long time but since the last update of domoticz 2022.2 or 2023.1 I have errors with the plugin. In doubt I switched to mosquitto 2.0.15 but nothing has changed. I went from python 3.7.4 to 3.10.7 but still the same problem. If anyone has any idea, thanks in advance. Attached is a log: 2023-03-09 18:29:37.210 Error: (ProcessInbound) MQTT protocol violation: Invalid message length 24 for packet type '3' (iQoS:0, topicLen:4096) 2023-03-09 18:29:37.210 Error: (ProcessInbound) MQTT protocol violation, sending DisconnectedEvent to Connection. 2023-03-09 18:29:37.210 Error: Tasmoticz: Call to function 'onMessage' failed, exception details: 2023-03-09 18:29:37.211 Error: Tasmoticz: Traceback (most recent call last): 2023-03-09 18:29:37.211 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 183, in onMessage 2023-03-09 18:29:37.211 Error: Tasmoticz: _plugin.onMessage(Connection, Data) 2023-03-09 18:29:37.211 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 127, in onMessage 2023-03-09 18:29:37.211 Error: Tasmoticz: self.mqttClient.onMessage(Connection, Data) 2023-03-09 18:29:37.211 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\mqtt.py", line 165, in onMessage 2023-03-09 18:29:37.211 Error: Tasmoticz: topic = Data['Topic'] if 'Topic' in Data else '' 2023-03-09 18:29:37.211 Error: Tasmoticz: TypeError: a bytes-like object is required, not 'str' 2023-03-09 18:29:37.212 Error: Tasmoticz: MqttClient::onDisconnect: localhost:1883 2023-03-09 18:29:47.298 Error: (ProcessInbound) MQTT protocol violation: Invalid message length 24 for packet type '3' (iQoS:0, topicLen:4096) 2023-03-09 18:29:47.299 Error: (ProcessInbound) MQTT protocol violation, sending DisconnectedEvent to Connection. 2023-03-09 18:29:47.299 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:29:47.300 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:29:47.300 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:29:47.300 Error: Tasmoticz: Call to function 'onMessage' failed, exception details: 2023-03-09 18:29:47.301 Error: Tasmoticz: Traceback (most recent call last): 2023-03-09 18:29:47.301 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 183, in onMessage 2023-03-09 18:29:47.301 Error: Tasmoticz: _plugin.onMessage(Connection, Data) 2023-03-09 18:29:47.301 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 127, in onMessage 2023-03-09 18:29:47.301 Error: Tasmoticz: self.mqttClient.onMessage(Connection, Data) 2023-03-09 18:29:47.301 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\mqtt.py", line 165, in onMessage 2023-03-09 18:29:47.302 Error: Tasmoticz: topic = Data['Topic'] if 'Topic' in Data else '' 2023-03-09 18:29:47.302 Error: Tasmoticz: TypeError: a bytes-like object is required, not 'str' 2023-03-09 18:29:47.302 Error: Tasmoticz: MqttClient::onDisconnect: localhost:1883 2023-03-09 18:29:57.256 Error: (ProcessInbound) MQTT protocol violation: Invalid message length 24 for packet type '3' (iQoS:0, topicLen:4096) 2023-03-09 18:29:57.256 Error: (ProcessInbound) MQTT protocol violation, sending DisconnectedEvent to Connection. 2023-03-09 18:29:57.257 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:29:57.257 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:29:57.257 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:29:57.257 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:29:57.257 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:29:57.257 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:29:57.257 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:29:57.257 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:29:57.257 Error: Tasmoticz: Call to function 'onMessage' failed, exception details: 2023-03-09 18:29:57.258 Error: Tasmoticz: Traceback (most recent call last): 2023-03-09 18:29:57.258 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 183, in onMessage 2023-03-09 18:29:57.258 Error: Tasmoticz: _plugin.onMessage(Connection, Data) 2023-03-09 18:29:57.258 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 127, in onMessage 2023-03-09 18:29:57.258 Error: Tasmoticz: self.mqttClient.onMessage(Connection, Data) 2023-03-09 18:29:57.258 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\mqtt.py", line 165, in onMessage 2023-03-09 18:29:57.258 Error: Tasmoticz: topic = Data['Topic'] if 'Topic' in Data else '' 2023-03-09 18:29:57.258 Error: Tasmoticz: TypeError: a bytes-like object is required, not 'str' 2023-03-09 18:29:57.258 Error: Tasmoticz: MqttClient::onDisconnect: localhost:1883 2023-03-09 18:30:00.914 Error: (ProcessInbound) MQTT protocol violation: Invalid message length 24 for packet type '3' (iQoS:0, topicLen:4096) 2023-03-09 18:30:00.914 Error: (ProcessInbound) MQTT protocol violation, sending DisconnectedEvent to Connection. 2023-03-09 18:30:00.914 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:30:00.914 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:30:00.915 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:30:00.915 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:30:00.915 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:30:00.916 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:30:00.916 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:30:00.916 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:30:00.917 Error: Tasmoticz: Call to function 'onMessage' failed, exception details: 2023-03-09 18:30:00.918 Error: Tasmoticz: Traceback (most recent call last): 2023-03-09 18:30:00.918 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 183, in onMessage 2023-03-09 18:30:00.919 Error: Tasmoticz: _plugin.onMessage(Connection, Data) 2023-03-09 18:30:00.919 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 127, in onMessage 2023-03-09 18:30:00.919 Error: Tasmoticz: self.mqttClient.onMessage(Connection, Data) 2023-03-09 18:30:00.919 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\mqtt.py", line 165, in onMessage 2023-03-09 18:30:00.920 Error: Tasmoticz: topic = Data['Topic'] if 'Topic' in Data else '' 2023-03-09 18:30:00.920 Error: Tasmoticz: TypeError: a bytes-like object is required, not 'str' 2023-03-09 18:30:00.920 Error: Tasmoticz: MqttClient::onDisconnect: localhost:1883 2023-03-09 18:30:07.208 Error: (ProcessInbound) MQTT protocol violation: Invalid message length 24 for packet type '3' (iQoS:0, topicLen:4096) 2023-03-09 18:30:07.209 Error: (ProcessInbound) MQTT protocol violation, sending DisconnectedEvent to Connection. 2023-03-09 18:30:07.209 Error: Tasmoticz: Call to function 'onMessage' failed, exception details: 2023-03-09 18:30:07.210 Error: Tasmoticz: Traceback (most recent call last): 2023-03-09 18:30:07.210 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 183, in onMessage 2023-03-09 18:30:07.211 Error: Tasmoticz: _plugin.onMessage(Connection, Data) 2023-03-09 18:30:07.211 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 127, in onMessage 2023-03-09 18:30:07.211 Error: Tasmoticz: self.mqttClient.onMessage(Connection, Data) 2023-03-09 18:30:07.211 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\mqtt.py", line 165, in onMessage 2023-03-09 18:30:07.211 Error: Tasmoticz: topic = Data['Topic'] if 'Topic' in Data else '' 2023-03-09 18:30:07.211 Error: Tasmoticz: TypeError: a bytes-like object is required, not 'str' 2023-03-09 18:30:07.211 Error: Tasmoticz: MqttClient::onDisconnect: localhost:1883 2023-03-09 18:30:10.921 Error: (ProcessInbound) MQTT protocol violation: Invalid message length 24 for packet type '3' (iQoS:0, topicLen:4096) 2023-03-09 18:30:10.923 Error: (ProcessInbound) MQTT protocol violation, sending DisconnectedEvent to Connection. 2023-03-09 18:30:10.925 Error: Tasmoticz: Call to function 'onMessage' failed, exception details: 2023-03-09 18:30:10.928 Error: Tasmoticz: Traceback (most recent call last): 2023-03-09 18:30:10.928 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 183, in onMessage 2023-03-09 18:30:10.928 Error: Tasmoticz: _plugin.onMessage(Connection, Data) 2023-03-09 18:30:10.929 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 127, in onMessage 2023-03-09 18:30:10.929 Error: Tasmoticz: self.mqttClient.onMessage(Connection, Data) 2023-03-09 18:30:10.929 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\mqtt.py", line 165, in onMessage 2023-03-09 18:30:10.930 Error: Tasmoticz: topic = Data['Topic'] if 'Topic' in Data else '' 2023-03-09 18:30:10.930 Error: Tasmoticz: TypeError: a bytes-like object is required, not 'str' 2023-03-09 18:30:10.930 Error: Tasmoticz: MqttClient::onDisconnect: localhost:1883 2023-03-09 18:30:17.278 Error: (ProcessInbound) MQTT protocol violation: Invalid message length 24 for packet type '3' (iQoS:0, topicLen:4096) 2023-03-09 18:30:17.279 Error: (ProcessInbound) MQTT protocol violation, sending DisconnectedEvent to Connection. 2023-03-09 18:30:17.280 Error: Tasmoticz: Call to function 'onMessage' failed, exception details: 2023-03-09 18:30:17.281 Error: Tasmoticz: Traceback (most recent call last): 2023-03-09 18:30:17.281 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 183, in onMessage 2023-03-09 18:30:17.281 Error: Tasmoticz: _plugin.onMessage(Connection, Data) 2023-03-09 18:30:17.281 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 127, in onMessage 2023-03-09 18:30:17.281 Error: Tasmoticz: self.mqttClient.onMessage(Connection, Data) 2023-03-09 18:30:17.281 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\mqtt.py", line 165, in onMessage 2023-03-09 18:30:17.282 Error: Tasmoticz: topic = Data['Topic'] if 'Topic' in Data else '' 2023-03-09 18:30:17.282 Error: Tasmoticz: TypeError: a bytes-like object is required, not 'str' 2023-03-09 18:30:17.282 Error: Tasmoticz: MqttClient::onDisconnect: localhost:1883 2023-03-09 18:30:27.240 Error: (ProcessInbound) MQTT protocol violation: Invalid message length 24 for packet type '3' (iQoS:0, topicLen:4096) 2023-03-09 18:30:27.241 Error: (ProcessInbound) MQTT protocol violation, sending DisconnectedEvent to Connection. 2023-03-09 18:30:27.241 Error: Tasmoticz: Call to function 'onMessage' failed, exception details: 2023-03-09 18:30:27.242 Error: Tasmoticz: Traceback (most recent call last): 2023-03-09 18:30:27.242 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 183, in onMessage 2023-03-09 18:30:27.242 Error: Tasmoticz: _plugin.onMessage(Connection, Data) 2023-03-09 18:30:27.242 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 127, in onMessage 2023-03-09 18:30:27.242 Error: Tasmoticz: self.mqttClient.onMessage(Connection, Data) 2023-03-09 18:30:27.242 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\mqtt.py", line 165, in onMessage 2023-03-09 18:30:27.242 Error: Tasmoticz: topic = Data['Topic'] if 'Topic' in Data else '' 2023-03-09 18:30:27.242 Error: Tasmoticz: TypeError: a bytes-like object is required, not 'str' 2023-03-09 18:30:27.243 Error: Tasmoticz: MqttClient::onDisconnect: localhost:1883 2023-03-09 18:30:37.250 Error: (ProcessInbound) MQTT protocol violation: Invalid message length 24 for packet type '3' (iQoS:0, topicLen:4096) 2023-03-09 18:30:37.251 Error: (ProcessInbound) MQTT protocol violation, sending DisconnectedEvent to Connection. 2023-03-09 18:30:37.252 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:30:37.253 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:30:37.253 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:30:37.253 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-03-09 18:30:37.254 Error: Tasmoticz: Call to function 'onMessage' failed, exception details: 2023-03-09 18:30:37.255 Error: Tasmoticz: Traceback (most recent call last): 2023-03-09 18:30:37.255 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 183, in onMessage 2023-03-09 18:30:37.255 Error: Tasmoticz: _plugin.onMessage(Connection, Data) 2023-03-09 18:30:37.255 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 127, in onMessage 2023-03-09 18:30:37.255 Error: Tasmoticz: self.mqttClient.onMessage(Connection, Data) 2023-03-09 18:30:37.255 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\mqtt.py", line 165, in onMessage 2023-03-09 18:30:37.255 Error: Tasmoticz: topic = Data['Topic'] if 'Topic' in Data else '' 2023-03-09 18:30:37.255 Error: Tasmoticz: TypeError: a bytes-like object is required, not 'str' 2023-03-09 18:30:37.256 Error: Tasmoticz: MqttClient::onDisconnect: localhost:1883

kaaw69 avatar Mar 09 '23 17:03 kaaw69

looks like a python library function has changed its api from taking a string to requiring bytes. I‘ll have a look…

joba-1 avatar Mar 09 '23 19:03 joba-1

Hello, have you had time to take a look at this problem? There seems to be a similar problem with zigbee2mqtt:

https://www.domoticz.com/forum/viewtopic.php?t=39354

Thanks

kaaw69 avatar Apr 04 '23 07:04 kaaw69

I can‘t reproduce it, but I think I can fix it. Can you test a change once I create a pull request?

joba-1 avatar Apr 05 '23 20:04 joba-1

Hello and thank you for your answer. I am not a developer, I will not be able to modify the code. I don't think it comes from the Tasmoticz Plugin but rather news from Domoticz in Windows version, there seems to be a lot of plugins that no longer work with versions 2022.2 and 2023.1 Thanks anyway.

kaaw69 avatar Apr 06 '23 12:04 kaaw69

I think you misunderstood me. I meant, I can do a change, but I cannot test it. So I would need someone who takes the changed file, tests it and reports back.

joba-1 avatar Apr 06 '23 21:04 joba-1

Here is a link to the file mqtt.py of PR #37 that needs to be replaced, in case you're interested:

https://raw.githubusercontent.com/joba-1/Tasmoticz/a219314cebff25bcf7aba97eb8170294687cd5c1/mqtt.py

joba-1 avatar Apr 06 '23 21:04 joba-1

Indeed I had not understood, I will test and I will let you know. Thanks

kaaw69 avatar Apr 07 '23 07:04 kaaw69

attached the log after the test with the us mqtt.py

2023-04-07 10:08:46.441 Error: (ProcessInbound) MQTT protocol violation: Invalid message length 24 for packet type '3' (iQoS:0, topicLen:4096) 2023-04-07 10:08:46.442 Error: (ProcessInbound) MQTT protocol violation, sending DisconnectedEvent to Connection. 2023-04-07 10:08:46.442 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:08:46.442 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:08:46.442 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:08:46.442 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:08:46.442 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:08:46.443 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:08:46.443 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:08:46.444 Error: Tasmoticz: Call to function 'onMessage' failed, exception details: 2023-04-07 10:08:46.452 Error: Tasmoticz: Traceback (most recent call last): 2023-04-07 10:08:46.452 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 183, in onMessage 2023-04-07 10:08:46.452 Error: Tasmoticz: _plugin.onMessage(Connection, Data) 2023-04-07 10:08:46.452 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 127, in onMessage 2023-04-07 10:08:46.452 Error: Tasmoticz: self.mqttClient.onMessage(Connection, Data) 2023-04-07 10:08:46.452 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\mqtt.py", line 165, in onMessage 2023-04-07 10:08:46.452 Error: Tasmoticz: if 'Topic' in Data: 2023-04-07 10:08:46.452 Error: Tasmoticz: TypeError: a bytes-like object is required, not 'str' 2023-04-07 10:08:46.453 Error: Tasmoticz: MqttClient::onDisconnect: localhost:1883

2023-04-07 10:08:55.251 Error: (ProcessInbound) MQTT protocol violation: Invalid message length 24 for packet type '3' (iQoS:0, topicLen:4096) 2023-04-07 10:08:55.251 Error: (ProcessInbound) MQTT protocol violation, sending DisconnectedEvent to Connection. 2023-04-07 10:08:55.251 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:08:55.251 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:08:55.251 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:08:55.251 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:08:55.251 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:08:55.251 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:08:55.251 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:08:55.251 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:08:55.251 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:08:55.251 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:08:55.251 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:08:55.252 Error: Tasmoticz: MqttClient::onDisconnect: localhost:1883

2023-04-07 10:09:05.715 Error: (ProcessInbound) MQTT protocol violation: Invalid message length 24 for packet type '3' (iQoS:0, topicLen:4096) 2023-04-07 10:09:05.716 Error: (ProcessInbound) MQTT protocol violation, sending DisconnectedEvent to Connection. 2023-04-07 10:09:05.716 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:05.717 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:05.717 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:05.717 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:05.717 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:05.717 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:05.717 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:05.718 Error: Tasmoticz: Call to function 'onMessage' failed, exception details: 2023-04-07 10:09:05.737 Error: Tasmoticz: Traceback (most recent call last): 2023-04-07 10:09:05.741 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 183, in onMessage 2023-04-07 10:09:05.741 Error: Tasmoticz: _plugin.onMessage(Connection, Data) 2023-04-07 10:09:05.741 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 127, in onMessage 2023-04-07 10:09:05.742 Error: Tasmoticz: self.mqttClient.onMessage(Connection, Data) 2023-04-07 10:09:05.742 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\mqtt.py", line 165, in onMessage 2023-04-07 10:09:05.746 Error: Tasmoticz: if 'Topic' in Data: 2023-04-07 10:09:05.746 Error: Tasmoticz: TypeError: a bytes-like object is required, not 'str' 2023-04-07 10:09:05.746 Error: Tasmoticz: MqttClient::onDisconnect: localhost:1883

2023-04-07 10:09:15.293 Error: (ProcessInbound) MQTT protocol violation: Invalid message length 24 for packet type '3' (iQoS:0, topicLen:4096) 2023-04-07 10:09:15.294 Error: (ProcessInbound) MQTT protocol violation, sending DisconnectedEvent to Connection. 2023-04-07 10:09:15.294 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:15.294 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:15.294 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:15.294 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:15.294 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:15.295 Error: Tasmoticz: MqttClient::onDisconnect: localhost:1883 2023-04-07 10:09:25.256 Error: (ProcessInbound) MQTT protocol violation: Invalid message length 24 for packet type '3' (iQoS:0, topicLen:4096) 2023-04-07 10:09:25.260 Error: (ProcessInbound) MQTT protocol violation, sending DisconnectedEvent to Connection. 2023-04-07 10:09:25.265 Error: Tasmoticz: Call to function 'onMessage' failed, exception details: 2023-04-07 10:09:25.267 Error: Tasmoticz: Traceback (most recent call last): 2023-04-07 10:09:25.268 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 183, in onMessage 2023-04-07 10:09:25.270 Error: Tasmoticz: _plugin.onMessage(Connection, Data) 2023-04-07 10:09:25.271 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 127, in onMessage 2023-04-07 10:09:25.271 Error: Tasmoticz: self.mqttClient.onMessage(Connection, Data) 2023-04-07 10:09:25.272 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\mqtt.py", line 165, in onMessage 2023-04-07 10:09:25.272 Error: Tasmoticz: if 'Topic' in Data: 2023-04-07 10:09:25.273 Error: Tasmoticz: TypeError: a bytes-like object is required, not 'str' 2023-04-07 10:09:25.273 Error: Tasmoticz: MqttClient::onDisconnect: localhost:1883

2023-04-07 10:09:35.267 Error: (ProcessInbound) MQTT protocol violation: Invalid message length 24 for packet type '3' (iQoS:0, topicLen:4096) 2023-04-07 10:09:35.269 Error: (ProcessInbound) MQTT protocol violation, sending DisconnectedEvent to Connection. 2023-04-07 10:09:35.269 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:35.270 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:35.270 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:35.271 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:35.272 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:35.272 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:35.272 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:35.272 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:35.272 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:35.272 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:35.272 Error: (ProcessInbound) MQTT protocol errored, discarding additional data. 2023-04-07 10:09:35.273 Error: Tasmoticz: MqttClient::onDisconnect: localhost:1883 2023-04-07 10:09:45.190 Error: (ProcessInbound) MQTT protocol violation: Invalid message length 24 for packet type '3' (iQoS:0, topicLen:4096) 2023-04-07 10:09:45.191 Error: (ProcessInbound) MQTT protocol violation, sending DisconnectedEvent to Connection. 2023-04-07 10:09:45.191 Error: Tasmoticz: Call to function 'onMessage' failed, exception details: 2023-04-07 10:09:45.192 Error: Tasmoticz: Traceback (most recent call last): 2023-04-07 10:09:45.192 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 183, in onMessage 2023-04-07 10:09:45.192 Error: Tasmoticz: _plugin.onMessage(Connection, Data) 2023-04-07 10:09:45.192 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\plugin.py", line 127, in onMessage 2023-04-07 10:09:45.192 Error: Tasmoticz: self.mqttClient.onMessage(Connection, Data) 2023-04-07 10:09:45.193 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\mqtt.py", line 165, in onMessage 2023-04-07 10:09:45.194 Error: Tasmoticz: if 'Topic' in Data: 2023-04-07 10:09:45.194 Error: Tasmoticz: TypeError: a bytes-like object is required, not 'str' 2023-04-07 10:09:45.194 Error: Tasmoticz: MqttClient::onDisconnect: localhost:1883

kaaw69 avatar Apr 07 '23 08:04 kaaw69

looks like nothing changed??? Are you sure the file is exchanged and domoticz restarted?

joba-1 avatar Apr 07 '23 15:04 joba-1

Yes I am sure I have modified the Mqtt.py file the differences are:

***** mqtt.old.py

    topic = Data['Topic'] if 'Topic' in Data else ''
    payload = Data['Payload'].decode('utf8') if 'Payload' in Data else ''

***** MQTT.PY

    if 'Topic' in Data:
        if isinstance(Data['Topic'], bytes):
            topic = Data['Topic'].decode('utf8')
        else:
            topic = Data['Topic']
    else:
        topic = ''

    if 'Payload' in Data:
        if isinstance(Data['Payload'], bytes):
            payload = Data['Payload'].decode('utf8')
        else:
            payload = Data['Payload']
    else:
        payload = ''

and I reboot my PC

kaaw69 avatar Apr 07 '23 17:04 kaaw69

Strange, I don’t understand how this

Error: Tasmoticz: if 'Topic' in Data:

can cause this:

2023-04-07 10:09:45.194 Error: Tasmoticz: TypeError: a bytes-like object is required, not 'str'

Need to investigate further, probably next week

joba-1 avatar Apr 07 '23 18:04 joba-1

This is the relevant error:

2023-04-07 10:09:45.193 Error: Tasmoticz: File "C:\Program Files (x86)\Domoticz\plugins\Tasmoticz-master\mqtt.py", line 165, in  onMessage
2023-04-07 10:09:45.194 Error: Tasmoticz: if 'Topic' in Data:
2023-04-07 10:09:45.194 Error: Tasmoticz: TypeError: a bytes-like object is required, not 'str'

And this clearly should not happen, since the mqtt spec says a topic MUST be an utf string (and not a byte like object)

see https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901107

The Topic Name MUST be present as the first field in the PUBLISH packet Variable Header. It MUST be a UTF-8 Encoded String

So I consider this an error in the mqtt lib that you use (mine does not do this). Could you please address this to the author of the mqtt lib?

joba-1 avatar Apr 15 '23 18:04 joba-1

Hello and thank you for your research I do not understand your questions about the library ? To make domoticz work in MQTT with my TASMOTA and TASMOTICZ devices, I installed the mosquitto 2.0.15 broker, which works perfectly with all versions of domoticz before version 2022.2

Should I change broker knowing that I am on Windows 10 ?

kaaw69 avatar Apr 20 '23 08:04 kaaw69

no, it is not about the broker (i guess).

Domoticz gives plugins a python environment. This python environment must include a mqtt client library. I don't know what decides which lib is used or how this can be influenced, but chances are it just uses what you installed on your system.

joba-1 avatar Apr 20 '23 10:04 joba-1