đŸ“ș Trakt.tv Plugin

Is Home Assistant showing as “Approved” in Your API Apps in your Trakt account?
https://trakt.tv/oauth/applications

Has anyone else had problems with the sensor.trakt_upcoming_calendar sensor lately? It looks like if there are no shows in the upcoming schedule the sensor is returning invalid data and the card doesn’t render. In fact it causes all other cards on the same page to also not render and I end up with a blank page.

I can reproduce this by adding a show to my Trakt watch list that is scheduled within the next three days (or whatever the days: is set to). After a reboot of HASS it shows up fine in the sensor.trakt_upcoming_calendar sensor and the upcoming media card.

When I remove the show from my watchlist and leave something on that’s not upcoming in the next three days I get this in the Dev Tools->States:

Also the page that contains the upcoming media for all of my other stuff including Trakt.tv is blank until I remove the configuration for the trakt.tv upcoming media card.

Anyone else seeing this? It only started happening relatively recently. Previously the upcoming media card for Trakt still rendered but just didn’t show anything if there wasn’t anything upcoming within the days specified.

Good to see a recent update to an integration and dialogue flow, great work in pushing this and maintaining the code to keep it up to date.

FYI for anyone struggling with this please see the setup here until the readme has been updated.

Thanks for reminding me :slight_smile: Updated Readme

1 Like

im so sorry to ask again, but I have setup the trakt.tv website app with callback url “urn:ietf:wg:oauth:2.0:oob” but all the time I try to connect from integration page within home assistant I get “oauth error The requested redirect uri is malformed or doesn’t match client redirect URI”

do i have setup anything wrong? also tried rebooting a few times, set my ip as callback, deleted the custom component through hacs - but nothing works
 pls help

edit: setting the right base_url under http in configuration.yaml und using the https://mydomain.com/ way solves the problem.

Thanks for your work on this great plugin, @iantrich.

I am having a problem configuring it. It was installed via HACS, and then I install the integration as normal. I enter the client ID and secret, and it then tries to exchange the OATH information. However the URL it is feeding is the Internal URL as defined in Configuration -> General rather than the external URL which is my Nabu Casa account.

I guess I Could change the URL definitions, but I am not sure what else it’d break.

How do I proceed?

Replying to the thread in case anyone else has problems getting the integration working. It’s very easy, but it took quite some time to get the right process.

Using HACS, install the upcoming media card from the ‘front end’ section, then install the Trakt integration.

Go to the Trakt website and install a new application: https://trakt.tv/oauth/applications
Set the callback URL with two lines:

urn:ietf:wg:oauth:2.0:oob
<The URL you are accessing HA with, including port>/auth/external/callback
(eg, mine is http://homeassistant.local:8123/auth/external/callback)

Update your configuration.yaml with:

trakt:
   client_id: <Client ID from Trakt website>
   client_secret: <Secret from Trakt website>

Restart HA.

Go Configuration -> Integrations -> click the plus -> Trakt
Follow the install flow.

The tile can start with something as simple as:

type: custom:upcoming-media-card
entity: sensor.trakt_upcoming_calendar
title: Upcoming Shows

(Note: sensor differs from the README).

I hope this helps someone else.

3 Likes

So I have this sync with my Trakt for upcoming shows which is great but is there a card I can have that displays the shows I haven’t watched yet/up next shows? Because we stream a lot of shows so it would be nice having a list of all the shows that have aired but I haven’t marked as watched yet?

That info is not available from this integration. Feel free to file a feature request on the repo.

Can’t get it to work through either configuration.yaml or through the integration. After entering the information through the integration I get “aborted” error.

Hi I installed this plug in by using HACS. Having issues when I get to the point of the installation when I get to the integration part and it ask for the client ID and client secret ID. I put in the code from trakt.tv site and submit i get aborted. I have tried all the suggestions on this forum but still no lucky. please help

Hi guys, thank you for this plugin. Could you please help me. I am trying to do the same thing as HAaccount7 on May '19. I would like to get attributes like “title”, “episode” to sensor. This kind of attributes is new for me. There is a solution:
value_template: '{{ state_attr('sensor.trakt_upcoming', 'data')[0].'title'}}'
It is not working for me. Should it work? Or something was changed. Thank you very much

Hello all! Sorry to revive and old topic here, but has anyone been able to run this with 2 accounts. Looking to incorporate both mine and my wife’s accounts into HA. I was able to integrate both as an integration, however it appears that even with different sensor names, I am getting the same upcoming schedule on both Lovelace cards.

I have been trying to get this component to work for quite some time now. I have followed the instructions and numerous suggestions that I have found on this thread. But I always have the same results.
I have created the API entry on the Trakt site:


But, when I enter the client id and client secret I get the following error:
trakt_b
I have also used the following for the Redirect URI on the Trakt site:

https://aw-----------------------------------------c2.ui.nabu.casa/auth/external/callback

as well as specifying both:

urn:ietf:wg:oauth:2.0:oob
https://aw-----------------------------------------c2.ui.nabu.casa/auth/external/callback

Does anyone have any idea what I am doing wrong?

I just did this tonight and had the same problem but a reboot of HA worked for me. Once I rebooted ha I was able to complete the process. In my case I am using the reverse proxy in my synology. I’m not sure how you are doing your SSL but one thing I did need to do was explicitly allow access in HA config to the proxy internal IP.

In my config in HA I added:

trakt_tv:
  language: en # Prefered language for movie/show title
  sensors:
    upcoming:
      show:
        days_to_fetch: 90 # How many days in the future you want to fetch
        max_medias: 3 # How many medias you want to fetch
      new_show:
        days_to_fetch: 90
        max_medias: 3
      premiere:
        days_to_fetch: 90
        max_medias: 3
      movie:
        days_to_fetch: 90
        max_medias: 3

#Explicit Reverse Proxy Enablement
http:
  use_x_forwarded_for: true
  trusted_proxies: 10.0.0.x # this is IP of my NAS, running reverse proxy

On my Synology’s built in reverse proxy I also allowed custom headers:

Hope something here allows your config to work!

I may have not replied to your post but I just posted my experience below yours and got it working. Hope it helps.

Thanks @hnkm.
I don’t know much about proxies, but I will try to figure it out if I can. From the little I know, it would make sense that I would see the results I do if I there is a proxy server that is not redirecting the request from the Trakt site (at least, that’s what I think is happening).

so im reading through and im havent found my answer

Im trying to setup the Trakt App. Is this right?

same issue mate! cant figure this out

Try this https:/ /my.home-assistant.io/redirect/oauth instead of http
/auth/external/callback