Roomba Sensor Template help

Hello,
I´ve tried to create a sensor template for the first time for my roomba, to see wether the trash bin is full empty.
Right now, the bin is full, but the sensor tells me still empty. Have I missed something?

image

This is the code

  vacy_trash:
    friendly_name: "Vacy Bin"
    value_template: >-
      {% if ('states.vacuum.vacy.attributes.bin_full', 'false') %}
        empty
      {% else %}
        full
      {% endif %}
    icon_template: >-
      {% if ('states.vacuum.vacy.attributes.bin_full', 'false') %}
        mdi:delete-outline
      {% else %}
        mdi:delete
      {% endif %}

Specify the entity that Home Assistant should monitor. Also modify the test used to determine if the attribute is false.

  vacy_trash:
    friendly_name: "Vacy Bin"
    entity_id: vacuum.vacy
    value_template: >-
      {% if is_state_attr('vacuum.vacy', 'bin_full', 'false') %}
        empty
      {% else %}
        full
      {% endif %}
    icon_template: >-
      {% if is_state_attr('vacuum.vacy', 'bin_full', 'false') %}
        mdi:delete-outline
      {% else %}
        mdi:delete
      {% endif %}

For more information see:

It can also be reduced to:

  vacy_trash:
    friendly_name: "Vacy Bin"
    entity_id: vacuum.vacy
    value_template: >-
      {{ 'full' if is_state_attr('vacuum.vacy', 'bin_full', 'true') else 'empty' }}
    icon_template: >-
      {{ 'mdi:delete' if is_state_attr('vacuum.vacy', 'bin_full', 'true') else 'mdi:delete-outline' }}

EDIT
Fixed silly mistakes.

no need for ‘then’ is there?

vacy_trash:
    friendly_name: "Vacy Bin"
    entity_id: vacuum.vacy
    value_template: >
      {% if is_state_attr('vacuum.vacy', 'bin_full', 'false') %} empty
      {% else %}  full
      {% endif %}
    icon_template: >
      {% if is_state_attr('vacuum.vacy', 'bin_full', 'false') %} mdi:delete-outline
      {% else %} mdi:delete
      {% endif %}

also, in the short notation, you need an ‘if’ there don’t you?

 vacy_trash:
    friendly_name: "Vacy Bin"
    entity_id: vacuum.vacy
    value_template: >
      {{ 'full' if is_state_attr('vacuum.vacy', 'bin_full', 'true') else 'empty' }}
    icon_template: >
      {{ 'mdi:delete' if is_state_attr('vacuum.vacy', 'bin_full', 'true') else 'mdi:delete-outline' }}

in both templates the entity_id can be left out probably.

Yep, thanks. I wasn’t paying much attention to the first version of the template and was more focused on the reduced version.

Thanks guys, it´s working!