Using state value as name in picture entity card

I am using the trash information card to show with trashcan I have empty. It makes some sensor with dates. Now I want to make an picture-entity with the picture of the trash can and the date it should be emptied.

But the problem is I cannot get the date as name of the picture card, it always show Object object instead of the date. The config I have right now is

      - entity: sensor.trash_first_next_item
        name:
         {{states.sensor.trash_first_next_date.state}}
        state_image:
          Geen: /local/afvalwijzer/geen.png
          gft: /local/afvalwijzer/gft.png
          papier: /local/afvalwijzer/papier.png
          plastic: /local/afvalwijzer/plastic.png
          restafval: /local/afvalwijzer/grijs.png
        type: picture-entity

I tried to following values for names but all show object object as name:
{{sensor.trash_first_next_date}}
{{states.sensor.trash_first_next_date.state}}
{{states.sensor.trash_first_next_date}}

I also tried to make a sensor:


How can I used the value of the sensor state/value as name of the picture card ?

You cant use templates in Lovelace cards without wrapping the card in this card:

Then it would be:

          - entity: sensor.trash_first_next_item
            name_template: >
             {{ states('sensor.trash_first_next_date') }}

thnx for the suggestion. I am trying to add it., but hassio automatically added codes to the codes even when I use raw editor:

      - type: 'custom:config-template-card'
        variables:
          - 'states[sensor.trash_first_next_item].state'
        entities:
          - sensor.trash_first_next_item
        card:
          type: >-
            ${vars[0] === 'on' ? 'custom:hui-glance-card' :
            'custom:hui-entities-card'}
          entities:
            - entity: sensor.trash_first_next_item
              name: '${vars[1] === ''open'' ? ''Close the garage!'' : ''Helaas''}'