Scrape- float sensor

I have make an scrape for fuel in Home assistant by intergration.
I see the value, but it is not an float value.

How to do this?
Website:

Css selector:
.price-list > dt:nth-child(3) > span:nth-child(2)

Screenshots/ setting in HASS


You need to set a value_template (Waardesjabloon). Use:

{{ value.replace(',', '.')|regex_replace('[^.\d]', '') }}

which changes the decimal comma to a decimal point, then removes everything that isn’t a decimal point or digit. It looks like you’ll need to delete and re-create the scrape sensor — I can’t see a way to edit it after it’s been created.

Developed:

and tested:

Note that you’ll need to add a unit of measurement (EUR) if you want a graph of the values.

1 Like

Thanks!!
It works, but I was suggested that it can be used for statistig graphic card. The sensors not finded yet,…

Explain what you mean by “It works” and “The sensors not finded yet”?

Does it show in Developer Tools / States?

Yes, it shows up in my states.

But it not shows up by an statistic card.

Set state_class to measurement.

1 Like

Thanks, this works!

1 Like

Thanks!!! Your post helped me a lot!

1 Like