How to simplify automations

Hello,

I’ve created 3 automations for my Smoke detectors.
Each of them send an alert to the mobile app of me, my wife and our daughter.

I like to simplify them in to one automation, but i still like to know which device triggered the alert.
additionally, i like to send the messages to all our devices, in a simpler way , instead of addressing all phone separately, can i use something like a group?

Current automation for the device “BrandAlarm1ste”
there are 2 more automations for devices

  • BrandAlarmWK
  • BrandAlarmZolder
alias: BrandAlarm1ste
description: ""
trigger:
  - type: smoke
    platform: device
    device_id: 3fe018ddc960f2740ee9248360e5857b
    entity_id: binary_sensor.rookmelder_1ste_smoke
    domain: binary_sensor
condition: []
action:
  - data: {}
    target:
      entity_id: switch.sirene_aan
    action: switch.turn_on
  - delay:
      hours: 0
      minutes: 2
      seconds: 0
      milliseconds: 0
  - data: {}
    target:
      entity_id: switch.sirene_uit
    action: switch.turn_on
  - data:
      message: Brand Alarm 1ste Etage gaat af
      title: Brand Alarm 1ste Etage gaat af
    action: notify.mobile_app_iphone_van_erwin
  - data:
      message: BrandAlarm 1ste Etage gaat af
      title: BrandAlarm 1ste Etage gaat af
    action: notify.mobile_app_iphone_van_jolanda
  - data:
      message: BrandAlarm 1ste Etage gaat af
      title: BrandAlarm 1ste Etage gaat af
    action: notify.mobile_app_iphone_francis_van_amstel
mode: single

Don’t use device triggers, use entity state triggers. Then you can use the trigger template variable (ref).

trigger:
  - platform: state
    entity_id:
      - binary_sensor.rookmelder_1ste_smoke
      - binary_sensor.ID_FOR_BRANDALARMWK
      - binary_sensor.ID_FOR_BRANDALARMZOLDER
    to: 'on'
action:
  - action: switch.turn_on
    target:
      entity_id: switch.sirene_aan
  - delay:
      minutes: 2
  - action: switch.turn_on
    target:
      entity_id: switch.sirene_uit
  - action: notify.mobile_app_iphone_van_erwin
    data:
      message: "{{ trigger.to_state.name }} gaat af"
      title: "{{ trigger.to_state.name }} gaat af"
  - action: notify.mobile_app_iphone_van_jolanda
    data:
      message: "{{ trigger.to_state.name }} gaat af"
      title: "{{ trigger.to_state.name }} gaat af"
  - action: notify.mobile_app_iphone_francis_van_amstel
    data:
      message: "{{ trigger.to_state.name }} gaat af"
      title: "{{ trigger.to_state.name }} gaat af"

The notify.send_message action appears not to support the mobile_app integration at this time, but this might help:

1 Like

I believe you should be able to do that.

have you looked at the docs page for groups?