core icon indicating copy to clipboard operation
core copied to clipboard

alpha_vantage: Error on device update!

Open kaizersoje opened this issue 2 years ago • 4 comments

The problem

Getting an error when getting forex rate. This used to work fine in v2022.8.1 Stopped working fom 2022.8.2

I even setup a new API key and it still doesn't work.

What version of Home Assistant Core has the issue?

2022.8.5

What was the last working version of Home Assistant Core?

2022.8.1

What type of installation are you running?

Home Assistant OS

Integration causing the issue

alpha_vantage

Link to integration documentation on our website

https://www.home-assistant.io/integrations/alpha_vantage/

Diagnostics information

No response

Example YAML snippet

sensor:
  - platform: alpha_vantage
    api_key: !secret alpha_vantage_apikey
    foreign_exchange:
      - name: AUD_INR
        from: AUD
        to: INR

Anything in the logs that might be useful for us?

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 477, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 702, in async_device_update
    await task
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/alpha_vantage/sensor.py", line 174, in update
    values, _ = self._foreign_exchange.get_currency_exchange_rate(
  File "/usr/local/lib/python3.10/site-packages/alpha_vantage/alphavantage.py", line 218, in _format_wrapper
    call_response, data_key, meta_data_key = func(
  File "/usr/local/lib/python3.10/site-packages/alpha_vantage/alphavantage.py", line 160, in _call_wrapper
    return self._handle_api_call(url), data_key, meta_data_key
  File "/usr/local/lib/python3.10/site-packages/alpha_vantage/alphavantage.py", line 361, in _handle_api_call
    raise ValueError(json_response["Information"])
ValueError: Thank you for using Alpha Vantage! This is a premium endpoint. You may subscribe to any of the premium plans at https://www.alphavantage.co/premium/ to instantly unlock all premium endpoints

API Key is not valid or currencies 'AUD'/'INR' not known

Additional information

No response

kaizersoje avatar Aug 19 '22 05:08 kaizersoje

I think the problem here is $$. The exchange rates API is now a premium API call. `` ValueError: Thank you for using Alpha Vantage! This is a premium endpoint. You may subscribe to any of the premium plans at https://www.alphavantage.co/premium/ to instantly unlock all premium endpoints

It's also flagged premium on the API doc site. Touche. ``

ktpx avatar Aug 20 '22 20:08 ktpx

I guess that explains it. Looks like the documentation needs to be updated to reflect this new change.

kaizersoje avatar Aug 21 '22 16:08 kaizersoje

Yeah. There are a few other services, but none of them do conversions for free it seems (base USD only, or EUR).

ktpx avatar Aug 21 '22 21:08 ktpx