Recognition with templates

Hi folks,

I have this automation:

alias: Feueralarm
description: Automatisierung wenn Rauchmelder auslösen
trigger:
  - platform: state
    entity_id: >-
      binary_sensor.rauchmelder_keller_smoke_alarm_smoke_detected,
      binary_sensor.rauchmelder_hobbyraum_smoke_alarm_smoke_detected,
      binary_sensor.rauchmelder_wohnzimmer_smoke_alarm_smoke_detected,
      binary_sensor.rauchmelder_flur_smoke_alarm_smoke_detected,
      binary_sensor.rauchmelder_treppenhaus_smoke_alarm_smoke_detected,
      binary_sensor.rauchmelder_obergeschoss_smoke_alarm_smoke_detected,
      binary_sensor.rauchmelder_martina_smoke_alarm_smoke_detected,
      binary_sensor.rauchmelder_patrik_smoke_alarm_smoke_detected,
      binary_sensor.rauchmelder_marc_smoke_alarm_smoke_detected,
      binary_sensor.rauchmelder_dachgeschoss_smoke_alarm_smoke_detected,
      binary_sensor.rauchmelder_schlafzimmer_smoke_alarm_smoke_detected
    to: 'on'
condition: []
action:
  - device_id: 262b5009af176551a32815815bb1313a
    domain: cover
    entity_id: cover.terrassentuer
    type: set_position
    position: 100
  - device_id: 20017b7aa4e2d5605f1eee541b6e98e3
    domain: cover
    entity_id: cover.wohnzimmerfenster
    type: set_position
    position: 100
  - device_id: aae4c0bd24080b6caa509e56ac03c4c8
    domain: cover
    entity_id: cover.kuchenfenster
    type: set_position
    position: 100
  - device_id: 7bcf658781eeef7ec581979ee6d07a72
    domain: cover
    entity_id: cover.fenster_marc
    type: set_position
    position: 100
  - device_id: 822fd45fddcf3bd7f85ff407182dc9a5
    domain: cover
    entity_id: cover.fenster_patrik
    type: set_position
    position: 100
  - device_id: e3704b350d7cc80ed546dc50cd3785ea
    domain: cover
    entity_id: cover.badezimmerfenster
    type: set_position
    position: 100
  - type: turn_on
    device_id: c1214e48bf2e7a6a71c7e0e69525b6fd
    entity_id: switch.high_volume_siren_95_db_and_led_strobe_light
    domain: switch
  - service: notify.familie
    data:
      message: Rauchmelder {{ trigger.entity_id }} hat ausgelöst
mode: single

Everything works quiet fine, but I want to have the configured name of the node in my recognition message an not the cryptic entity.id

What can I do?

      message: Rauchmelder {{ trigger.to_state.name }} hat ausgelöst

NOTE

If you wish, you can also replace the multiple Device Actions with a single service call:

  - service: cover.set_cover_position
    target:
      entity_id:
        - cover.terrassentuer
        - cover.wohnzimmerfenster
        - cover.kuchenfenster
        - cover.fenster_marc
        - cover.fenster_patrik
        - cover.badezimmerfenster
      data:
        position: 100

For more information, refer to the example posted in the Cover documentation.

If those six covers represents all of the covers in your system, you can simple use entity_id: all in the service call.

1 Like