Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95343

Notification to State Which Sensor Triggered Manual Alarm

$
0
0

@chris_avfc wrote:

Hi All,

Looking for some help on how to send a notification which states which sensor tripped the manual alarm component, with the added complication of it being in a separate automation to the alarm trigger automation.
I want to keep the two separate so the notification is only sent when the alarm reaches the alarm triggered state, rather than the pending state.

My current code (simplified down to make it easier to read)

# ARMED AWAY TRIGGER
- id: alarm_trigger_away
  alias: Trigger Alarm While Armed Away
  trigger:
    - platform: state
      entity_id: binary_sensor.door_window_sensor_158d0001fd637f #Side Door
      to: 'on'
  condition:
    - condition: state
      entity_id: 'alarm_control_panel.home_alarm'
      state: armed_away
    - condition: state
      entity_id: 'input_boolean.bed_mode'
      state: 'off'
  action:
    - service: alarm_control_panel.alarm_trigger
      entity_id: alarm_control_panel.home_alarm
# ARMED AWAY TRIGGER NOTIFICATION  
- id: alarm_away_trigger_notification
  alias: Send notification when alarm away triggered
  trigger:
    - platform: state
      entity_id: alarm_control_panel.home_alarm
      to: 'triggered'
  action:
    - service: notify.notify
      data_template:
        title: "ALARM!"
        message: "The alarm has been triggered by the {{ trigger.to_state.attributes.friendly_name }} at {{now().strftime('%H:%M %d-%m-%Y')}}." 

Putting the {{ trigger.to_state.attributes.friendly_name }} in the original alarm automation will send the correct sensor (in this case the side door sensor), but moving it to the secondary automation the trigger is the home alarm itself.

Is there a way to have the sensor from the primary automation carry through?

Thanks

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95343

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>