It is always helpful to include the error - however I imagine this one fails because ui_update is undefined. i.e. add msg.ui_update = {} on the line before so that ui_update is an object.
That looks ok, but what are you doing with it? Do you return the msg? have you checked with a debug node that the msg contains the "right stuff"? did you wire it into the gauge node? Have you tried sending a new value along with it in the payload?