Be the first to post a message
Welcome to the MQTT.Cool client API forum. Here you can discuss the development of clients with the MQTT.Cool client APIs.
I'm working on a project in progress, where I read multiplexed 20 digital I / O sensors in a single input of an ESP8266. Use for multiplexing or PCA9698. When one of the sensors changes state (0 ---> 1 and 1 ---> 0 in the sequence) a pair of data (topic and message) is sent to an MQTT broker.
sensor 1 actuated, sends topic a1, msg 1 and topic e1, msg 'E'.
If another sensor is triggered, it also sends a pair of data (topic and message) such as: topic b3, msg 1 and topic d3, msg 'S' ...... Sensors are named from a1 to a8, b1 a b8 and c1 to c4, totaling 20 and the topics are 40 to the total, where a1 is related to e1 and successively, b1 to d1 and successively and c1 to c5, see:
a1 ------ e1
a8 ------ e8
b1 ------ d1
b8 ----- d8
c1 ----- c5
c4 ----- c8
Using PHP and MYSQL I have already desensitized, but because it is a real-time application and the 20 sensors can be acted on simultaneously, the latency to write to MYSQL using tcp causes data in a new measurement before 1s to be lost and not registered. In this situation ESP has not yet received confirmation of the registrations.
That's why I'm studying this MQTTCOOL solution, but I confess, I'm not having success. I do not understand. A simple example such as MQTT.Cool-example-Hello_IoT_World-client-node
I would like to send via MQTT to a local server mosquitto the 20 pairs of information and then save such data in an sqlite database, to manipulate the data later.
Topics are the columns and messages written to each column.
As I said, even looking at all the examples, I could not find a solution. Someone could help me.
as you can read from the documentation, MQTT.Cool is basically a gateway that you put in front of an existing MQTT broker, in your case mosquitto.
In the scenario you described, sensors send data to the mqtt broker and, from that, you save such data into MySQL. If you show us how data will be further used, probably we can find the right way to take benefit of MQTT.Cool. For example, putting an instance of MQTT.Cool in front of your mosquitto broker, you can then use the Node.js Client SDK to fetch data through the web and then use another API to store them into the database. But, again, please tell us more about the final usage of data.
Could you please also give us more information about your issue in understanding our examples? This way, we could certainly improve it. Thanks!