Fuel/Gas Prices integration

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)

With this beta I only get this line even with debug on:

2024-01-05 14:37:42.838 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration fuel_prices: No module named 'sklearn'

The integration show me this:

## Error

Config flow could not be loaded: {"message":"Invalid handler specified"}

Yeah, thats what I expect now.

Seems like I’m not the only one who has hit this problem with one of the dependencies :confused:

https://community.home-assistant.io/t/how-to-use-scikit-learn-with-a-custom-intigration/

Apologies for this, re-download 2024.1.0b0 from hacs (or manually install again).

I’ve reluctantly restarted the betas for this release and removed the performance optimizations as I can’t get around the dependency problems.

That being said, if you define an area with a large radius, it will probably take some time to load fully.

Removed the fder. Add location to HACS as custom link. Add latest beta and now I can do the setup!!

I was needed to convert miles to km. (we use km here) haha

It’s fast to see 18 device_trackers added to the integration.

I’m on a Dell 3050 mini pc

Maybe a idea to create a option to calculate the 5 lowest gas stations within the given radius? The device_trackers names are always:

device_trackers.lowest_gas_1
device_trackers.lowest_gas_2
device_trackers.lowest_gas_3
device_trackers.lowest_gas_4
device_trackers.lowest_gas_5

And the content of them change because nit always the same station is the lowest.

I’m using this to want add them in a map. So we see where in the area the lowest price will be.

P.s. //keep up the good.work. I wish I can write code like this… But started learning python haha

Sorry!!

Modify information. Gives errors.
I can’t add a second service for.different location.
Maybe this is a expected behavior because of the code.

I will change log to debug later the day and play around to collect logs.

Yes, you can’t change the options yet as I’ve not completed the OptionsFlow for it.

1 Like

This is awesome, thank you for creating this!
I’m working on an automation using this that updates the fuel prices and sends me and my wife a notification every morning with the top 3 fuel stations by lowest petrol price. I was trying to include a “Last Updated” datetime but it doesn’t look like the Last Updated Time of the device tracker entity gets updated when the fuel prices are updated. Is it possible to add an updated time attribute to the entites at all or am I looking in the wrong place?

1 Like

The last updated attribute is a recent addition to the underlying library. I’ve noticed the same thing too so will take a look and see if it’s home assistant causing a fuss or just a attribute not fully implemented in the lib yet.

Great thank you. Just so I’m understanding this correctly, if I’ve set up the fuel stations I’m interested by defining the areas, then the fuel prices for those should update just by calling the find fuel service? Nothing else is needed to get them to update?

Yes, for the UK all fuel stations will update daily in the background.

In other countries there is a lot more logic added to update stations due to differences in how the APIs work. But generally those should also update roughly daily.

1 Like

For device tracker, only the name or the state can be shown on a Map card.
Do you know how to display only an attribute value (for example, E10 value) on a Map card?

Hi all,

Since yesterday the Addon won’t start:

logger:%20homeassistant.config_entries%0ASource%3A%20config_entries.py%3A406%0AFirst%20occurred%3A%2006%3A11%3A29%20(1%20occurrences)%0ALast%20logged%3A%2006%3A11%3A29%0A%0AError%20setting%20up%20entry%20Fuel%20Prices%20for%20fuel_prices%0ATraceback%20(most%20recent%20call%20last)%3A%0A%20%20File%20%22/config/custom_components/fuel_prices/__init__.py%22,%20line%2067,%20in%20async_setup_entry%0A%20%20%20%20await%20fuel_prices.update()%0A%20%20File%20%22/usr/local/lib/python3.11/site-packages/pyfuelprices/__init__.py%22,%20line%2035,%20in%20update%0A%20%20%20%20await%20asyncio.gather(*coros)%0A%20%20File%20%22/usr/local/lib/python3.11/site-packages/pyfuelprices/__init__.py%22,%20line%2031,%20in%20update_src%0A%20%20%20%20await%20s.update(areas=a)%0A%20%20File%20%22/usr/local/lib/python3.11/site-packages/pyfuelprices/sources/__init__.py%22,%20line%20146,%20in%20update%0A%20%20%20%20raise%20UpdateFailedError(%0Apyfuelprices.sources.UpdateFailedError%0A%0AThe%20above%20exception%20was%20the%20direct%20cause%20of%20the%20following%20exception:%0A%0ATraceback%20(most%20recent%20call%20last):%0A%20%20File%20%22/usr/src/homeassistant/homeassistant/config_entries.py%22,%20line%20406,%20in%20async_setup%0A%20%20%20%20result%20=%20await%20component.async_setup_entry(hass,%20self)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%0A%20%20File%20%22/config/custom_components/fuel_prices/__init__.py%22,%20line%2073,%20in%20async_setup_entry%0A%20%20%20%20raise%20CannotConnect%20from%20err%0Acustom_components.fuel_prices.CannotConnect%0A
  • Core: 2024.1.5
  • Supervisor: 2023.12.1
  • Operating System: 11.4
  • Frontend: 20240104.0

Great integration. Is there a data feed for Costco?

Hi, what data source(s) are you using?

Not currently, but looks like it could be scraped from their website.