MQTT, Paho, Python, JSON, MySQL....
Budget: $10 – $30 USD
Hello, we are looking for a friend to solve our problem ...
We have an MQTT broker and clients who send JSON payload.msg. We want this JSON data to be processed by a Python / Paho client and written to MySql.
We need two tables in MySQL. One in which all messages are recorded (something like a log), and another which shows the current (updated by criteria) data.
We have a working Python (Paho) script that works perfectly, but currently records the entire JSON message in one field without breaking it.
The JSON string is as follows:
{"devID": "92F43E6B", "cID": "8A3A4F568A3A43", "psk": 0, "rdr": "some string", "stat": 1, "otr": "some string", "pint" : 1234, "Vnet": "2A5B3F67", "Val": 12345, "tsc": 1631859958018}
This is all the data we need to store as a history in Table 1 ("dev_hostory_log"), + toppic, QoS, ts
In table 2 ("dev_real_data")
| cID | psk | vnet | val | tsc |
We update the "cID" data when "vnet" is not empty.
We have an MQTT broker and clients who send JSON payload.msg. We want this JSON data to be processed by a Python / Paho client and written to MySql.
We need two tables in MySQL. One in which all messages are recorded (something like a log), and another which shows the current (updated by criteria) data.
We have a working Python (Paho) script that works perfectly, but currently records the entire JSON message in one field without breaking it.
The JSON string is as follows:
{"devID": "92F43E6B", "cID": "8A3A4F568A3A43", "psk": 0, "rdr": "some string", "stat": 1, "otr": "some string", "pint" : 1234, "Vnet": "2A5B3F67", "Val": 12345, "tsc": 1631859958018}
This is all the data we need to store as a history in Table 1 ("dev_hostory_log"), + toppic, QoS, ts
In table 2 ("dev_real_data")
| cID | psk | vnet | val | tsc |
We update the "cID" data when "vnet" is not empty.