itchannel / fordpass-ha

Fordpass integration for Home Assistant
278 stars 45 forks source link

Feature Request "vehicleImage" #463

Open jpettitt opened 6 months ago

jpettitt commented 6 months ago

I'd like to be able to show the vehicleImage on pages and as the icon on maps - it looks like the URL returned https://api.mps.ford.com/api/imageservice/v1/data?key=<vin>-4-thumbnail requires an authenticated connection (I get 401). Would it be possible to either fetch the image and either cache it or proxy the request using the stored credentials andf make it available in HA?

itchannel commented 6 months ago

So if your running the latest version of the integration there is 4 hidden entities. If you enable the fordpass_vehicles entity and give it 30 seconds to update inside of the attributes is a key called "vehicleImage" which contains a URL to the image displayed in the Fordpass app. That URL doesn't have any authentication so you could use that one?

jpettitt commented 6 months ago

Thats how I found there was an image. That url has authentication, it's the one I listed above - I get a 401 if I try and access it from a browser.

However after some experimentation with the Ford website I found https://www.digitalservices.ford.com/vehicleimage/api/v1/vehicles/image/full?vin=<vin>&year=<year>&countryCode=USA&angle=4 with is not protected and you can change the angle number to get different views

Strangly https://www.digitalservices.ford.com/vehicleimage/api/v1/vehicles/image/thumbnail?vin=<vin>&year=<year>&countryCode=USA&angle=4 fives a higher resolution images than 'full' does.

This is angle 4 of my truck 'full' image

and this is 'thumbnail' - it's only angle 4 that is bigger, 1-3 and 5 are all smaller as I would expoect. Weird. image

itchannel commented 6 months ago

Thats how I found there was an image. That url has authentication, it's the one I listed above - I get a 401 if I try and access it from a browser.

However after some experimentation with the Ford website I found https://www.digitalservices.ford.com/vehicleimage/api/v1/vehicles/image/full?vin=<vin>&year=<year>&countryCode=USA&angle=4 with is not protected and you can change the angle number to get different views

Strangly https://www.digitalservices.ford.com/vehicleimage/api/v1/vehicles/image/thumbnail?vin=<vin>&year=<year>&countryCode=USA&angle=4 fives a higher resolution images than 'full' does.

This is angle 4 of my truck 'full' image

and this is 'thumbnail' - it's only angle 4 that is bigger, 1-3 and 5 are all smaller as I would expoect. Weird. image

That's interesting as it looks like the image source varies depending on the region you're from. I get a completely different link for the vehicle image which as mentioned earlier has no auth on it.

https://www.fordpass.com/content/dam/assets/aunz/ford/vehicle/2020/2020-ford-vlkd-cabc-ser1-pmyhr-s.png

The link you provided gives me a invalid token error when I use my VIN and model year

mrgrlscz commented 6 months ago

Hey, i get this link provided by the sensor.fordpass_vehicles's "vehicleProfile:" attribute: https://www.gpas-cache.ford.com/nas/gforcenaslive/deu/cge12/yyw/images/deucge12yywbs-ffvs-d4acmaa(a)(a)pn3gzshowroom_0_0.png I'm in France and this is a Ford Focus Estate.

I tried with the jpettitt link, changing VIN, year and Country Code with my values and it worked... if this can help... (I had to delete the <> arround 'vin'and 'year', and my countrycode is 'FRA') https://www.digitalservices.ford.com/vehicleimage/api/v1/vehicles/image/thumbnail?vin=**YOUR_VIN_NUMBER**&year=2021&countryCode=FRA&angle=1 But, unfortunately, there are no others viewing angles... changing the number at the end just does nothing.

BobMac57 commented 4 months ago

Image no longer shows and I get this error:

Whitelabel Error Page This application has no configured error view, so you are seeing this as a fallback.

Mon Mar 18 09:31:53 UTC 2024 [7cb23b6d] There was an unexpected error (type=Forbidden, status=403). Access Denied