Trouble with mysql flow, mariandb

[{"id":"c67aa2b8.aef96","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"3449c78b.5e7a08","type":"mysql","z":"c67aa2b8.aef96","mydb":"5785e23e.a04c2c","name":"Temp DB","x":379.16705322265625,"y":468.8499755859375,"wires":[["25e3dcea.f630f4"]]},{"id":"64a43963.6c7658","type":"function","z":"c67aa2b8.aef96","name":"Get Temp","func":"msg.topic-'Select outsideTemperature from WeatherData order by ID desc limit 1';          \nreturn msg;\n\n\n","outputs":1,"noerr":0,"x":243.1666259765625,"y":540.8499755859375,"wires":[["3449c78b.5e7a08","c5eeb109.8cf9a"]]},{"id":"25e3dcea.f630f4","type":"ui_gauge","z":"c67aa2b8.aef96","name":"","group":"1085c790.f90408","order":1,"width":"6","height":"3","gtype":"gage","title":"","label":"C","format":"{{msg.value[0].Temperature}}","min":"-10","max":"30","colors":["#0004b5","#00ff00","#ca3838"],"seg1":"20","seg2":"25","x":553.1116943359375,"y":468.405517578125,"wires":[]},{"id":"c5eeb109.8cf9a","type":"debug","z":"c67aa2b8.aef96","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":238,"y":629,"wires":[]},{"id":"aefe809e.383c1","type":"inject","z":"c67aa2b8.aef96","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":39,"y":532,"wires":[["64a43963.6c7658"]]},{"id":"5785e23e.a04c2c","type":"MySQLdatabase","z":"","host":"localhost","port":"3306","db":"GroveWeatherPi","tz":"gmt+8"},{"id":"1085c790.f90408","type":"ui_group","z":"","name":"Temperature","tab":"e185194d.28b9a8","order":2,"disp":true,"width":"6","collapse":false},{"id":"e185194d.28b9a8","type":"ui_tab","z":"","name":"Weather","icon":"dashboard","disabled":false,"hidden":false}]

Hi, I am having problems with this flow. The last tutorial I watched on youtube is https://www.youtube.com/watch?v=nsqL_lZYkK0

I have tried looking at many flows, but I cannot figure out how to get this to work. I get an error when I use the inject Error: ER_EMPTY_QUERY: Query was empty. Please give me some help my eyes are starting to bleed.

Did you notice the little symbol beside the first line of your function? Hover over it and it tells you there is an error on that line. You should have
msg.topic = '.....'
If you had changed the debug node to 'Output complete message' you would have seen that the topic is not set correctly. In fact you could see that from the debug as you have it (if you had enabled it) though it is not quite so obvious.

Doh! thank you that hint really made a huge difference on all my nodes, I did not notice that symbol, have almost but not quite got this now. I still have a little researching to do, but that opened up a whole new way of me looking at this.

1 Like