View your Trakt calendar items in Upcoming Media Card on a Home Assistant dashboard.
:warning: This is still an early release. It may not be stable and it may have bugs. :warning:
See the Issues page to report a bug or to add a feature request.
The image above was generated using Upcoming Media Card and Upcoming Media Card modification.
Having the following installed in Home Assistant will help best use this integration:
Installation is a multi-step process. Follow each of the following steps.
This integration is available in HACS (Home Assistant Community Store). Install it as follows:
The following shows all of the integration's default settings.
Add it as a top-level key (i.e., trakt_tv:
is not indented) in the configuration.yaml
file:
trakt_tv:
language: en # Prefered language for movie/show title
timezone: Europe/Paris # Prefered timezone
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
dvd:
days_to_fetch: 90
max_medias: 3
next_to_watch:
all:
max_medias: 5
exclude:
- veep
- the-original
- friends
only_aired:
max_medias: 5
exclude:
- veep
- the-original
- friends
only_upcoming:
max_medias: 5
language
should be an ISO 639-1 codes (default is "en")timezone
should be a pytz timezone (default is the server timezone)By default, this integration does not create any sensors.
The settings that you include in the configuration.yaml
file determines which sensors are created.
This keeps you from having useless sensors that you don't need, such as the DVD sensor which will likely not fetch anything from the Trakt API,
but you can still use it if you want to.
Upcoming sensors are sensors giving the next anticipated movies or shows from your watch list.
There are five sensors available under the sensors
> upcoming
array:
show
for TV Shows (actually, episodes). Creates sensor.trakt_upcoming_shows
new_show
for New Shows (series premiers). Creates sensor.trakt_upcoming_new_shows
premiere
for Season Premieres. Creates sensor.trakt_upcoming_premieres
movie
for Movies premieres. Creates sensor.trakt_upcoming_movies
dvd
for DVD & Blu-ray releases. Creates sensor.trakt_upcoming_dvds
There are two parameters for each sensor:
days_to_fetch
should be a positive number for how many days to searchmax_medias
should be a positive number for how many items to grabAll Upcoming sensors are sensors giving the next anticipated movies or shows.
There are five sensors available under the sensors
> all_upcoming
array:
show
for TV Shows (actually, episodes). Creates sensor.trakt_all_upcoming_shows
new_show
for New Shows (series premiers). Creates sensor.trakt_all_upcoming_new_shows
premiere
for Season Premieres. Creates sensor.trakt_all_upcoming_premieres
movie
for Movies premieres. Creates sensor.trakt_all_upcoming_movies
dvd
for DVD & Blu-ray releases. Creates sensor.trakt_all_upcoming_dvds
There are two parameters for each sensor:
days_to_fetch
should be a positive number for how many days to searchmax_medias
should be a positive number for how many items to grabRecommendation sensors are sensors giving media that you may like.
There are five sensors available under the sensors
> recommendation
array:
show
for TV Shows. Creates sensor.trakt_recommendation_shows
movie
for Movies. Creates sensor.trakt_recommendation_movies
There are one parameter for each sensor:
max_medias
should be a positive number for how many items to grabNext To Watch sensor is sensor giving the next show to watch depending on your progress.
There only one sensor available under the sensors
> next_to_watch
array:
all
for all TV Shows progress. Creates sensor.trakt_next_to_watch_all
only_aired
for only aired TV Shows progress. Creates sensor.trakt_next_to_watch_only_aired
only_upcoming
for only upcoming TV Shows progress. Creates sensor.trakt_next_to_watch_only_upcoming
There are three parameters for each sensor:
max_medias
should be a positive number for how many items to grabexclude
should be a list of shows you'd like to exclude, since it's based on your watched history. To find keys to put there, go on trakt.tv, search for a show, click on it, notice the url slug, copy/paste it. So, if I want to hide "Friends", I'll do the steps mentioned above, then land on https://trakt.tv/shows/friends, I'll just have to copy/paste the last part, friends
, that's it
You can also use the Trakt.tv "hidden" function to hide a show from your calendar or the progress pagesensor.trakt_anticipated_shows
: This sensor displays the most anticipated TV shows on Trakt.sensor.trakt_anticipated_movies
: This sensor displays the most anticipated movies on Trakt.To enable these sensors, you can use the following configuration:
trakt_tv:
language: en
timezone: America/Los_Angeles
sensors:
anticipated:
movie:
max_medias: 10
show:
max_medias: 10
You can also exclude collected items from these sensors:
trakt_tv:
language: en
timezone: America/Los_Angeles
sensors:
anticipated:
movie:
exclude_collected: true
max_medias: 10
show:
exclude_collected: true
max_medias: 10
Creates individual sensors giving all of your stats about the movies, shows, and episodes you have watched, collected, and rated.
Add sensors
> stats
with a list of the sensors you want to enable. You can enable all of them instead by adding all
to the list.
The available stats are available:
movies_plays
movies_watched
movies_minutes
movies_collected
movies_ratings
movies_comments
shows_watched
shows_collected
shows_ratings
shows_comments
seasons_ratings
seasons_comments
episodes_plays
episodes_watched
episodes_minutes
episodes_collected
episodes_ratings
episodes_comments
network_friends
network_followers
network_following
ratings_total
trakt_tv:
sensors:
# Create sensors for all available stats
stats:
- all
# OR
# Create sensors for specific stats (see available stats above)
stats:
- episodes_plays
- movies_minutes
For example, adding only the following to configuration.yaml
will create two sensors.
One with the next 10 TV episodes in the next 30 days and another with the next 5 movies coming out in the next 45 days:
trakt_tv:
language: en
sensors:
upcoming:
show:
days_to_fetch: 30
max_medias: 10
movie:
days_to_fetch: 45
max_medias: 5
recommendation:
show:
max_medias: 3
movie:
max_medias: 3
configuration.yaml
is valid in Configuration > Server Controls > Configuration validation > Check Configuration buttonNote: You will not see anything new in Home Assistant yet.
You have to provide a client_id
and a client_secret
to use this integration. Get these keys with the following:
https://my.home-assistant.io/redirect/oauth
https://<ha-cloud-remote-url>/auth/external/callback
https://<your-ha-server-address>:<port>/auth/external/callback
client_id
and client_secret
client_id
and client_secret
from TraktDepending on the options you set in the configuration.yaml
file, the sensors may take a while to be created and populated.
Go to your Dashboard, enable editing, and add a manual card like the following:
type: custom:upcoming-media-card
entity: sensor.trakt_upcoming_shows
title: Upcoming Episodes
image_style: fanart
hide_empty: true
title_text: $title
line1_text: $episode
line2_text: $number
line3_text: $day, $date $time
line4_text: $empty
max: 10
See the Upcoming Media Card page for formatting and display options to add to your card.
Some people are unable to use the integration because the OAUTH authentification is not working.
Thanks @blizzrdof77 and @robloh for the following workaround:
There is already another integration for Trakt, sensor.trakt. However, I decided to create my own integration for the following reasons:
Don't hesitate to ask for features or contribute your own pull request. ⭐
If you want to add a feature or fix a bug by yourself, follow these instructions:
localhost:8123
:info: To restart home assistant use make homeassistant