PLEX latest movies click to play

Is there a ways to have the poster of the recently added movies and play that movie in a specific player?

Would like to have 1 page on the dashboard with the latest movie posters where every poster is clickable and deploys the action of playing that movie plus a automation.

Any guidance would be great! thanks :grin:

2 Likes

The new media browser functionality is available from Media Control cards. There’s a Recently Added section as you open it up. Clicking on any of those will play it on the device if supported. There’s also library-specific recently added and on deck sections if you drill down deeper.

Hi so far so good:
got sensors with the name of the movie , image and the flag and could put them as picture cards inside a picture elements card so i can arrange them. but when it came to the action part it didn’t work , i was reading and all seams good. maybe take a quick look and see if there is something wrong here?

tap_action:
      entity_id: media_player.plex_tv_livingroom
      media_content_type: movie
      media_content_id: '{ "library_name": "Movies", "title": "Date With an Angel" }'

type: picture-elements
image: /local/pictures/hc-courtines.jpg
elements:
  - type: 'custom:config-template-card'
    entities:
      - sensor.plex_recently_movies_poster_1
    card:
      type: picture
      image: '${states[''sensor.plex_recently_movies_poster_1''].state }'
    tap_action:
      entity_id: media_player.plex_tv_livingroom
      media_content_type: movie
      media_content_id: '{ "library_name": "Movies", "title": "Date With an Angel" }'
    style:
      top: 44%
      left: 12%
      width: 13%
      border: 2px solid gold
  - type: 'custom:config-template-card'
    entities:
      - sensor.plex_recently_movies_poster_2
    card:
      type: picture
      elements:
        - state-icon: 'mdi:plex'
      image: '${states[''sensor.plex_recently_movies_poster_2''].state }'
    style:
      top: 44%
      left: 30%
      width: 13%
      border: 2px solid gold
  - type: 'custom:config-template-card'
    entities:
      - sensor.plex_recently_movies_poster_3
    card:
      type: picture
      elements:
        - state-icon: 'mdi:plex'
      image: '${states[''sensor.plex_recently_movies_poster_3''].state }'
    style:
      top: 44%
      left: 48%
      width: 13%
      border: 2px solid gold
  - type: 'custom:config-template-card'
    entities:
      - sensor.plex_recently_movies_poster_4
    card:
      type: picture
      elements:
        - state-icon: 'mdi:plex'
      image: '${states[''sensor.plex_recently_movies_poster_4''].state }'
    style:
      top: 44%
      left: 66%
      width: 13%
      border: 2px solid gold
  - type: 'custom:config-template-card'
    entities:
      - sensor.plex_recently_movies_poster_5
    card:
      type: picture
      elements:
        - state-icon: 'mdi:plex'
      image: '${states[''sensor.plex_recently_movies_poster_5''].state }'
    style:
      top: 44%
      left: 85%
      width: 13%
      border: 2px solid gold
  - type: 'custom:config-template-card'
    entities:
      - sensor.plex_recently_movies_poster_6
    card:
      type: picture
      elements:
        - state-icon: 'mdi:plex'
      image: '${states[''sensor.plex_recently_movies_poster_6''].state }'
    style:
      top: 82%
      left: 12%
      width: 13%
      border: 2px solid gold
  - type: 'custom:config-template-card'
    entities:
      - sensor.plex_recently_movies_poster_7
    card:
      type: picture
      elements:
        - state-icon: 'mdi:plex'
      image: '${states[''sensor.plex_recently_movies_poster_7''].state }'
    style:
      top: 82%
      left: 30%
      width: 13%
      border: 2px solid gold
  - type: 'custom:config-template-card'
    entities:
      - sensor.plex_recently_movies_poster_8
    card:
      type: picture
      elements:
        - state-icon: 'mdi:plex'
      image: '${states[''sensor.plex_recently_movies_poster_8''].state }'
    style:
      top: 82%
      left: 48%
      width: 13%
      border: 2px solid gold
  - type: 'custom:config-template-card'
    entities:
      - sensor.plex_recently_movies_poster_9
    card:
      type: picture
      elements:
        - state-icon: 'mdi:plex'
      image: '${states[''sensor.plex_recently_movies_poster_9''].state }'
    style:
      top: 82%
      left: 66%
      width: 13%
      border: 2px solid gold
  - type: 'custom:config-template-card'
    entities:
      - sensor.plex_recently_movies_poster_10
    card:
      type: picture
      elements:
        - state-icon: 'mdi:plex'
      image: '${states[''sensor.plex_recently_movies_poster_10''].state }'
    style:
      top: 82%
      left: 85%
      width: 13%
      border: 2px solid gold

The player must be running and available. Enabling debug logs with the logger.set_level service and home assistant.components.plex: debug as the payload should give you more context.

thanks for all your help, its alomst there
its phaying but in the tap_action, media_content_is is showing me a indent error, its works fin in the developers tools template:

"{ "library_name": "Movies", "title": "{{ state_attr('sensor.plex_recently_added', 'data')[1]['title'] }}", "Year": "{% set text = state_attr('sensor.plex_recently_added', 'data')[1]['aired'] %}{{ text.split('-')[0].strip()}}" }"

i get the correct reponse:
“{ “library_name”: “Movies”, “title”: “Date With an Angel”, “Year”: “1987” }”

