You are right, i can see in another major city the data, but not in the searched smaller city.
5 miles radius would be enough for stations.
When i check Spritpreisrechner, both are showing results.
Working:
48.277495
14.294849
5miles
Not working: (or only showing 4 from 10 possible stations)
48.212120650046984
14.287071446311938
5miles
I’ve just released version 2024.11.0 which should fix these issues. It seems data collection by region is quite complex compared to what it once was as they split out into hundreds of different sub-regions (postal code areas).
While testing their API wasn’t returning fuel price information.
I have one additional question, not directly related to the plugin
I would like to create a button on dashboard to start a navigation in Android to the Cheapest Station. This would mean i would need to extract the address attribute from the entity and then configure a button.
Anybody did something like this already or has an tip how to do this?
I’ve used a notification to do it (button on home screen to get cheapest station in 5 miles, then an action within the notification to start navigation), but you might be able to broadcast an intent instead. Because I’m in the UK, I can use the name of the fuel station to navigate, but to use the address you would just change data.fuels[0]['name'] within the uri action at the bottom to data.fuels[0]['address']
This is really cool, thanks.
So this means you created a action to check which are the cheapest prices based on your phone location?
Could you share this code with us? Exactly this was something i would like to achieve, but wanted to start with something simpler
No problem, yes this is based on the location of my phone, the above code block contains the sequence of the script itself that I created in Home Assistant.
I have another script that takes into account the current fuel level in my car, calculates how much it will cost to fill and sends a similar notification.
Replace device_tracker.sm_s918b in the above with the entity ID of your own device tracker, and notify.mobile_app_sm_s918b with the notify service. Might need to change the Price (per litre) too if measured differently.
Just updated to HA Core 24.11.3 and on reload Fuel Prices now fails to setup. Any clues? This was in log:
2024-11-23 10:30:52.530 ERROR (MainThread) [custom_components.fuel_prices]
2024-11-23 10:30:52.531 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Fuel Prices for fuel_prices
Traceback (most recent call last):
File “/config/custom_components/fuel_prices/init.py”, line 67, in async_setup_entry
await fuel_prices.update()
File “/usr/local/lib/python3.12/site-packages/pyfuelprices/init.py”, line 37, in update
await asyncio.gather(*coros)
File “/usr/local/lib/python3.12/site-packages/pyfuelprices/init.py”, line 31, in update_src
await s.update(areas=a, force=f)
File “/usr/local/lib/python3.12/site-packages/pyfuelprices/sources/uk/shell.py”, line 52, in update
raise UpdateFailedError(
pyfuelprices.sources.UpdateFailedError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 635, in __async_setup_with_context
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/config/custom_components/fuel_prices/init.py”, line 73, in async_setup_entry
raise CannotConnect from err
custom_components.fuel_prices.CannotConnect
i think the “fuel_prices.find_fuels” Action is not working for me (spritpreisrechner)
I tried many locations in austria, everywhere the same.
Debug Log:
Log:
2024-11-26 21:54:45.163 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Error for call_service at pos 1: Country not available for fuel data.
2024-11-26 21:54:45.163 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140166632678464] Error handling message: Country not available for fuel data.
When i try the find fuel stations, i get data back for the fuel stations