Template value to split value from web scrape

Hi, I have managed to get value from webpage into HA but the value shows “18°” for 18° Celsius. I want it to be a number so I can trend it and I understand it is needed a Template command with split and I have tried this {{ value.split(“°”)[1] }} but then I get no value.

Can anyone help me with correct data for template ?

Pål Einar

Jinja templates use 0 as the index for the first item in a list, not 1.

You could also just use replace:

{{ value.replace("°","") }}

Thank you very much for your prompt answer :slight_smile:

Make sure you have the right symbol,there are like 3 that are very similar but different codes.

1 Like
{{ value|select('in','-.0123456789')|join }}

will remove anything that’s not part of a number.