pantherale0 / ha-fuelprices

A generic and extensible integration with pyfuelprices to retrieve local (or remote) fuel price data.
MIT License
19 stars 2 forks source link

All fuel stations appear to be in Sheernes #2

Closed Ed-M72 closed 10 months ago

Ed-M72 commented 10 months ago

System Health details

System Information

version core-2023.12.4
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.6
os_name Linux
os_version 6.1.58-haos-raspi
arch aarch64
timezone Europe/London
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4810 Installed Version | 1.33.0 Stage | running Available Repositories | 1428 Downloaded Repositories | 14
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | 1 January 2018 at 00:00 relayer_connected | false relayer_region | null remote_enabled | true remote_connected | false alexa_enabled | false google_enabled | false remote_server | null certificate_status | null instance_id | 638891f9feea4f36861542b1876d4d4d can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 11.2 -- | -- update_channel | stable supervisor_version | supervisor-2023.12.0 agent_version | 1.6.0 docker_version | 24.0.7 disk_total | 458.4 GB disk_used | 9.1 GB healthy | true supported | true board | yellow supervisor_api | ok version_api | ok installed_addons | File editor (5.7.0), Terminal & SSH (9.8.1), Silicon Labs Multiprotocol (2.3.2), Samba share (12.2.0), FTP (4.7.3), Mosquitto broker (6.4.0), Node-RED (16.0.2), MariaDB (2.6.1)
Dashboards dashboards | 7 -- | -- resources | 5 views | 25 mode | storage
Recorder oldest_recorder_run | 3 December 2023 at 21:51 -- | -- current_recorder_run | 27 December 2023 at 22:14 estimated_db_size | 267.56 MiB database_engine | mysql database_version | 10.6.12

Checklist

Describe the issue

It doesn't matter what latitude or longitude I use I always get a fuel station in Sheernes. Rather than in 5 miles of my co-ordinates.

Reproduction steps

  1. Create a new location
  2. Select a source of tesco, Shell or Morissons
  3. ...

Debug logs

I couldn't work this out.

Diagnostics dump

And this too.

pantherale0 commented 10 months ago

Hi,

Please attach debug logs, there is a guide in the Home Assistant documentation on enabling debug logging.

https://www.home-assistant.io/docs/configuration/troubleshooting/

Thanks

Ed-M72 commented 10 months ago

home-assistant.log

This is the log with debugging turned on. Ed

pantherale0 commented 10 months ago

Thanks, will review and update soon.

pantherale0 commented 10 months ago

I've done a search with the same coordinates as you have used and have returned the following:

items:
  - name: Morrisons ME11 5JS
    last_update: "2023-12-28T11:32:14.886548"
    address: Neats Court
    latitude: "51.409688"
    longitude: "0.75805"
    brand: Morrisons
    E10: 138.9
    B7: 146.9
    E5: 148.9
  - name: TESCO ME12 1RH
    last_update: "2023-12-28T11:32:14.886548"
    address: Bridge Road Sheerness
    latitude: 51.442621
    longitude: 0.759551
    brand: TESCO
    E5: 146.9
    E10: 138.9
    B7: 146.9
  - name: SHELL ME12 3EW
    last_update: "2023-12-28T11:32:14.886548"
    address: 265-269 QUEENBOROUGH ROAD
    latitude: 51.414641
    longitude: 0.75856
    brand: SHELL
    B7: 149.9
    E10: 143.9

Are you missing fuel stations? If so its because the retailer is not taking part in the temporary open fuel price scheme setup by the CMA (https://www.gov.uk/guidance/access-fuel-price-data)

Its important to note, even if the garage is Esso for example, the retailer that operates this garage might not be Esso themselves, but an independent or another chain.

As far as I can see, the integration is working as expected. I'm looking at other fuel price sources such as https://play.google.com/store/apps/details?id=apposing.petrolprices&hl=en_GB&gl=US&pli=1 to fill the gaps for the missing retailers.

Ed-M72 commented 10 months ago

Ah, you are correct. Now I have looked at the JSON I see the mistake. I didn't quite understand the positives/negatives on google maps. I took my longitude as positive, but now reading a W longitude is actually a negative number.

pantherale0 commented 10 months ago

Ok, I doubt it's to do with the lat/long as that isn't changed. The search itself is purely a loop that uses geopy to calculate if the distance is within the given radius. The only thing that is done is a conversion between meters and miles as the home assistant location selector sends the radius back to the module in meters.

What coordinates and radius are you using in your service call?

Ed-M72 commented 10 months ago

Yep now works as expected with a negative longitude.

pantherale0 commented 10 months ago

Perfect stuff 👍