Convert Data from String to Number

Hello life savers,
I'm using sensors to send data from Node-Red to AWS IoT by using MQTT out.
In the begining, there was no battery data in the payload so I set the change node to put the battery data in the payload(Someone helped me doing this Thank you so much). Just like the pictures.


But there is a small problem in the data type. Which is the data type of battery_percent is not a number but string. So the data is not automatically being displayed on the AWS graph. Do you guys have any idea to convert the data type?

Thank you so much for every help that you can give me! Have a nice day!

You can convert to number in the change node if you switch to JSONata type input

1 Like

Thank you so much for the quick answer with the appropriate solution!

Am I correct in saying that the data is ingested via a serial port? Why don't you change the code on the device sending the data to you to send you a int/float?

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