Get Entity where attribute = value

Hi

Looking for some help, I have a bunch of variable entities (based on board games) using the Wibias/hass-variables HACS integration.
What I want to do is identify one of these variables, based on an attribute I’ve assigned.

I have a bunch of these variable entities, as an example:

variable.boardgame_alchemists with the following attributes:
restore: true
last_played:
friendly_name: Alchemists
icon: mdi:dice-6
bgg_link:
entity_image:
image:
tag: 53-9B-1C-1C-10-00-01
color_1: 230, 211, 184
color_2: 149, 107, 66
color_3: 103, 104, 61
color_4: 203, 146, 56
color_5: 100, 48, 90
color_6: 192, 71, 31

What I would like to do is find the entity (name) by the attribute tag.

Ideally I will scan a tag, the ID of the tag can then be used to find this entity and I can use all the attributes to do various things.
I do most of this stuff now, but my automation has gotten a bit unweildy and isn’t an ideal place to store all this kind of information.

I did manage to get this far:
{{ states.variable | selectattr('attributes.tag', 'defined') | list }}
but all it does it provide a huge list of the variables and attributes, which isn’t helpful and not sure where to go from here.

Appreciate any help :slight_smile: