# NodeRed dashboard 2.0 Gauge node dynamic Unit

**URL:** <https://discourse.nodered.org/t/nodered-dashboard-2-0-gauge-node-dynamic-unit/90469>\
**Category:** General\
**Created:** [27 August 2024 03:53 UTC](https://discourse.nodered.org/t/nodered-dashboard-2-0-gauge-node-dynamic-unit/90469 "2024-08-27T03:53:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![psychoLK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/psycholk/32/93936_2.png) [@psychoLK](https://discourse.nodered.org/u/psychoLK)\
**Post date:** [27 August 2024 03:53 UTC](https://discourse.nodered.org/t/nodered-dashboard-2-0-gauge-node-dynamic-unit/90469/1 "2024-08-27T03:53:34Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [27 August 2024 07:10 UTC](https://discourse.nodered.org/t/nodered-dashboard-2-0-gauge-node-dynamic-unit/90469/2 "2024-08-27T07:10:18Z")

</div>

They are currently implementing dynamic properties for ui gauge:

> <https://github.com/FlowFuse/node-red-dashboard/pull/1238/files/02eede280123b6d130da1980b6525ef64feb04d0..6afe7e46e276931ecbfc960e32b8052f6e9bb164>
>
> \## Description
> 
> 
> 
> \## Related Issue(s)
> 
> 
> 
> \## Checklist
> 
> 
> 
> - \[\] I ha…ve read the \[contribution guidelines\](https://github.com/FlowFuse/flowfuse/blob/main/CONTRIBUTING.md)
> - \[\] Suitable unit/system level tests have been added and they pass 
> - \[\] Documentation has been updated
> - \[\] Upgrade instructions
> - \[\] Configuration details
> - \[\] Concepts
> - \[\] Changes \`flowforge.yml\`?
> - \[\] Issue/PR raised on \`FlowFuse/helm\` to update ConfigMap Template
> - \[\] Issue/PR raised on \`FlowFuse/CloudProject\` to update values for Staging/Production
> 
> \## Labels
> 
> - \[\] Includes a DB migration? -\> add the \`area:migration\` label

---

<div class="post-metadata">

**Author:** ![psychoLK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/psycholk/32/93936_2.png) [@psychoLK](https://discourse.nodered.org/u/psychoLK)\
**Post date:** [5 September 2024 09:13 UTC](https://discourse.nodered.org/t/nodered-dashboard-2-0-gauge-node-dynamic-unit/90469/3 "2024-09-05T09:13:16Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/d/6d6e9516e820d41dc138b34571bcf849fbb8d6cb.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/f/ef353de1f6e2ea6ca07d2e37ba45e8cc4d34c081.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/4/9401c78435936b5e03a6fbf6c2d75567dfd91b2c.png)

---

<div class="post-metadata">

**Author:** ![psychoLK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/psycholk/32/93936_2.png) [@psychoLK](https://discourse.nodered.org/u/psychoLK)\
**Post date:** [5 September 2024 09:14 UTC](https://discourse.nodered.org/t/nodered-dashboard-2-0-gauge-node-dynamic-unit/90469/4 "2024-09-05T09:14:39Z")

</div>

```auto
// 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];
}

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [5 September 2024 17:12 UTC](https://discourse.nodered.org/t/nodered-dashboard-2-0-gauge-node-dynamic-unit/90469/5 "2024-09-05T17:12:25Z")

</div>

> [@psychoLK](#):
>
> But my gauge is not being updated.  
> Could you guess why?

See this...

> [@How to Update to the Final Version of Dashboard 2.0?](https://discourse.nodered.org/t/how-to-update-to-the-final-version-of-dashboard-2-0/90728/5):
>
> Docs are slightly ahead (again)
> 
> Dynamic support for gauge [was merged](https://github.com/FlowFuse/node-red-dashboard/pull/1238) into the main branch - which has updated the docs. However, this is not yet released as there are some additional issues with the dynamic support for gauge that are being addressed here: [1180 UI Gauge bug fixes by gayanSandamal · Pull Request #1264 · FlowFuse/node-red-dashboard · GitHub](https://github.com/FlowFuse/node-red-dashboard/pull/1264) before we push a new release.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [4 December 2024 17:12 UTC](https://discourse.nodered.org/t/nodered-dashboard-2-0-gauge-node-dynamic-unit/90469/6 "2024-12-04T17:12:38Z")

</div>

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