home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.7k stars 30.83k forks source link

CO2 intensity too frequent API calls #21139

Closed remyderuysscher closed 5 years ago

remyderuysscher commented 5 years ago

Home Assistant: 0.87.1

Last working Home Assistant version: unknown

Operating System: offical docker container

Component: https://www.home-assistant.io/components/sensor.co2signal/

Problem: Too frequent API calls, produces ERROR in the logfile

Configuration:

sensor:
  - platform: co2signal
    token: !secret co2signal
    country_code: NL

Error log:

Update for sensor.co2_intensity_nl fails
06:54 components/sensor/co2signal.py (ERROR)
Update for sensor.co2_intensity_nl fails
06:54 components/sensor/co2signal.py (ERROR)
Update for sensor.co2_intensity_nl fails
06:53 components/sensor/co2signal.py (ERROR)
Update for sensor.co2_intensity_nl fails
06:53 components/sensor/co2signal.py (ERROR)
Update for sensor.co2_intensity_nl fails
06:52 components/sensor/co2signal.py (ERROR)
Update for sensor.co2_intensity_nl fails
06:52 components/sensor/co2signal.py (ERROR)
Update for sensor.co2_intensity_nl fails
06:51 components/sensor/co2signal.py (ERROR)
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/sensor/co2signal.py", line 107, in update
    self._token, country_code=self._country_code)
  File "/usr/local/lib/python3.6/site-packages/CO2Signal/__init__.py", line 15, in get_latest_carbon_intensity
    latest_data = get_latest(token, country_code, latitude, longitude)
  File "/usr/local/lib/python3.6/site-packages/CO2Signal/co2signal.py", line 48, in get_latest
    longitude = longitude, wait = False)
  File "/usr/local/lib/python3.6/site-packages/CO2Signal/co2signal.py", line 50, in get_latest
    raise ValueError("API rate limit exceeded. Please wait a few seconds before retrying the request.")
ValueError: API rate limit exceeded. Please wait a few seconds before retrying the request
danielsjf commented 5 years ago

Hmm this is new. It seems that they have updated something in their backend. In any case it's probably cleaner to keep a more reasonable refresh value. I'll look into it.

remyderuysscher commented 5 years ago

I cannot verify this as the component seems to be broken (API change).

http://static.electricitymap.org/api/docs/index.html#forecasted-marginal-power-consumption-breakdown

It needs a zone or geolocation instead of a country.


   raise ValueError("This location currently does not provide a carbon intensity. Please check electricitymap.org for further information.")
ValueError: This location currently does not provide a carbon intensity. Please check electricitymap.org for further information.
stale[bot] commented 5 years ago

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 👍 This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

remyderuysscher commented 5 years ago

Please close