Fuel/Gas Prices integration

Can you check if anything shows up if you put your coords into this website?

https://petrolspy.com.au/map/latlng/LATHERE/LONGHERE

Yes, I can confirm that that works!

Hmm, can you pm me a coordinate near you so I can test please?

Hi - had a go with this yesterday, but got a 0.0.0.0 version number (likely the way I got it off github). Removed completely and added via HACS today and get 2024.6.1. Looks like it’s installed OK, and I’ve added my work area with a radius of 20 miles (for testing).

No entities are showing up for me - I’m guessing they should? There are definitely garages within my home & work areas as I live on your map screenshot (Peterborough). Still a bit new to the below-the-surface parts of HA so I could be being stupid. If I run the service in Developer Tools, I get the garage at the end of the road in the response, so something’s working. Enter the work coordinates and one near the office.

Any ideas?

Hi,

Can you enable debug logging and send me a PM with the output please?

Maybe I broke something accidentally lol.

EDIT: Ahhh yes, I have broken something. My bad. I’ll release an update now. Might also be the cause of @deanfourie issues too :slight_smile:

1 Like

Ok, just pushed 2024.6.2 which fixes this. Can you test please? Might take a few minutes for the release to appear.

53 entities have appeared - thank you!

1 Like

That looks better, thank you!

Thanks for this,

Are you able to show some possible use cases for displaying some data on the dashboard?

My dashboard use cases are pretty boring to be honest and I just provide a table which contains all the prices of all the fuel stations near me (the yaml for this is in this thread somewhere).

Really I use this for scripts / automation and have a button on my phone that triggers a script to search all the fuel stations near where I currently am and give me the cheapest one.

Similarly, I have done some automation based on my cars location and fuel capacity, when the fuel is low, ping a notification with the cheapest fuel station, how much fuel is left and how much it would roughly cost.

Yes thanks I found it, using this code.

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

However, it is not happy with the data, is there a way to find out what the E5, E10 and B7 etc is? as I think its failing to pull the data from the entities.

Those are attributes within the sensors. You will need to look for a common set of attributes across the produced sensors manually and replace / remove where required.

See here for more documentation on that card GitHub - custom-cards/flex-table-card: Highly Flexible Lovelace Card - arbitrary contents/columns/rows, regex matched, perfect to show appdaemon created content and anything breaking out of the entity_id + attributes concept

Thanks, ok ill have a play!

Getting into this now, and see that it has a lot of automation power. Are you saying you leverage it to generate custom “areas” when you’re out and about?

Also, is there a best practice for de-duping the results? Where I currently am lists the same garage twice as the cheapest, with one source being morrisons and the other motorfuelgroup (same price / postal_code). Is it best once you’ve set the areas up to remove any surplus entities?

I don’t generate any areas in my case. The service calls allow you to retrieve everything needed, the backend code will perform requests to the external data sources if needed.

On de-duplication, I’ve seen a couple too, but not really been bothered by them as they soon disappear. I would suggest disabling them after configuration however no entities are used in the service calls though so that’s something to be aware of.

1 Like

Using this card, I cannot fill in all fields for all gas stations as the formatting of the data is different for each gas station,.

Using this card,

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: U91
      name: Petrol 91
    - data: U95
      name: Petrol 95
    - data: U98
      name: Petrol 98
    - data: DIESEL
      name: Diesel

Any gas station displaying the price as U91, U95 and U98 work as expected, but the others do not as it appears they present the data in a different way.

For example, a working entry would look like this

locationChecked: true
**U91**
**273.9**
**U98**
**307.9**
PremDSL
263.9
Area
HA

But then the others, I only have it formatted like this with an “amount” option listed under the fuel type, U91 etc.

restrooms: false
open24: true
updated: true
prices:
E10:
id: 5dd9791be4b0e256d484492e
stationId: 556fcfdccf79db30f9694c37
type: E10
updated: 1574533403175
relevant: false
amount: 227.9
U91:
id: 5dd9791be4b0e256d484492c
stationId: 556fcfdccf79db30f9694c37
type: U91
updated: 1574533403175
relevant: false
amount: 227.9
U95:
id: 5dd9791be4b0e256d484492f
stationId: 556fcfdccf79db30f9694c37
type: U95
updated: 1574533403175
relevant: false
amount: 241.9
DIESEL:

Is it possible to only add specific gas stations instead of pulling all from an area? I don’t want to hammer the website with 50 gas stations when I really just want to monitor around 6 in 3 different towns.

it depends on the provider, but generally they aren’t all polled individually. This integration doesn’t directly support returning individual stations (and not something I am going to add), but you can get around it by creating an area for each of your stations that you want to monitor.

No problem, just wanted to make sure I wasn’t overlooking it. Thank you for making this.

Many thanks for developing and supporting this useful integration

Can I ask if there is a way (configuration or manual) to add an element to the entity ID names - so instead of sensor.applegreen_xxxx_xxx I could get sensor.fuel_prices_applegreen_xxxx_xxx ? I can see there is an attribute of “available_fuels” that I could use in a search but would prefer to use the entity name.

Many thanks