A little while ago someone created a way of showing German gas priceses for their favorite gas station.
Sadly enough I don’t live in Germany but in the Netherlands and I would like to have a way for Home Assistant to show me where I can get the cheapest gas around my home.
This topic was discussed in another topic quite briefly and we mentioned starting a new topic for it so here we are. I will include the previous conversation about this topic below. Right now I am albe to monitor Shell gas stations but they are a little far away from me and quite expensive most of the time.
The Direct Lease Tank Service indeed uses the images to show gas priceses sadly enough. Th thing that it does to is show pins on the map (coloured) based on how expensive the gas is there. I suppose that it has to get that data from somewhere. Maybe there is a way to show the one with the greenest pin in Home Assistant?
I don’t have any time to hack this, but the other day I used the Chrome developer tools to examine the loaded javascript. There is one that has ‘tankservice’ in the filename. That should point you in the right direction.
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.