NodeRed dashboard 2.0 Gauge node dynamic Unit

Hello Everyone. I am looking for a way to change the unit of Gauge node of dashboard 2.0 dynamically based on msg.unit. Is this possible?

They are currently implementing dynamic properties for ui gauge:

Hello,
Dynamic property of gauge released :smiley:
Thanks to the dev team.
But my gauge is not being updated.
Could you guess why?


image
image

// Define Variables
var Flowrate = { payload: null, ui_update: { units: "", max: null } }; // Initialize with ui_update structure
var Volume = {};
var Com_Status = {};
var peripheral_number = {};

if (msg.Device_Name == "0_Main_FlowMeter") { // Check if received data is for this flowmeter
    Flowrate.payload = msg.Flowrate; // Assign Flowrate value
    Flowrate.ui_update.units = msg.Flowrate_Unit; // Assign Flowrate unit dynamically
    Flowrate.ui_update.max = 55; // Set max dynamically

    Volume.payload = msg.Volume + '  ' + msg.Volume_Unit; // Assemble volume display
    peripheral_number.payload = msg.peripheral_number; // Peripheral number

    if (msg.Comm_Error === true) { 
        Com_Status.payload = msg.Comm_Error; // Pass Com Error signal to display
    } else { 
        Com_Status.payload = false; 
    }
    
    Com_Status.topic = "Com Error signal";

    // Write data to global variables so SQL write can access them
    global.set(msg.Device_Name + "_peripheral_number", peripheral_number.payload);
    global.set(msg.Device_Name + "_Flowrate", Flowrate.payload);
    global.set(msg.Device_Name + "_Flowrate_Unit", msg.Flowrate_Unit);
    global.set(msg.Device_Name + "_Volume", msg.Volume);
    global.set(msg.Device_Name + "_Volume_Unit", msg.Volume_Unit);
    global.set(msg.Device_Name + "_Status", !Com_Status.payload);

    return [Flowrate, Volume, peripheral_number, Com_Status];
}

See this...

1 Like