Here's my test setup.
This is what I put in the first function node...
var max = 50;
var min = 20;
var data = 30;
msg = {payload:data,ui_control:{min:min,max:max},topic:"Soil"};
return msg;
The second function node is the same but with different values for max, min and data.
Hope this works for you.