Feature Request: Add MQTT5 support including Request-Response Pattern support #17969
Replies: 5 comments 6 replies
-
|
As I already suggested on Discord, such features are primarily up to the MQTT library used by Tasmota. This is currently pubsubclient which can be MQTT 3.1.1 or 3.1. Not MQTT 5. Technical detail: Berry is by default enabled on ESP32 builds, but "scripting" is an entirely different feature, not included in default builds, but also supporting ESP8266. |
Beta Was this translation helpful? Give feedback.
-
|
There will be no support for mqtt 5.x in near future. |
Beta Was this translation helpful? Give feedback.
-
|
Although for esp32, esp-idf supports MQTT5, it would be a major refactoring. It does not seem worth it for now. |
Beta Was this translation helpful? Give feedback.
-
|
It's now going on 3 years since this particular discussion, what are the recent thoughts on MQTT5 support? |
Beta Was this translation helpful? Give feedback.
-
|
Mqtt 5 would mean deep changes in Tasmota and most certainly regression. I haven’t seen any killer feature in mqtt 5 that would make the change worth the risk |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem:
Building an external API interface (like a TasmotaAdapter library) currently is pretty hard when you want to use MQTT, because you can't send a command and get a response.
Possible Solution:
MQTT5 introduces support for Request-Response patterns using
Response TopicsandCorrelation Datawhich allows a command issuer to know what message is a direct response to the command and avoids race conditions.Suboptimal Alternatives:
Changing the API
Aside from supporting the "standard" MQTT5 Request/Response pattern, an alternative that implements this on top of MQTT3 is also possible, but would significantly change the way the current way of issueing commands and receiving results works and would probably either require to break the existing API (which is really bad) or to add a new MQTT API that specifically allows issueing commands with correlation data (which bloats the API surface and is also suboptimal).
Using the HTTP API
Using the HTTP API is not always possible, because most web services (e.g. when using a webapp to issue commands) are behind a HTTPS endpoint and therefore browsers won't allow access to HTTP APIs from those apps.
Also in my usecase I want to use the MQTT log to see which commands got issued when to which device. This kind of monitoring is not possible with the HTTP API (outside of fairly dirty workarounds using the MqttLog feature).
Using Berry Scripting
Scripting is disabled in default builds and is not even possible on all devices because of size constraints. This means that if someone wants to use such an adapter library, it's fairly likely that they have to reflash tasmota for it to work and to "install" the right scripts on it.
I'm open to other suggestions and normally I would offer to chime in with a contribution, but I don't feel like I would be able to implement a working solution here.
For reference: This started as a message in discord here: https://discord.com/channels/479389167382691863/790182550085304342/1076105810788233296
Beta Was this translation helpful? Give feedback.
All reactions