Split file config show friendly name of sensor that triggers

Im new to HA but trying to set it up in a proper way.
I have split my config in multiple file and folders to keep the configuration.yaml small.
SETUP:
I have 2 automation files: 1 to set the home alarm panel to triggered if one of the door sensors is opened and 1 for a notification to send an update to my mobile if the state of the panel turns to “triggered”
Works like a charm.

Now i try to push the actual door sensor’s name that triggered the home alarm panel to turn to triggered to the notification but of course that does not work as the panel caused the trigger for the notification.

Is there anyway to do this?

See the yams below:
notification_alarm.yaml

  • alias: Manual Send Notification
    description: ‘’
    trigger:
    • platform: state
      entity_id: alarm_control_panel.home_alarm
      to: triggered
      condition: []
      action:
    • service: notify.mobile_app_my_mobile
      data_template:
      message: ‘{{ trigger.to_state.attributes.friendly_name }}’
      mode: single

sound_alarm.yaml

  • alias: Manual Trigger alarm while armed away
    trigger:
    • platform: state
      entity_id:
      - binary_sensor.bijkeuken_door_sensor_aqara_on_off
      - binary_sensor.voordeur_door_sensor_aqara_on_off
      to: ‘on’
      condition:
    • condition: state
      entity_id: alarm_control_panel.home_alarm
      state: armed_away
      action:
    • service: alarm_control_panel.alarm_trigger
      data: {}
      target:
      entity_id: alarm_control_panel.home_alarm

Any help is appreciated.

notification_alarm.yaml

alias: Manual Send Notification
description: ‘’
trigger:
platform: state
entity_id: alarm_control_panel.home_alarm
to: triggered
condition: []
action:
service: notify.mobile_app_my_mobile
data_template:
message: ‘{{ trigger.to_state.attributes.friendly_name }}’
mode: single

This will (as I suppose you noticed) send you the friendly name of the alarm, since that is what is in the trigger.
Note untested… but I think you could set all the door sensors as triggers.
Then the alarm as condition armed.

Now the trigger will be one of the door sensors, but only when alarm is armed and trigger.friendly name will be the friendly name of the binary sensor ( door sensor).

Please make sure to post the code inside a code block.
We can’t copy the automations correctly and it’s much harder to read and spot indentation errors.

Thanks for the quick reply and tip to post as a code block. Maybe I am over completing things in trying to set it up super flexible and splitting everything up. Maybe someone has some tips:
The idea is to have multiple sensors around the house (door, vibration, motion and camera) and depending on what sensor tiggers and the state of the panel (away, armed, vacation) would like to be able to send out different notifications.
e.g door sensors should always send push to mobile and sound the siren for all panel states, but in state holiday if motion is detected bij the outdoor camera it should sent notification to mobile but not sound siren (eg mailman walking on the driveway).

I would like the actual sensor friendly name in the notification.

Any tips on how to set that up flexibly?

I believe the best way is to set up one automation per group (door, vibration, motion and camera).

You could probably make it all in to one automation with different triggers but that is probably more confusing.

Example for doors:

alias: New Automation
description: ''
mode: single
trigger:
  - platform: state
    entity_id: binary_sensor.door1
    to: 'on'
  - platform: state
    entity_id: binary_sensor.door2
    to: 'on'
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: alarm.alarm_panel
            state: armed
        sequence:
          - service: notify.mobile_app_somephone
            data:
              message: >-
                {{ trigger.to_state.attributes.friendly_name }} was triggered
                when alarm was armed
    default: []
  - choose:
      - conditions:
          - condition: state
            entity_id: alarm.alarm_panel
            state: armed_home
        sequence:
          - service: notify.mobile_app_somephone
            data:
              message: >-
                {{ trigger.to_state.attributes.friendly_name }} was triggered
                when alarm was armed_home
    default: []

And then you create one for cameras and so on.