Closed Aviatorpaal closed 1 year ago
Hey there @hfurubotten, mind taking a look at this issue as it has been labeled with an integration (entur_public_transport
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
entur_public_transport documentation entur_public_transport source (message by IssueLinks)
This is because the client-id is the same for every Home Assistant user: https://github.com/home-assistant/core/blob/dev/homeassistant/components/entur_public_transport/sensor.py#L25
I can try to implement a fix, but I dont know the proper way to identify a client in HA. Optimally this would be something like
API_CLIENT_NAME = "homeassistant-unique-id-per-install
"
Any easy imports that I can do that fixes this? @hfurubotten
Christian says that he doesn't really know how to uniquely identify an instance of Home Assistant. I'm not sure there is. An idea that occurs to me is that the integration has an optional parameter "name" (defaults to "Entur" IIRC), that at least some users are configuring. I have mine set to "Reise" ("Travel"). Using this value as part of the API client name should help a little.
It may also be worth double checking the code to verify that API_CLIENT_NAME is going into the correct HTTP header (ET-Client-Name). The Entur docs say that unidentified clients will be subjected to strict rate limitation. (https://developer.entur.org/pages-intro-authentication)
The problem
Same as #66141
ERROR (MainThread) [enturclient.api] Error connecting to Entur, response http status code: 429 shows up frequently in my logs. In the documentation I am unable to rate limit the API calls from the integration, even if the Note states:
Suggested fix: allow users to rate limit the calls from the sensor in configuration.yaml or sensor.yaml
What version of Home Assistant Core has the issue?
2023.1.7
What was the last working version of Home Assistant Core?
NA
What type of installation are you running?
Home Assistant OS
Integration causing the issue
entur_public_transport
Link to integration documentation on our website
https://www.home-assistant.io/integrations/entur_public_transport#faq---troubleshooting
Diagnostics information
2023-01-24 17:26:31.032 ERROR (MainThread) [enturclient.api] Error connecting to Entur, response http status code: 429 2023-01-24 17:29:31.118 ERROR (MainThread) [enturclient.api] Error connecting to Entur, response http status code: 429 2023-01-24 17:32:31.011 ERROR (MainThread) [enturclient.api] Error connecting to Entur, response http status code: 429 2023-01-24 17:35:31.012 ERROR (MainThread) [enturclient.api] Error connecting to Entur, response http status code: 429 2023-01-24 17:38:31.017 ERROR (MainThread) [enturclient.api] Error connecting to Entur, response http status code: 429 2023-01-24 17:41:31.024 ERROR (MainThread) [enturclient.api] Error connecting to Entur, response http status code: 429 2023-01-24 17:44:31.040 ERROR (MainThread) [enturclient.api] Error connecting to Entur, response http status code: 429 2023-01-24 17:45:32.090 ERROR (MainThread) [frontend.js.latest.202301100] :0:0 Script error. 2023-01-24 17:47:31.061 ERROR (MainThread) [enturclient.api] Error connecting to Entur, response http status code: 429 2023-01-24 17:50:31.062 ERROR (MainThread) [enturclient.api] Error connecting to Entur, response http status code: 429 2023-01-24 17:53:31.067 ERROR (MainThread) [enturclient.api] Error connecting to Entur, response http status code: 429 2023-01-24 17:56:31.069 ERROR (MainThread) [enturclient.api] Error connecting to Entur, response http status code: 429 2023-01-24 17:59:31.081 ERROR (MainThread) [enturclient.api] Error connecting to Entur, response http status code: 429 2023-01-24 18:05:31.085 ERROR (MainThread) [enturclient.api] Error connecting to Entur, response http status code: 429
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
NA