mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-05-12 05:58:58 +00:00
109 lines
2.5 KiB
Markdown
109 lines
2.5 KiB
Markdown
---
|
|
layout: page
|
|
title: "Examples for flashing lights"
|
|
description: "Automation examples for flashing lights in case of an alarm."
|
|
date: 2016-03-30 08:00
|
|
sidebar: true
|
|
comments: false
|
|
sharing: true
|
|
footer: true
|
|
ha_category: Automation Examples
|
|
---
|
|
|
|
#### {% linkable_title Flashing lights triggered by an alarm %}
|
|
|
|
For flashing regular lights in case the the triggering of an alarm.
|
|
|
|
```yaml
|
|
# AlmAct1 - switch to activate the alarm in Room1
|
|
# AlmSnd1 - switch for a buzzer
|
|
|
|
automation:
|
|
- alias: 'Alarm_PIR_Room1'
|
|
trigger:
|
|
platform: state
|
|
entity_id: binary_sensor.PIR1
|
|
state: 'on'
|
|
condition:
|
|
- condition: state
|
|
entity_id: switch.AlmAct1
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: script.alarm_room1
|
|
state: 'off'
|
|
action:
|
|
# start alarm on movement if alarm activated
|
|
# and the alarm is not triggered
|
|
service: script.turn_on
|
|
entity_id: script.alarm_room1
|
|
|
|
- alias: 'flash_room1_start'
|
|
trigger:
|
|
platform: state
|
|
entity_id: switch.AlmSnd1
|
|
state: 'on'
|
|
action:
|
|
service: script.turn_on
|
|
entity_id: script.flash_room1
|
|
|
|
- alias: 'flash_room1_stop'
|
|
trigger:
|
|
platform: state
|
|
entity_id: switch.REL1
|
|
state: 'off'
|
|
condition:
|
|
condition: state
|
|
entity_id: switch.AlmSnd1
|
|
state: 'off'
|
|
action:
|
|
service: script.turn_off
|
|
entity_id: script.flash_room1
|
|
|
|
script:
|
|
alarm_room1:
|
|
alias: Alarm room1
|
|
sequence:
|
|
- alias: Alarm Room1 Start
|
|
service: homeassistant.turn_on
|
|
data:
|
|
entity_id: switch.AlmSnd1
|
|
- alias: Set Ack Room1
|
|
service: homeassistant.turn_on
|
|
data:
|
|
entity_id: input_boolean.ack1
|
|
- alias: email_Room1
|
|
service: notify.email
|
|
data:
|
|
message: 'Movement alarm in Room1'
|
|
- delay:
|
|
# time interval for alarm sound and light flashing
|
|
seconds: 60
|
|
- alias: Alarm Room1 Stop
|
|
service: homeassistant.turn_off
|
|
data:
|
|
entity_id: switch.AlmSnd1
|
|
|
|
flash_room1:
|
|
alias: Flash Room1 On
|
|
sequence:
|
|
- alias: Light Room1 On
|
|
service: homeassistant.turn_on
|
|
data:
|
|
entity_id: switch.REL1
|
|
- delay:
|
|
# time for flash light on
|
|
seconds: 1
|
|
- alias: Light Room1 Off
|
|
service: homeassistant.turn_off
|
|
data:
|
|
entity_id: switch.REL1
|
|
- delay:
|
|
# time for flash light off
|
|
seconds: 1
|
|
- alias: loop_room1
|
|
service: script.turn_on
|
|
data:
|
|
entity_id: script.flash_room1
|
|
```
|
|
|