node-red-dashboard
node-red-dashboard copied to clipboard
Gauge node unit field issue
There is a problem with the gauge node if you use it the way I do,

In this case everything works well, until you continuously write zero in the value field, then the unit field will not show the units but rather {{unit}}. Any other (non changing) value that is written to {{value}}, will cause the gauge node to work well, accept when you write 0 to {{value}} as I mentioned before. I don't see any way to correct this problem, rather than placing a constant string in this field in stead of {{unit}}.
I mentioned this issue on https://discourse.nodered.org/t/behavior-of-the-gauge-node/74072 but no solution was mentioned.
I think the problem is easily to reproduce, as I gave an example on the node-red forum.
My system is an RPI 3B+ with following software.

Browsers: Microsoft edge, Firefox
hmm maybe not so easy - when I run it I get
what do you do exactly to provoke it ? do you flush / reload / change tabs / click something ?
@dceejay To keep it simple. If you have 2 gauges, and feed one with the value 0 (zero) and the other with 1234, with a constant interval, let's say 1 sec. The one with zero value will show {{unit}} after a while. You can force this by refresh the browser page, which shows the gauges. The label {{topic}} is always OK though, it will always show the string that's feed to it.
Why do I want to use the gauges this way, with variables for all entries? Because I want to be able to change the units field from, for instance "Watt" to "kW" and back again. Or "m3" to "Liters" and back again.

It is also a bit random somehow. Sometimes stays OK for a while but with combination of restart flows and refresh the browser, it will show this effect.
I succeeded avoiding this problem, by feeding a very small value, when the value should be zero, by giving value field a format, but then I got a comma for values greater then 999, which is also undesirable for me. (see pic that I updated just now)
I can see an issue... that could be a so and so to fix... - but ... it seems to work for me if I use msg.units (not .unit) and {{units}}
@dceejay. For me it is still the same result with 'msg.units'/{{units}} in stead of 'msg.unit' {{unit}}.
I was just wondering why units-field reacts different then label-field {{topic}}. They are both just text-fields with no special meaning.
they aren't - one is handled outside the gauge widget, whereas the units has to be passed into the gauge library and manipulated there.
@dceejay OK, understand.