Nice that you actually might have something working. Let me know if this works. Too bad it’s the “advies” prijs and not the current price at a gas station. They usually differ quite a lot.
I tried debugging the Android App yesterday (Direct Lease Tank Service) to figure out what API they call but could not figure it out yet. I’m a complete noob at this stuff. I will check the website in a bit. Since you mentioned the JAVA script that is called.
I can’t get it to work (with or without the value_template).
- platform: scrape
resource: "https://www.tango.nl/stations/tango-nieuwerkerk-ad-ijssel"
select: “#euro95 .pump_price span.price”
# value_template: "{{ value.split(' ')[0].replace(',', '.') | float }}"
scan_interval: 3600 # be nice; once per hour only
2018-07-15 20:49:26 ERROR (MainThread) [homeassistant.components.sensor] scrape: Error on device update!
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
await entity.async_device_update(warning=False)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 319, in async_device_update
yield from self.hass.async_add_job(self.update)
File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/sensor/scrape.py", line 120, in update
value = raw_data.select(self._select)[0].text
IndexError: list index out of range
@Joey_Germeraad@metbril
My knowledge is too limited to decipher this unfortunately, but I see the following lines in the source:
.
Does it work without the “#euro95” or with “pricing open” perhaps? At the moment I’m unable to test this myself.
I’ll check you’re specific tango station tonight. It’s strange that the exact same setup with a different station is giving you errors. You mentioned it allready, but just checking, are you using the value_ template? In my setup the Tango.nl scraper would only work without the Value_template.
The main reason for adding the #euro95 is because the classes open and pricing are to generic, there are more divs on the page that have these classes which will result in Errors.
I just tried you’re specific location with the select value as mentioned and it’s resulting in a value without any issues or errors. For the comparison, I’m running Homeassistant 73.1 with Docker.
Using this for the last 3 months gave me some nice stats in Grafana, cleary showing how long they wait to drop the prices at Shell Express and how fast they raise the price.
But United Consumers seem to have done something in their website code resulting in a 0.0 price.
I have tried to make cheese how this scrape works with the inspect option from Google Chrome but no luck.