but in the card it wont work (created a separate picture card)

type: 'custom:config-template-card'
entities:
      - sensor.plex_recently_added
card:
  type: 'custom:hui-picture-card'
  tiltle: Movie 1
  image: '${states[''sensor.plex_recently_movies_poster_1''].state }'
  tap_action:
    action: call-service
    service: media_player.play_media
    service_data:
      entity_id: media_player.plex_tv_livingroom
      media_content_type: movie
      media_content_id: '$"{ "library_name": "Movies", "title": "{{ state_attr('sensor.plex_recently_added', 'data')[1]['title'] }}", "Year": "{% set text = state_attr('sensor.plex_recently_added', 'data')[1]['aired'] %}{{ text.split('-')[0].strip()}}" }" '
    style:
      top: 44%
      left: 12%
      width: 13%
      border: 2px solid gold

can you help me point out where im am doing the wrong ident?

thanks

this is how i think the card should be but still cant make it to work

type: picture-elements
image: /local/pictures/hc-courtines.jpg
elements:
  - type: 'custom:config-template-card'
    entities:
      - sensor.plex_recently_movies_poster_1
    card:
      type: 'custom:hui-picture-card'
      image: '${{ state_attr('sensor.plex_recently_added', 'data')[1]['poster'] }}'
      tap_action:
        action: call-service
        service: media_player.play_media
        service_data:
          entity_id: media_player.plex_for_samsung_tv_livingroom
          media_content_type: movie
          media_content_id: '$"{ "library_name": "Movies", "title": "{{ state_attr('sensor.plex_recently_added', 'data')[1]['title'] }}", "Year": "{{ state_attr('sensor.plex_recently_added', 'data')[1]['aired'].split("-")[0] }}" }" '
    style:
        top: 44%
        left: 12%
        width: 13%
        border: 2px solid goldtype or paste code here

where
this:
“{ “library_name”: “Movies”, “title”: “{{ state_attr(‘sensor.plex_recently_added’, ‘data’)[1][‘title’] }}”, “Year”: “{{ state_attr(‘sensor.plex_recently_added’, ‘data’)[1][‘aired’].split(”-”)[0] }}" }"
gives me:
“{ “library_name”: “Movies”, “title”: “Date With an Angel”, “Year”: “1987” }”

and"{{ state_attr(‘sensor.plex_recently_added’, ‘data’)[1][‘poster’] }}"
gives me:
“/local/upcoming-media-card-images/plex/Plex_Recently_Added/p173500.jpg”

Anyone??

Hi Dingin,

Can you enlighten me from where you get the sensor.plex_recently_movies_poster_1 entity?

TIA

Hi,
I created template sensors extracted from the Plex Recently Added integration in HACS.
Here is the first set for the first movie

############################################
########### Home Cinema Sensors  ###########
############################################

  - platform: template
    sensors:
      plex_recently_movies_name_1:
        friendly_name: "Movie 1 name"
        icon_template: mdi:movie-roll
        value_template:  "{{ state_attr('sensor.recently_added_movies', 'data')[1]['title'] }}"

  - platform: template
    sensors:
      plex_recently_movies_poster_1:
        friendly_name: "Movie 1 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[1]['poster'] }}"

  - platform: template
    sensors:
      plex_recently_movies_fanart_1:
        friendly_name: "Movie 1 fanart"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[1]['fanart'] }}"
        
  - platform: template
    sensors:
      plex_recently_movies_flag_1:
        friendly_name: "Movie 1 play status"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[1]['flag'] }}"
        
  - platform: template
    sensors:
      plex_recently_movies_year_1:
        friendly_name: "Movie 1 Year"
        icon_template: mdi:movie-roll
        value_template: "{% set text = state_attr('sensor.recently_added_movies', 'data')[1]['aired'] %}{{ text.split('-')[0].strip()}}" 
        
  - platform: template
    sensors:
      plex_recently_movies_play_movie_1:
        friendly_name: "Movie 1 play button"
        icon_template: mdi:movie-roll
        value_template: >-
         { "library_name": "Movies", "title": "{{states('sensor.plex_recently_movies_name_1')}}", "year": "{{states('sensor.plex_recently_movies_year_1') }}" }
        

Hope it helps you or let me know if you need more help.

Dingin

Did you ever get this going? I was looking for the same kind of thing.

yes i did, there is also a new integration plex mets home assistant you shpuld check it out

Could you share your final card where you got it working? I have the plex integration already.

Here is the card:

