1
0
Fork 0
ansible-home-assistant/configuration/automations/alarm.yaml

329 lines
9.4 KiB
YAML
Raw Normal View History

- id: alarm_away_hallway
2023-01-25 03:09:03 +01:00
alias: '[Alarm] Trigger alarm when not at home - Hallway camera'
2021-01-17 02:59:02 +01:00
trigger:
2023-01-25 03:09:03 +01:00
# Use hallway motion sensor
2021-01-17 02:59:02 +01:00
- platform: state
2023-01-25 03:09:03 +01:00
entity_id: binary_sensor.hallway_motion_sensor
2021-01-17 02:59:02 +01:00
to: 'on'
2023-01-25 03:09:03 +01:00
# Use open/close sensors
2021-01-17 02:59:02 +01:00
- platform: state
2023-01-25 03:09:03 +01:00
entity_id: binary_sensor.bathroom_door_open_close
2021-01-17 02:59:02 +01:00
to: 'on'
- platform: state
2023-01-25 03:09:03 +01:00
entity_id: binary_sensor.front_door_open_close
2021-01-17 02:59:02 +01:00
to: 'on'
2023-01-25 03:09:03 +01:00
# Use lock
- platform: state
entity_id: lock.front_door_lock_doorlock
to: 'unlocked'
condition:
- condition: state
entity_id: alarm_control_panel.home_alarm
state: armed_away
action:
- service: alarm_control_panel.alarm_trigger
entity_id: alarm_control_panel.home_alarm
2023-02-02 15:04:54 +01:00
- service: notify.mobile_app_iphone
data:
title: "ALARM! Pending for disarm"
message: >
{{ state_attr(trigger.entity_id, 'friendly_name') }}
data:
entity_id: camera.hallway
url: "/lovelace-tablet/security"
- service: camera.snapshot
data:
filename: /config/www/cctv/hallway.jpg
target:
entity_id: camera.hallway
- service: notify.home_assistant
data:
2023-02-04 04:32:17 +01:00
message: >
ALARM. Pending to disarm
Motion in hallway - {{ state_attr(trigger.entity_id, 'friendly_name') }}
@everyone
2023-02-02 15:04:54 +01:00
target: [ "1070507369164984372" ]
data:
images:
- "/config/www/cctv/hallway.jpg"
2023-02-04 04:32:17 +01:00
- service: camera.record
data:
duration: 30
lookback: 30
filename: /config/www/cctv/hallway.mp4
target:
entity_id: camera.hallway
- service: notify.home_assistant
data:
message: >
Motion recording
target: [ "1070507369164984372" ]
data:
images:
- "/config/www/cctv/hallway.mp4"
2023-01-25 03:09:03 +01:00
- id: alarm_away_living_roomn
2023-01-25 03:09:03 +01:00
alias: '[Alarm] Trigger alarm when not at home (Living Room)'
trigger:
# Use motion sensors
2021-01-17 02:59:02 +01:00
- platform: state
entity_id: binary_sensor.kitchen_motion_sensor
to: 'on'
2023-02-01 18:03:19 +01:00
- platform: state
entity_id: binary_sensor.office_sensor_motion
to: 'on'
2023-01-30 00:47:05 +01:00
# - platform: state
# entity_id: binary_sensor.kitchen_tabletop_motion_detection
# to: 'on'
2023-01-28 01:11:18 +01:00
# - platform: state
# entity_id: binary_sensor.kitchen_sink_motion_sensor
# to: 'on'
# Use open/close sensors
2021-01-18 23:28:22 +01:00
- platform: state
2021-10-11 20:15:50 +02:00
entity_id: binary_sensor.dining_window_1_open_close
2021-05-10 11:26:51 +02:00
to: 'on'
2021-05-07 01:03:36 +02:00
- platform: state
2021-10-11 20:15:50 +02:00
entity_id: binary_sensor.dining_window_2_open_close
2021-05-10 11:26:51 +02:00
to: 'on'
2021-05-07 01:03:36 +02:00
- platform: state
entity_id: binary_sensor.freezer_door_on_off
2021-05-10 11:26:51 +02:00
to: 'on'
2021-01-18 23:28:22 +01:00
- platform: state
2021-05-07 01:03:36 +02:00
entity_id: binary_sensor.front_door_open_close
2021-05-10 11:26:51 +02:00
to: 'on'
2021-01-18 23:28:22 +01:00
- platform: state
2021-10-11 20:15:50 +02:00
entity_id: binary_sensor.office_window_open_close
2021-05-10 11:26:51 +02:00
to: 'on'
2023-01-25 03:09:03 +01:00
condition:
- condition: state
entity_id: alarm_control_panel.home_alarm
state: armed_away
action:
- service: alarm_control_panel.alarm_trigger
entity_id: alarm_control_panel.home_alarm
2023-02-02 15:04:54 +01:00
- service: notify.mobile_app_iphone
data:
title: "ALARM! Pending for disarm"
message: >
{{ state_attr(trigger.entity_id, 'friendly_name') }}
data:
entity_id: camera.living_room
url: "/lovelace-tablet/security"
- service: camera.snapshot
data:
filename: /config/www/cctv/living_room.jpg
target:
2023-02-07 14:10:00 +01:00
entity_id: camera.living_room
2023-02-02 15:04:54 +01:00
- service: notify.home_assistant
data:
2023-02-04 04:32:17 +01:00
message: >
ALARM. Pending to disarm
Motion in Living Room - {{ state_attr(trigger.entity_id, 'friendly_name') }}
@everyone
2023-02-02 15:04:54 +01:00
target: [ "1070507369164984372" ]
data:
images:
- "/config/www/cctv/living_room.jpg"
2023-02-04 04:32:17 +01:00
- service: camera.record
data:
duration: 30
lookback: 30
filename: /config/www/cctv/living_room.mp4
target:
entity_id: camera.hallway
- service: notify.home_assistant
data:
message: >
Motion recording
target: [ "1070507369164984372" ]
data:
images:
- "/config/www/cctv/living_room.mp4"
2023-01-25 03:09:03 +01:00
2023-02-06 03:20:38 +01:00
- id: alarm_away_bedroom
2023-02-06 03:20:38 +01:00
alias: '[Alarm] Trigger alarm when not at home (Bedroom)'
trigger:
# Use motion sensors
- platform: state
entity_id: binary_sensor.bedroom_motion_occupancy
to: 'on'
# Use open/close sensors
- platform: state
entity_id: binary_sensor.bedroom_window_open_close
to: 'on'
condition:
- condition: state
entity_id: alarm_control_panel.home_alarm
state: armed_away
action:
- service: alarm_control_panel.alarm_trigger
entity_id: alarm_control_panel.home_alarm
- service: camera.snapshot
data:
2023-02-07 14:10:00 +01:00
filename: /config/www/cctv/bedroom.jpg
2023-02-06 03:20:38 +01:00
target:
2023-02-07 14:10:00 +01:00
entity_id: camera.bedroom
2023-02-06 03:20:38 +01:00
- service: notify.home_assistant
data:
message: >
ALARM. Pending to disarm
Motion in Bedroom - {{ state_attr(trigger.entity_id, 'friendly_name') }}
@everyone
target: [ "1070507369164984372" ]
data:
images:
- "/config/www/cctv/bedroom.jpg"
- service: camera.record
data:
duration: 30
lookback: 30
filename: /config/www/cctv/bedroom.mp4
target:
entity_id: camera.bedroom
2023-02-07 14:10:00 +01:00
- service: notify.home_assistant
data:
message: >
Motion recording
target: [ "1070507369164984372" ]
data:
images:
- "/config/www/cctv/bedroom.mp4"
2023-02-06 03:20:38 +01:00
- id: alarm_away_remaining
2023-01-25 03:09:03 +01:00
alias: '[Alarm] Trigger alarm when not at home'
trigger:
# Use motion sensors
- platform: state
2023-01-25 03:09:03 +01:00
entity_id: binary_sensor.bathroom_motion_occupancy
to: 'on'
2023-02-06 03:20:38 +01:00
# - platform: state
# entity_id: binary_sensor.bedroom_motion_occupancy
# to: 'on'
2023-01-25 03:09:03 +01:00
- platform: state
2023-06-07 18:17:45 +02:00
entity_id: binary_sensor.bathroom_shower_sensor_motion
2023-01-25 03:09:03 +01:00
to: 'on'
# Use open/close sensors
2023-02-06 03:20:38 +01:00
# - platform: state
# entity_id: binary_sensor.bedroom_window_open_close
# to: 'on'
2021-01-17 02:59:02 +01:00
condition:
- condition: state
2022-04-30 18:05:15 +02:00
entity_id: alarm_control_panel.home_alarm
2021-01-17 02:59:02 +01:00
state: armed_away
action:
- service: alarm_control_panel.alarm_trigger
2022-04-30 18:05:15 +02:00
entity_id: alarm_control_panel.home_alarm
2023-01-25 03:09:03 +01:00
- service: notify.mobile_app_iphone
data:
title: "ALARM! Pending for disarm"
message: >
{{ state_attr(trigger.entity_id, 'friendly_name') }}
2023-01-25 03:09:03 +01:00
data:
2023-01-29 01:51:33 +01:00
url: "/lovelace-tablet/security"
2021-01-17 02:59:02 +01:00
- id: alarm_away_test_vibration
2023-02-01 18:06:14 +01:00
alias: '[Alarm] Window vibration test'
trigger:
- platform: state
entity_id: binary_sensor.office_vibration
to: 'on'
condition:
# - condition: state
# entity_id: alarm_control_panel.home_alarm
# state: armed_away
action:
# - service: alarm_control_panel.alarm_trigger
# entity_id: alarm_control_panel.home_alarm
- service: notify.mobile_app_iphone
data:
title: "Vibration Test ALARM!"
message: >
{{ state_attr(trigger.entity_id, 'friendly_name') }}
data:
entity_id: camera.living_room
url: "/lovelace-tablet/security"
- id: alarm_night
2021-01-17 02:59:02 +01:00
alias: '[Alarm] Trigger alarm at night'
trigger:
- platform: state
2021-05-07 01:03:36 +02:00
entity_id: binary_sensor.bedroom_window_open_close
2021-05-10 11:26:51 +02:00
to: 'on'
2021-01-18 23:28:22 +01:00
- platform: state
2021-10-11 20:15:50 +02:00
entity_id: binary_sensor.dining_window_1_open_close
2021-05-10 11:26:51 +02:00
to: 'on'
2021-01-18 23:28:22 +01:00
- platform: state
2021-10-11 20:15:50 +02:00
entity_id: binary_sensor.dining_window_2_open_close
2021-05-10 11:26:51 +02:00
to: 'on'
2021-01-18 23:28:22 +01:00
- platform: state
2021-05-07 01:03:36 +02:00
entity_id: binary_sensor.freezer_door_on_off
2021-05-10 11:26:51 +02:00
to: 'on'
2021-05-07 01:03:36 +02:00
- platform: state
entity_id: binary_sensor.front_door_open_close
2021-05-10 11:26:51 +02:00
to: 'on'
2021-05-07 01:03:36 +02:00
- platform: state
2021-10-11 20:15:50 +02:00
entity_id: binary_sensor.office_window_open_close
2021-05-10 11:26:51 +02:00
to: 'on'
2021-01-17 02:59:02 +01:00
condition:
- condition: state
2022-04-30 18:05:15 +02:00
entity_id: alarm_control_panel.home_alarm
2021-01-17 02:59:02 +01:00
state: armed_away
action:
- service: alarm_control_panel.alarm_trigger
2022-04-30 18:05:15 +02:00
entity_id: alarm_control_panel.home_alarm
- service: notify.mobile_app_iphone
data:
title: "ALARM! Pending for disarm"
message: >
{{ state_attr(trigger.entity_id, 'friendly_name') }}
data:
2023-01-29 01:51:33 +01:00
url: "/lovelace-tablet/security"
2021-01-17 02:59:02 +01:00
- id: alarm_arm_away
2021-01-17 02:59:02 +01:00
alias: '[Alarm] Arm away'
trigger:
- platform: zone
2021-05-07 01:03:36 +02:00
entity_id: device_tracker.przemyslaws_iphone
2021-01-17 02:59:02 +01:00
zone: zone.home
event: leave
action:
- service: alarm_control_panel.alarm_arm_away
2022-04-30 18:05:15 +02:00
entity_id: alarm_control_panel.home_alarm
2021-01-17 02:59:02 +01:00
- id: alarm_pending
2021-01-17 02:59:02 +01:00
alias: '[Alarm] Send notification when alarm triggered'
2021-05-07 01:03:36 +02:00
trigger:
- platform: state
2022-04-30 18:05:15 +02:00
entity_id: alarm_control_panel.home_alarm
2021-05-07 01:03:36 +02:00
to: 'pending'
action:
2022-04-29 21:29:59 +02:00
- service: zwave_js.set_config_parameter
2022-04-29 21:42:14 +02:00
data:
parameter: '7'
value: '2'
target:
entity_id: switch.siren_alarm
2021-05-07 01:03:36 +02:00
- service: switch.turn_on
entity_id: switch.siren_switch
- id: alarm_triggered
2021-05-07 01:03:36 +02:00
alias: '[Alarm] Turn on alarm'
2021-01-17 02:59:02 +01:00
trigger:
- platform: state
2022-04-30 18:05:15 +02:00
entity_id: alarm_control_panel.home_alarm
2021-01-17 02:59:02 +01:00
to: 'triggered'
action:
- service: notify.notify
data:
2021-05-07 01:03:36 +02:00
message: "ALARM! The alarm has been triggered"
2022-04-25 00:35:59 +02:00
data:
importance: max
2022-04-29 21:29:59 +02:00
- service: zwave_js.set_config_parameter
2021-05-07 01:03:36 +02:00
data:
2022-04-29 21:29:59 +02:00
parameter: '7'
value: '1'
target:
entity_id: switch.siren_alarm
2021-05-07 01:03:36 +02:00
- service: switch.turn_on
entity_id: switch.siren_switch