[Blueprint] Turn off lights when the alarm is armed

Modified Frenck’s blueprint

blueprint:
  name: Turn off lights when the alarm is armed
  description: A blueprint that turns off the selected lights when the alarm is armed.
  domain: automation
  input:
    alarm:
      name: Alarm Control Panel
      description: Select a Alarm Control Panel
      selector:
        entity:
          domain: alarm_control_panel
    armed_away:
      name: When the alarm is armed "Away"
      default: true
      selector:
        boolean: {}
    armed_home:
      name: When the alarm is armed "Home"
      default: true
      selector:
        boolean: {}
    armed_night:
      name: When the alarm is armed "Night"
      default: true
      selector:
        boolean: {}
    armed_custom_bypass:
      name: When the alarm is armed "Custom Bypass"
      default: false
      selector:
        boolean: {}
    lights:
      name: Lights
      description: Select one or more light to turn off
      selector:
        target:
          entity:
            domain: light
    light_off_wait:
      name: Wait time
      description: Time to wait until the light should be turned off.
      default: 5
      selector:
        number:
          min: 0
          max: 3600
          unit_of_measurement: seconds
trigger:
- platform: state
  entity_id: !input 'alarm'
  to:
  - armed_away
  - armed_custom_bypass
  - armed_home
  - armed_night
variables:
  on_armed_away: !input 'armed_away'
  on_armed_custom_bypass: !input 'armed_custom_bypass'
  on_armed_home: !input 'armed_home'
  on_armed_night: !input 'armed_night'
condition:
- condition: or
  conditions:
  - condition: and
    conditions:
    - '{{ on_armed_away }}'
    - condition: state
      entity_id: !input 'alarm'
      state: armed_away
  - condition: and
    conditions:
    - '{{ on_armed_custom_bypass }}'
    - condition: state
      entity_id: !input 'alarm'
      state: armed_custom_bypass
  - condition: and
    conditions:
    - '{{ on_armed_home }}'
    - condition: state
      entity_id: !input 'alarm'
      state: armed_home
  - condition: and
    conditions:
    - '{{ on_armed_night }}'
    - condition: state
      entity_id: !input 'alarm'
      state: armed_night
action:
- delay: !input light_off_wait
- service: light.turn_off
  target: !input 'lights'

2 Likes