Skip to content

Instantly share code, notes, and snippets.

@tteck
Last active December 5, 2020 18:22
Show Gist options
  • Save tteck/dfe006e1922ae1ea0d9eedb5ab6a3211 to your computer and use it in GitHub Desktop.
Save tteck/dfe006e1922ae1ea0d9eedb5ab6a3211 to your computer and use it in GitHub Desktop.
A blueprint that turns off the selected lights (delayed if needed) when the alarm is armed. (Modified Frenck 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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment