Changing unit and rounding of e.g. temperature notifications - Printable Version +- OpenMarine (https://forum.openmarine.net) +-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1) +--- Forum: Feature Requests (https://forum.openmarine.net/forumdisplay.php?fid=5) +--- Thread: Changing unit and rounding of e.g. temperature notifications (/showthread.php?tid=727) |
Changing unit and rounding of e.g. temperature notifications - Alpenskipper - 2017-09-06 Hi! In notifications it would be great, if units could be changed (e.g. celsius) and rounded. It looks strange in freeboard. RE: Changing unit and rounding of e.g. temperature notifications - PaddyB - 2017-09-06 (2017-09-06, 08:21 AM)Alpenskipper Wrote: Hi! 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; RE: Changing unit and rounding of e.g. temperature notifications - dione - 2017-09-06 (2017-09-06, 08:21 AM)Alpenskipper Wrote: Hi! 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 Changing unit and rounding of e.g. temperature notifications - Alpenskipper - 2017-09-06 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 RE: Changing unit and rounding of e.g. temperature notifications - dione - 2017-09-06 (2017-09-06, 10:04 PM)Alpenskipper Wrote: Thanks for the hints. But, for I am a Linux/ JS noob, I have no idea, where to edit...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 Changing unit and rounding of e.g. temperature notifications - Alpenskipper - 2017-09-07 Great! .toFixed(n) worked perfect. |