bengt
1
My temperature sensors seems to report their outputs with a dot ( 5.3 degrees ).
In Norwegian language, we split our numbers with comma instead of dot (5,3 instead of 5.3), and this makes the TTS sound wierd.
Is there any way to get node-red to convert dot to comma ( . --> , )?
PCRx
2
With temperature in string:
var temp = temperature.replace (".", ",");
bengt
3
I am new to node red, can you please tell me where to put that string?
PCRx
4
Insert a Function node after your “Retrieving temperature” node. The Functions code would be:
msg.payload = msg.payload.replace("." , ",");
return msg;
2 Likes
Kermit
5
This can also be done from within the call-service node by changing the data type from JSON to JSONata Expression and using:
{ "message": "The inside temperature is " & $replace(payload, ".", ",") & "." }
1 Like
bengt
6
Thank you, now its working fine