User interface do not work with id but name when same name of entities allowed

This is allowed:
name:Kitchen;entity_id:light.kitchen
name:Kitchen;entity_id:switch.kitchen
name:Kitchen;entity_id:fun.kitchen
But user interface (script, automation) does not work with id of entity, but with name.
I choose fun.kitchen, but always first one light.kitchen is selected.