Reject entity

I tried to reject some entities from my counter sensor, but it does’t work for me.

- platform: template
  sensors:
    count_media_players:
      friendly_name: "Количество включенных плееров"
      value_template: >-
        {{ states. media_player
          |rejectattr ("attributes.entity_id", "defined")
          |selectattr ('state', 'in', ['on','paused', 'playing', 'idle'])
          |reject ('in', ['media_player.evo_150_2','media_player.spotify','media_player.plex_plex_for_android_tv_mibox_s'])
          |list | count }}
- platform: template
  sensors:
    count_media_players:
      friendly_name: "Количество включенных плееров"
      value_template: >-
        {{ states. media_player
          |rejectattr ("attributes.entity_id", "defined")
          |selectattr ('state', 'in', ['on','paused', 'playing', 'idle'])
          |rejectattr ('entity_id', 'in', ['media_player.evo_150_2','media_player.spotify','media_player.plex_plex_for_android_tv_mibox_s'])
          |list | count }}
1 Like