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.
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.
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.
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.
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.
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.