Thanks based on your idea I ended up simply creating a new sensor with the zone friendly_name:
sensor:
- platform: template
scan_interval: 5
sensors:
visonic_exception_count:
value_template: "{{ state_attr('alarm_control_panel.visonic_alarm', 'Comm Exception Count') | int }}"
friendly_name: 'Panel Exception Count'
visonic_panel_status:
value_template: "{{ state_attr('alarm_control_panel.visonic_alarm', 'Panel Status') | title }}"
friendly_name: 'Panel Status'
visonic_panel_mode:
value_template: "{{ state_attr('alarm_control_panel.visonic_alarm', 'Mode') | title }}"
friendly_name: 'Panel Mode'
visonic_panel_last_event:
value_template: "{{ state_attr('alarm_control_panel.visonic_alarm', 'Panel Last Event') | title }}"
friendly_name: 'Last Event'
visonic_panel_alarm_status:
value_template: "{{ state_attr('alarm_control_panel.visonic_alarm', 'Panel Alarm Status') | title }}"
friendly_name: 'Panel Alarm Status'
visonic_panel_trouble_status:
value_template: "{{ state_attr('alarm_control_panel.visonic_alarm', 'Panel Trouble Status') | title }}"
friendly_name: 'Panel Trouble Status'
visonic_panel_last_event_zone:
value_template: >
{% set zones_friendly_names = [
state_attr(states.binary_sensor.visonic_z01.entity_id,'friendly_name'),
state_attr(states.binary_sensor.visonic_z02.entity_id,'friendly_name'),
state_attr(states.binary_sensor.visonic_z03.entity_id,'friendly_name'),
state_attr(states.binary_sensor.visonic_z04.entity_id,'friendly_name'),
state_attr(states.binary_sensor.visonic_z05.entity_id,'friendly_name'),
state_attr(states.binary_sensor.visonic_z06.entity_id,'friendly_name'),
state_attr(states.binary_sensor.visonic_z07.entity_id,'friendly_name'),
state_attr(states.binary_sensor.visonic_z08.entity_id,'friendly_name'),
state_attr(states.binary_sensor.visonic_z09.entity_id,'friendly_name'),
state_attr(states.binary_sensor.visonic_z10.entity_id,'friendly_name'),
state_attr(states.binary_sensor.visonic_z11.entity_id,'friendly_name'),
state_attr(states.binary_sensor.visonic_z12.entity_id,'friendly_name'),
state_attr(states.binary_sensor.visonic_z13.entity_id,'friendly_name'),
state_attr(states.binary_sensor.visonic_z14.entity_id,'friendly_name'),
state_attr(states.binary_sensor.visonic_z15.entity_id,'friendly_name'),
state_attr(states.binary_sensor.visonic_z16.entity_id,'friendly_name'),
state_attr(states.binary_sensor.visonic_z17.entity_id,'friendly_name'),
state_attr(states.binary_sensor.visonic_z18.entity_id,'friendly_name'),
state_attr(states.binary_sensor.visonic_z19.entity_id,'friendly_name')
] %}
{% if 'Zone' in state_attr('alarm_control_panel.visonic_alarm', 'Panel Last Event') %}
{% set zone = state_attr('alarm_control_panel.visonic_alarm', 'Panel Last Event') .split(' / Zone ')[1]|int - 1 %}
{{ zones_friendly_names[zone] }}
{% endif %}
friendly_name: 'Zone Friendly Name'
That way I can use the zone friendly name of the last event where I want.
I am not sure if there is a cleaner way to achieve this because it seems that the array with all the friendly names are always created for each update.
I suppose I would need some kind of global variable, but it doesn’t seem to be easy (I am really starting with Home Assistant, YAML and template).
If somebody has a better idea…