dylandoamaral / trakt-integration

A Trakt integration for Home Assistant compatible with upcoming media card
MIT License
30 stars 12 forks source link

Set a sensor to check if tv-show is among next_to_watch #100

Open vintage8902 opened 2 months ago

vintage8902 commented 2 months ago

Is there a way I can check the attributes if say "House of Cards" is among the next episodes to watch? I tried {{ state_attr("sensor.trakt_next_to_watch_all", "title") }} But that gave me nothing

`

downey-lv commented 1 month ago

Here's a binary sensor template to achieve this:

{% set data = state_attr("sensor.trakt_next_to_watch_all", "data") %}
{% set ns = namespace(title_found=False) %}

{% for item in data %}
  {% if item.title == "House of Cards" %}
    {% set ns.title_found = True %}
    {% break %}
  {% endif %}
{% endfor %}

{{ ns.title_found }}