Hi,
i want to ask for your opinion. I wanted to use the alpha_vantage platform which pulls currency exchange rates as well as stock prices by querying the alpha vantage api.
For stocks you can configure a currency: attribute, but this is only used to display the related icon and to set the unit_of_measurement. It does not mean that the stock price is converted to a desired currency.
For example
symbols:
- symbol: GOOGL
name: Google
currency: EUR
Will show a Euro € in the gui, but the numeric value is still the price in Dollar (or whatever currency the Api returns together with the numeric value)
Now i started to introduce a new attribute convert_currency like this
symbols:
- symbol: GOOGL
name: Google
currency: EUR- symbol: FLT.V
name: Drone Delivery Canada
currency: EUR
convert_currency: USD_EURforeign_exchange:
- name: USD_EUR
from: USD
to: EUR
This means: Alpha Vantage Api returns the price for FLT.V in USD, the price should be converted to EUR using the conversion rate which the sensor USD_EUR already “knows”.
This happens in the update-method of Entity FLT.V
Now my question: i implemented two methods how the conversion rate is transferred from Entity USD_EUR to Entity FLT.V
- Entity FLT.V runs self._hass.states.get(“sensor.usd_eur”)
- Entity USD_EUR writes the result of an update to self._hass.data[“DATA_alpha_vantage_USD_EUR”] where entity FLT.V reads it
What would be the proper way in homeassistant? Calling this internal Api or using shared memory?
Gerhard