Replies: 6 comments 2 replies
-
regardless of your modifications and their possible effects: first enable
within your conf or better add I assume |
Beta Was this translation helpful? Give feedback.
-
As long as I don't have any further info (your verbose/debug output, your conf file, your modifications etc.) I can't say anything about your issue The right syntax for multiple topics in conf file is The right syntax for multiple topics on command line is Then using add.
|
Beta Was this translation helpful? Give feedback.
-
I was able make a test, and subscribe multiple topics with this string (adapted from your documentation, with the latest info regarding the sintax to pass the arguments for the --mqtt-topic) : 2023-02-19 20:17:32: mqtt2sql.py[14905] v2.5.5 start I could not achieve the same result with the conf file uncommenting "verbose" and "debug" in the conf file, but it works passing it with the parameters : I see that the topic names are in mqtt table with its ID, right? If you want, I suggest to insert in the "Usage" section the --mqtt-topic parameter, and in the part "Create mqtt2sql.service" add [Service] [Install] Thank you so much for the script and the precious help and support BR |
Beta Was this translation helpful? Give feedback.
-
Regarding conf file, help is only possible if I can take a look into the file (hide private info like usernames, pw hostnames by *** if needed) History table is normalized and storing the topic also in a second table contradicts the idea of relational databases. It also unnecessarily increases the amount of space needed, since all the information is already atomic and exists. To get the topics also with the history data, JOIN the tables e. g. SELECT
h.id,
h.ts,
m.topic,
h.value
FROM mqtt_history h
INNER JOIN mqtt m ON m.id = h.topicid; Create a view if you want it using as a table: CREATE VIEW v_mqtt_history AS
SELECT
h.id,
h.ts,
m.topic,
h.value
FROM mqtt_history h
INNER JOIN mqtt m ON m.id = h.topicid; than you can use it like that: SELECT *
FROM v_mqtt_history
WHERE topic LIKE 'topic1/%' |
Beta Was this translation helpful? Give feedback.
-
[EDIT] Making a fresh new installationin a VM, I need, more than what you wrote in the requirements : python3-dev python-is-python3 libmysqlclient-dev Then all works fine |
Beta Was this translation helpful? Give feedback.
-
Ubuntu 22.04.1 LTS Minimal
|
Beta Was this translation helpful? Give feedback.
-
Hi,
first of all, thanks to your script I've been able, with some modifications, to start the script like a service, subscribe a topic, and write in MySQL the payload.
The only that I could improve, it's that I read in DB that the topicID only "1" and not the real name of the topic, but in this moment it's not a big issue
The biggest problem it's that I can't subscribe to multple topic, like I read in the mqtt2sql.conf file :
MQTT topics subscribe to [string] or [array]
mqtt-topic = [topic1/#, topic2/+/sub/#, topic3/#]
It works only with a single topic, it ignore if a put a second one, with [ ] or not, and also with , or ' '
Do you experienced something similar?
How I can solve it?
Thank you
Beta Was this translation helpful? Give feedback.
All reactions