Sensor convert problem

Hi, I have a sensor setup which scrapes a certain website for the current gasprice in my town.

  - platform: scrape
    resource: https://www.shellexpress.nl/nl_nl/station/se-nieuwerkerk-aan-den-ijssel
    name: Shell Express
    select: ".price-actual"
    value_template: '{{ value.split(" ")[0] }}'
    unit_of_measurement: "EUR/L"

It looks ok on the frontend but the value doesn’t seem to be an integer (probably because of the comma (?)). When I use my value in TTS, it speaks out as “one thousand five hundred and fifty nine”.

Whenever I try to convert this to an INT, it outputs value 0:

states.sensor.shell_express.state 

outputs

1,559

However,

states.sensor.shell_express.state | int

outputs

0

For some reason the convertion seems to fail.

Convert the value into an integer. If the conversion doesn’t work it will return 0.

Any suggestions on how I can convert the value?

Hi @Bob_NL, not testet, but maybe this could work.
states.sensor.shell_express.state | replace(",", ".") | float

1 Like

That was quick! Thanks, it worked.

@Bob_NL hello my friend, how do you get the value .price-actual ??