šŸ“ŗ Trakt.tv Plugin

I did implement that on a test branch, but it is incredibly slow as it has to go through all your shows and all their history. You can give it a shot here: https://github.com/custom-components/sensor.trakt/tree/up-next

I have a weird problem with this plugin. For some reason If I have the sensor.py under /custom_components/trakt/ and also the sensor on my yaml the HA it doesnā€™t start. It restarts I have SSH access and i can see the files with samba share but no GUI, it shows that it cannot connect to HA. When iā€™m removing the sensor.py and the entry from yaml it logins just fine. Any ideas? I have 0.93.2 version and trakt and upcoming card up to date

You need all the files, especially the manifest

Of course I have all the files, but the ones I said are the ones that making the HA work again when I remove them from HA

I had the same problem but got it working again with these steps:

  • delete .trakt.conf
  • restart HA (I then got a trakt.configurator notification)
  • generate a new OAuth PIN from Trakt to use in the configurator
2 Likes

I may have to give your solution a shot. I had to stop using Trakt several weeks ago as it brought HA to a screeching halt.

This along with new Trakt authorization app credentials fixed it for me.

Thanks!

Unfortunately the success was short-lived. HA cannot boot up. Checking Home Assistant log I get the below Trakt error over and over hundreds of times. A search of ā€œtraktā€ in my HA log brought up over 1000 entries. Had to disable Trakt custom component as HA would never come up. Obviously it has something to do with the Trakt authorization, but I have no idea how to stop this from happening.

  File "/config/custom_components/trakt/sensor.py", line 81, in setup_platform
    continue_setup_platform(hass, config, token, add_devices, discovery_info)
  File "/config/custom_components/trakt/sensor.py", line 89, in continue_setup_platform
    add_devices([TraktUpcomingCalendarSensor(hass, config, token)], True)
  File "/config/custom_components/trakt/sensor.py", line 127, in __init__
    self.update()
  File "/config/custom_components/trakt/sensor.py", line 144, in update
    calendar = MyShowCalendar(days=self._days)
  File "/usr/local/lib/python3.7/site-packages/trakt/calendar.py", line 31, in __init__
    self._get()
  File "/usr/local/lib/python3.7/site-packages/trakt/core.py", line 455, in inner
    json_data = self._handle_request('get', url)
  File "/usr/local/lib/python3.7/site-packages/trakt/core.py", line 432, in _handle_request
    raise self.error_map[response.status_code]()
trakt.errors.OAuthException: Unauthorized - OAuth must be provided

Anyone have any suggestions?

1 Like

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