Closed DanaGoyette closed 1 year ago
With debug logging enabled, nothing changes in the logs (nothing DEBUG between the ERROR messages):
2022-10-27 17:57:36.671 ERROR (MainThread) [custom_components.openei] Error fetching openei data:
2022-10-27 17:58:17.276 ERROR (MainThread) [custom_components.openei] Error fetching openei data:
2022-10-27 17:59:37.815 ERROR (MainThread) [custom_components.openei] Error fetching openei data:
2022-10-27 18:00:00.595 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/openei/__init__.py", line 117, in _async_refresh_data
self._data = await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/openei/__init__.py", line 153, in get_sensors
value = getattr(rate, SENSOR_TYPES[sensor].key)
File "/usr/local/lib/python3.10/site-packages/openeihttp/__init__.py", line 197, in current_adjustment
adj = self._data["energyratestructure"][rate_structure][0]["adj"]
KeyError: 'adj'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/config/custom_components/openei/__init__.py", line 121, in _async_refresh_data
raise UpdateFailed() from exception
homeassistant.helpers.update_coordinator.UpdateFailed
The fact that there's no content or explanation after that dangling colon seems like a bug to me
It isn't, that means the data returned is null
.
I'll work on handling a rate limit error better.
The latest beta version should handle rate limit issues gracefully now. Please give it a try.
Version of ha-openei
0.1.8
Describe the bug
My OpenEI integration keeps dropping back to a state of
Error fetching openei data:
.The fact that there's no content or explanation after that dangling colon seems like a bug to me; it should have exception text or something.
When I looked at the logs before I restarted homeassistant, I saw that the API had replied with a message about having exceeded the rate limit.
Debug log
Next refresh in 3140 seconds? But then it retries in way less time than that.
At some point, all the retries also blow up the rate limit from the API. From before I restarted:
Now, is the rate limiting the cause of the error ("Error fetching openei data: "), or is the error the cause of the retries and thus the rate limiting? I'll have to try disabling the integration for a full day to see if it recovers.