type: picture-elements
image: /local/pictures/hc-courtines.jpg
elements:
  - type: custom:config-template-card
    entities:
      - sensor.plex_recently_movies_poster_1
      - sensor.plex_recently_added
      - sensor.plex_recently_movies_play_movie_1
    card:
      type: custom:hui-picture-card
      tiltle: Movie 1
      image: ${states['sensor.plex_recently_movies_poster_1'].state }
      tap_action:
        action: call-service
        service: media_player.play_media
        service_data:
          entity_id: media_player.plex_for_samsung_tv_livingroom
          media_content_type: movie
          media_content_id: ${states['sensor.plex_recently_movies_play_movie_1'].state  }
    style:
      top: 44%
      left: 30%
      width: 13%
      border: 2px solid gold
  - type: custom:config-template-card
    entities:
      - sensor.plex_recently_movies_poster_2
      - sensor.plex_recently_added
      - sensor.plex_recently_movies_play_movie_2
    card:
      type: custom:hui-picture-card
      tiltle: Movie 2
      image: ${states['sensor.plex_recently_movies_poster_2'].state }
      tap_action:
        action: call-service
        service: media_player.play_media
        service_data:
          entity_id: media_player.plex_for_samsung_tv_livingroom
          media_content_type: movie
          media_content_id: ${states['sensor.plex_recently_movies_play_movie_2'].state  }
    style:
      top: 44%
      left: 12%
      width: 13%
      border: 2px solid gold
  - type: custom:config-template-card
    entities:
      - sensor.plex_recently_movies_poster_3
    card:
      type: picture
      elements:
        - state-icon: mdi:plex
      image: ${states['sensor.plex_recently_movies_poster_3'].state }
      tap_action:
        action: call-service
        service: media_player.play_media
        service_data:
          entity_id: media_player.plex_for_samsung_tv_livingroom
          media_content_type: movie
          media_content_id: ${states['sensor.plex_recently_movies_play_movie_3'].state  }
    style:
      top: 44%
      left: 48%
      width: 13%
      border: 2px solid gold
  - type: custom:config-template-card
    entities:
      - sensor.plex_recently_movies_poster_4
    card:
      type: picture
      elements:
        - state-icon: mdi:plex
      image: ${states['sensor.plex_recently_movies_poster_4'].state }
      tap_action:
        action: call-service
        service: media_player.play_media
        service_data:
          entity_id: media_player.plex_for_samsung_tv_livingroom
          media_content_type: movie
          media_content_id: ${states['sensor.plex_recently_movies_play_movie_4'].state  }
    style:
      top: 44%
      left: 66%
      width: 13%
      border: 2px solid gold
  - type: custom:config-template-card
    entities:
      - sensor.plex_recently_movies_poster_5
    card:
      type: picture
      elements:
        - state-icon: mdi:plex
      image: ${states['sensor.plex_recently_movies_poster_5'].state }
      tap_action:
        action: call-service
        service: media_player.play_media
        service_data:
          entity_id: media_player.plex_for_samsung_tv_livingroom
          media_content_type: movie
          media_content_id: ${states['sensor.plex_recently_movies_play_movie_5'].state  }
    style:
      top: 44%
      left: 85%
      width: 13%
      border: 2px solid gold
  - type: custom:config-template-card
    entities:
      - sensor.plex_recently_movies_poster_6
    card:
      type: picture
      elements:
        - state-icon: mdi:plex
      image: ${states['sensor.plex_recently_movies_poster_6'].state }
      tap_action:
        action: call-service
        service: media_player.play_media
        service_data:
          entity_id: media_player.plex_for_samsung_tv_livingroom
          media_content_type: movie
          media_content_id: ${states['sensor.plex_recently_movies_play_movie_6'].state  }
    style:
      top: 82%
      left: 12%
      width: 13%
      border: 2px solid gold
  - type: custom:config-template-card
    entities:
      - sensor.plex_recently_movies_poster_7
    card:
      type: picture
      elements:
        - state-icon: mdi:plex
      image: ${states['sensor.plex_recently_movies_poster_7'].state }
      tap_action:
        action: call-service
        service: media_player.play_media
        service_data:
          entity_id: media_player.plex_for_samsung_tv_livingroom
          media_content_type: movie
          media_content_id: ${states['sensor.plex_recently_movies_play_movie_7'].state  }
    style:
      top: 82%
      left: 30%
      width: 13%
      border: 2px solid gold
  - type: custom:config-template-card
    entities:
      - sensor.plex_recently_movies_poster_8
    card:
      type: picture
      elements:
        - state-icon: mdi:plex
      image: ${states['sensor.plex_recently_movies_poster_8'].state }
      tap_action:
        action: call-service
        service: media_player.play_media
        service_data:
          entity_id: media_player.plex_for_samsung_tv_livingroom
          media_content_type: movie
          media_content_id: ${states['sensor.plex_recently_movies_play_movie_8'].state  }
    style:
      top: 82%
      left: 48%
      width: 13%
      border: 2px solid gold
  - type: custom:config-template-card
    entities:
      - sensor.plex_recently_movies_poster_9
    card:
      type: picture
      elements:
        - state-icon: mdi:plex
      image: ${states['sensor.plex_recently_movies_poster_9'].state }
      tap_action:
        action: call-service
        service: media_player.play_media
        service_data:
          entity_id: media_player.plex_for_samsung_tv_livingroom
          media_content_type: movie
          media_content_id: ${states['sensor.plex_recently_movies_play_movie_9'].state  }
    style:
      top: 82%
      left: 66%
      width: 13%
      border: 2px solid gold
  - type: custom:config-template-card
    entities:
      - sensor.plex_recently_movies_poster_10
    card:
      type: picture
      elements:
        - state-icon: mdi:plex
      image: ${states['sensor.plex_recently_movies_poster_10'].state }
      tap_action:
        action: call-service
        service: media_player.play_media
        service_data:
          entity_id: media_player.plex_for_samsung_tv_livingroom
          media_content_type: movie
          media_content_id: ${states['sensor.plex_recently_movies_play_movie_10'].state  }
    style:
      top: 82%
      left: 85%
      width: 13%
      border: 2px solid gold

