Inject MySQL datas to slider

Hello,

I'm trying to set a slider position from a MySQL database.
I tested on a gauge and it works well but despite all my tests the slider remains at 0.
Can someone explain to me where I made a mistake?
Thanks for your help!

[{"id":"948a9bcb.b13a18","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"8fea9051.f5709","type":"inject","z":"948a9bcb.b13a18","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"1","x":170,"y":320,"wires":[["d8135987.0eabb8"]]},{"id":"d8135987.0eabb8","type":"function","z":"948a9bcb.b13a18","name":"","func":"msg.topic='select lum from current_settings'\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":320,"wires":[["7d357c56.1c0714"]]},{"id":"7d357c56.1c0714","type":"mysql","z":"948a9bcb.b13a18","mydb":"2f1a5af1.aa5b26","name":"db","x":510,"y":320,"wires":[["cd3d4ed0.6935c","37968f98.bd8e4","cc182677.3de1f8"]]},{"id":"cd3d4ed0.6935c","type":"ui_slider","z":"948a9bcb.b13a18","name":"","label":"slider","tooltip":"","group":"f0bbf294.5fdec","order":2,"width":0,"height":0,"passthru":true,"outs":"all","topic":"{{msg.payload[0].lum}}","min":0,"max":"100","step":1,"x":670,"y":320,"wires":[[]]},{"id":"37968f98.bd8e4","type":"debug","z":"948a9bcb.b13a18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":630,"y":260,"wires":[]},{"id":"cc182677.3de1f8","type":"ui_gauge","z":"948a9bcb.b13a18","name":"","group":"f0bbf294.5fdec","order":1,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"units","format":"{{msg.payload[0].lum}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":680,"y":400,"wires":[]},{"id":"2f1a5af1.aa5b26","type":"MySQLdatabase","z":"","host":"127.0.0.1","port":"3306","db":"nodered","tz":""},{"id":"f0bbf294.5fdec","type":"ui_group","z":"","name":"Default","tab":"d17418dd.ed6648","disp":true,"width":"6","collapse":false},{"id":"d17418dd.ed6648","type":"ui_tab","z":"","name":"Menu","icon":"fa-tachometer","order":5,"disabled":false,"hidden":false}]

The slider expects the input to be a numeric value in msg.payload - you need to use a change node to move the msg.payload[0].lum to msg.payload.

Thank you dceejay, that was the trick !

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.