Template to know which sensor is On

Hello I would like to know if someone can help me, how to know from a list of 5 door / window sensors which of them has been the one that has triggered the alarm. to be able to send it by Telegram.

In other words, I have an automation that, based on the change in status, triggers the alarm and I want Telegram to send me the sensor that has changed to ON.

Thanks for the help! a greeting

trigger:
  platform: state
  entity_id:
    - binary_sensor.1
    - binary_sensor.2
    - binary_sensor.3
  to: 'on' 
action:
  service: notify.telegram
  data:
    message: "The sensor that triggered this automation was {{ trigger.to_state.entity_id }}!"

Thnk´s its works!!!

1 Like