2 Likes

and here are the sensors, Just remember you need the Plex Recently Added from hacs, this is based on those sensors. you will get something like this:

hope it helps you. please share your final card image and config :smiley:

sensors:

############################################
########### Home Cinema Sensors  ###########
############################################

  - platform: template
    sensors:
      plex_recently_movies_name_1:
        friendly_name: "Movie 1 name"
        icon_template: mdi:movie-roll
        value_template:  "{{ state_attr('sensor.recently_added_movies', 'data')[1]['title'] }}"

  - platform: template
    sensors:
      plex_recently_movies_poster_1:
        friendly_name: "Movie 1 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[1]['poster'] }}"

  - platform: template
    sensors:
      plex_recently_movies_fanart_1:
        friendly_name: "Movie 1 fanart"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[1]['fanart'] }}"
        
  - platform: template
    sensors:
      plex_recently_movies_flag_1:
        friendly_name: "Movie 1 play status"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[1]['flag'] }}"
        
  - platform: template
    sensors:
      plex_recently_movies_year_1:
        friendly_name: "Movie 1 Year"
        icon_template: mdi:movie-roll
        value_template: "{% set text = state_attr('sensor.recently_added_movies', 'data')[1]['aired'] %}{{ text.split('-')[0].strip()}}" 
        
  - platform: template
    sensors:
      plex_recently_movies_play_movie_1:
        friendly_name: "Movie 1 play button"
        icon_template: mdi:movie-roll
        value_template: >-
         { "library_name": "Movies", "title": "{{states('sensor.plex_recently_movies_name_1')}}", "year": "{{states('sensor.plex_recently_movies_year_1') }}" }
        

  - platform: template
    sensors:
      plex_recently_movies_name_2:
        friendly_name: "Movie 2 name"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[2]['title'] }}"

  - platform: template
    sensors:
      plex_recently_movies_poster_2:
        friendly_name: "Movie 2 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[2]['poster'] }}"

  - platform: template
    sensors:
      plex_recently_movies_fanart_2:
        friendly_name: "Movie 2 fanart"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[2]['fanart'] }}"

  - platform: template
    sensors:
      plex_recently_movies_flag_2:
        friendly_name: "Movie 2 play status"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[2]['flag'] }}"

  - platform: template
    sensors:
      plex_recently_movies_year_2:
        friendly_name: "Movie 2 Year"
        icon_template: mdi:movie-roll
        value_template: "{% set text = state_attr('sensor.recently_added_movies', 'data')[2]['aired'] %}{{ text.split('-')[0].strip()}}" 
        
        
  - platform: template
    sensors:
      plex_recently_movies_play_movie_2:
        friendly_name: "Movie 2 play button"
        icon_template: mdi:movie-roll
        value_template: >-
         { "library_name": "Movies", "title": "{{states('sensor.plex_recently_movies_name_2')}}", "year": "{{states('sensor.plex_recently_movies_year_2') }}" }


  - platform: template
    sensors:
      plex_recently_movies_name_3:
        friendly_name: "Movie 3 name"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[3]['title'] }}"

  - platform: template
    sensors:
      plex_recently_movies_poster_3:
        friendly_name: "Movie 3 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[3]['poster'] }}"

  - platform: template
    sensors:
      plex_recently_movies_fanart_3:
        friendly_name: "Movie 3 fanart"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[3]['fanart'] }}"

  - platform: template
    sensors:
      plex_recently_movies_flag_3:
        friendly_name: "Movie 3 play status"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[3]['flag'] }}"

  - platform: template
    sensors:
      plex_recently_movies_year_3:
        friendly_name: "Movie 3 Year"
        icon_template: mdi:movie-roll
        value_template: "{% set text = state_attr('sensor.recently_added_movies', 'data')[3]['aired'] %}{{ text.split('-')[0].strip()}}" 
        

  - platform: template
    sensors:
      plex_recently_movies_play_movie_3:
        friendly_name: "Movie 3 play button"
        icon_template: mdi:movie-roll
        value_template: >-
         { "library_name": "Movies", "title": "{{states('sensor.plex_recently_movies_name_3')}}", "year": "{{states('sensor.plex_recently_movies_year_3') }}" }

  - platform: template
    sensors:
      plex_recently_movies_name_4:
        friendly_name: "Movie 4 name"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[4]['title'] }}"

  - platform: template
    sensors:
      plex_recently_movies_poster_4:
        friendly_name: "Movie 4 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[4]['poster'] }}"

  - platform: template
    sensors:
      plex_recently_movies_fanart_4:
        friendly_name: "Movie 4 fanart"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[4]['fanart'] }}"
        
  - platform: template
    sensors:
      plex_recently_movies_flag_4:
        friendly_name: "Movie 4 play status"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[4]['flag'] }}"

  - platform: template
    sensors:
      plex_recently_movies_year_4:
        friendly_name: "Movie 4 Year"
        icon_template: mdi:movie-roll
        value_template: "{% set text = state_attr('sensor.recently_added_movies', 'data')[4]['aired'] %}{{ text.split('-')[0].strip()}}" 

  - platform: template
    sensors:
      plex_recently_movies_play_movie_4:
        friendly_name: "Movie 4 play button"
        icon_template: mdi:movie-roll
        value_template: >-
         { "library_name": "Movies", "title": "{{states('sensor.plex_recently_movies_name_4')}}", "year": "{{states('sensor.plex_recently_movies_year_4') }}" }
        
  - platform: template
    sensors:
      plex_recently_movies_name_5:
        friendly_name: "Movie 5 name"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[5]['title'] }}"

  - platform: template
    sensors:
      plex_recently_movies_poster_5:
        friendly_name: "Movie 5 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[5]['poster'] }}"

  - platform: template
    sensors:
      plex_recently_movies_fanart_5:
        friendly_name: "Movie 5 fanart"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[5]['fanart'] }}"

  - platform: template
    sensors:
      plex_recently_movies_flag_5:
        friendly_name: "Movie 5 play status"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[5]['flag'] }}"
        

  - platform: template
    sensors:
      plex_recently_movies_name_6:
        friendly_name: "Movie 6 name"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[6]['title'] }}"

  - platform: template
    sensors:
      plex_recently_movies_poster_6:
        friendly_name: "Movie 7 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[6]['poster'] }}"

  - platform: template
    sensors:
      plex_recently_movies_fanart_6:
        friendly_name: "Movie 6 fanart"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[6]['fanart'] }}"

  - platform: template
    sensors:
      plex_recently_movies_flag_6:
        friendly_name: "Movie 6 play status"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[6]['flag'] }}"

  - platform: template
    sensors:
      plex_recently_movies_year_6:
        friendly_name: "Movie 6 Year"
        icon_template: mdi:movie-roll
        value_template: "{% set text = state_attr('sensor.recently_added_movies', 'data')[6]['aired'] %}{{ text.split('-')[0].strip()}}" 
        
  - platform: template
    sensors:
      plex_recently_movies_play_movie_6:
        friendly_name: "Movie 6 play button"
        icon_template: mdi:movie-roll
        value_template: >-
         { "library_name": "Movies", "title": "{{states('sensor.plex_recently_movies_name_6')}}", "year": "{{states('sensor.plex_recently_movies_year_6') }}" }        

  - platform: template
    sensors:
      plex_recently_movies_name_7:
        friendly_name: "Movie 7 name"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[7]['title'] }}"

  - platform: template
    sensors:
      plex_recently_movies_poster_7:
        friendly_name: "Movie 7 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[7]['poster'] }}"

  - platform: template
    sensors:
      plex_recently_movies_fanart_7:
        friendly_name: "Movie 7 fanart"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[7]['fanart'] }}"

  - platform: template
    sensors:
      plex_recently_movies_flag_7:
        friendly_name: "Movie 7 play status"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[7]['flag'] }}"

  - platform: template
    sensors:
      plex_recently_movies_year_7:
        friendly_name: "Movie 7 Year"
        icon_template: mdi:movie-roll
        value_template: "{% set text = state_attr('sensor.recently_added_movies', 'data')[7]['aired'] %}{{ text.split('-')[0].strip()}}" 

  - platform: template
    sensors:
      plex_recently_movies_play_movie_7:
        friendly_name: "Movie 7 play button"
        icon_template: mdi:movie-roll
        value_template: >-
         { "library_name": "Movies", "title": "{{states('sensor.plex_recently_movies_name_7')}}", "year": "{{states('sensor.plex_recently_movies_year_7') }}" }

  - platform: template
    sensors:
      plex_recently_movies_name_8:
        friendly_name: "Movie 8 name"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[8]['title'] }}"

  - platform: template
    sensors:
      plex_recently_movies_poster_8:
        friendly_name: "Movie 8 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[8]['poster'] }}"

  - platform: template
    sensors:
      plex_recently_movies_fanart_8:
        friendly_name: "Movie 8 fanart"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[8]['fanart'] }}"

  - platform: template
    sensors:
      plex_recently_movies_flag_8:
        friendly_name: "Movie 8 play status"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[8]['flag'] }}"

  - platform: template
    sensors:
      plex_recently_movies_year_8:
        friendly_name: "Movie 8 Year"
        icon_template: mdi:movie-roll
        value_template: "{% set text = state_attr('sensor.recently_added_movies', 'data')[8]['aired'] %}{{ text.split('-')[0].strip()}}" 

  - platform: template
    sensors:
      plex_recently_movies_play_movie_8:
        friendly_name: "Movie 8 play button"
        icon_template: mdi:movie-roll
        value_template: >-
         { "library_name": "Movies", "title": "{{states('sensor.plex_recently_movies_name_8')}}", "year": "{{states('sensor.plex_recently_movies_year_8') }}" }

  - platform: template
    sensors:
      plex_recently_movies_name_9:
        friendly_name: "Movie 9 name"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[9]['title'] }}"

  - platform: template
    sensors:
      plex_recently_movies_poster_9:
        friendly_name: "Movie 9 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[9]['poster'] }}"

  - platform: template
    sensors:
      plex_recently_movies_fanart_9:
        friendly_name: "Movie 9 fanart"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[9]['fanart'] }}"

  - platform: template
    sensors:
      plex_recently_movies_flag_9:
        friendly_name: "Movie 9 play status"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[9]['flag'] }}"

  - platform: template
    sensors:
      plex_recently_movies_year_9:
        friendly_name: "Movie 9 Year"
        icon_template: mdi:movie-roll
        value_template: "{% set text = state_attr('sensor.recently_added_movies', 'data')[9]['aired'] %}{{ text.split('-')[0].strip()}}" 

  - platform: template
    sensors:
      plex_recently_movies_play_movie_9:
        friendly_name: "Movie 9 play button"
        icon_template: mdi:movie-roll
        value_template: >-
         { "library_name": "Movies", "title": "{{states('sensor.plex_recently_movies_name_9')}}", "year": "{{states('sensor.plex_recently_movies_year_9') }}" }

  - platform: template
    sensors:
      plex_recently_movies_name_10:
        friendly_name: "Movie 10 name"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[10]['title'] }}"

  - platform: template
    sensors:
      plex_recently_movies_poster_10:
        friendly_name: "Movie 10 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[10]['poster'] }}"

  - platform: template
    sensors:
      plex_recently_movies_fanart_10:
        friendly_name: "Movie 10 fanart"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[10]['fanart'] }}"

  - platform: template
    sensors:
      plex_recently_movies_flag_10:
        friendly_name: "Movie 10 play status"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added_movies', 'data')[10]['flag'] }}"

  - platform: template
    sensors:
      plex_recently_movies_year_10:
        friendly_name: "Movie 10 Year"
        icon_template: mdi:movie-roll
        value_template: "{% set text = state_attr('sensor.recently_added_movies', 'data')[10]['aired'] %}{{ text.split('-')[0].strip()}}" 

  - platform: template
    sensors:
      plex_recently_movies_play_movie_10:
        friendly_name: "Movie 10 play button"
        icon_template: mdi:movie-roll
        value_template: >-
         { "library_name": "Movies", "title": "{{states('sensor.plex_recently_movies_name_10')}}", "year": "{{states('sensor.plex_recently_movies_year_10') }}" }


