Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gauge node unit field issue #792

Open
Henkkas52 opened this issue Jan 24, 2023 · 6 comments
Open

Gauge node unit field issue #792

Henkkas52 opened this issue Jan 24, 2023 · 6 comments

Comments

@Henkkas52
Copy link

There is a problem with the gauge node if you use it the way I do,

afbeelding

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.

afbeelding

Browsers: Microsoft edge, Firefox

@dceejay
Copy link
Member

dceejay commented Jan 24, 2023

hmm maybe not so easy - when I run it I get
image
what do you do exactly to provoke it ? do you flush / reload / change tabs / click something ?

@Henkkas52
Copy link
Author

Henkkas52 commented Jan 24, 2023

@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.

afbeelding

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)

@dceejay
Copy link
Member

dceejay commented Jan 24, 2023

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}}

@Henkkas52
Copy link
Author

Henkkas52 commented Jan 24, 2023

@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.

@dceejay
Copy link
Member

dceejay commented Jan 24, 2023

they aren't - one is handled outside the gauge widget, whereas the units has to be passed into the gauge library and manipulated there.

@Henkkas52
Copy link
Author

@dceejay OK, understand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants