Look-up table to use in multiple automations, scripts, etc

Is it possible to have a lookup table accessible to the whole system, i.e. across automations, scripts, intents, etc?

I’m not sure if this a sensible approach or if it’s possible so guidance would be appreciated. The data in the table would change typically on a timescale of months and would be manually changed.

The use case that best explains what I’d like to achieve is to have one table with multiple columns such as;

Friendly name, Intent name, TV channel name, TV channel number, Set-top box channel name, Set-top box channel number, ....

This would store spoken channel names, provider name for channel, channel number, etc these can then be referenced by any automation, script, intent script, etc. These names and channels vary enough between media_players to make me write different automations for each player however, I think I could make it much easier by having fewer automations that reference the applicable data

So a possibility for my current setup;

BBC One, one, BBC ONE WstHD, 101, BBC One West HD, 101,...
BBC Two, two, BBC Two HD, 102, BBC Two HD, 102,...
...

At the moment in one automation I have a very large nested if to convert a channel name into the correct number, and channel name. I think I could make it much shorter and easier to read plus I can use the same information in multiple locations and not have to update multiple automations when names or channel numbers change.

Chris

Since about 1.5 years that has been possible
2023.4: Custom template macros, and many more new entity dialogs! - Home Assistant (home-assistant.io)

@Hellis81 I think I’m being really dumb, but I can’t see what in that update helps me?

The link goes to macros in templates.
That should be what you want.

Your post is very unclear but just reading the headline then the answer is macros.

For example this:

You have a channel name you need to convert to correct number and channel name?
You already have channel name??

Ah, sorry I was missing the point you made, my bad. I also don’t think I picked the best use case to explain!

In my post I was trying to write in words rather than code. So to clarify, there are multiple possible channel names for the same channel. What it would be called in an intent, the string the broadcaster calls it, the string the provider calls it, cable, satellite, off-air, etc and the channel number that the TV, set top box, etc would use to select the requested channel. What I was after was to have all that info in one place, then to reference in automations, scripts, intents, etc as required.

Time to play!

I will have a play with using a macro and a big if statement, at least it would be in one place to amend and add to as time goes on.

Thank you and sorry for completely missing the point!

Chris