############# TV Shows Plex ###############
### 1 ###
  - platform: template
    sensors:
      plex_recently_tvshow_title_1:
        friendly_name: "tv show episode name"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[1]['episode'] }}"

  - platform: template
    sensors:
      plex_recently_tvshow_poster_1:
        friendly_name: "tv show 1 poster"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[1]['poster'] }}"

  - platform: template
    sensors:
      plex_recently_tvshow_fanart_1:
        friendly_name: "tv show 1 fanart"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[1]['fanart'] }}"

  - platform: template
    sensors:
      plex_recently_tvshow_flag_1:
        friendly_name: "tv show 1 play status"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[1]['flag'] }}"


  - platform: template
    sensors:
      plex_recently_tvshow_play_tvshow_1:
        friendly_name: "tv show 1 play button"
        icon_template: mdi:television-classic
        value_template: >-
         { "library_name": "TV_Shows", "show_name": "{{ state_attr('sensor.recently_added_tv_shows', 'data')[1]['title'] }}", "season_number": "{{ state_attr('sensor.recently_added_tv_shows', 'data')[1]['number'].split('E')[-2] | replace('S',' ') }}", "episode_number": "{{state_attr('sensor.recently_added_tv_shows', 'data')[1]['number'].split('E')[1] }}" }

### 2 ###
  - platform: template
    sensors:
      plex_recently_tvshow_title_2:
        friendly_name: "tv show 2 episode name"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[2]['episode'] }}"

  - platform: template
    sensors:
      plex_recently_tvshow_poster_2:
        friendly_name: "tv show 2 poster"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[2]['poster'] }}"

  - platform: template
    sensors:
      plex_recently_tvshow_fanart_2:
        friendly_name: "tv show 2 fanart"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[2]['fanart'] }}"

  - platform: template
    sensors:
      plex_recently_tvshow_flag_2:
        friendly_name: "tv show 2 play status"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[2]['flag'] }}"

  - platform: template
    sensors:
      plex_recently_tvshow_play_tvshow_2:
        friendly_name: "tv show 2 play button"
        icon_template: mdi:television-classic
        value_template: >-
         { "library_name": "TV_Shows", "show_name": "{{ state_attr('sensor.recently_added_tv_shows', 'data')[2]['title'] }}", "season_number": "{{ state_attr('sensor.recently_added_tv_shows', 'data')[2]['number'].split('E')[-2] | replace('S',' ') }}", "episode_number": "{{state_attr('sensor.recently_added_tv_shows', 'data')[2]['number'].split('E')[1] }}" }

