Feature: Implement public and private Trakt lists as sensors
Created a new implementation of the highly requested Trakt lists. Tried to match your existing code as close as possible, but let me know if you want anything changed or have any suggestions for future contributions.
Currently doesn't support sorting,to keep the PR simpler, can implement that in the future.
Resolves #74, closes #75
Testing
Private list
- friendly_name: "Sonarr Watchlist"
private_list: True
list_id: "sonarr-watchlist"
Public list
- friendly_name: "2024 Academy Awards"
list_id: 26885014
max_medias: 10
Filtered list
- friendly_name: "Marvel Episodes"
list_id: 1248149
media_type: "episode"
I will also check it ASAP, thank you !
It may be interesting to add the sorting strategy according to https://trakt.docs.apiary.io/#reference/users/list-items
I started to look into it, but it was 1AM at that point 😃 Will check it out
I started to look into it, but it was 1AM at that point 😃 Will check it out
BTW the previous attempt added the sort feature if you need some inspiration: https://github.com/dylandoamaral/trakt-integration/pull/75/files
Again thank you for your hard work !
Improvements
- Implemented your code review suggestions
- Implemented sorting
- Exposed trakt_rating to HA in case users prefer that over TMDB. Will look into populating this for all the other data sources in separate PR. Would probably allow to implement sorting everywhere as well.
- Moved all date formatting to a utils function
Fixes
- Set trakt.request return type to dict as it's not returning ClientResponse
Sorting demo
I've synced with main and tested that everything works. Anything else before you can approve?
@dylandoamaral any chance of a merge on this please?
I wait the PR to be merged with develop and then I will merge it with pleasure !
@downey-lv any chance of the above? :)
Should be good to go now
@dylandoamaral Can we merge please? :)
Will try it first then merge max next week if everything is ok.
@dylandoamaral 🙏 🙏
I have a pending comment, waiting for the author response for 3 weeks. Tried on my PC but it is not working right now.
@downey-lv have you seen pending comment?
It would be so great to use @downey-lv Improvements, @dylandoamaral
Will try to take a look at what's not working soon, it's been a very busy time
Fixed the issues, @dylandoamaral should be good to merge now. Tested with the following:
configuration.yaml
trakt_tv:
language: fr
timezone: Europe/Paris
sensors:
upcoming:
movie:
days_to_fetch: 90
max_medias: 3
lists:
- friendly_name: "Favorites"
private_list: True # Set to True if the list is your own private list
list_id: "favorites" # Can be the slug, because it's a private list
max_medias: 5
- friendly_name: "2024 Academy Awards"
list_id: 26885014
max_medias: 5
sort_by: rating_trakt # Sort by Trakt user rating instead of list rank
sort_order: desc
- friendly_name: "Star Trek Movies"
list_id: 967660
media_type: "movie" # Filters the list to only show movies
max_medias: 5
ui-lovelace.yaml
views:
- title: Test environment
cards:
- type: custom:upcoming-media-card
entity: sensor.trakt_upcoming_movies
enable_tooltips: true
enable_trailers: true
title: "Upcoming Movies"
- type: custom:upcoming-media-card
entity: sensor.trakt_list_star_trek_movies
enable_tooltips: true
enable_trailers: true
title: "Star Trek Movies"
- type: custom:upcoming-media-card
entity: sensor.trakt_list_favorites
enable_tooltips: true
enable_trailers: true
title: "Favorites"
I will check this after my working day, thanks for the hard work !
All set with the tweaks @dylandoamaral. Also tested on 2025.9, no issues.
On a sidenote we should bump the dev version, doesn't make much sense to develop for Python 3.10 compatibility when the support has been removed since 2023.8
About python, indeed you are right