Comments (14)
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
from tasmoticz.
looks like a python library function has changed its api from taking a string to requiring bytes. I‘ll have a look…
from tasmoticz.
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
from tasmoticz.
I can‘t reproduce it, but I think I can fix it. Can you test a change once I create a pull request?
from tasmoticz.
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.
from tasmoticz.
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.
from tasmoticz.
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
from tasmoticz.
Indeed I had not understood, I will test and I will let you know.
Thanks
from tasmoticz.
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
from tasmoticz.
looks like nothing changed???
Are you sure the file is exchanged and domoticz restarted?
from tasmoticz.
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
from tasmoticz.
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?
from tasmoticz.
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 ?
from tasmoticz.
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.
from tasmoticz.
Related Issues (20)
- Device naming in German? HOT 8
- Cant switch on/off a offline device HOT 2
- Athom device incorrectly handled HOT 1
- Better handling of humidity sensors HOT 7
- Domoticz Switch State not updated after switching HOT 8
- Error: Tazmoticz: AttributeError: type object 'Collection' has no attribute 'Mapping' with Python 3.10.4 HOT 5
- Deletion of some devices when used with a damaged Domoticz installation HOT 8
- Support for Tasmota 12.1 and Tasmota Discovery / hatasmota HOT 5
- Error message every 12hrs but everything works HOT 7
- More than 255 devices error -> filtering ? HOT 10
- Create device for LWT messages. HOT 4
- Incorrect electricity data being sent to Domoticz. HOT 2
- I am asking for two separate blocks in domoticz HOT 23
- Another malfunction related to the energy indicator. HOT 3
- Tasmota 13.0.0 and PZEM 004 HOT 2
- Athom Tasmota RGB(WW) LED Strip Controller HOT 2
- Can I make a DevkitV1 esp32 working with tasmoticz HOT 4
- typeDb contains keys in different languages HOT 2
- Switches/buttons not detected HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tasmoticz.