### 3 ###
  - platform: template
    sensors:
      plex_recently_tvshow_title_3:
        friendly_name: "tv show 3 episode name"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[3]['episode'] }}"

  - platform: template
    sensors:
      plex_recently_tvshow_poster_3:
        friendly_name: "tv show 3 poster"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[3]['poster'] }}"

  - platform: template
    sensors:
      plex_recently_tvshow_fanart_3:
        friendly_name: "tv show 3 fanart"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[3]['fanart'] }}"

  - platform: template
    sensors:
      plex_recently_tvshow_flag_3:
        friendly_name: "tv show 3 play status"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[3]['flag'] }}"


  - platform: template
    sensors:
      plex_recently_tvshow_play_tvshow_3:
        friendly_name: "tv show 3 play button"
        icon_template: mdi:television-classic
        value_template: >-
         { "library_name": "TV_Shows", "show_name": "{{ state_attr('sensor.recently_added_tv_shows', 'data')[3]['title'] }}", "season_number": "{{ state_attr('sensor.recently_added_tv_shows', 'data')[3]['number'].split('E')[-2] | replace('S',' ') }}", "episode_number": "{{state_attr('sensor.recently_added_tv_shows', 'data')[3]['number'].split('E')[1] }}" }

### 4 ###
  - platform: template
    sensors:
      plex_recently_tvshow_title_4:
        friendly_name: "tv show 4 episode name"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[4]['episode'] }}"

  - platform: template
    sensors:
      plex_recently_tvshow_poster_4:
        friendly_name: "tv show 4 poster"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[4]['poster'] }}"

  - platform: template
    sensors:
      plex_recently_tvshow_fanart_4:
        friendly_name: "tv show 4 fanart"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[4]['fanart'] }}"

  - platform: template
    sensors:
      plex_recently_tvshow_flag_4:
        friendly_name: "tv show 4 play status"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[4]['flag'] }}"


  - platform: template
    sensors:
      plex_recently_tvshow_play_tvshow_4:
        friendly_name: "tv show 4 play button"
        icon_template: mdi:television-classic
        value_template: >-
         { "library_name": "TV_Shows", "show_name": "{{ state_attr('sensor.recently_added_tv_shows', 'data')[4]['title'] }}", "season_number": "{{ state_attr('sensor.recently_added_tv_shows', 'data')[4]['number'].split('E')[-2] | replace('S',' ') }}", "episode_number": "{{state_attr('sensor.recently_added_tv_shows', 'data')[4]['number'].split('E')[1] }}" }

