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

Do not run an automation if one ran just earlier ? (tricky)

$
0
0

I’ve got these 2 automations :

This is notifying me if the alarm goes to “Home” mode, which can be happen manually (via the keypad) or via another HomeAss automation.

- alias: Alarm armed Home
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: alarm_control_panel.home_alarm
      to: armed_home
  action:
    - delay: '00:00:3'
    - service: notify.ha_telegram
      data_template:
        message: >
          {% if states.sensor.last_armed_by_user.state == ''  %}
             Someone has armed the alarm 'Home'
          {% else %}
            {{ states.sensor.last_armed_by_user.state }} has armed the alarm 'Home'
          {% endif %}

This will set the alarm to “Home” after 11pm when no motions for 20 min :

- alias: alarm set to 'home' after 11pm
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id:
      - binary_sensor.hallway_pir
      - binary_sensor.landing_pir
      - binary_sensor.lounge_pir
      - binary_sensor.kitchen_pir
    to: 'off'
    for:
      minutes: 20
  condition:
  - condition: time
    after: '23:00:00'
    before: '06:00:00'
  - condition: state
    entity_id: alarm_control_panel.home_alarm
    state: 'disarmed'
  action:
  - service: alarm_control_panel.alarm_arm_home
    entity_id: alarm_control_panel.home_alarm
  - service: notify.ha_telegram
    data_template:
      message: "Night alarm triggered"

Any idea how could I still receive notifications when the alarm goes to “home” EXCEPT if the trigger was done by the 11PM automation ?

Currently at 11PM I get two notifications :

  • Night alarm triggered
  • Someone has armed the alarm ‘Home’

Ideally I’d prefer to only receive :

  • Night alarm triggered

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 106800

Trending Articles