Fuel/Gas Prices integration

I found you might have to move the center point on the map slightly. There seems to be a “bug” in the frontend (or somewhere within home assistant) where it doesn’t send coordinates if you have only adjusted the radius or left it at its default.

Yep, that gets the list populated, easy work around, thank you!

1 Like

Hi,

Many thanks for the integration. Very useful!
As mentioned I have to drag the center point on the service call but apart from that it’s working well.
I’m still learning HA so wondering how best to display the prices in some table / grid form on a card. Any ideas appreciated.
Thanks. Great work.

Good thought, you might be able to use this as a starting point and the entity attributes can be used to retrieve the price.

Future plan might introduce a toggle setting between sensors and the device tracker platform but not too sure yet.

Thanks for the tip. I had the auto-entities integration installed but not put to much use.
So a little progress. Probably not the best method but at least its a start.

My local fuel station list was only 9 stations. I manually created an Area and assigned these entities to an area called ‘Fuel’.

On my dashboard I now can see the list of stations on a card.
It shows the name of the station and postcode.
I am now uncertain how to dig deeper and show the attributes of the station as well?

Code is:

type: custom:auto-entities
card:
  type: entities
  state_color: false
  show_header_toggle: true
filter:
  include:
    - area: Fuel
  exclude: []
sort:
  method: none
  numeric: false
show_empty: true

I will keep tinkering…

EDIT I now see I have not used the flex table card so will need to try this combination

1 Like

Not perfect, but I’ve just quickly put this together:

type: custom:auto-entities
filter:
  include:
    - integration: fuel_prices
  exclude: []
sort:
  method: attribute
  attribute: B7
  reverse: false
card:
  type: custom:flex-table-card
  columns:
    - data: friendly_name
      name: Name
    - data: E5
      name: Petrol Premium
    - data: E10
      name: Petrol
    - data: B7
      name: Diesel

Brilliant!

It might not be perfect but its almost perfect for me. Looks like some of my local stations don’t do Petrol Premium so they are showing as undefinedundefinedundefined in the colum but apart from that maybe a bit wider colums and its a cool integration to have an instant view of the local prices. Also a bit of an eye opener (as I knew) to the difference in price between a couple of miles.
Thanks again

1 Like

Same with me, I’ve removed the petrol premium column for myself as we only have 1 petrol car which doesn’t get that treatment anyway.

Did a search for all fuel stations in a 25 mile radius of myself and realised how expensive the fuels were in my local town which is equivalent of motorway prices.

Taken a look at this, parsed out a list of fuel stations from their API, some dodgy data in there (missing names and brands etc), however it does work, there is a performance penalty with pulling all the fuel price data (as I need to OCR it) so it will do that on demand if it hasn’t been collected yet, and will also update in the background after it’s been collected (set to once per day so it doesn’t bring Home Assistant to its knees).

Need to do some further testing in home assistant to see how well this will integrate, but things are looking promising :slight_smile:

2 Likes

Sometimes it’s easy to miss the obvious :slight_smile: I should of thought of that as I cannot remember the last time I used any premium fuel. Also removed the column and that’s cleaned things up nicely. Card looks fine now. Added to a dashboard, very useful.

I’ve noticed that some of the local stations are not detected. The main one’s I use are however.

Thanks.

It uses the feeds published at the link below, and I have myself noticed some missing retailers, my local mace garage for example is “Esso” fuel and branding but not actually operated by Esso so this doesn’t show up.

Promising news on the Netherlands / Belgium front. I’ve identified the endpoints that return the station data in JSON (rather than an image) by proxying the requests the mobile app makes. Need to figure out how to generate the checksum that is sent, but looking through the code for the mobile app, it appears to just be a SHA1 hash based on current date and time, random GUID and the file part of the URL. Example response below:

{
	"date": [
		2023,
		12,
		24
	],
	"id": 4747,
	"lat": 51.97354,
	"lng": 5.66068,
	"brand": "Total",
	"name": "Express",
	"city": "Wageningen",
	"country": "NL",
	"address": "v Uvenweg 119",
	"postalCode": "6708AE",
	"phoneNr": "0344614734",
	"services": [
		"unmanned",
		"gas247",
		"carwash"
	],
	"openingTimes": [
		{
			"types": [
				"fuel"
			],
			"mon": [
				0,
				2400
			],
			"tue": [
				0,
				2400
			],
			"wed": [
				0,
				2400
			],
			"thu": [
				0,
				2400
			],
			"fri": [
				0,
				2400
			],
			"sat": [
				0,
				2400
			],
			"sun": [
				0,
				2400
			]
		}
	],
	"fuels": [
		{
			"key": "e10",
			"name": "Euro 95 (E10)",
			"price": 1859,
			"nextPrice": 1919
		},
		{
			"key": "diesel",
			"name": "Diesel (B7)",
			"price": 1669,
			"nextPrice": 1749
		},
		{
			"key": "euro98",
			"name": "Euro 98 (E5)",
			"price": 2179
		},
		{
			"key": "diesel_special",
			"name": "Premium Diesel (B7)",
			"price": 1899
		}
	]
}
1 Like

You speak agragafabra to me now hahaha. I wish I can code that way… Happy to see progess

Had to completely rewrite most of the underlying module to account for different data sources that don’t return everything in one go, but I’ve just released the first beta that includes support for; DirectLease (both Belgium and Netherlands), GasBuddy (USA), TankerKoenig (Germany), FuelWatch (West Australia).

Any issues please report :slight_smile:

2 Likes

Hi, thanks for your efforts. Keen to track the progress of this integration.

I installed the new version and can see the data from the developers / services method.
The full list populates of the local stations.
One issue however is the table I added to my dashboard that you shared below does not show any data.
Thanks!

type: custom:auto-entities
filter:
  include:
    - integration: fuel_prices
  exclude: []
sort:
  method: attribute
  attribute: B7
  reverse: false
card:
  type: custom:flex-table-card
  columns:
    - data: friendly_name
      name: Name
    - data: E5
      name: Petrol Premium
    - data: E10
      name: Petrol
    - data: B7
      name: Diesel

Please ignore. Not sure what I did wrong but now works. Thank you.

No problem, note for anyone else, that card is only tested with UK data, changing the columns to fuel types available in your area should provide the same result.

Whoop whoop. Later this day I’ll install your tool and will come back with results for Netherlands!!!

Everything done. But when I try to add a integration it stay on this screen:

## Error

Config flow could not be loaded: 500 Internal Server Error Server got itself in trouble

Unstable. After HA restart it configuration screen stay there forever.

Thanks for reporting, not sure whats happened here, just released a newer version, can you try that please? https://github.com/pantherale0/ha-fuelprices/releases/tag/2024.1.0b2

EDIT: Actually seems to be some dependency problems that have been reported a few times on the forum (search numpy)