State map not working as expected

Dear all,

I am trying to set a hue bulb color based on the next garbage to be collected.
I was able to brake the issue down to my map.

{% set map = {'papier': 'green', 'Mobile Problemabfallsammlung in Burgoberbach, biotonne': 'orange', 'biotonne': 'brown', 'gelberSack':
    'yellow', 'restmuell': 'blue'} %} {% set state =
    states('states.sensor.abfallnaechster.attributes.values()') | first  %}  {{ map[state] if state
    in map else states.sensor.abfallnaechster.attributes.values() | first }}

executed in developer tools template results in “Mobile Problemabfallsammlung in Burgoberbach, biotonne”
However I would expect “orange”.

I am quite new to HA so please excuse if any important information is missing

Working with

{% set map = {'papier': 'green', 'Mobile Problemabfallsammlung in Burgoberbach, biotonne': 'brown', 'biotonne': 'brown', 'gelberSack':'yellow', 'restmuell': 'blue'} %}
{% set state = states.sensor.abfallnaechster.attributes.values() | first  %}

do not set map to anything, it’s an existing function. change the name to something else, like ‘colors’.

also, I don’t think you understand what this is doing

This won’t always give you the correct attributes value.