Hi all. Having a bit of a hard time here, but I’ve read through quite a few wikis and posts and still can’t seem to get this right.
Using the Plex Recently Added Component community addon, I’ve got a notification for when a new TV show is added to Plex, which is working fine, but I wanted to add the title - episode along with the notification.
I recognize there are other platforms I could use to solve this, but I’d really like to use HA here.
Using the Developer Tools > States, here’s what I get for the sensor attribute:
data:
- title_default: $title
line1_default: $episode
line2_default: $release
line3_default: $number - $rating - $runtime
line4_default: $genres
icon: 'mdi:eye-off'
- airdate: '2021-05-22T22:36:08Z'
aired: '2019-10-10'
release: '$day, $date $time'
flag: false
title: Impractical Jokers
episode: Irritable Vowel Syndrome
number: S08E18
runtime: 24
rating: ''
poster: /local/upcoming-media-card-images/plex/plex_tv/p117892.jpg
fanart: /local/upcoming-media-card-images/plex/plex_tv/f117892.jpg
- airdate: '2021-05-22T22:15:43Z'
aired: '2021-05-19'
release: '$day, $date $time'
flag: true
title: Chicago P.D.
episode: The Right Thing
number: S08E15
runtime: 41
rating: ''
poster: /local/upcoming-media-card-images/plex/plex_tv/p117890.jpg
fanart: /local/upcoming-media-card-images/plex/plex_tv/f117890.jpg
- airdate: '2021-05-22T22:13:25Z'
aired: '2021-05-19'
release: '$day, $date $time'
flag: true
title: Chicago Fire
episode: A White-Knuckle Panic
number: S09E15
runtime: 41
rating: ''
poster: /local/upcoming-media-card-images/plex/plex_tv/p117889.jpg
fanart: /local/upcoming-media-card-images/plex/plex_tv/f117889.jpg
- airdate: '2021-05-22T17:13:13Z'
aired: '2014-04-27'
release: '$day, $date $time'
flag: false
title: Game of Thrones
episode: Oathkeeper
number: S04E04
runtime: 55
rating: ★ 7.8
poster: /local/upcoming-media-card-images/plex/plex_tv/p117834.jpg
fanart: /local/upcoming-media-card-images/plex/plex_tv/f117834.jpg
- airdate: '2021-05-11T04:48:04Z'
aired: '2018-10-27'
release: '$day, $date $time'
flag: true
title: 'My Little Pony: Friendship Is Magic'
episode: The Best Gift Ever
number: S00E66
runtime: 44
rating: ''
poster: /local/upcoming-media-card-images/plex/plex_tv/p117724.jpg
fanart: /local/upcoming-media-card-images/plex/plex_tv/f117724.jpg
friendly_name: plex_tv
Using Developer Tools > Template, I’ve done:
{{ state_attr('sensor.plex_movies', 'data') }}
Which gives me the string:
[{'title_default': '$title', 'line1_default': '$episode', 'line2_default': '$release', 'line3_default': '$number - $rating - $runtime', 'line4_default': '$genres', 'icon': 'mdi:eye-off'}, {'airdate': '2021-05-23T13:50:38Z', 'aired': '2020-10-15', 'release': '$day, $date $time', 'flag': True, 'title': 'Combat Wombat', 'episode': '', 'runtime': 85, 'studio': 'Like A Photon Creative', 'genres': 'Family, Animation', 'rating': '', 'poster': '/local/upcoming-media-card-images/plex/plex_movies/p117938.jpg', 'fanart': '/local/upcoming-media-card-images/plex/plex_movies/f117938.jpg'}, {'airdate': '2021-05-23T03:12:45Z', 'aired': '2020-12-23', 'release': '$day, $date $time', 'flag': False, 'title': 'The Midnight Sky', 'episode': '', 'runtime': 118, 'studio': 'Smoke House Pictures', 'genres': 'Science Fiction, Thriller', 'rating': '', 'poster': '/local/upcoming-media-card-images/plex/plex_movies/p117933.jpg', 'fanart': '/local/upcoming-media-card-images/plex/plex_movies/f117933.jpg'}, {'airdate': '2021-05-22T23:01:39Z', 'aired': '2020-12-25', 'release': '$day, $date $time', 'flag': True, 'title': 'Soul', 'episode': '', 'runtime': 100, 'studio': 'Walt Disney Pictures', 'genres': 'Family, Animation', 'rating': '', 'poster': '/local/upcoming-media-card-images/plex/plex_movies/p117920.jpg', 'fanart': '/local/upcoming-media-card-images/plex/plex_movies/f117920.jpg'}, {'airdate': '2021-05-22T22:50:59Z', 'aired': '2021-02-19', 'release': '$day, $date $time', 'flag': False, 'title': 'Flora & Ulysses', 'episode': '', 'runtime': 90, 'studio': 'Walt Disney Pictures', 'genres': 'Family, Comedy', 'rating': '', 'poster': '/local/upcoming-media-card-images/plex/plex_movies/p117906.jpg', 'fanart': '/local/upcoming-media-card-images/plex/plex_movies/f117906.jpg'}, {'airdate': '2021-05-22T21:22:43Z', 'aired': '2021-03-05', 'release': '$day, $date $time', 'flag': False, 'title': 'Raya and the Last Dragon', 'episode': '', 'runtime': 107, 'studio': 'Walt Disney Pictures', 'genres': 'Family, Animation', 'rating': '', 'poster': '/local/upcoming-media-card-images/plex/plex_movies/p117880.jpg', 'fanart': '/local/upcoming-media-card-images/plex/plex_movies/f117880.jpg'}]
I just don’t know what to do at this point to extract the first title/episode. I appreciate any help I can get with this!