I want to scrape the daily Belgian Gas price from a website.
The scrape sensor returns as a value ‘€ 5.30000’ .
I want to use an altered version of this value (convert from cents to euro and include taxes) to calculate my daily energy cost in the energy panel.
I am however unable to add anything in the value-template as the value will change into unknown.
Currently I have the status unknown with the following in the value template: {{ ( value.split(’ ')[1] | float ) * 0.102153 }}
You need to format your code properly using backticks, see this link. Your code has a fancy single quote and a normal single quote, but I don’t know if that’s because you didn’t format it properly in your reply, or if your code actually contains that mistake.
Please paste the actual code in using proper formatting. I can’t help you unless I know exactly what characters and spacing is in your yaml. Please read the link in my first reply and look specifically at the section titled Codeblocks
It ignores all characters except numbers or a decimal point, so is more resistant to multiple or unexpected spacing characters (e.g. HTML ). Here it is in action in the template editor tool, with an additional round() filter: