Mushroom - Media Player Card

Alors après quelques modif pour ajuster à mes sensors, ton code fonctionne parfaitement chez moi.
Est-ce que tu peux lancer une musique (ou films ou séries) sur plex ensuite tu vas dans les outil de dev dans HA puis tu regarde l’état de tes binary_sensor :

Tu peux voir que je suis en train d’écouter de la musique
Juste pour voir que ceux-ci fonctionne correctement.

Ils sont tous en false.
Mon template.yaml

## Sensors pour l'affichage du lecteur multimédia
- sensors:
      plex_oneplus_music_content_type:
        friendly_name: 'Plex OnePlus Music'
        value_template: >-
          {{ (state_attr('media_player.plex_plex_web_chrome_windows_8','media_content_type') == 'music') }}
      plex_oneplus_tvshow_content_type:
        friendly_name: 'Plex OnePlus TV Show'
        value_template: >-
          {{ (state_attr('media_player.plex_plex_web_chrome_windows_8','media_content_type') == 'tvshow') }}
      plex_oneplus_movie_content_type:
        friendly_name: 'Plex OnePlus Movie'
        value_template: >-
          {{ (state_attr('media_player.plex_plex_web_chrome_windows_8','media_content_type') == 'movie') }}
- sensors:
      plex_recently_all_poster_1:
        friendly_name: "All 1 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added', 'data')[1]['poster'] }}"
- sensors:
      plex_tv_playing:
        value_template: "{{ states.media_player.plex_plex_web_chrome_windows_8.attributes.media_title }}" 
        friendly_name: "Plex TV - Titre"

Mon fichier config:

##Groupe Media Player
media_player:
  - platform: universal
    name: Currently Playing
    children:
      - media_player.plex_plex_web_chrome_windows_1
      - media_player.plex_plex_web_chrome_windows_2
      - media_player.plex_plex_web_chrome_windows_3
      - media_player.plex_plex_web_chrome_windows_4
      - media_player.plex_plex_web_chrome_windows_5
      - media_player.plex_plex_web_chrome_windows_6
      - media_player.plex_plex_web_chrome_windows_7
      - media_player.plex_plex_web_chrome_windows_8
      - media_player.plex_plex_web_chrome_windows_9
      - media_player.plex_plexamp_android
      - media_player.plex_plexamp_android_2

Et « tous mes lecteurs »

Moi ce code est dans mon fichier binary_sensor.yaml et non dans template.yaml
Couper/coller au bon endroit, un reboot HA et tout devrait rentrer dans l’ordre

Je viens de faire les modfis, mais j’ai toujours le même affichage.



binary_sensor.yaml

## Sensors pour l'affichage du lecteur multimédia
- sensors:
      plex_oneplus_music_content_type:
        friendly_name: 'Plex OnePlus Music'
        value_template: >-
          {{ (state_attr('media_player.plex_plex_web_chrome_windows_8','media_content_type') == 'music') }}
      plex_oneplus_tvshow_content_type:
        friendly_name: 'Plex OnePlus TV Show'
        value_template: >-
          {{ (state_attr('media_player.plex_plex_web_chrome_windows_8','media_content_type') == 'tvshow') }}
      plex_oneplus_movie_content_type:
        friendly_name: 'Plex OnePlus Movie'
        value_template: >-
          {{ (state_attr('media_player.plex_plex_web_chrome_windows_8','media_content_type') == 'movie') }}
- sensors:
      plex_recently_all_poster_1:
        friendly_name: "All 1 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added', 'data')[1]['poster'] }}"
- sensors:
      plex_tv_playing:
        value_template: "{{ states.media_player.plex_plex_web_chrome_windows_8.attributes.media_title }}" 
        friendly_name: "Plex TV - Titre"

Configuration.yaml

#  themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
switch: !include switches.yaml
template: !include template.yaml
command_line: !include command_line.yaml

La carte :

