Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Alpha Vantage error on startup #15271
Home Assistant release with the issue:
Last working Home Assistant release (if known):
Operating environment (Hass.io/Docker/Windows/etc.):
Hassio supervisor 110
Description of problem:
sensor: - platform: alpha_vantage api_key: !secret alpha_vantage_api_key symbols: - name: Google symbol: GOOGL - name: Apple Inc. symbol: AAPL - name: AEX symbol: "AEX" - name: ING Group symbol: "INGA" - name: ASML symbol: "ASML" logger: default: info logs: homeassistant.components.sensor.alpha_vantage: debug
Traceback created with
$ cat home-assistant.log | grep 'alpha' > temp.txt
Traceback (if applicable):
You are hitting their API limit.
Not much we can do here. You could try to use a bigger
That isn't a very nice error from the component itself. We should catch that error.
I have googled around and it seems like there is no actual hard limit, but they monitor hitting the API more than once per second.
Would it then be an idea to build in a delay that prevents too many hits?
There is a batch class to get multiple stocks at once.
This would require less API calls and thus less calls at startup.
I have tried to circumvent errors in a lot of ways, but keep getting these errors. I really looks like the component or underlying library is making too many calls at once and I keep hitting some API limit.
For 1 last time, I will revert to just 1 stock and see if this is working. Using 4 does NOT.
sensor: - platform: alpha_vantage ## https://www.home-assistant.io/components/sensor.alpha_vantage/ api_key: !secret alpha_vantage_api_key symbols: - symbol: AEX name: Stocks AEX scan_interval: 600 # 10 minutes
Update: I tested it again, and I immediately run into issues with more than 2 symbols. A delay is definitely required.
I have been experimenting with a custom component. A time.sleep() for at least 10 seconds did not create timeouts. A timeout of 6 seconds still gave some throttling errors (for 9 listed stocks).
I will submit a PR with this (not so nice) workaround and discuss there.
The sensor should be made asynchronous, but that would re-introduce throttling, since we would probably have no control over how fast API-calls will be made.
This was referenced
Aug 5, 2018
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment