Defining a dictionary for value mapping:
I used following template sensor:
- name: "My Map"'
unique_id: my_map
state: ''
attributes: !include my_map.yaml
and the file my_map.yaml contains a dictionary-object:
{
'1041': 'OvExt',
'1042': 'UnExt',
'1069': 'VArCtlVol',
}
to get result of the map:
{{ state_attr("sensor.my_map","1042") }}
result: UnExt
In my usecase, the dictionary has about 130 items. (It is better to store it in own file)