Notify Entities Name that Triggered Automation

Hello,

I would like to create an automation that sends me an telegram message as soon as one of the windows at the children’s room gets opened.
So far I manage to get an notification, but I would like it to tell me which window exactly triggered it (= got opened).
I googled about but did not find anything that worked. Can anyone help?
This is my current effort:

- id: '1586006827467'
  alias: Alert Kinderzimmerfenster
  description: ''
  trigger:
  - entity_id: binary_sensor.openclose_42,binary_sensor.openclose_41
    platform: state
    to: 'on'
  condition: []
  action:
  - data:
      data_template:
        message: Some window got opened, {{ trigger.to_state.attributes.friendly_name }}!
    service: notify.telegram_alerts

Ok figured it out with some trial and error. Maybe someone is interested, this works for me:

# put in your automations.yaml
- id: '1586006827467'
  alias: Alert Window
  description: 'Notify if any of the windows get opened and tell me which it is exactly'
  trigger:
  - entity_id: binary_sensor.openclose_42,binary_sensor.openclose_44,binary_sensor.openclose_41
    platform: state
    to: 'on'
  condition: []
  action:
  - data_template:
      message: ' {{ trigger.to_state.attributes.friendly_name }} got opened.'
      title: '*Window Alert*'
    service: notify.telegram_alerts
  - service: notify.lannouncer
    data_template:
      message: ' {{ trigger.to_state.attributes.friendly_name }} got opened.'
3 Likes