Oops, sorry about the previous post. Let me try this again.
I have read several posts about using a ui_control with a ui_gauge. I am trying to modify the sectors / segments and I would only want to do it once after deployment. The attached code is based on another post I saw. The problem I am having is when I send the msg without a payload I get the following error.
“TypeError: Cannot read property 'Avail|number:1' of undefined.
Inside the gauge I have the following in the Value Format field:
{{msg.payload.Metrics.Avail | number:1}}
Is it possible to change the gauge sectors / segments by just sending msg.ui_control WITHOUT the msg.payload? (It seems like a valid msg.payload is necessary otherwise it will throw an error).
Note that if I uncomment and send the msg. payload with msg.ui_control it works.
var seg1 = 70;
var seg2 = 90;
/*
msg.payload = {
"Metrics": {
"Avail": 42
}}
console.log("Avail=", msg.payload.Metrics.Avail);
*/
msg.ui_control = {
"seg1":seg1,
"seg2":seg2
};
return msg;