Send push notification only when alarm is armed

I currently have my push notification setup so that I receive a text whenever the front door is opened.

  - alias: Front Door Push Notification Open
    trigger:
      platform: state
      entity_id: binary_sensor.door_window_sensor_158d000423de01
      to: 'on'
    action:
      service: notify.alarm
      data:
        title: "DOOR OPENED"
        message: "Guest house front door has been opened."
  - alias: Front Door Push Notification Closed
    trigger:
      platform: state
      entity_id: binary_sensor.door_window_sensor_158d000423de01
      to: 'off'
    action:
      service: notify.alarm
      data:
        title: "DOOR CLOSED"
        message: "Guest house front door has been closed."

How do I make it so that the push notification only gets forwarded to me if my alarm is also armed?

Thanks,
trwolff04

Use a condition.

2 Likes

Does this look right?

  - alias: Office Push Notification Open
    trigger:
      platform: state
      entity_id: binary_sensor.door_window_sensor_158d000423e13d
      to: 'on'
    condition:
      condition: state
      entity_id: alarm_control_panel.home_alarm
      state: 
        - armed_away
        - armed_home
    action:
      service: notify.alarm
      data:
        title: "WINDOW OPENED"
        message: "Studio window has been opened."

Yeah, in fact it looks exactly like the example in the docs :wink:

1 Like

That’s because it is. I am a quick learner but still pretty bad at this. Tested and it’s working fine. Thanks again.

1 Like