Skip to content

A generic and extensible integration with pyfuelprices to retrieve local (or remote) fuel price data.

License

Notifications You must be signed in to change notification settings

pantherale0/ha-fuelprices

Repository files navigation

Fuel Prices

GitHub Release GitHub Activity License

Project Maintenance BuyMeCoffee

Discord Community Forum

Integration to integrate with pyfuelprices.

This integration will set up the following platforms.

Platform Description
sensor Optional entities for fuel stations, attributes will contain fuel price data

Installation

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_components directory (folder) there, you need to create it.
  3. In the custom_components directory (folder) create a new folder called fuel_prices.
  4. Download all the files from the custom_components/fuel_prices/ directory (folder) in this repository.
  5. Place the files you downloaded in the new directory (folder) you created.
  6. Restart Home Assistant
  7. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Fuel Prices"

Privacy notice

This integration relies entirely on cloud services, alongside this a few libraries are used to geocode provided coordinates into location data for certain providers such as GasBuddy or TankerKoenig.

For reverse geocoding a mix of Nominatim (https://nominatim.org/) and these-united-states (https://pypi.org/project/these-united-states/). This is done to improve performance, for example, looking up provided coordinates with Nominatim will allow us to restrict the fuel station search to data providers available in only that country.

Similar to this, this integration will use these-united-states to retrieve the state of given coordinates, and finally Nominatim is also used to retrieve the nearest postcode for the TankerKoenig data source.

Configuration

A new configuration parameter was introduced in 2024.6.0 that allows you to specify what state to display within Home Assistant. By default this is name, however it can be changed to a value of your liking after setup by clicking Configure followed by Configure data collection sources. This parameter is called State to show on the created sensors.

This value must be set to a fuel price key (available under Available Fuels for the produced sensor entities). In the UK this can be reliably set to E5 or B7, however if you set to SDV, a large number of fuel stations either do not stock this or do not provide this data. In this case the integration will default back to the fuel station name but this may create warnings / errors in your logs. Currently this cannot be configured by area.

Configuration is done in the UI

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines