From b22ca8c3be1716c01758405e5a17cccdc26a3d06 Mon Sep 17 00:00:00 2001 From: Home Assistant Version Control Date: Tue, 28 Jul 2026 19:31:30 +0000 Subject: [PATCH] hallway_motion_automation.yaml --- hallway_motion_automation.yaml | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 hallway_motion_automation.yaml diff --git a/hallway_motion_automation.yaml b/hallway_motion_automation.yaml new file mode 100644 index 0000000..2dee865 --- /dev/null +++ b/hallway_motion_automation.yaml @@ -0,0 +1,44 @@ +alias: "Hallway Camera Motion Snapshot" +description: "Takes a snapshot when the Hallway Nest camera detects motion, analyzes it with AI, and sends a notification." +triggers: + - trigger: event.received + target: + entity_id: event.hallway_hallway_camera_motion + options: + event_type: + - camera_motion + - camera_person + - camera_sound +actions: + - variables: + snapshot_filename: "hallway_{{ now().strftime('%Y%m%d_%H%M%S') }}.jpg" + notification_id: "hallway_motion_{{ now().strftime('%Y%m%d_%H%M%S_%f') }}" + - action: camera.snapshot + target: + entity_id: camera.hallway_hallway_camera + data: + filename: "/config/www/{{ snapshot_filename }}" + - delay: + seconds: 2 + - action: ai_task.generate_data + continue_on_error: true + response_variable: ai_profile + data: + task_name: "Hallway Camera Analysis" + entity_id: ai_task.ollama_ai_task_video + instructions: "Describe what you see in this image in brief. Focus on any people, objects, or activities. Text needs to be max 240 characters." + attachments: + - media_content_id: "media-source://media_source/local/{{ snapshot_filename }}" + media_content_type: image/jpeg + - action: notify.notify + continue_on_error: true + data: + title: "Motion Detected - Hallway" + message: "{{ ai_profile.data if ai_profile is defined and 'data' in ai_profile else 'Motion detected, but the AI Task integration failed to return a response.' }}" + - action: persistent_notification.create + data: + title: "Motion Detected - Hallway" + message: "{{ ai_profile.data if ai_profile is defined and 'data' in ai_profile else 'Motion detected, but the AI Task integration failed to return a response.' }}\n![Snapshot](/local/{{ snapshot_filename }})" + notification_id: "{{ notification_id }}" +mode: queued +max: 10