[I want a node] MQTT Plain and Simple

node-name

MQTT Publish
MQTT Subscribe

Inputs

Server
User / Password
Topic
Payload
Init
Quality of Service
Retain

Outputs

MQTT Subscribe - Payload

Extra info: I know people are working on this basing it on PubSubClient Library but figured it worthy of a strong mention as this would bring XOD full swing into the IOT world.

1 Like

Hi anthony420
Sorry for the delay i do have a fix for the MQTT Lib bradzilla84/pubsub-mqtt but i have been busy with a rather large library i am working on.
It should be finished soon and i will push an update for MQTT.

2 Likes

Thanks so much for the reply. We appreciate the work you are doing and I’m certain a functioning MQTT Node set will bring XOD to the next level for so many users. I can’t say enough for the people like yourself who volunteer their time to help a common cause like this.

1 Like

Sorry for the Delay, Complete rewrite was needed the Library has been updated and tested (ESP8266).
See the example but it is fairly straightforward. there is no loop buffer in place at the moment so go easy on the Subscribe node (keep it under 10 Messages a second).
I will implement a buffer Qos and Retain later.
I have not done extensive testing yet please let me know if you have any problems.
I have tested with Node-Red and the potential looks very promising.
:smile:

https://xod.io/libs/bradzilla84/pubsub-mqtt/

2 Likes

Hello, bradzilla84.
I have been tested your pubsub-mqtt nodes, all works fine, thank you, but i found one flaw. Connection with a broker occurs only when the device starts. If the connection is broken in the process, then it is not already restored, no connection check.
And node mqtt-connect look like is incomplete.

if (isInputDirty<input_CONN>(ctx)) {

->> do nothing

        emitValue<output_DONE>(ctx, true);
        emitValue<output_OUT>(ctx, MQTT);

}

Are you planning to resume work on this node?

Hi Ioex

Unfortunately I moved, had to pack everything up in storage I will be set back up soon and would love to add that to the node.

i’m never before wrote on cpp, but I tried to implement reconnect and even partially I succeeded =)
But there was another problem. At the connection stage, as well as at the reconnect stage, there is an endless loop until a connection is established with the mqtt server.

  while (!MQTT->connect(_id, _username, _password)) {
           delay(1000);
         }

this means that the execution of the rest of the program stops until the connection resumes and the controller stop execute its internal logic. Will seem to freeze.
it would be great if we added a bit of asynchrony to this logic. This means that the controller would perform any actions laid down in the program regardless of the connection to the MQTT (for example, PIR sensor and light, without MQTT).

And it seems to me the use of “delay” is not the best idea. It may make sense to use the classic time difference, in this case, probably, use setTimeout and isTimedOut maybe. Maybe I’m wrong. I met Xod a few days ago and do not fully understand the logic and procedure of the program, but I like it.

Not use delay, see this

Hello. Are you planning to create an MQTT node for the w5500? Thanks.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.