This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing unit and rounding of e.g. temperature notifications
#1
Hi!

In notifications it would be great, if units could be changed (e.g. celsius) and rounded.

It looks strange in freeboard.


Attached Files Thumbnail(s)
   
  Reply
#2
(09-06-2017, 03:21 AM)Alpenskipper Wrote: Hi!

In notifications it would be great, if units could be changed (e.g. celsius) and rounded.

It looks strange in freeboard.

You can add a function node to do that, I don't use freeboard so you'll probably need to change msg.topic to something else.  

var numInput = Number(msg.payload);
msg.topic = "Eng";
var T =  numInput-273.15;
msg.payload = T.toFixed(1);
return msg;
  Reply
#3
(09-06-2017, 03:21 AM)Alpenskipper Wrote: Hi!

In notifications it would be great, if units could be changed (e.g. celsius) and rounded.

It looks strange in freeboard.

Hello, I changed the units in freeborad in "value" or JS editor with this is comand:

datasources["node-red"][environment.inside.heating.temperature"].toFixed()-273

Saludos
  Reply
#4
Thanks for the hints. But, for I am a Linux/ JS noob, I have no idea, where to edit...
Could you explain it for dummies, please?

Martin
  Reply
#5
(09-06-2017, 05:04 PM)Alpenskipper Wrote: Thanks for the hints. But, for I am a Linux/ JS noob, I have no idea, where to edit...
Could you explain it for dummies, please?

Martin
if I remember correctly, it is modified where you have added the temperature, pressure, ... in freeboard.

you have to add the last part. 

.toFixed()-273
If you do not find it, tomorrow I'll send you a screenshot

Saludos
  Reply
#6
Great!
.toFixed(n)
worked perfect.

[Image: 77e90c5b2224c30356beed44da2ca354.png]
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)