Templating and stuff with exchange rate for more unsupported currencies ratios

Im sure there is a way to do what i want, i just dont know it yet, but you might!

i use the “open exchange rate” integration, to display the rats for some of the currencies i use daily, however, i am interested in some more “complex” calculation, to display more ratios than the integration gives (to my knowledge), as this integration take USD as base for all currencies ratios.

so… i want to use a template to extract the ratio of some certain rates, do some calculation with basic math, to show the solution of the new equation as a new entity (or new exchange ratio).

the integration shows the state of the EUR to USD as:
‘sensor.open_exchange_rates_usd_eur’ with state of 0.91

and the state of GBP to USD as:
‘sensor.open_exchange_rates_usd_gbp’ with state of 0.78

the following equations will give me the ratio i need directly between the two:




im sharing my thoughts as i believe more ppl will benefit from them, as we all come from different countries, and might not have local integrations to properly show their home country currency of choice - as in my case.
this will allow everyone who needs it, to properly calculate their currency of choice.

could anyone pls show the proper template for this?

ok, i think i got it.

this is the template that works for me:

{{ ((states('sensor.open_exchange_rates_usd_eur')|float) / (states('sensor.open_exchange_rates_usd_gbp')|float)) }}

the rest of the work is just creating a “template helper” and pasting that in.
give it a name, and a “measure” unit. and that it.

hope this help others in my situations