### 5 ###
  - platform: template
    sensors:
      plex_recently_tvshow_title_5:
        friendly_name: "tv show 5 episode name"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[5]['episode'] }}"

  - platform: template
    sensors:
      plex_recently_tvshow_poster_5:
        friendly_name: "tv show 5 poster"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[5]['poster'] }}"

  - platform: template
    sensors:
      plex_recently_tvshow_fanart_5:
        friendly_name: "tv show 5 fanart"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[5]['fanart'] }}"

  - platform: template
    sensors:
      plex_recently_tvshow_flag_5:
        friendly_name: "tv show 5 play status"
        icon_template: mdi:television-classic
        value_template: "{{ state_attr('sensor.recently_added_tv_shows', 'data')[5]['flag'] }}"


  - platform: template
    sensors:
      plex_recently_tvshow_play_tvshow_5:
        friendly_name: "tv show 5 play button"
        icon_template: mdi:television-classic
        value_template: >-
         { "library_name": "TV_Shows", "show_name": "{{ state_attr('sensor.recently_added_tv_shows', 'data')[5]['title'] }}", "season_number": "{{ state_attr('sensor.recently_added_tv_shows', 'data')[5]['number'].split('E')[-2] | replace('S',' ') }}", "episode_number": "{{state_attr('sensor.recently_added_tv_shows', 'data')[5]['number'].split('E')[1] }}" }


1 Like

Hello everybody.
Does anyone know why the recently added sensor is empty?
Thanks

logs logs :grinning:

I have this error when running it. I am within a virtual environment. I don’t know if this changes anything.

those are not the logs needed
look in the ui configuration/ logs

Thanks. Errors appear from other things that I am trying to correct.

The integration created the folders in www.

configuration.yaml

logger:
  default: warning
  logs:
    homeassistant.components.sensor: fatal 
    homeassistant.components.websocket_api: fatal
    homeassistant.components.bluetooth_tracker.device_tracker: fatal

Logs

