351 lines
12 KiB
YAML
351 lines
12 KiB
YAML
# automations-alarm.yaml – Alarmo & Sécurité
|
||
# Automatisations liées au système d'alarme
|
||
# Version anonymisée — noms, pièces et identifiants remplacés
|
||
|
||
# ─────────────────────────────────────────────
|
||
# DÉCLENCHEMENT ALARME
|
||
# ─────────────────────────────────────────────
|
||
|
||
- alias: Notification déclenchement alarme
|
||
description: Envoie un message de notification quand l'alarme est déclenchée
|
||
triggers:
|
||
- trigger: state
|
||
entity_id: alarm_control_panel.alarmo
|
||
to: triggered
|
||
actions:
|
||
- action: telegram_bot.send_message
|
||
data:
|
||
message: "Alarme déclenchée !"
|
||
target:
|
||
- !secret telegram_chat_user1
|
||
- !secret telegram_chat_user2
|
||
|
||
- alias: Notification alarme mode absence prolongée
|
||
description: Notifie les contacts d'urgence en mode absence prolongée
|
||
triggers:
|
||
- trigger: state
|
||
entity_id: alarm_control_panel.alarmo
|
||
from: armed_vacation
|
||
to: triggered
|
||
actions:
|
||
- action: notify.mobile_app_contact_1
|
||
data:
|
||
message: "Alarme déclenchée !"
|
||
title: "Alarme domicile"
|
||
- action: notify.mobile_app_contact_2
|
||
data:
|
||
title: "Alarme domicile"
|
||
message: "ALARME DÉCLENCHÉE"
|
||
|
||
- alias: Snapshots caméra principale sur alarme
|
||
description: Envoie plusieurs photos + vidéo de la caméra principale sur déclenchement
|
||
triggers:
|
||
- trigger: state
|
||
entity_id: alarm_control_panel.alarmo
|
||
to: triggered
|
||
actions:
|
||
- repeat:
|
||
count: 3
|
||
sequence:
|
||
- action: camera.snapshot
|
||
data:
|
||
filename: /config/www/tmp1.jpg
|
||
target:
|
||
entity_id: camera.camera_principale
|
||
- action: telegram_bot.send_photo
|
||
data:
|
||
verify_ssl: true
|
||
file: /config/www/tmp1.jpg
|
||
target:
|
||
- !secret telegram_chat_user1
|
||
- !secret telegram_chat_user2
|
||
- delay:
|
||
seconds: 1
|
||
- action: camera.record
|
||
data:
|
||
filename: /config/www/clip1.mp4
|
||
duration: 10
|
||
target:
|
||
entity_id: camera.camera_principale
|
||
- action: telegram_bot.send_video
|
||
data:
|
||
verify_ssl: true
|
||
file: /config/www/clip1.mp4
|
||
target:
|
||
- !secret telegram_chat_user1
|
||
- !secret telegram_chat_user2
|
||
|
||
- alias: Snapshots caméra secondaire sur alarme
|
||
description: Envoie plusieurs photos + vidéo de la caméra secondaire sur déclenchement
|
||
triggers:
|
||
- trigger: state
|
||
entity_id: alarm_control_panel.alarmo
|
||
to: triggered
|
||
actions:
|
||
- repeat:
|
||
count: 3
|
||
sequence:
|
||
- action: camera.snapshot
|
||
data:
|
||
filename: /config/www/tmp2.jpg
|
||
target:
|
||
entity_id: camera.camera_secondaire
|
||
- action: telegram_bot.send_photo
|
||
data:
|
||
verify_ssl: true
|
||
file: /config/www/tmp2.jpg
|
||
target:
|
||
- !secret telegram_chat_user1
|
||
- !secret telegram_chat_user2
|
||
- delay:
|
||
seconds: 1
|
||
- action: camera.record
|
||
data:
|
||
filename: /config/www/clip2.mp4
|
||
duration: 10
|
||
target:
|
||
entity_id: camera.camera_secondaire
|
||
- action: telegram_bot.send_video
|
||
data:
|
||
verify_ssl: true
|
||
file: /config/www/clip2.mp4
|
||
target:
|
||
- !secret telegram_chat_user1
|
||
- !secret telegram_chat_user2
|
||
|
||
# ─────────────────────────────────────────────
|
||
# ARMEMENT / DÉSARMEMENT
|
||
# ─────────────────────────────────────────────
|
||
|
||
- alias: Notification armement alarme
|
||
description: Confirme l'armement par notification
|
||
triggers:
|
||
- trigger: state
|
||
entity_id: alarm_control_panel.alarmo
|
||
to: armed_away
|
||
actions:
|
||
- action: telegram_bot.send_message
|
||
data:
|
||
message: "Alarme armée."
|
||
title: "Alarme activée"
|
||
target: !secret telegram_chat_user1
|
||
- action: telegram_bot.send_message
|
||
data:
|
||
message: "Alarme armée."
|
||
title: "Alarme activée"
|
||
target: !secret telegram_chat_user2
|
||
|
||
- alias: Notification désarmement alarme
|
||
description: Confirme le désarmement par notification
|
||
triggers:
|
||
- trigger: state
|
||
entity_id: alarm_control_panel.alarmo
|
||
to: disarmed
|
||
actions:
|
||
- action: telegram_bot.send_message
|
||
data:
|
||
message: "Alarme désactivée."
|
||
title: "Alarme désactivée"
|
||
target:
|
||
- !secret telegram_chat_user1
|
||
- !secret telegram_chat_user2
|
||
|
||
- alias: Désarmement via commande Telegram
|
||
description: Désarme l'alarme via commande bot Telegram
|
||
triggers:
|
||
- trigger: event
|
||
event_type: telegram_callback
|
||
event_data:
|
||
command: /desactive_alarme
|
||
actions:
|
||
- action: alarmo.disarm
|
||
data:
|
||
entity_id: alarm_control_panel.alarmo
|
||
|
||
- alias: Armement via commande Telegram
|
||
description: Arme en mode absence prolongée via commande bot Telegram
|
||
triggers:
|
||
- trigger: event
|
||
event_type: telegram_callback
|
||
event_data:
|
||
command: /arme_alarme
|
||
actions:
|
||
- action: alarmo.arm
|
||
data:
|
||
entity_id: alarm_control_panel.alarmo
|
||
mode: vacation
|
||
|
||
# ─────────────────────────────────────────────
|
||
# SURVEILLANCE À DISTANCE
|
||
# ─────────────────────────────────────────────
|
||
|
||
- alias: Surveillance à distance
|
||
description: Envoie des photos de toutes les caméras sur commande Telegram /garde_alarme
|
||
triggers:
|
||
- trigger: event
|
||
event_type: telegram_callback
|
||
event_data:
|
||
command: /garde_alarme
|
||
actions:
|
||
- repeat:
|
||
count: 5
|
||
sequence:
|
||
- action: camera.snapshot
|
||
data:
|
||
filename: /config/www/tmp1.jpg
|
||
target:
|
||
entity_id: camera.camera_principale
|
||
- action: telegram_bot.send_photo
|
||
data:
|
||
verify_ssl: true
|
||
file: /config/www/tmp1.jpg
|
||
target:
|
||
- !secret telegram_chat_user1
|
||
- !secret telegram_chat_user2
|
||
- action: camera.snapshot
|
||
data:
|
||
filename: /config/www/tmp2.jpg
|
||
target:
|
||
entity_id: camera.camera_secondaire
|
||
- action: telegram_bot.send_photo
|
||
data:
|
||
verify_ssl: true
|
||
file: /config/www/tmp2.jpg
|
||
target:
|
||
- !secret telegram_chat_user1
|
||
- !secret telegram_chat_user2
|
||
|
||
# ─────────────────────────────────────────────
|
||
# SIRÈNE ZIGBEE
|
||
# ─────────────────────────────────────────────
|
||
|
||
- alias: Contrôle sirène Zigbee
|
||
description: Publie le mode sirène (burglar/stop) selon l'état de l'input_boolean
|
||
triggers:
|
||
- trigger: state
|
||
entity_id: input_boolean.sirene_switch
|
||
actions:
|
||
- action: mqtt.publish
|
||
data:
|
||
topic: zigbee2mqtt/sirene/set
|
||
payload_template: >
|
||
{% if is_state('input_boolean.sirene_switch', 'on') %}
|
||
{"warning": {"mode": "burglar"}}
|
||
{% else %}
|
||
{"warning": {"mode": "stop"}}
|
||
{% endif %}
|
||
|
||
# ─────────────────────────────────────────────
|
||
# INTÉGRATIONS CONDITIONNELLES
|
||
# ─────────────────────────────────────────────
|
||
|
||
- alias: Détection Frigate selon état alarme
|
||
description: Active/désactive la détection Frigate selon l'état de l'alarme
|
||
triggers:
|
||
- trigger: state
|
||
entity_id: alarm_control_panel.alarmo
|
||
actions:
|
||
- if:
|
||
- condition: state
|
||
entity_id: alarm_control_panel.alarmo
|
||
state: disarmed
|
||
then:
|
||
- type: turn_off
|
||
device_id: DEVICE_ID_CAMERA_1
|
||
entity_id: switch.frigate_detect_camera_1
|
||
domain: switch
|
||
- type: turn_off
|
||
device_id: DEVICE_ID_CAMERA_2
|
||
entity_id: switch.frigate_detect_camera_2
|
||
domain: switch
|
||
else:
|
||
- type: turn_on
|
||
device_id: DEVICE_ID_CAMERA_1
|
||
entity_id: switch.frigate_detect_camera_1
|
||
domain: switch
|
||
- type: turn_on
|
||
device_id: DEVICE_ID_CAMERA_2
|
||
entity_id: switch.frigate_detect_camera_2
|
||
domain: switch
|
||
|
||
- alias: Extinction lumières à l'armement
|
||
description: Éteint toutes les lumières quand l'alarme passe en mode arming
|
||
triggers:
|
||
- trigger: state
|
||
entity_id: alarm_control_panel.alarmo
|
||
from: disarmed
|
||
to: arming
|
||
actions:
|
||
- type: turn_off
|
||
device_id: DEVICE_ID_LUMIERE_1
|
||
entity_id: switch.lumiere_1
|
||
domain: switch
|
||
- type: turn_off
|
||
device_id: DEVICE_ID_LUMIERE_2
|
||
entity_id: switch.lumiere_2
|
||
domain: switch
|
||
- type: turn_off
|
||
device_id: DEVICE_ID_LUMIERE_3
|
||
entity_id: light.lumiere_3
|
||
domain: light
|
||
- type: turn_off
|
||
device_id: DEVICE_ID_LUMIERE_4
|
||
entity_id: light.lumiere_4
|
||
domain: light
|
||
|
||
- alias: Éclairage plantes en absence
|
||
description: Active l'éclairage des plantes à pleine puissance quand absent depuis 5 min
|
||
triggers:
|
||
- trigger: state
|
||
entity_id: alarm_control_panel.alarmo
|
||
to: armed_away
|
||
for:
|
||
minutes: 5
|
||
actions:
|
||
- type: turn_on
|
||
device_id: DEVICE_ID_LUMIERE_PLANTES_1
|
||
entity_id: light.lumiere_plantes_1
|
||
domain: light
|
||
brightness_pct: 100
|
||
- type: turn_on
|
||
device_id: DEVICE_ID_LUMIERE_PLANTES_2
|
||
entity_id: light.lumiere_plantes_2
|
||
domain: light
|
||
brightness_pct: 100
|
||
|
||
# ─────────────────────────────────────────────
|
||
# CLAVIER PHYSIQUE (BLUEPRINT)
|
||
# ─────────────────────────────────────────────
|
||
|
||
- alias: Clavier physique avec Alarmo
|
||
description: Armement/désarmement via clavier Zigbee à code PIN
|
||
use_blueprint:
|
||
path: Bygood91/frient_keypad_with_alarmo.yaml
|
||
input:
|
||
z2m_keypad_path: zigbee2mqtt/clavier
|
||
z2m_keypad_path_set: zigbee2mqtt/clavier/set
|
||
pin_list: !secret alarmo_pin
|
||
control_panel: alarm_control_panel.alarmo
|
||
pin_control_panel: !secret alarmo_pin
|
||
action_arming:
|
||
- device_id: DEVICE_ID_ALARMO
|
||
domain: alarm_control_panel
|
||
entity_id: alarm_control_panel.alarmo
|
||
type: arm_away
|
||
action_disarmed:
|
||
- device_id: DEVICE_ID_ALARMO
|
||
domain: alarm_control_panel
|
||
entity_id: alarm_control_panel.alarmo
|
||
type: disarm
|
||
code: !secret alarmo_pin
|
||
action_alarm:
|
||
- device_id: DEVICE_ID_ALARMO
|
||
domain: alarm_control_panel
|
||
entity_id: alarm_control_panel.alarmo
|
||
type: trigger
|
||
action_armed_night:
|
||
- device_id: DEVICE_ID_ALARMO
|
||
domain: alarm_control_panel
|
||
entity_id: alarm_control_panel.alarmo
|
||
type: arm_night
|