Hello,
i try to get only the values from a sensor where the “flag” attribute is true.
{% for i in states.sensor.plex_recently_added_movies.attributes.data %}
{{ i }}
{% endfor %}
with this code i get all the values
{'title_default': '$title', 'line1_default': '$episode', 'line2_default': '$release', 'line3_default': '$number - $rating - $runtime', 'line4_default': '$genres', 'icon': 'mdi:eye-off'}
{'airdate': '2022-05-17T18:56:22Z', 'aired': '2022-02-04', 'release': '$day, $date $time', 'flag': True, 'title': 'Moonfall', 'episode': '', 'runtime': 130, 'studio': 'Centropolis Entertainment', 'genres': 'Action, Adventure', 'rating': '★ 3.7', 'poster': '/local/upcoming-media-card-images/plex/Plex_Recently_Added_Movies/p10335.jpg', 'fanart': '/local/upcoming-media-card-images/plex/Plex_Recently_Added_Movies/f10335.jpg'}
{'airdate': '2022-05-15T18:56:55Z', 'aired': '2022-04-01', 'release': '$day, $date $time', 'flag': True, 'title': 'Morbius', 'episode': '', 'runtime': 103, 'studio': 'Columbia Pictures', 'genres': 'Horror, Science Fiction', 'rating': '★ 1.7', 'poster': '/local/upcoming-media-card-images/plex/Plex_Recently_Added_Movies/p10302.jpg', 'fanart': '/local/upcoming-media-card-images/plex/Plex_Recently_Added_Movies/f10302.jpg'}
{'airdate': '2022-05-15T18:56:55Z', 'aired': '2022-05-12', 'release': '$day, $date $time', 'flag': True, 'title': 'Firestarter', 'episode': '', 'runtime': 94, 'studio': 'Blumhouse Productions', 'genres': 'Drama, Horror', 'rating': '★ 1.3', 'poster': '/local/upcoming-media-card-images/plex/Plex_Recently_Added_Movies/p10303.jpg', 'fanart': '/local/upcoming-media-card-images/plex/Plex_Recently_Added_Movies/f10303.jpg'}
{'airdate': '2022-05-13T06:20:10Z', 'aired': '2022-04-22', 'release': '$day, $date $time', 'flag': False, 'title': 'Die Gangster Gang', 'episode': '', 'runtime': 100, 'studio': 'DreamWorks Animation', 'genres': 'Animation, Adventure', 'rating': '★ 8.7', 'poster': '/local/upcoming-media-card-images/plex/Plex_Recently_Added_Movies/p10283.jpg', 'fanart': '/local/upcoming-media-card-images/plex/Plex_Recently_Added_Movies/f10283.jpg'}
{'airdate': '2022-05-13T06:20:09Z', 'aired': '2022-03-25', 'release': '$day, $date $time', 'flag': False, 'title': 'The Lost City - Das Geheimnis der verlorenen Stadt', 'episode': '', 'runtime': 111, 'studio': 'Paramount', 'genres': 'Action, Adventure', 'rating': '★ 7.8', 'poster': '/local/upcoming-media-card-images/plex/Plex_Recently_Added_Movies/p10282.jpg', 'fanart': '/local/upcoming-media-card-images/plex/Plex_Recently_Added_Movies/f10282.jpg'}
{'airdate': '2022-05-13T06:20:08Z', 'aired': '2022-04-15', 'release': '$day, $date $time', 'flag': True, 'title': 'Choose or Die', 'episode': '', 'runtime': 85, 'studio': 'Anton', 'genres': 'Drama, Horror', 'rating': '★ 3.0', 'poster': '/local/upcoming-media-card-images/plex/Plex_Recently_Added_Movies/p10276.jpg', 'fanart': '/local/upcoming-media-card-images/plex/Plex_Recently_Added_Movies/f10276.jpg'}
now i tried to add a if condition to filter but he always said there is no attribute flag
{% for i in states.sensor.plex_recently_added_movies.attributes.data %}
{{ i }}
{%- if i['flag'] == True -%}
{% endif %}
{% endfor %}