From 0ef7acfc19e07bf6b8c978aad488c4144888fc76 Mon Sep 17 00:00:00 2001 From: jjlawren Date: Fri, 22 Oct 2021 16:48:19 -0500 Subject: [PATCH] Improve Plex library sensor description and add automation example (#19740) --- source/_integrations/plex.markdown | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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 }}" +``` +
The library sensors are disabled by default, but can be enabled via the Plex integration page.