cctvQL — Motion Alert with Natural Language Camera Summary
When a motion sensor triggers, this blueprint queries cctvQL and sends the plain-English answer as a notification. Instead of “motion detected”, you get “A person was seen walking toward the front door at 14:32.”
Works with Frigate, Hikvision, Synology Surveillance Station, Dahua, Milestone XProtect, ONVIF, and Scrypted.
Prerequisites: A running cctvQL server + the cctvQL HA integration (HACS). Full source and setup: github dot com/arunrajiah/cctvql
Features
- Triggered by any binary motion/occupancy sensor
- Configurable natural-language query with
{{ camera_id }}templating - Configurable notification target (
notify.*) - Cooldown to prevent notification floods
Blueprint source
blueprint:
name: cctvQL — Motion Alert with Natural Language Summary
domain: automation
author: arunrajiah
homeassistant:
min_version: "2024.1.0"
input:
motion_sensor:
name: Motion / Occupancy Sensor
selector:
entity:
domain: binary_sensor
device_class: [motion, occupancy]
camera_id:
name: Camera ID
selector: {text: {}}
default: ""
query_template:
name: Query
selector: {text: {}}
default: "What was detected at the {{ camera_id }} camera in the last 5 minutes?"
notify_target:
name: Notification Target
selector: {text: {}}
default: notify.notify
cooldown_minutes:
name: Cooldown (minutes)
selector:
number: {min: 1, max: 60, unit_of_measurement: min}
default: 5
variables:
camera_id: !input camera_id
query_template: !input query_template
notify_target: !input notify_target
trigger:
- platform: state
entity_id: !input motion_sensor
to: "on"
action:
- service: cctvql.query
data:
query: "{{ query_template | replace('{{ camera_id }}', camera_id) }}"
session_id: "blueprint-motion-{{ camera_id }}"
response_variable: cctvql_response
- service: "{{ notify_target }}"
data:
title: "Camera Alert — {{ camera_id }}"
message: "{{ cctvql_response.answer | default('Motion detected.') }}"
mode: single
max_exceeded: silent