Convert sensor output from dot to comma

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 ( . --> , )?

With temperature in string:

var temp = temperature.replace (".", ",");

I am new to node red, can you please tell me where to put that string?

Insert a Function node after your ‚ÄúRetrieving temperature‚ÄĚ node. The Functions code would be:

msg.payload = msg.payload.replace("." , ",");
return msg;
1 Like

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

Thank you, now its working fine :+1: