Fuel/Gas Prices integration

Yeah i don’t want to add too much extra work but i just thought it would be a really good feature to have, but as you said its taking it into account for all stations and countries

Hi,
Would it be possible to show only first 5 or less entries? Thank you

Hi,
Thanks for sharing this, I had something previously but it stopped working and I’ve just discovered this. Set it up and it’s working great, have all the local petrol stations and their prices for E10 showing. The only thing I can’t get to work is the 3 nearest stations using the sensor template.

This is what I have in my configuration.yaml:

template:
- trigger:
    - platform: homeassistant
      event: start
    - platform: time_pattern
      hours: /12
  action:
    - variables:
        fuel_type: E10
        lat: |
          {{ state_attr('zone.home', 'latitude') }}
        long: |
          {{ state_attr('zone.home', 'longitude') }}
        radius: |
          {{ 5 * 1609.34 }} # 5 miles converted to meters
    - service: fuel_prices.find_fuels
      data:
        location:
          latitude: |
            {{ lat }}
          longitude: |
            {{ long }}
          radius: |
            {{ radius }}
        type: |
          {{ fuel_type }}
      response_variable: data
  sensor:
    - name: Home Nearest Fuel Station 1
      unique_id: Home Nearest Fuel Station 1
      state: |
        {{ data['fuels'][0].available_fuels[fuel_type] | float }}
      availability: |
        {{ data['fuels'] | count > 0 }}
      state_class: total
      device_class: monetary
      unit_of_measurement: |
        {{ data['fuels'][0].currency }}
      attributes:
        latitude: |
          {{ data['fuels'][0].latitude }}
        longitude: |
          {{ data['fuels'][0].longitude }}
        name: |
          {{ data['fuels'][0].name }}
        station: |
          {{ data['fuels'][0] }}
    - name: Home Nearest Fuel Station 2
      unique_id: Home Nearest Fuel Station 2
      state: |
        {{ data['fuels'][1].available_fuels[fuel_type] | float }}
      availability: |
        {{ data['fuels'] | count > 1 }}
      state_class: total
      device_class: monetary
      unit_of_measurement: |
        {{ data['fuels'][0].currency }}
      attributes:
        latitude: |
          {{ data['fuels'][1].latitude }}
        longitude: |
          {{ data['fuels'][1].longitude }}
        name: |
          {{ data['fuels'][1].name }}
        station: |
          {{ data['fuels'][1] }}
    - name: Home Nearest Fuel Station 3
      unique_id: Home Nearest Fuel Station 3
      state: |
        {{ data['fuels'][2].available_fuels[fuel_type] | float }}
      availability: |
        {{ data['fuels'] | count > 2 }}
      state_class: total
      device_class: monetary
      unit_of_measurement: |
        {{ data['fuels'][0].currency }}
      attributes:
        latitude: |
          {{ data['fuels'][2].latitude }}
        longitude: |
          {{ data['fuels'][2].longitude }}
        name: |
          {{ data['fuels'][2].name }}
        station: |
          {{ data['fuels'][2] }}

Apologies in advance, as this is no doubt user error. Thanks.

In a card? Yes, this could be possible but depends on what you are using to display the data.

For more complex and advanced setups, the integration exposes services to perform queries on demand, so using template sensors you could limit how many entities are actually registered. The integration is designed to be flexible in this regard.

Do you see any attributes at all? Did you also restart Home Assistant? Otherwise the template will only refresh every 12 hours or when Home Assistant first starts

Yep, looks like everything else is pulling through nicely; I can see multiple stations with 5 miles of my home zone and the prices for their E10, E5 and B7.

I’ve restarted Home Assistant a few times and even rebooted the whole system but no joy. The 3 Nearest Fuel Station entities just show Unknown.

Only error I have in my logs is:

This error originated from a custom integration.

Logger: custom_components.fuel_prices.coordinator
Source: custom_components/fuel_prices/coordinator.py:33
integration: Fuel Prices (documentation, issues)
First occurred: 7:19:27 PM (4 occurrences)
Last logged: 8:49:27 PM

Error communicating with service jet - 403
Traceback (most recent call last):
  File "/config/custom_components/fuel_prices/coordinator.py", line 33, in _async_update_data
    return await self.api.update()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pyfuelprices/__init__.py", line 42, in update
    raise UpdateExceptionGroup([x for x in exceptions if isinstance(x, Exception)])
pyfuelprices.UpdateExceptionGroup: [ServiceBlocked()]

But I’m assuming that isn’t relevant and is more than likely down to Jet rate throttling my requests. Plus my closest petrol station is a Tesco.

What data sources are you using? Might be worth disabling the provider specific ones and using PetrolPrices instead.

I had the defaults, so a lot lol. I’ve taken them all out and opted for just PetrolPrices but nearest stations are still showing unknown. Cheapest stations have now appeared though, so that’s a bonus.

Hi there, thank you for this integration. I am from New Zealand and tried both sources are not updated well and good to use. Do you perhaps manage to get the Gaspy as data source? Their fuel data is really good.

Hi,

Finelly is actually something supported by the company themselves. Perhaps worth reaching out and asking them about their datasets?

Thanks for the reply. I gave another look and confirmed that their dataset is not updated at all. At least where I live, unlike Gaspy.

I am however unsure if they have an open API or some sort to fetch the data .

Gaspy requires reverse engineering, I can add it to the pile for the next sprint. For now I’d suggest to reach out to Finelly’s support (their contact info is on the bottom of the website) and seeing if they can do anything.