delzear / hass-formulaoneapi

Formula One API Integration Into Home Assistant
53 stars 10 forks source link

Abu Dhabi GP flag and track layout image url incorrect #57

Closed vaibhav2912 closed 1 year ago

vaibhav2912 commented 1 year ago

Hi all,

My dashboard markdown card config is, {% set nr = states.sensor.formula_one_sensor_races.attributes.next_race %}

To display the flag, I use, src="https://www.countries-ofthe-world.com/flags-normal/flag-of-{{nr.Circuit.Location.country | replace(" ","-")}}.png"

This has worked OK for all the races until now (except one other that I don't remember)

But for Abu Dhabi GP, the url is different. So I have to use, src="https://www.countries-ofthe-world.com/flags-normal/flag-of-United-Arab-Emirates.png"

Because country for Abu Dhabi in the sensor is UAE but the flag url needs United Arab Emirates. https://www.countries-ofthe-world.com/flags-normal/flag-of-United-Arab-Emirates.png

For the track layout for Abu Dhabi, country name in the sensor is UAE but the link needs AbuDhabi. So, I need to use, `src="https://www.formula1.com/content/dam/fom-website/2018-redesign assets/Circuit%20maps%2016x9/{{nr.Circuit.Location.locality | replace(" ","")}}_Circuit.png.transform/7col/image.png"`

https://www.formula1.com/content/dam/fom-website/2018-redesign-assets/Circuit%20maps%2016x9/Abu_Dhabi_Circuit.png.transform/7col/image.png

For other races, src="https://www.formula1.com/content/dam/fom-website/2018-redesign-assets/Circuit%20maps%2016x9/{{nr.Circuit.Location.country | replace(" ","_")}}_Circuit.png.transform/7col/image.png"

Regards, Vaibhav

marcokreeft87 commented 1 year ago

Hey @vaibhav2912 I'd advise you to use formulaone-card. This will make your life easier

delzear commented 1 year ago

Use the Formula One Card by marcokeeftl87. https://github.com/marcokreeft87/formulaone-card