I have several scrape sensors to get fuel prices. One of them is
https://www.tango.nl/stations/tango-capelle-aan-den-ijssel-hoofdweg
The scrape sensor looks like this:
- platform: scrape
resource: "https://www.tango.nl/stations/tango-capelle-aan-den-ijssel-hoofdweg"
name: Euro95 (Tango Hoofdweg)
select: “div#euro95 div.pump_price span.price”
scan_interval: 3600 # be nice; once per hour only
This returns ‘None’:
2022-09-25 07:18:29.560 WARNING (SyncWorker_9) [homeassistant.components.scrape.sensor] Index 'None' not found in sensor.euro95_tango_hoofdweg
2022-09-25 07:18:29.561 DEBUG (SyncWorker_9) [homeassistant.components.scrape.sensor] None
I am certain that the select is correct, since when I run a simple Python script, it returns the proper output:
import requests
from bs4 import BeautifulSoup
URL = "https://www.tango.nl/stations/tango-capelle-aan-den-ijssel-hoofdweg"
page = requests.get(URL)
soup = BeautifulSoup(page.content, "html.parser")
results = soup.select("div#euro95 div.pump_price span.price")
print(results[0].string)
Output:
$ python3 tango.py
1.909
I’ve also created a dummy sensor with a select of "title"
that should just get the page title, but that has the same results.
So what could possibly be wrong?