type: custom:local-conditional-card
default: show
id: OnePlus
card:
  type: custom:stack-in-card
  keep:
    box_shadow: false
    border_radius: true
    margin: true
    outer_padding: false
    background: false
  cards:
    - type: grid
      columns: 2
      square: false
      cards:
        - type: grid
          columns: 1
          square: false
          cards:
            - type: vertical-stack
              cards:
                - type: custom:mushroom-title-card
                  title: OnePLus
                  subtitle: >
                    {% if is_state('media_player.currently_playing', 'playing')
                    %}
                      Lecture en cours
                    {% elif is_state('media_player.currently_playing', 'paused')
                    %}
                      En pause
                    {% else %}
                      En veille
                    {% endif %}
                  alignment: center
                - type: conditional
                  conditions:
                    - entity: media_player.currently_playing
                      state_not: unavailable
                    - entity: media_player.currently_playing
                      state_not: idle
                  card:
                    type: custom:mushroom-chips-card
                    chips:
                      - type: template
                        icon: mdi:skip-backward
                        entity: media_player.currently_playing
                        tap_action:
                          action: call-service
                          service: media_player.media_previous_track
                          data: {}
                          target:
                            entity_id: media_player.currently_playing
                        card_mod:
                          style:
                            style: |
                              ha-card {
                                margin: 0px 10px 0px 0;
                                --chip-background: rgba(var(--rgb-disabled), 0.15);
                                --ha-card-box-shadow: none;
                                --chip-border-radius: 12px;
                                --chip-height: 35px;
                                --chip-padding: 10px;
                              }
                      - type: template
                        entity: media_player.currently_playing
                        icon: >-
                          {% if is_state('media_player.currently_playing',
                          'playing') %}
                            mdi:pause
                          {% else %}
                            mdi:play
                          {% endif %}
                        tap_action:
                          action: call-service
                          service: media_player.media_play_pause
                          data: {}
                          target:
                            entity_id: media_player.currently_playing
                        card_mod:
                          style:
                            style: |
                              ha-card {
                                margin: 0px 0px 0px 0px;
                                --chip-background: rgba(var(--rgb-disabled), 0.15);
                                --ha-card-box-shadow: none;
                                --chip-border-radius: 12px;
                                --chip-height: 35px;
                                --chip-padding: 10px;
                              }
                      - type: template
                        entity: media_player.currently_playing
                        icon: mdi:skip-forward
                        tap_action:
                          action: call-service
                          service: media_player.media_next_track
                          data: {}
                          target:
                            entity_id: media_player.currently_playing
                        card_mod:
                          style:
                            style: |
                              ha-card {
                                margin: 0px 0px 0px 10px;
                                --chip-background: rgba(var(--rgb-disabled), 0.15);
                                --ha-card-box-shadow: none;
                                --chip-border-radius: 12px;
                                --chip-height: 35px;
                                --chip-padding: 10px;
                              }
                    alignment: center
                - type: conditional
                  conditions:
                    - entity: binary_sensor.plex_oneplus_movie_content_type
                      state: 'on'
                  card:
                    type: custom:mushroom-chips-card
                    chips:
                      - type: template
                        content: >
                          {{ state_attr('media_player.currently_playing',
                          'media_library_title') }}
                        entity: media_player.currently_playing
                        tap_action:
                          action: none
                    alignment: center
                    card_mod:
                      style:
                        style: |
                          ha-card {
                            margin: 20px 0 0 0;
                            --chip-background: rgba(var(--rgb-disabled), 0.15);
                            --ha-card-box-shadow: none;
                            --chip-border-radius: 12px;
                            --chip-height: 35px;
                            --chip-padding: 60px;
                          }
                - type: conditional
                  conditions:
                    - entity: binary_sensor.plex_oneplus_music_content_type
                      state: 'on'
                  card:
                    type: custom:mushroom-title-card
                    title: ''
                    alignment: center
                    subtitle: >-
                      {{ state_attr('media_player.currently_playing',
                      'media_artist') }} - {{
                      state_attr('media_player.currently_playing',
                      'media_title') }}
                - type: conditional
                  conditions:
                    - entity: binary_sensor.plex_oneplus_movie_content_type
                      state: 'on'
                  card:
                    type: custom:mushroom-title-card
                    title: ''
                    alignment: center
                    subtitle: >-
                      {{ state_attr('media_player.currently_playing',
                      'media_title') }}
                - type: conditional
                  conditions:
                    - entity: binary_sensor.plex_oneplus_tvshow_content_type
                      state: 'on'
                  card:
                    type: custom:mushroom-title-card
                    title: ''
                    alignment: center
                    subtitle: >-
                      {{ state_attr('media_player.currently_playing',
                      'media_series_title') }}
        - type: conditional
          conditions:
            - entity: media_player.currently_playing
              state_not: playing
            - entity: media_player.currently_playing
              state_not: paused
          card:
            type: vertical-stack
            cards:
              - type: custom:mushroom-media-player-card
                entity: media_player.currently_playing
                primary_info: none
                secondary_info: none
                icon_type: none
                use_media_info: false
                use_media_artwork: false
                show_volume_level: false
                fill_container: false
                card_mod:
                  style: |
                    ha-card:before {
                      transform: translate3d(0,0,0);
                      -webkit-transform: translate3d(0,0,0);
                      content: "";
                      
                     background: url('/local/mushroom/idle_art.png') center no-repeat;
                      {% if not is_state(config.entity, 'unavailable') and not is_state(config.entity, 'idle') %}
                        background: url( '{{ state_attr(config.entity, "entity_picture") }}') center no-repeat;
                      {% endif %}
                     background-size: contain;

                      border-radius: var(--control-border-radius);
                     {% set media_type = state_attr(config.entity, 'media_content_type') %}
                      {% if media_type == 'tvshow' %}
                        aspect-ratio: 16 / 9;
                      {% elif media_type == 'movie' %}
                        aspect-ratio: 2 / 3;
                      {% else %}
                        aspect-ratio: 1 / 1;
                      {% endif %}
                    }
                    ha-card {
                      transform: translate3d(0,0,0);
                      -webkit-transform: translate3d(0,0,0);
                      border-radius: 30px;
                      overflow: visible !important;
                      box-shadow: none !important;
                      background-color: transparent;
                      border: none !important;
                    }
        - type: conditional
          conditions:
            - entity: binary_sensor.plex_oneplus_tvshow_content_type
              state: 'on'
          card:
            type: vertical-stack
            cards:
              - type: custom:mushroom-media-player-card
                entity: media_player.currently_playing
                primary_info: none
                secondary_info: none
                icon_type: none
                use_media_info: false
                use_media_artwork: false
                show_volume_level: false
                fill_container: false
                card_mod:
                  style: |
                    ha-card:before {
                      transform: translate3d(0,0,0);
                      -webkit-transform: translate3d(0,0,0);
                      content: "";
                      
                     background: url('/local/mushroom/idle_art.png') center no-repeat;
                      {% if not is_state(config.entity, 'unavailable') %}
                        background: url( '{{ state_attr(config.entity, "entity_picture") }}') center no-repeat;
                      {% endif %}
                     background-size: contain;

                      border-radius: var(--control-border-radius);
                     {% set media_type = state_attr(config.entity, 'media_content_type') %}
                      {% if media_type == 'tvshow' %}
                        aspect-ratio: 16 / 9;
                        margin: 0px 0px 0px -45px;
                        margin-top: 1px;
                      {% elif media_type == 'movie' %}
                        aspect-ratio: 2 / 3;
                      {% else %}
                        aspect-ratio: 1 / 1;
                        width: 99%;
                      {% endif %}
                    }
                    ha-card {
                      transform: translate3d(0,0,0);
                      -webkit-transform: translate3d(0,0,0);
                      border-radius: 30px;
                      overflow: visible !important;
                      box-shadow: none !important;
                      background-color: transparent;
                      border: none !important;
                    }
              - type: conditional
                conditions:
                  - entity: binary_sensor.plex_oneplus_tvshow_content_type
                    state: 'on'
                card:
                  type: custom:mushroom-chips-card
                  chips:
                    - type: template
                      content: >
                        {{ state_attr('media_player.currently_playing',
                        'media_library_title') }}
                      entity: media_player.currently_playing
                      tap_action:
                        action: none
                  alignment: center
                  card_mod:
                    style:
                      style: |
                        ha-card {
                          margin: 0px 40px 10px 0px;
                          --chip-background: rgba(var(--rgb-disabled), 0.15);
                          --ha-card-box-shadow: none;
                          --chip-border-radius: 12px;
                          --chip-height: 35px;
                          --chip-padding: 60px;
                        }
        - type: conditional
          conditions:
            - entity: binary_sensor.plex_oneplus_music_content_type
              state: 'on'
          card:
            type: vertical-stack
            cards:
              - type: custom:mushroom-media-player-card
                entity: media_player.currently_playing
                primary_info: none
                secondary_info: none
                icon_type: none
                use_media_info: false
                use_media_artwork: false
                show_volume_level: false
                fill_container: false
                card_mod:
                  style: |
                    ha-card:before {
                      transform: translate3d(0,0,0);
                      -webkit-transform: translate3d(0,0,0);
                      content: "";
                      
                     background: url('/local/mushroom/idle_art.png') center no-repeat;
                      {% if not is_state(config.entity, 'unavailable') %}
                        background: url( '{{ state_attr(config.entity, "entity_picture") }}') center no-repeat;
                      {% endif %}
                     background-size: contain;

                      border-radius: var(--control-border-radius);
                     {% set media_type = state_attr(config.entity, 'media_content_type') %}
                      {% if media_type == 'tvshow' %}
                        aspect-ratio: 16 / 9;
                        margin: 0px -5px -20px -20px;
                        margin-top: 20px;
                      {% elif media_type == 'movie' %}
                        aspect-ratio: 2 / 3;
                      {% else %}
                        aspect-ratio: 1 / 1;
                        width: 99%;
                      {% endif %}
                    ha-card {
                      transform: translate3d(0,0,0);
                      -webkit-transform: translate3d(0,0,0);
                      border-radius: 30px;
                      overflow: visible !important;
                      box-shadow: none !important;
                      background-color: transparent;
                      border: none !important;
                    }
              - type: conditional
                conditions:
                  - entity: binary_sensor.plex_oneplus_music_content_type
                    state: 'on'
                card:
                  type: custom:mushroom-chips-card
                  chips:
                    - type: template
                      content: >
                        {{ state_attr('media_player.currently_playing',
                        'media_library_title') }}
                      entity: media_player.currently_playing
                      tap_action:
                        action: none
                  alignment: center
                  card_mod:
                    style:
                      style: |
                        ha-card {
                          margin: -10px 0px 10px 0;
                          --chip-background: rgba(var(--rgb-disabled), 0.15);
                          --ha-card-box-shadow: none !important;
                          --chip-border-radius: 12px;
                          --chip-height: 35px;
                          --chip-padding: 60px;
                        }
        - type: conditional
          conditions:
            - entity: binary_sensor.plex_oneplus_movie_content_type
              state: 'on'
          card:
            type: vertical-stack
            cards:
              - type: custom:mushroom-media-player-card
                entity: media_player.currently_playing
                primary_info: none
                secondary_info: none
                icon_type: none
                use_media_info: false
                use_media_artwork: false
                show_volume_level: false
                fill_container: false
                card_mod:
                  style: |
                    ha-card:before {
                      transform: translate3d(0,0,0);
                      -webkit-transform: translate3d(0,0,0);
                      content: "";
                      
                     background: url('/local/mushroom/idle_art.png') center no-repeat;
                      {% if not is_state(config.entity, 'unavailable') %}
                        background: url( '{{ state_attr(config.entity, "entity_picture") }}') center no-repeat;
                      {% endif %}
                     background-size: contain;

                      border-radius: var(--control-border-radius);
                     {% set media_type = state_attr(config.entity, 'media_content_type') %}
                      {% if media_type == 'tvshow' %}
                        aspect-ratio: 16 / 9;
                        margin: 0px -5px -20px -20px;
                        margin-top: 20px;
                      {% elif media_type == 'movie' %}
                        aspect-ratio: 2 / 3;
                      {% else %}
                        aspect-ratio: 1 / 1;
                        width: 99%;
                      {% endif %}
                    }
          card_mod:
            style: |
              ha-card:before {
                transform: translate3d(0,0,0);
                -webkit-transform: translate3d(0,0,0);
                content: "";
                position: absolute;
                height: 100%;
                width: 100%;

              ha-card {
                transform: translate3d(0,0,0);
                -webkit-transform: translate3d(0,0,0);
                border-radius: 30px;
                overflow: visible !important;
                box-shadow: none;
                background-color: transparent;
                border: none !important;
              }
              @media (min-width: 1200px) {
                ha-card {
                  margin-top: 30px;
                }
              }
              :host {
                margin-top: 50px !important;
                --album-art-color:      
                {% if not is_state('media_player.currently_playing', 'idle') and not is_state('media_player.currently_playing', 'off') %}
                  {{ state_attr('media_player.currently_playing', "entity_picture") }}
                {% else %}
                  var(--rgb-indigo-color)
                {% endif %};
              }
  card_mod:
    style: |
      ha-card:before {
        transform: translate3d(0,0,0);
        -webkit-transform: translate3d(0,0,0);
        content: "";
        position: absolute;
        height: 100%;
        width: 100%;

        background: url('{{ state_attr('media_player.currently_playing', "entity_picture") }}') center no-repeat;


        filter: blur(150px) saturate(200%);
        background-size: 100% 100%;
      }
      ha-card {
        transform: translate3d(0,0,0);
        -webkit-transform: translate3d(0,0,0);
      }

Essaye d’ajouter ça à ton configuration.yaml :

#  themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
switch: !include switches.yaml
template: !include template.yaml
command_line: !include command_line.yaml
binary_sensor: !include binary_sensor.yaml

Le code pour le binary_sensor.yaml

binary_sensor:
  - platform: template
    sensors:
      plex_iphone_music_content_type:
        friendly_name: 'Plex Iphone Music'
        value_template: >-
          {{ (state_attr('media_player.plex_plex_web_chrome_windows_8','media_content_type') == 'music') }}
      plex_iphone_tvshow_content_type:
        friendly_name: 'Plex Iphone TV Show'
        value_template: >-
          {{ (state_attr('media_player.plex_plex_web_chrome_windows_8','media_content_type') == 'tvshow') }}
      plex_iphone_movie_content_type:
        friendly_name: 'Plex Iphone Movie'
        value_template: >-
          {{ (state_attr('media_player.plex_plex_web_chrome_windows_8','media_content_type') == 'movie') }}

Le code pour le sensor.yaml :

sensor:
  - platform: template
    sensors:
      plex_recently_all_poster_1:
        friendly_name: "All 1 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added', 'data')[1]['poster'] }}"
      plex_tv_playing:
        value_template: "{{ states.media_player.plex_plex_web_chrome_windows_8.attributes.media_title }}" 
        friendly_name: "Plex TV - Titre"

Je dois vraiment louper quelque chose.
configuration.yaml

#  themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
switch: !include switches.yaml
template: !include template.yaml
command_line: !include command_line.yaml
binary_sensor: !include binary_sensor.yaml

##Groupe Media Player
media_player:
  - platform: universal
    name: Currently Playing
    children:
      - media_player.plex_plex_web_chrome_windows_1
      - media_player.plex_plex_web_chrome_windows_2
      - media_player.plex_plex_web_chrome_windows_3
      - media_player.plex_plex_web_chrome_windows_4
      - media_player.plex_plex_web_chrome_windows_5
      - media_player.plex_plex_web_chrome_windows_6
      - media_player.plex_plex_web_chrome_windows_7
      - media_player.plex_plex_web_chrome_windows_8
      - media_player.plex_plex_web_chrome_windows_9
      - media_player.plex_plexamp_android
      - media_player.plex_plexamp_android_2

binary_sensor.yaml

## Sensors pour l'affichage du lecteur multimédia
binary_sensor:
  - platform: template
    sensors:
      plex_iphone_music_content_type:
        friendly_name: 'Plex OnePlus Music'
        value_template: >-
          {{ (state_attr('media_player.plex_plex_web_chrome_windows_8','media_content_type') == 'music') }}
      plex_iphone_tvshow_content_type:
        friendly_name: 'Plex OnePLus TV Show'
        value_template: >-
          {{ (state_attr('media_player.plex_plex_web_chrome_windows_8','media_content_type') == 'tvshow') }}
      plex_iphone_movie_content_type:
        friendly_name: 'Plex OnePlus Movie'
        value_template: >-
          {{ (state_attr('media_player.plex_plex_web_chrome_windows_8','media_content_type') == 'movie') }}
        
#Alarme météo
  - platform: meteoalarm
    country: "france"
    province: "Albert"

template.yaml

- sensor:
      plex_recently_all_poster_1:
        friendly_name: "All 1 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added', 'data')[1]['poster'] }}"
      plex_tv_playing:
        value_template: "{{ states.media_player.plex_plex_web_chrome_windows_8.attributes.media_title }}" 
        friendly_name: "Plex TV - Titre"

Mais j’ai l’erreur suivante lorsque je test le code Yaml

Configuration warnings

Invalid config for ‹ binary_sensor › at configuration.yaml, line 29: required key ‹ platform › not provided

L’implentation du sensor est mauvaise :

- sensor:
      plex_recently_all_poster_1:
        friendly_name: "All 1 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added', 'data')[1]['poster'] }}"
      plex_tv_playing:
        value_template: "{{ states.media_player.plex_plex_web_chrome_windows_8.attributes.media_title }}" 
        friendly_name: "Plex TV - Titre"

A remplacer par :

sensor:
  - platform: template
    sensors:
      plex_recently_all_poster_1:
        friendly_name: "All 1 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added', 'data')[1]['poster'] }}"
      plex_tv_playing:
        value_template: "{{ states.media_player.plex_plex_web_chrome_windows_8.attributes.media_title }}" 
        friendly_name: "Plex TV - Titre"

Vérifie que la notion « sensor » tout en haut n’existe déjà pas. Sinon inutile de la mettre ca te fera une erreur de doublon

La notion de sensor existe déjà dans mon fichier template:

#template:
- sensor:
    - name: "poubelle_grise"
      state: >-
        {% set delta = state_attr('calendar.poubelles_grises', 'start_time') | as_datetime | as_local - today_at() %}
        {{ {0: "Aujourd'hui", 1: "Demain"}.get(delta.days, 'Dans ' ~ delta.days ~  ' Jours') }}
      attributes:
        date: >-
          {{ as_timestamp(states.calendar.poubelles_grises.attributes.start_time) | timestamp_custom("%d/%m/%y", True) }}
        jours: "{{((as_timestamp(states.calendar.poubelles_grises.attributes.start_time)- as_timestamp(now())) /86400+1) | int}}"

    - name: "poubelle_jaune"
      state: >-
        {% set delta = state_attr('calendar.poubelles_jaunes', 'start_time') | as_datetime | as_local - today_at() %}
        {{ {0: "Aujourd'hui", 1: "Demain"}.get(delta.days, 'Dans ' ~ delta.days ~  ' Jours') }}
      attributes:
        date: >-
          {{ as_timestamp(states.calendar.poubelles_jaunes.attributes.start_time) | timestamp_custom("%d/%m/%y", True) }}
        jours: "{{((as_timestamp(states.calendar.poubelles_jaunes.attributes.start_time)- as_timestamp(now())) /86400+1) | int}}"
- sensor:
    - name: "poubelle_grise_jour"
      state: >-
        {% set delta = state_attr('calendar.poubelles_grises', 'start_time') | as_datetime | as_local - today_at() %}
        {{ {0: "Aujourd'hui", 1: "Demain"}.get(delta.days, 'Dans ' ~ delta.days ~  ' Jours') }}
      attributes:
        date: >-
          {{ as_timestamp(states.calendar.poubelles_grises.attributes.start_time) | timestamp_custom("%d/%m/%y", True) }}
        jours: "{{((as_timestamp(states.calendar.poubelles_grises.attributes.start_time)- as_timestamp(now())) /86400+1) | int}}"

    - name: "poubelle_jaune_jour"
      state: >-
        {% set delta = state_attr('calendar.poubelles_jaunes', 'start_time') | as_datetime | as_local - today_at() %}
        {{ {0: "Aujourd'hui", 1: "Demain"}.get(delta.days, 'Dans ' ~ delta.days ~  ' Jours') }}
      attributes:
        date: >-
          {{ as_timestamp(states.calendar.poubelles_jaunes.attributes.start_time) | timestamp_custom("%d/%m/%y", True) }}
        jours: "{{((as_timestamp(states.calendar.poubelles_jaunes.attributes.start_time)- as_timestamp(now())) /86400+1) | int}}"
- sensor:
    - name: Lune
      state: >-
          {% set phases = {'first_quarter': 'Premier quartier', 'full_moon': 'Pleine lune',
                           'last_quarter': 'Dernier quartier', 'new_moon': 'Nouvelle lune',
                           'waning_crescent': 'Dernier croissant', 'waning_gibbous': 'Gibbeuse décroissante',
                           'waxing_crescent': 'Premier croissant', 'waxing_gibbous': 'Gibbeuse croissante'} %}
          {% set phase = states('sensor.moon_phase') %}
          {{ phases[phase] if phase in phases.keys() else 'Error' }}
      picture: /local/image/{{ states('sensor.moon_phase') }}.png
      
-   sensor:
      - platform: template
        sensors:
          plex_recently_all_poster_1:
            friendly_name: "All 1 poster"
            icon_template: mdi:movie-roll
            value_template: "{{ state_attr('sensor.recently_added', 'data')[1]['poster'] }}"
          plex_tv_playing:
            value_template: "{{ states.media_player.plex_plex_web_chrome_windows_9.attributes.media_title }}" 

Mais j’ai toujours le message :

Configuration warnings
Invalid config for ‹ binary_sensor › at configuration.yaml, line 29: required key ‹ platform › not provided

Voila à quoi doit ressembler ton fichier sensor.yaml :

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

Ce code est à mettre dans ton fichier sensor.yaml et non pas le template.yaml.
Il n’y a rien concernant Plex qui se met dans template.yaml.

Pour récupérer les poster/affiches il faut passer par le fichier sensor.yaml
Pour récupérer les media_content_type il faut passer par le binary_sensor.yaml

J’ai créé le fichier sensor.yaml et je l’appelle dans configuration.yaml
sensor.yaml

sensor:
  - platform: template
    sensors:
      plex_recently_all_poster_1:
        friendly_name: "All 1 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added', 'data')[1]['poster'] }}"
        
        
        
#template:
  - platform: template
    sensors:
    - name: "poubelle_grise"
      state: >-
        {% set delta = state_attr('calendar.poubelles_grises', 'start_time') | as_datetime | as_local - today_at() %}
        {{ {0: "Aujourd'hui", 1: "Demain"}.get(delta.days, 'Dans ' ~ delta.days ~  ' Jours') }}
      attributes:
        date: >-
          {{ as_timestamp(states.calendar.poubelles_grises.attributes.start_time) | timestamp_custom("%d/%m/%y", True) }}
        jours: "{{((as_timestamp(states.calendar.poubelles_grises.attributes.start_time)- as_timestamp(now())) /86400+1) | int}}"

    - name: "poubelle_jaune"
      state: >-
        {% set delta = state_attr('calendar.poubelles_jaunes', 'start_time') | as_datetime | as_local - today_at() %}
        {{ {0: "Aujourd'hui", 1: "Demain"}.get(delta.days, 'Dans ' ~ delta.days ~  ' Jours') }}
      attributes:
        date: >-
          {{ as_timestamp(states.calendar.poubelles_jaunes.attributes.start_time) | timestamp_custom("%d/%m/%y", True) }}
        jours: "{{((as_timestamp(states.calendar.poubelles_jaunes.attributes.start_time)- as_timestamp(now())) /86400+1) | int}}"
  - platform: template
    sensors:
    - name: "poubelle_grise_jour"
      state: >-
        {% set delta = state_attr('calendar.poubelles_grises', 'start_time') | as_datetime | as_local - today_at() %}
        {{ {0: "Aujourd'hui", 1: "Demain"}.get(delta.days, 'Dans ' ~ delta.days ~  ' Jours') }}
      attributes:
        date: >-
          {{ as_timestamp(states.calendar.poubelles_grises.attributes.start_time) | timestamp_custom("%d/%m/%y", True) }}
        jours: "{{((as_timestamp(states.calendar.poubelles_grises.attributes.start_time)- as_timestamp(now())) /86400+1) | int}}"

    - name: "poubelle_jaune_jour"
      state: >-
        {% set delta = state_attr('calendar.poubelles_jaunes', 'start_time') | as_datetime | as_local - today_at() %}
        {{ {0: "Aujourd'hui", 1: "Demain"}.get(delta.days, 'Dans ' ~ delta.days ~  ' Jours') }}
      attributes:
        date: >-
          {{ as_timestamp(states.calendar.poubelles_jaunes.attributes.start_time) | timestamp_custom("%d/%m/%y", True) }}
        jours: "{{((as_timestamp(states.calendar.poubelles_jaunes.attributes.start_time)- as_timestamp(now())) /86400+1) | int}}"
  - platform: template
    sensors:
    - name: Lune
      state: >-
          {% set phases = {'first_quarter': 'Premier quartier', 'full_moon': 'Pleine lune',
                           'last_quarter': 'Dernier quartier', 'new_moon': 'Nouvelle lune',
                           'waning_crescent': 'Dernier croissant', 'waning_gibbous': 'Gibbeuse décroissante',
                           'waxing_crescent': 'Premier croissant', 'waxing_gibbous': 'Gibbeuse croissante'} %}
          {% set phase = states('sensor.moon_phase') %}
          {{ phases[phase] if phase in phases.keys() else 'Error' }}
      picture: /local/image/{{ states('sensor.moon_phase') }}.png
      

Binary

## Sensors pour l'affichage du lecteur multimédia
binary_sensor:
  - platform: template
    sensors:
      plex_iphone_music_content_type:
        friendly_name: 'Plex OnePlus Music'
        value_template: >-
          {{ (state_attr('media_player.plex_plex_web_chrome_windows_8','media_content_type') == 'music') }}
      plex_iphone_tvshow_content_type:
        friendly_name: 'Plex OnePLus TV Show'
        value_template: >-
          {{ (state_attr('media_player.plex_plex_web_chrome_windows_8','media_content_type') == 'tvshow') }}
      plex_iphone_movie_content_type:
        friendly_name: 'Plex OnePlus Movie'
        value_template: >-
          {{ (state_attr('media_player.plex_plex_web_chrome_windows_8','media_content_type') == 'movie') }}
        
#Alarme météo
  - platform: meteoalarm
    country: "france"
    province: "Albert"

Mais toujours l’erreur

Configuration will not prevent Home Assistant from starting!
Configuration warnings
Invalid config for ‹ binary_sensor › at configuration.yaml, line 29: required key ‹ platform › not provided
Invalid config for ‹ sensor › at configuration.yaml, line 30: required key ‹ platform › not provided

Alors pour clarifier, tu utilises des fichiers séparés yaml dans ta configuration ?
Ou tout est présent dans ton configuration.yaml ?

Car d’après ton message d’erreur j’ai l’impression que tu mets tes codes dans le configuration.yaml

PS: balance ton configuration.yaml complet que je regarde ça (en masquant les infos sensible si besoin)

J’utilise des fichiers séparés, voici le code complet

# Loads default set of integrations. Do not remove.
default_config:

#Frigate
expose_camera_stream_source:

# Load frontend themes from the themes folder
frontend:
  extra_module_url:
    - /hacsfiles/Bubble-Card/bubble-pop-up.js
    - /hacsfiles/lovelace-card-mod/card-mod.js
    - /hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js
  themes:
    versatile_thermostat_theme:
      state-binary_sensor-safety-on-color: "#FF0B0B"
      state-binary_sensor-power-on-color: "#FF0B0B"
      state-binary_sensor-window-on-color: "rgb(156, 39, 176)"
      state-binary_sensor-motion-on-color: "rgb(156, 39, 176)"
      state-binary_sensor-presence-on-color: "lightgreen"
      state-binary_sensor-running-on-color: "orange"

#  themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
switch: !include switches.yaml
template: !include template.yaml
command_line: !include command_line.yaml
binary_sensor: !include binary_sensor.yaml
sensor: !include sensor.yaml

homeassistant:
  customize: !include customize.yaml
  
##Groupe Media Player
media_player:
  - platform: universal
    name: Currently Playing
    children:
      - media_player.plex_plex_web_chrome_windows_1
      - media_player.plex_plex_web_chrome_windows_2
      - media_player.plex_plex_web_chrome_windows_3
      - media_player.plex_plex_web_chrome_windows_4
      - media_player.plex_plex_web_chrome_windows_5
      - media_player.plex_plex_web_chrome_windows_6
      - media_player.plex_plex_web_chrome_windows_7
      - media_player.plex_plex_web_chrome_windows_8
      - media_player.plex_plex_web_chrome_windows_9
      - media_player.plex_plexamp_android
      - media_player.plex_plexamp_android_2

#Photo MétéoFrance pour la page Weather
camera:
- platform: local_file
  name: MF_alerte_today
  file_path: /config/www/image/meteo_france_alertes_today.jpg
    
- platform: local_file
  name: MF_alerte_tomorrow
  file_path: /config/www/image/meteo_france_alertes_tomorrow.jpg

# Telegram Bot
telegram_bot:
  - platform: polling
    api_key: !secret telegram_token
    allowed_chat_ids: !secret id_telegram

# Notifier
notify:
  - platform: telegram
    name: xxxx
    chat_id: !secret id_telegram



#InfluxDB
#influxdb:
#  host: a0d7b954_influxdb
#  port: 8086
#  database: homeassistantDB
#  username: !secret influxdb_user
#  password: !secret influxdb_pwd
#  max_retries: 3
#  default_measurement: state
#  tags_attributes:
#    - friendly_name
#  include:
#    domains:
#      - sensor
#      - binary_sensor

# Google Assistant
#google_assistant:
#  project_id: home-assistant-votre_project_ID
#  service_account: !include homer-403316-b120e8e92054.json
#  exposed_domains:
#    - script

# Example configuration.yaml entry
proximity:
  x:
    zone: home
    ignored_zones:
      - work
    devices:
      - person.x
      - device_tracker.x
    tolerance: 50
    unit_of_measurement: km
  x:
    zone: home
    ignored_zones:
      - work
    devices:
      - person.x
      - device_tracker.iphone_de_x
    tolerance: 50
    unit_of_measurement: km


# Xiaomi Vaccum Map
#camera:
#  - platform: xiaomi_cloud_map_extractor
#    host: !secret xiaomi_vacuum_host
#    token: !secret xiaomi_vacuum_token
#    username: !secret xiaomi_cloud_username
#    password: !secret xiaomi_cloud_password
#    name: "My Vaccum Camera"
#    colors:
#      color_map_inside: [32, 115, 185]
#      color_map_outside: [19, 87, 148]
#      color_map_wall: [100, 196, 254]
#      color_map_wall_v2: [93, 109, 126]
#      color_grey_wall: [93, 109, 126]
#      color_ignored_obstacle: [0, 0, 0, 127]
#      color_ignored_obstacle_with_photo: [0, 0, 0, 127]
#      color_obstacle: [0, 0, 0, 127]
#      color_obstacle_with_photo: [0, 0, 0, 127]
#      color_path: [147, 194, 238]
#      color_goto_path: [0, 255, 0]
#      color_predicted_path: [255, 255, 0, 0]
#      color_cleaned_area: [127, 127, 127, 127]
#      color_zones: [0xAD, 0xD8, 0xFF, 0x8F]
#      color_zones_outline: [0xAD, 0xD8, 0xFF]
#      color_virtual_walls: [255, 0, 0]
#      color_new_discovered_area: [64, 64, 64]
#      color_no_go_zones: [255, 33, 55, 127]
#      color_no_go_zones_outline: [255, 0, 0]
#      color_no_mop_zones: [163, 130, 211, 127]
#      color_no_mop_zones_outline: [163, 130, 211]
#      color_charger: [0x66, 0xfe, 0xda, 0x7f]
#      color_robo: [75, 235, 149]
#      color_room_names: [0, 0, 0]
#      color_unknown: [0, 0, 0]
#      color_scan: [0xDF, 0xDF, 0xDF]
#    room_colors:
#      1: [240, 178, 122]
#      2: [133, 193, 233]
#      3: [217, 136, 128]
#      4: [52, 152, 219]
#      5: [205, 97, 85]
#      6: [243, 156, 18]
#      7: [88, 214, 141]
#      8: [245, 176, 65]
#      9: [252, 212, 81]
#      10: [72, 201, 176]
#      11: [84, 153, 199]
#      12: [133, 193, 233]
#      13: [245, 176, 65]
#      14: [82, 190, 128]
#      15: [72, 201, 176]
#      16: [165, 105, 18]
#    draw:
#      - charger
#      - cleaned_area
#      - goto_path
#      - ignored_obstacles
#      - ignored_obstacles_with_photo
#      - no_go_zones
#      - no_mopping_zones
#      - obstacles
#      - obstacles_with_photo
#      - path
#      - predicted_path
#      - room_names
#      - vacuum_position
#      - virtual_walls
#      - zones
#    texts:
#      - text: "Room 1"
#        x: 25
#        y: 25
#        color: [125, 20, 213]
#      - text: "Room 2"
#        x: 25
#        y: 75
#        color: [125, 20, 213, 127]
#        font: "FreeSans.ttf"
#        font_size: 25
#    map_transformation:
#      scale: 2
#      rotate: 90
#      trim:
#        top: 10
#        bottom: 20
#        left: 30
#        right: 40
#    sizes:
#      charger_radius: 4
#      vacuum_radius: 6.5
#      path_width: 1
#      obstacle_radius: 3
#      ignored_obstacle_radius: 3
#      obstacle_with_photo_radius: 3
#      ignored_obstacle_with_photo_radius: 3
#    attributes:
#      - calibration_points
#      - charger
#      - cleaned_rooms
#      - country
#      - goto
#      - goto_path
#      - goto_predicted_path
#      - image
#      - is_empty
#      - map_name
#      - no_go_areas
#      - no_mopping_areas
#      - obstacles
#      - ignored_obstacles
#      - obstacles_with_photo
#      - ignored_obstacles_with_photo
#      - path
#      - room_numbers
#      - rooms
#      - vacuum_position
#      - vacuum_room
#      - vacuum_room_name
#      - walls
#      - zones
#    scan_interval:
#      seconds: 10
#    auto_update: true

Oki c’est bon pour moi.
Maintenant montre moi ton fichier sensor.yaml complet

Le fichier sensor

sensor:
  - platform: template
    sensors:
      plex_recently_all_poster_1:
        friendly_name: "All 1 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added', 'data')[1]['poster'] }}"
        
        
        
#template:
  - platform: template
    sensors:
    - name: "poubelle_grise"
      state: >-
        {% set delta = state_attr('calendar.poubelles_grises', 'start_time') | as_datetime | as_local - today_at() %}
        {{ {0: "Aujourd'hui", 1: "Demain"}.get(delta.days, 'Dans ' ~ delta.days ~  ' Jours') }}
      attributes:
        date: >-
          {{ as_timestamp(states.calendar.poubelles_grises.attributes.start_time) | timestamp_custom("%d/%m/%y", True) }}
        jours: "{{((as_timestamp(states.calendar.poubelles_grises.attributes.start_time)- as_timestamp(now())) /86400+1) | int}}"

    - name: "poubelle_jaune"
      state: >-
        {% set delta = state_attr('calendar.poubelles_jaunes', 'start_time') | as_datetime | as_local - today_at() %}
        {{ {0: "Aujourd'hui", 1: "Demain"}.get(delta.days, 'Dans ' ~ delta.days ~  ' Jours') }}
      attributes:
        date: >-
          {{ as_timestamp(states.calendar.poubelles_jaunes.attributes.start_time) | timestamp_custom("%d/%m/%y", True) }}
        jours: "{{((as_timestamp(states.calendar.poubelles_jaunes.attributes.start_time)- as_timestamp(now())) /86400+1) | int}}"
  - platform: template
    sensors:
    - name: "poubelle_grise_jour"
      state: >-
        {% set delta = state_attr('calendar.poubelles_grises', 'start_time') | as_datetime | as_local - today_at() %}
        {{ {0: "Aujourd'hui", 1: "Demain"}.get(delta.days, 'Dans ' ~ delta.days ~  ' Jours') }}
      attributes:
        date: >-
          {{ as_timestamp(states.calendar.poubelles_grises.attributes.start_time) | timestamp_custom("%d/%m/%y", True) }}
        jours: "{{((as_timestamp(states.calendar.poubelles_grises.attributes.start_time)- as_timestamp(now())) /86400+1) | int}}"

    - name: "poubelle_jaune_jour"
      state: >-
        {% set delta = state_attr('calendar.poubelles_jaunes', 'start_time') | as_datetime | as_local - today_at() %}
        {{ {0: "Aujourd'hui", 1: "Demain"}.get(delta.days, 'Dans ' ~ delta.days ~  ' Jours') }}
      attributes:
        date: >-
          {{ as_timestamp(states.calendar.poubelles_jaunes.attributes.start_time) | timestamp_custom("%d/%m/%y", True) }}
        jours: "{{((as_timestamp(states.calendar.poubelles_jaunes.attributes.start_time)- as_timestamp(now())) /86400+1) | int}}"
  - platform: template
    sensors:
    - name: Lune
      state: >-
          {% set phases = {'first_quarter': 'Premier quartier', 'full_moon': 'Pleine lune',
                           'last_quarter': 'Dernier quartier', 'new_moon': 'Nouvelle lune',
                           'waning_crescent': 'Dernier croissant', 'waning_gibbous': 'Gibbeuse décroissante',
                           'waxing_crescent': 'Premier croissant', 'waxing_gibbous': 'Gibbeuse croissante'} %}
          {% set phase = states('sensor.moon_phase') %}
          {{ phases[phase] if phase in phases.keys() else 'Error' }}
      picture: /local/image/{{ states('sensor.moon_phase') }}.png
      

Et tu as une erreur avec ce fichier lorsque tu vérifie la config ?

Oui, j’ai le message

Configuration warnings

Invalid config for ‹ binary_sensor › at configuration.yaml, line 29: required key ‹ platform › not provided Invalid config for ‹ sensor › at configuration.yaml, line 30: required key ‹ platform › not provided

Remplace ton code par celui-ci pour voir

sensor:
  - platform: template
    sensors:
      plex_recently_all_poster_1:
        friendly_name: "All 1 poster"
        icon_template: mdi:movie-roll
        value_template: "{{ state_attr('sensor.recently_added', 'data')[1]['poster'] }}"
        
  - platform: template
    sensors:
    - name: "poubelle_grise"
      state: >-
        {% set delta = state_attr('calendar.poubelles_grises', 'start_time') | as_datetime | as_local - today_at() %}
        {{ {0: "Aujourd'hui", 1: "Demain"}.get(delta.days, 'Dans ' ~ delta.days ~  ' Jours') }}
      attributes:
        date: >-
          {{ as_timestamp(states.calendar.poubelles_grises.attributes.start_time) | timestamp_custom("%d/%m/%y", True) }}
        jours: "{{((as_timestamp(states.calendar.poubelles_grises.attributes.start_time)- as_timestamp(now())) /86400+1) | int}}"

    - name: "poubelle_jaune"
      state: >-
        {% set delta = state_attr('calendar.poubelles_jaunes', 'start_time') | as_datetime | as_local - today_at() %}
        {{ {0: "Aujourd'hui", 1: "Demain"}.get(delta.days, 'Dans ' ~ delta.days ~  ' Jours') }}
      attributes:
        date: >-
          {{ as_timestamp(states.calendar.poubelles_jaunes.attributes.start_time) | timestamp_custom("%d/%m/%y", True) }}
        jours: "{{((as_timestamp(states.calendar.poubelles_jaunes.attributes.start_time)- as_timestamp(now())) /86400+1) | int}}"

    - name: "poubelle_grise_jour"
      state: >-
        {% set delta = state_attr('calendar.poubelles_grises', 'start_time') | as_datetime | as_local - today_at() %}
        {{ {0: "Aujourd'hui", 1: "Demain"}.get(delta.days, 'Dans ' ~ delta.days ~  ' Jours') }}
      attributes:
        date: >-
          {{ as_timestamp(states.calendar.poubelles_grises.attributes.start_time) | timestamp_custom("%d/%m/%y", True) }}
        jours: "{{((as_timestamp(states.calendar.poubelles_grises.attributes.start_time)- as_timestamp(now())) /86400+1) | int}}"

    - name: "poubelle_jaune_jour"
      state: >-
        {% set delta = state_attr('calendar.poubelles_jaunes', 'start_time') | as_datetime | as_local - today_at() %}
        {{ {0: "Aujourd'hui", 1: "Demain"}.get(delta.days, 'Dans ' ~ delta.days ~  ' Jours') }}
      attributes:
        date: >-
          {{ as_timestamp(states.calendar.poubelles_jaunes.attributes.start_time) | timestamp_custom("%d/%m/%y", True) }}
        jours: "{{((as_timestamp(states.calendar.poubelles_jaunes.attributes.start_time)- as_timestamp(now())) /86400+1) | int}}"

    - name: Lune
      state: >-
          {% set phases = {'first_quarter': 'Premier quartier', 'full_moon': 'Pleine lune',
                           'last_quarter': 'Dernier quartier', 'new_moon': 'Nouvelle lune',
                           'waning_crescent': 'Dernier croissant', 'waning_gibbous': 'Gibbeuse décroissante',
                           'waxing_crescent': 'Premier croissant', 'waxing_gibbous': 'Gibbeuse croissante'} %}
          {% set phase = states('sensor.moon_phase') %}
          {{ phases[phase] if phase in phases.keys() else 'Error' }}
      picture: /local/image/{{ states('sensor.moon_phase') }}.png

Toujours le même message.

Petite capture du message s’il te plait

1 « J'aime »