So I was extremely exited to be able to INSERT records from a temperature sensor...so exited I went and bought three more Node-MCU Arduinos with sensors as I eventually want to monitor temperatures of three boilers.
The issue I now have is that I have two flows: if I connect any of the two it updates the database just fine, but as soon as I connect BOTH none works.
So I changed the topic to two completely different topics, thinking that would help, but still does not work .
(P.s.: The arduinos both open a WiFi connection and keep it open as I want to update temperature readings every 500 milliseconds - I am not sure if that MIGHT cause the issue- but I doubt it)
By the way, we call a boiler a geyser, in case someone do not understand my naming convention:
attached is a snippet of the flow.
[{"id":"163a4d52.990043","type":"mqtt in","z":"170d5f99.154f1","name":"","topic":"/18561/geyser1/temp","qos":"2","broker":"93155540.4d2f18","x":120,"y":260,"wires":[["e9b7f867.539dd8","bcb382bc.f8333"]]},{"id":"efe8311.4ce8dd","type":"debug","z":"170d5f99.154f1","name":"Time Temp","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","x":550,"y":120,"wires":},{"id":"e9b7f867.539dd8","type":"function","z":"170d5f99.154f1","name":"Add Time","func":"topic = msg.topic;\n\ntemp = msg.payload\n\n//construct and format a date timestamp from now()\nd= new Date(),\n\ndformat = \n[d.getFullYear(),\nd.getMonth()+1,\nd.getDate()\n].join('/') + ',' +\n\n[d.getHours(),\nd.getMinutes(),\nd.getSeconds()].join(':');\n\n//Replace message payload\n\nmsg.payload = dformat + "," + temp\n\nreturn msg;\n","outputs":1,"noerr":0,"x":340,"y":120,"wires":[]},{"id":"bcb382bc.f8333","type":"function","z":"170d5f99.154f1","name":"Create SQL INSERT ","func":"topic = msg.topic;\n\ntemp = msg.payload\n\nstring1 = "INSERT INTO temperatures
(source
, read_date
, create_date
, reading
)"; // string1:\n\nstring2 = (" VALUES ("); // string2\n\nstring3 = ("'geyser1','"); // string3\n\nd= new Date(), //string4 construct and format a date timestamp from now()\n\nstring4 = \n[d.getFullYear(),\nd.getMonth()+1,\nd.getDate()\n].join('-') + ' ' +\n\n[d.getHours(),\nd.getMinutes(),\nd.getSeconds()].join(':');\n\nstring5 = ("',CURRENT_TIMESTAMP,"); // string5\n\nstring6 = (temp); // string6\n\nstring7 = (")"); //string7\n\nmsg.topic = string1 + string2 + string3 + string4 + string5 + string6 + string7 // Concatenate strings\n\nreturn msg;\n","outputs":1,"noerr":0,"x":360,"y":260,"wires":[["8ef6462.54138b8"]]},{"id":"8ef6462.54138b8","type":"mysql","z":"170d5f99.154f1","mydb":"b5034bb3.da6df8","name":"Geyser1","x":600,"y":280,"wires":[]},{"id":"14753a1a.d5a916","type":"mqtt in","z":"170d5f99.154f1","name":"","topic":"/18562/geyser2/temp","qos":"2","broker":"93155540.4d2f18","x":120,"y":320,"wires":[["b068cc8a.7192b","47b6f46a.1cb52c"]]},{"id":"f6440d1.00c68f","type":"debug","z":"170d5f99.154f1","name":"Time Temp","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","x":570,"y":400,"wires":},{"id":"b068cc8a.7192b","type":"function","z":"170d5f99.154f1","name":"Add Time","func":"topic = msg.topic;\n\ntemp = msg.payload\n\n//construct and format a date timestamp from now()\nd= new Date(),\n\ndformat = \n[d.getFullYear(),\nd.getMonth()+1,\nd.getDate()\n].join('/') + ',' +\n\n[d.getHours(),\nd.getMinutes(),\nd.getSeconds()].join(':');\n\n//Replace message payload\n\nmsg.payload = dformat + "," + temp\n\nreturn msg;\n","outputs":1,"noerr":0,"x":340,"y":480,"wires":[]},{"id":"47b6f46a.1cb52c","type":"function","z":"170d5f99.154f1","name":"Create SQL INSERT ","func":"topic = msg.topic;\n\ntemp = msg.payload\n\nstring1 = "INSERT INTO temperatures
(source
, read_date
, create_date
, reading
)"; // string1:\n\nstring2 = (" VALUES ("); // string2\n\nstring3 = ("'geyser2','"); // string3\n\nd= new Date(), //string4 construct and format a date timestamp from now()\n\nstring4 = \n[d.getFullYear(),\nd.getMonth()+1,\nd.getDate()\n].join('-') + ' ' +\n\n[d.getHours(),\nd.getMinutes(),\nd.getSeconds()].join(':');\n\nstring5 = ("',CURRENT_TIMESTAMP,"); // string5\n\nstring6 = (temp); // string6\n\nstring7 = (")"); //string7\n\nmsg.topic = string1 + string2 + string3 + string4 + string5 + string6 + string7 // Concatenate strings\n\nreturn msg;\n","outputs":1,"noerr":0,"x":360,"y":320,"wires":[["8ef6462.54138b8"]]},{"id":"93155540.4d2f18","type":"mqtt-broker","z":"","name":"MQTTonUBUNTU","broker":"192.168.1.110","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"30","cleansession":true,"birthTopic":"","birthQos":"1","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"b5034bb3.da6df8","type":"MySQLdatabase","z":"170d5f99.154f1","host":"127.0.0.1","port":"3306","db":"Temp_Basic","tz":""}]
Any suggestions how I can fix it would be greatly appreciated.