I have used the following code and it works:
# nach Preis sortiert:
***
{% for entity in expand('group.alle_tankstellen_sensors') | sort(attribute='state') | map(attribute='entity_id') | map('string') | list %}
{% if 'ARAL' in state_attr(entity, 'brand') %}

{% elif 'TotalEnergies' in state_attr(entity, 'brand') %}

{% elif 'BFT' in state_attr(entity, 'brand') %}

{% elif 'JET' in state_attr(entity, 'brand') %}

{% elif 'Esso' in state_attr(entity, 'brand') %}

{% elif 'Shell' in state_attr(entity, 'brand') %}

{% endif %}
{{ state_attr(entity, 'station_name') }}
{{ state_attr(entity, 'street') }} {{ state_attr(entity, 'house_number') }}
{{ state_attr(entity, 'postcode') }} {{ state_attr(entity, 'city') }}
## Preis: {{ states(entity) | replace(".",",") }} €
***
{% endfor %}
But after an Home Assistant Update i get the following Error:
TypeError: argument of type ‘NoneType’ is not iterable
What I must change in my code, to fix the error?