Files
N22/include/automations/snapshots_indkorsel.yaml

40 lines
1.3 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
- alias: 'Indkorsel: Slet gamle snapshots (behold 100)'
description: Køres via webhook fra galleriet sletter alle undtagen de 100 nyeste snapshots og regenererer galleriet.
trigger:
- platform: webhook
webhook_id: indkorsel_prune_100
allowed_methods: [POST]
local_only: true
action:
- action: shell_command.indkorsel_prune_keep_100
- delay: '00:00:02'
- action: shell_command.indkorsel_generate_gallery
mode: single
- alias: 'Snapshot ved person i indkorsel'
description: >
Gemmer et tidsstemplet snapshot + opdaterer latest.jpg + regenererer HTML-galleri,
hver gang binary_sensor.indkoersel_person skifter til 'on'.
trigger:
- platform: state
entity_id: binary_sensor.indkoersel_person
to: 'on'
condition: []
action:
- variables:
ts: "{{ now().strftime('%Y-%m-%d_%H-%M-%S') }}"
# Gem tidsstemplet kopi
- action: camera.snapshot
data:
entity_id: camera.indkoersel_sub
filename: "/config/www/snapshots/indkorsel/{{ ts }}.jpg"
# Overskriv latest.jpg (bruges af local_file-kamera i dashboardet)
- action: camera.snapshot
data:
entity_id: camera.indkoersel_sub
filename: "/config/www/snapshots/indkorsel/latest.jpg"
# Regenerer HTML-galleriet
- action: shell_command.indkorsel_generate_gallery
mode: queued
max: 5