Change part of state

I have a problem with my strings please help

592 : msg.payload : string[13]

"0.0 °C T7"

i need to change the "°c" part to just C

{"501":"56.3 °C Fremløb","502":"28 % Ydelse","503":"36.7 °C Skakt","504":"5.2 kW Ydelse","505":"24283 kg Magasin indhold","506":"100 Lx Lys","507":"Drift ","508":"12/11-2021 09:24:58","521":"47 °C Retur","522":"0 liter/time Flow","524":"999.9 °C Ekstern temperatur","525":"999.9 °C Temperatur VVB","526":"15.5 % Aktuelt ilt","527":"18 % Ønsket ilt","528":"1149 Gram snegl ydelse/6 min","530":"16.134 kg Idag","531":"0 kg/m2 Idag","532":"122.4 °C Røg temperatur","533":"55 °C Ønsket kedeltemp.","534":"43 °C Ønsket VVB temp.","542":"999 cm","584":"Jyderup ","585":"91 % luftfugtighed","586":"1019 hPa barometer","587":"3.9 m/s vindhastighed","588":" ","589":"6.6 °C lufttemperatur","591":"176 null","592":"0.0 °C T7","alarm":"0"}

In a function node you could use the following:

msg.payload = JSON.parse(JSON.stringify(msg.payload).replace(/ °/g,""))
return msg

This will replace them all at once.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.