[BDV-N9200W(http://192.168.0.25:10000/sony)] Unable to connect
10:30:46 – (ADVERTENCIA) Sony Songpal - el mensaje se produjo por primera vez a las 28 de junio de 2021 19:40:31 y aparece 295 veces
[Dormitorio Ana(192.168.0.203):8009] Failed to connect to service ServiceInfo(type='mdns', data='Chromecast-3ff275d6ffb10ffff192eabd6b17d316._googlecast._tcp.local.'), retrying in 5.0s
10:14:40 – (ERROR) /srv/homeassistant/lib/python3.8/site-packages/pychromecast/socket_client.py - el mensaje se produjo por primera vez a las 28 de junio de 2021 20:59:00 y aparece 5 veces
[Dormitorio Ana(192.168.0.203):8009] Heartbeat timeout, resetting connection
10:14:10 – (ADVERTENCIA) /srv/homeassistant/lib/python3.8/site-packages/pychromecast/socket_client.py - el mensaje se produjo por primera vez a las 28 de junio de 2021 20:58:30 y aparece 6 veces
Config entry 'https://192-168-0-115.a7d5360a324945a2b5786e405b790e6f.plex.direct:32400' for plex integration not ready yet: HTTPSConnectionPool(host='192-168-0-115.a7d5360a324945a2b5786e405b790e6f.plex.direct', port=32400): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x9d266a18>: Failed to establish a new connection: [Errno 113] No route to host')); Retrying in background
9:21:16 – (ADVERTENCIA) config_entries.py - el mensaje se produjo por primera vez a las 28 de junio de 2021 21:24:23 y aparece 3 veces
Plex server (https://192-168-0-115.a7d5360a324945a2b5786e405b790e6f.plex.direct:32400) could not be reached: [HTTPSConnectionPool(host='192-168-0-115.a7d5360a324945a2b5786e405b790e6f.plex.direct', port=32400): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x9d266a18>: Failed to establish a new connection: [Errno 113] No route to host'))]
9:21:16 – (ERROR) Plex Media Server - el mensaje se produjo por primera vez a las 28 de junio de 2021 21:24:23 y aparece 3 veces
Websocket to PC-MILE failed, aborting [Error: Too many retries]
9:21:12 – (ERROR) Plex Media Server - el mensaje se produjo por primera vez a las 28 de junio de 2021 21:24:20 y aparece 5 veces
Websocket connection failed, retrying in 15s: Cannot connect to host 192-168-0-115.a7d5360a324945a2b5786e405b790e6f.plex.direct:32400 ssl:default [Connect call failed ('192.168.0.115', 32400)]
9:17:09 – (ERROR) /srv/homeassistant/lib/python3.8/site-packages/plexwebsocket.py - el mensaje se produjo por primera vez a las 28 de junio de 2021 21:16:22 y aparece 16 veces
Update of sensor.l4 is taking over 10 seconds
8:18:13 – (ADVERTENCIA) helpers/entity.py - el mensaje se produjo por primera vez a las 28 de junio de 2021 22:17:12 y aparece 33 veces
Error fetching data: http://192.168.0.4/cm?cmnd=state failed with
7:56:46 – (ERROR) RESTful - el mensaje se produjo por primera vez a las 28 de junio de 2021 22:17:15 y aparece 13 veces
Unexpected exception occurred: 'sessionKey'
1:12:12 – (ERROR) /srv/homeassistant/lib/python3.8/site-packages/plexwebsocket.py - el mensaje se produjo por primera vez a las 1:12:05 y aparece 2 veces
http://192.168.0.115:32400: Client not found at http://192.168.0.115:32400
1:06:42 – (ERROR) /srv/homeassistant/lib/python3.8/site-packages/plexapi/myplex.py
Setup of media_player platform songpal is taking over 10 seconds.
28 de junio de 2021 23:34:36 – (ADVERTENCIA) Reproductor multimedia - el mensaje se produjo por primera vez a las 28 de junio de 2021 21:08:20 y aparece 2 veces
Error while executing automation automation.homeassistant_start: Unable to find service fullykiosk.load_start_url
28 de junio de 2021 19:42:00 – (ERROR) Automatización
homeassistant_start: Error executing script. Service not found for call_service at pos 8: Unable to find service fullykiosk.load_start_url
28 de junio de 2021 19:42:00 – (ERROR) Automatización
Error in 'choose[0]' evaluation: In 'state' (item 1 of 4): In 'state' condition: unknown entity media_player.sony_bravia_tv In 'state' (item 2 of 4): In 'state' condition: unknown entity media_player.samsung_tv In 'state' (item 3 of 4): In 'state' condition: unknown entity media_player.spotify In 'state' (item 4 of 4): In 'state' condition: unknown entity media_player.kok
28 de junio de 2021 19:41:50 – (ADVERTENCIA) helpers/script.py
Invalid option: (possible options: Tyst, Standard, Medium, Turbo, Av)
28 de junio de 2021 19:41:37 – (ADVERTENCIA) Entrada de selección
Can't connect to eWeLink Cloud
28 de junio de 2021 19:41:36 – (ADVERTENCIA) Sonoff (integración personalizada)
Login error: None, region: us
28 de junio de 2021 19:41:36 – (ERROR) Sonoff (integración personalizada)
Coolkit API error: Cannot connect to host us-api.coolkit.cc:8080 ssl:default [None]
28 de junio de 2021 19:41:36 – (ERROR) Sonoff (integración personalizada)
Waiting on integrations to complete setup: sonoff
28 de junio de 2021 19:41:23 – (ADVERTENCIA) bootstrap.py
Entity id already exists - ignoring: calendar.algoritmos_y_est_de_datos_computacion
28 de junio de 2021 19:40:40 – (ERROR) Calendario
Setup of sonoff is taking over 10 seconds.
28 de junio de 2021 19:40:37 – (ADVERTENCIA) /usr/local/lib/python3.8/asyncio/events.py
Setup of calendar platform google is taking over 10 seconds.
28 de junio de 2021 19:40:36 – (ADVERTENCIA) Calendario
Platform songpal not ready yet: Unable to do POST request: Cannot connect to host 192.168.0.25:10000 ssl:default [Connect call failed ('192.168.0.25', 10000)]: None; Retrying in background in 30 seconds
28 de junio de 2021 19:40:31 – (ADVERTENCIA) Reproductor multimedia

i think plex is the least of your issues :grinning:

but it says om the error:
https://192-168-0-115 , no route to host.

make sure you are using the correct ip and maybe try with http insted of https

You likely have issues with DNS rebinding protection. See the docs for the integration and Plex’s documentation.