Code Monkey home page Code Monkey logo

Comments (14)

kaaw69 avatar kaaw69 commented on May 31, 2024 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

from tasmoticz.

joba-1 avatar joba-1 commented on May 31, 2024

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

from tasmoticz.

kaaw69 avatar kaaw69 commented on May 31, 2024

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.

joba-1 avatar joba-1 commented on May 31, 2024

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.

kaaw69 avatar kaaw69 commented on May 31, 2024

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.

joba-1 avatar joba-1 commented on May 31, 2024

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.

joba-1 avatar joba-1 commented on May 31, 2024

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.

kaaw69 avatar kaaw69 commented on May 31, 2024

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

from tasmoticz.

kaaw69 avatar kaaw69 commented on May 31, 2024

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.

joba-1 avatar joba-1 commented on May 31, 2024

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

from tasmoticz.

joba-1 avatar joba-1 commented on May 31, 2024

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.

joba-1 avatar joba-1 commented on May 31, 2024

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.

kaaw69 avatar kaaw69 commented on May 31, 2024

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.

joba-1 avatar joba-1 commented on May 31, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.