# Dashboard Gauge unit conversion

**URL:** <https://discourse.nodered.org/t/dashboard-gauge-unit-conversion/11053>\
**Category:** Dashboard\
**Created:** [13 May 2019 05:16 UTC](https://discourse.nodered.org/t/dashboard-gauge-unit-conversion/11053 "2019-05-13T05:16:36Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)\
**Post date:** [13 May 2019 05:16 UTC](https://discourse.nodered.org/t/dashboard-gauge-unit-conversion/11053/1 "2019-05-13T05:16:36Z")

</div>

Using the gauge as a temperature display, the input to it is in F.

I have used the angular expression {{ (payload.currently.temperature - 32) \* 5/9 | number:0 }} to convert to C (in the Value Format field).

The numeric display on the gauge is correct, however the icon representation is still showing the value as it would be for F. I am assuming I have done something wrong in the expression above?

Thanks.

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [13 May 2019 05:26 UTC](https://discourse.nodered.org/t/dashboard-gauge-unit-conversion/11053/2 "2019-05-13T05:26:13Z")

</div>

Change value in unit field  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/ecb7fe34392498ae344365ff4734ab7f903efee6.png)

or append the unit in value field

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/309829f0b92d8af190d3f849c7707fa71b4ee9c9.png)

---

<div class="post-metadata">

**Author:** ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)\
**Post date:** [13 May 2019 05:29 UTC](https://discourse.nodered.org/t/dashboard-gauge-unit-conversion/11053/3 "2019-05-13T05:29:13Z")

</div>

The Unit Field is as per your first option already. I'll try the second way.

---

<div class="post-metadata">

**Author:** ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)\
**Post date:** [13 May 2019 05:52 UTC](https://discourse.nodered.org/t/dashboard-gauge-unit-conversion/11053/4 "2019-05-13T05:52:54Z")

</div>

So, it _appears_ the angular expression doesn't like standard brackets, would that be correct?

---

<div class="post-metadata">

**Author:** ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)\
**Post date:** [13 May 2019 06:36 UTC](https://discourse.nodered.org/t/dashboard-gauge-unit-conversion/11053/5 "2019-05-13T06:36:10Z")

</div>

Problem solved. Always closely examine your input type, just in case it isn't what it appears to be.

Thanks hotNipi

---

<div class="post-metadata">

**Author:** ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)\
**Post date:** [13 May 2019 07:03 UTC](https://discourse.nodered.org/t/dashboard-gauge-unit-conversion/11053/6 "2019-05-13T07:03:42Z")

</div>

Ok, spoke too soon. Don't believe it is related to my input.

Digging deeper it seems I cannot enclose the payload part of the expression in parenthesis without it throwing a type error.

For example, this {{payload.currently.humidity\*(100-5)}} works. But {{(payload.currently.humidity)\*(100-5)}} throws an error. Any idea where I'm going wrong?

Thanks

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [13 May 2019 07:29 UTC](https://discourse.nodered.org/t/dashboard-gauge-unit-conversion/11053/7 "2019-05-13T07:29:03Z")

</div>

You probably aren't. Probably a limitation of the expression parser trying to cope with both angular and node-red properties.

---

<div class="post-metadata">

**Author:** ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)\
**Post date:** [13 May 2019 07:48 UTC](https://discourse.nodered.org/t/dashboard-gauge-unit-conversion/11053/8 "2019-05-13T07:48:10Z")

</div>

Ok, thanks. Good to know I'm not going crazy in this particular instance.

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [13 May 2019 14:33 UTC](https://discourse.nodered.org/t/dashboard-gauge-unit-conversion/11053/9 "2019-05-13T14:33:08Z")

</div>

For this particular case (temp conversions), I often just use a `range` node to convert the value before passing it to the UI widget. E.g. to go from F to C, set the input range from 32-212 and the output as 0-100...

---

<div class="post-metadata">

**Author:** ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)\
**Post date:** [14 May 2019 02:03 UTC](https://discourse.nodered.org/t/dashboard-gauge-unit-conversion/11053/10 "2019-05-14T02:03:56Z")

</div>

Thanks @shrickus for the tip.
