Closed Tomasz-Matuszewski closed 5 months ago
I also see this on my installation. Looks like the custom component is using the old API, api-v2launch.trakt.tv , that was closed on Feb 1st... Need to update to use api.trakt.tv which might also require usage of a newer python trakt module..
https://twitter.com/traktapi/status/1742976564567106019
2024-02-05 10:21:12.110 ERROR (MainThread) [custom_components.trakt] Error requesting trakt data: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /calendars/my/shows/2024-02-05/30 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fa420c32910>: Failed to establish a new connection: [Errno -2] Name does not resolve'))
Same here. Restarted HA after roughly a month. When the integration tries to load it also complains it can not connect to the API api-v2launch.trakt.tv
...
Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht
Logger: custom_components.trakt
Source: helpers/update_coordinator.py:226
Integration: Trakt (documentation)
First occurred: 5. Februar 2024 um 23:44:05 (16 occurrences)
Last logged: 00:02:46
Error requesting trakt data: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /calendars/my/shows/2024-02-05/30 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f319b14b0>: Failed to establish a new connection: [Errno -2] Name does not resolve'))
Error requesting trakt data: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /calendars/my/shows/2024-02-05/30 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f31f08ee0>: Failed to establish a new connection: [Errno -2] Name does not resolve'))
Error requesting trakt data: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /calendars/my/shows/2024-02-06/30 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f56d1a830>: Failed to establish a new connection: [Errno -2] Name does not resolve'))
Error requesting trakt data: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /calendars/my/shows/2024-02-06/30 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f722582e0>: Failed to establish a new connection: [Errno -2] Name does not resolve'))
Error requesting trakt data: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /calendars/my/shows/2024-02-06/30 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f2cb45990>: Failed to establish a new connection: [Errno -2] Name does not resolve'))
As it's not just another hostname but likely a new API, just locally redirecting old api-v2launch.trakt.tv
to new api.trakt.tv
on DNS level will likely help nothing.
So: HELP! :-(
Who can fix this? Are you able to fix it @iantrich? Last update from 2022, now the integration is completely broken and more users are discovering this, once their HA restarts...
Following what @henel321 posted: Wow, deprecated for more than 6 years and the final call from January 4th also got no attention... this integration/repo is not dead, is it?
No idea if it's "just" adapting this to the new API: https://github.com/custom-components/sensor.trakt/blob/e6ce74f767d68338e37e4ccb1f2a52844c8679ba/custom_components/trakt/const.py#L4
@Tomasz-Matuszewski Could you please rename this issue to something like "Connection issues + integration not loading: can not connect to former api "api-v2launch.trakt.tv", integration needs to switch to new "api.trakt.tv" instead"?
Same here. Restarted HA after roughly a month. When the integration tries to load it also complains it can not connect to the API
api-v2launch.trakt.tv
...Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht Logger: custom_components.trakt Source: helpers/update_coordinator.py:226 Integration: Trakt (documentation) First occurred: 5. Februar 2024 um 23:44:05 (16 occurrences) Last logged: 00:02:46 Error requesting trakt data: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /calendars/my/shows/2024-02-05/30 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f319b14b0>: Failed to establish a new connection: [Errno -2] Name does not resolve')) Error requesting trakt data: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /calendars/my/shows/2024-02-05/30 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f31f08ee0>: Failed to establish a new connection: [Errno -2] Name does not resolve')) Error requesting trakt data: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /calendars/my/shows/2024-02-06/30 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f56d1a830>: Failed to establish a new connection: [Errno -2] Name does not resolve')) Error requesting trakt data: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /calendars/my/shows/2024-02-06/30 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f722582e0>: Failed to establish a new connection: [Errno -2] Name does not resolve')) Error requesting trakt data: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /calendars/my/shows/2024-02-06/30 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f2cb45990>: Failed to establish a new connection: [Errno -2] Name does not resolve'))
As it's not just another hostname but likely a new API, just locally redirecting old
api-v2launch.trakt.tv
to newapi.trakt.tv
on DNS level will likely help nothing.So: HELP! :-(
Who can fix this? Are you able to fix it @iantrich? Last update from 2022, now the integration is completely broken and more users are discovering this, once their HA restarts...
Following what @henel321 posted: Wow, deprecated for more than 6 years and the final call from January 4th also got no attention... this integration/repo is not dead, is it?
No idea if it's "just" adapting this to the new API:
@Tomasz-Matuszewski Could you please rename this issue to something like "Connection issues + integration not loading: can not connect to former api "api-v2launch.trakt.tv", integration needs to switch to new "api.trakt.tv" instead"?
Same problem here!
Este erro originou-se de uma integração personalizada.
Logger: custom_components.trakt Source: helpers/update_coordinator.py:313 Integration: Trakt (documentation) First occurred: 12:22:29 (479 occurrences) Last logged: 22:44:22
Error requesting trakt data: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /calendars/my/shows/2024-02-05/30 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f78c57d3b10>: Failed to establish a new connection: [Errno -2] Name does not resolve')) Error requesting trakt data: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /calendars/my/shows/2024-02-05/30 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f792547a4d0>: Failed to establish a new connection: [Errno -2] Name does not resolve')) Error requesting trakt data: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /calendars/my/shows/2024-02-05/30 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f7925478e90>: Failed to establish a new connection: [Errno -2] Name does not resolve')) Error requesting trakt data: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /calendars/my/shows/2024-02-05/30 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f790e29ccd0>: Failed to establish a new connection: [Errno -2] Name does not resolve')) Error requesting trakt data: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /calendars/my/shows/2024-02-05/30 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f7924cd9cd0>: Failed to establish a new connection: [Errno -2] Name does not resolve'))
Let me up front say in NO WAY understand the internals of Home Assistant or even HA integrations....
HOWEVER as an Engineer for more years than I can now count before moving to the Dark Side (Mgt). lol I was able to figure out SOME of what is going on here...
After deleting my config and trying to re-add back in this integration I was able to confirm that the issue here is the removal of the the old api-v2launch.trakt.tv hosts (per comments here and on twitter. Seems they deprecated the server but the API should still work so..... ever the hack...
I hacked up the Integration. Specifically editing const.py revising the authorize and token URL as follows
OAUTH2 AUTHORIZE = "https://api.trakt.tv/oauth/authorize"
OAUTH2 TOKEN = "https://api.trakt.tv/oauth/token"
After revising, I am able to now get an Oauth token for Trakt in HA and add the integration..... HOWEVER I am now getting the error everyone else has whenever the integration trys to update/refresh
Logger: custom_components.trakt
Source: helpers/update_coordinator.py:313
Integration: Trakt ([documentation](https://github.com/custom-components/sensor.trakt/blob/master/README.md))
First occurred: 10:45:19 PM (29 occurrences)
Last logged: 11:14:24 PM
Error requesting trakt data: HTTPSConnectionPool(host='api-v2launch.trakt.tv', port=443): Max retries exceeded with url: /calendars/my/shows/2024-02-05/30 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fd8892b68d0>: Failed to establish a new connection: [Errno -2] Name does not resolve'))
This SHOULD be simple to fix IF I could figure out where the call/code for the update lies. I looked through all the in the repo and can't seem to find where it's pulling the host name from. I was HOPING that was just building it from the cont file I updated but it seems like it's somewhere else SO if anyone can figure out where it's coming from it should be is simple to get this back up.
As I said I have never written a line of Python in my life and while I can occasionally fight may way through YAML when needed I am at the end of what I can do here I suspect.... HOPEFULLY someone else can pick the ball up here and put it across the line.
Thanks! (yes I know about the other trakt integration with by the way DOES work)..... and is bring maintained so..... if this code is has been abandoned then we should push HACS to mark it as such and remove it from HACS as it's non-functional as implemented and folks should move to get this ACTIVELY updated fork into HACS as a replacement.
Thoughts on decommissioning this and/or which file to hack up with the new server host?
@taw123 : as you can see in manifest.json
, sensor.trakt
is based over PyTrakt.
You can find reference to api-v2 here
Sadly it seems PyTrakt is no more maintained too ... https://github.com/moogar0880/PyTrakt/issues/216, but there is a fork.
Maybe it's possible to change sensor.trakt
backend with some work ...
I vote for switching to the fork which seems to be very actively maintained.
Who is able to implement this? Will there be an approval by the owner of this repository?
Who is able to implement this? Will there be an approval by the owner of this repository?
Not sure how that works for HACS integrations.....
In THEORY when this bug is opened for a HA Integration the BOT automatically copies the integration over and asks them to look at the integration.
My suggestion would be to find the ORIGINAL integration announcement on the Home Assistance forum and see if the author is the OP... Then you can ping them direct. If they don't respond then think you are out of luck in general as someone will need to fork this repo and port it to the new API and prequalify it for HACS (or just let us know they have made the mods and wee can each replace our current configs with their PRIVATE repo.
Initially posting user can be found at https://community.home-assistant.io/t/trakt-tv-plugin/111897.
Let's see if this integration can be fixed. Plan B is to switch to a forked version (there's already a pretty good one, "only" not stable yet and still missing UI setup/control which is a downer for me personally).
We can get new maintainers added to this repo; email me at iantrich@gmail.com. I’m no longer able to actively maintain
OK everyone that's not perfect but in a way good news! So if someone can fix this issue by adjusting this integration to use the new API, the PR is able to be merged by someone who got in contact with https://github.com/custom-components/sensor.trakt/issues/72#issuecomment-1967605941.
As there are other integrations using the "new" API (like https://github.com/dylandoamaral/trakt-integration), it should be possible to make the necessary adjustments - right?
So who has the skills here 😃
Unfortunately as I said I don't know python ore enough about the internals of HA (and GitHub) to take this on. I can offer the simple hack I made above to get the integration to add which of course forks for Auth. What I DON'T know is where/how the code exists that ACTUALLY calls for data from Trakt.
Again all that I think needs two be done here is CHANGE the name of the server. API for auth is still the same so it should be a single change (assuming the server name is abstracted to a field/variable in the code like it is in the hack I made.
Sorry can't offer more I COULD ask a ton of questions (what is the process/component flow here for the integration, where are the files involved, how do you set up GitHub so my account is set up as an authorized contributor / or transfer control of integration source control, how to get it BACK to HA in a form they will accept (assuming- and it's a BIG assumption! that nothing else needs to be done to "modernize" the code)... EVEN if I got the info for all that I would gladly look into making the change but things would be VERY fragile as again as I would just be searching the code for the original server address/API and substituting the revision by gleaming what I can from looking at the logic of the code. All programing languages have similarities in logic but again I don't know python, so not a good long term owner for the codebase.
BUT a willing person to help (test, review code, provide insight, etc) or anything else someone needs. And at least you can see my offering/code tweek above ;)
So the search continues.....
Apologies I missed GaelBarone post above with answers to some of the questions I mentioned above. I'll spend an hour or 2 today to look at the original library mentioned, and see if I can figure out where/how it's installed/and if the code can be duplicated, hacked up and saved LOCALLY under a DIFFERENT name to make this one integration work WITHOUT effecting anything else that might be still using the "real" library. IF that can be done and I can find the likely api call I'll try to figure out how Python/HA import the original lib to substitute the hack... AGAIN all big ifs but all I can offer thus far... Alternatively seems like GaelBarone you know a thing or two about this perhaps you and I could work the problem together?
Again all that I think needs two be done here is CHANGE the name of the server. API for auth is still the same so it should be a single change (assuming the server name is abstracted to a field/variable in the code like it is in the hack I made.
Wait, really? Did you test this with your local productive installation of the integration? One could simply hack this locally and test if it works.
I always assumed (no matter why) the API itself changed meaning there's a need to also adjust the requests. If you tested this and it works "just" with the new API url... with that confidence it could be easy to submit a PR and hopefully have (@)iantrich just approve and merge that. Not sure what's needed to finally pack that in a new release or if he (according to https://github.com/custom-components/sensor.trakt/issues/72#issuecomment-1967605941) only wants fixed new maintainers - but step by step.
The change I made ONLY effects the Integration config (changing the server). This will allow the INITIAL oAuth to succeed and the integration to config & load... This is of no PRACTICAL value as future calls via python library will fail as the API server address IS NOT pulled from where I changed it. It DOES however STRONGLY indicate that IF the same change of address is made (and assuming the code LIKEWISE abstracts the server address as I mentioned) then it should be a simple matter of making a likewise single change to THAT file....
These 2 hacks would fix things LOCALLY for someone (as the first did for me), but 2 issues IF one were to go with this quick and dirty hack approach...
Right solution as was stated by #GaelBarone is to move this integration to a SUPPORTED fork of the library (which I found- PyTrakt). It was actually created bye someone for the same reason as we have. API changed and orignal author of the (GENERAL PURPOSE) python lib for Trakt has abandoned it, and he kindly stepped up to to fork and update adding over 15 changes....
From what I have SEEN the pytrakt library APIs are exactly the same (at this point) as the abandoned library so in THEORY all one needs to do is change THIS integration to point at @glensc's current and maintained forked version rather than @moogar0880's abandoned version.
So this integration is still DEAD... will it stay in that state? If so, it will be removed from HACS.
Still no update... what a pity. Broken integrations should not exist in HACS, leading to frustrating new users (like the old ones currently). Really sad 😞
why doesn't whoever who uses and needs this, send pr to change this line to pytrakt==3.4.31
:
likely these need to be changed too:
Seems like here's a mix of people
That whole situation is a bit strange. As mentioned I could submit PRs once to fix this current major issue but have no idea what needs to be done and I won't be able to test it etc.
My summary: this integration needs a new maintainer otherwise it will be dead :-(
And still dead.
@bcutter you can start by leading an example. i.e take these instructions and start a pr:
alternatively, you could just find source code in your local install, and replace all occurrences of https://api-v2launch.trakt.tv
with https://api.trakt.tv
why doesn't whoever who uses and needs this, send pr to change this line to
pytrakt==3.4.31
:THANK YOU!! @glensc
This was the missing piece (as I didn't/still don't adequately understand HA internals but trying too learn as I get time btwn my own ZFS issues but I digress).
Combine my hack at the top (also kindly included by @glensc ) to get proper credentials with the missing piece supplied by him to make the sensor code use the newer library and the sensor will again work properly!
@bcutter What he referenced DOES work and should be the basis for your PR. Again I just don't have the cycles and (as witnessed by my inability to figure out what needed to be changed to get the integration onto the newer library) clearly demonstrates I am not presently qualified to own the code so I really don't want to stick my finger in the pot. Perhaps one day that will change when I am better able to assist beyond what I have already done as just a hack.
I would suggest that you do the following 3 things.
Sorry I can"t offer more assistance but it looks like you should be in good shape to go now knowing that the workaround DOES work.
Regards, T
@bcutter you can start by leading an example. i.e take these instructions and start a pr:
* [Connection issues + integration not loading: can not connect to former api "api-v2launch.trakt.tv", integration needs to switch to new "api.trakt.tv #72 (comment)](https://github.com/custom-components/sensor.trakt/issues/72#issuecomment-2021576003)
alternatively, you could just find source code in your local install, and replace all occurrences of
https://api-v2launch.trakt.tv
withhttps://api.trakt.tv
Indeed it is working, confirmed after patching it locally. Only necessary changes are here exactly as described:
https://github.com/custom-components/sensor.trakt/issues/72#issuecomment-2021576003
I now wanted to create the necessary PRs but the repository does not allow this currently:
@iantrich @engrbm87 can you please
I won't step up as a maintainer but I'm willing to support fixing this for others. This way maybe we can revoke the HACS removal flags.
Summary:
1) It can be fixed and the integration continues to work, but one has to patch it locally (e. g. using the SAMBA share: \custom_components\trakt
2) The integration will be removed from HACS (unless we at least fix THIS issue).
3) Creation of PRs not possible without support by @iantrich / @engrbm87.
4) Of course anyone could fork this repo, do the work and apply to register it as a new integration for HACS again.
Creation of PRs not possible without support by @iantrich / @engrbm87.
not true. you need to:
if you fix the "not on the branch" from the UI (pick "master" as branch), then the rest of it you can basically do from web.
@glensc
Seeing a) how skilled you are with how GitHub works and b) that you came up with the original necessary changes
why don't you simply create those PRs.
@bcutter I'm not using this project. no idea even what this even is. i got pulled in because someone mentioned active pytrakt fork.
if you fix the "not on the branch" from the UI (pick "master" as branch), then the rest of it you can basically do from web
That did the trick. Awaiting PRs to be merged. No idea what happens after that, cause a release needs to be build too I guess. I'm out for that.
Hi I have been trying to run this add-on for several days but without success, I keep seeing this synchronization error in the log, ID , secrets and Redirect URI from the trakt.tv API is correct, any sugestion what I'm doing wrong ? , HA is latest docker images 2024.3.0.dev20240202 , but also trying on stable and other dev version
2024-02-04 14:18:00.104 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Trakt for trakt_tv Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 442, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/trakt_tv/init.py", line 63, in async_setup_entry await coordinator.async_config_entry_first_refresh() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 278, in async_config_entry_first_refresh await self._async_refresh( File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 313, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 269, in _async_update_data return await self.update_method() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/trakt_tv/apis/trakt.py", line 445, in retrieve_data sources_data = await gather(coroutine_sources_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/trakt_tv/apis/trakt.py", line 341, in fetch_upcomings data = await gather( ^^^^^^^^^^^^^ File "/config/custom_components/trakt_tv/apis/trakt.py", line 273, in fetch_upcoming data = await gather( ^^^^^^^^^^^^^ File "/config/custom_components/trakt_tv/apis/trakt.py", line 108, in fetch_calendar response = await self.request( ^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/trakt_tv/apis/trakt.py", line 77, in request response = await self.web_session.request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 578, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 544, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 911, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1204, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection return await self._loop.create_connection(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1101, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1004, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 637, in sock_connect return await fut ^^^^^^^^^ asyncio.exceptions.CancelledError