Need Help: Values is string but need float values (platform: rest)

Hi,
I made some sensors for my boiler and got the json file that sends the readouts from the boiler. One of the sensors returns the amount of pellets in the pellethopper. But if I don’t update the value (i.e. filling pellets in the hopper but dont update the value), it becomes a negative number.

If I make a Entity card in my dashboard, it returns the number, but it’s converted to a positive number. I guess it’s because the number is a string and not a float.

How do I convert that?

stoker03

stoker04

No, it’s not converted to a positive number, your regex extracts only the number and not the - sign at the beginning.

Please read the communitiy guidelines and post code not pictures of code.

Well found the answer:

If I put a -? in this expression: regex_findall_index("(-?\d+)") It finds if the number is negative or positive.