Hi,
i am new with node-red and i want decrease the digits in a Gauge.
When i start the Dashboard i get the temperature in e.g. 21.77615442345 degrees. And i want to show it with 2 digits e.g. 21.78 degrees.
Ho can i do this?
Hi,
i am new with node-red and i want decrease the digits in a Gauge.
When i start the Dashboard i get the temperature in e.g. 21.77615442345 degrees. And i want to show it with 2 digits e.g. 21.78 degrees.
Ho can i do this?
Not sure it gauge supports angular formatting but you can achieve this with a change node and JSONata...
JSONata: $round(payload, 2)
demo flow
[{"id":"1841b241.5604ae","type":"inject","z":"6117dd0.3b67e24","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"27.123456789","payloadType":"num","x":630,"y":160,"wires":[["1c0d3d6d.2edd53","db59ece1.09794"]]},{"id":"1c0d3d6d.2edd53","type":"change","z":"6117dd0.3b67e24","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$round(payload, 2)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":160,"wires":[["92f6ae1b.7b05"]]},{"id":"db59ece1.09794","type":"debug","z":"6117dd0.3b67e24","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":630,"y":200,"wires":[]},{"id":"92f6ae1b.7b05","type":"debug","z":"6117dd0.3b67e24","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":830,"y":200,"wires":[]}]
Yes it does.
@Heimo001 if you look in the help pane for the node you will see
For example : {{value | number:1}}%
will round the value to one decimal place and append a % sign.
So if you put {{value | number:2}}
you will get two places. No need for an extra node.
In my case, i am using STM32CubeMonitor with node-red implementation.
So i mean this works a bit different?
got it...
in the Gauge-node (Value format) type in {{value | number:2}}
will round the value by 2 digits.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.