diff --git a/source/_integrations/plex.markdown b/source/_integrations/plex.markdown index b33e71dd3ab..6347beaac64 100644 --- a/source/_integrations/plex.markdown +++ b/source/_integrations/plex.markdown @@ -65,6 +65,29 @@ The activity sensor provides a count of users currently watching media from the The library sensors show a count of items in each library. Depending on the library contents, the sensor will show extra detail in its attributes. For example, a library sensor for TV shows will represent the total number of episodes in the library and its attributes will also report the number of shows and seasons it contains. +In addition to the item count, the last added media item (movie, album, or episode) and a timestamp showing when it was added are also provided with each library sensor. + +Example automation to use the `last_added_item` attribute on library sensors to notify when new media has been added: +```yaml +alias: Plex - New media added +trigger: + - platform: state + entity_id: sensor.plex_library_movies + id: movie + - platform: state + entity_id: sensor.plex_library_music + id: album + - platform: state + entity_id: sensor.plex_library_tv_shows + id: episode + +action: + - service: notify.mobile_app_phone + data: + title: "New {{ trigger.id }} added" + message: "{{ trigger.to_state.attributes.last_added_item }}" +``` +