Guide for CCTV Snapshot on motion, send to Google Generative AI & get notification with description & snapshot

Maybe you can guide us? :wink:

Since noone else has answered, I found something that helped me to finally get it working again.

1 Like

I tried that guide. But I cannot get images from the camera in my iPhone notifications :frowning:

It is important that you allow external access to the correct folders in your configuration.yaml.
image
llm vision uses different folders to store their images in.

Also make sure that you use the correct description for the pictures to load in the notifications.
For example, the notification to my Telegram bot uses the direct key_frame

Where the direct HA notification to the phone of my wife uses an extra .replace to load the image file.

I’m posting my current configuration for reference, hope it helps.

alias: Melding bij detectie Camera deurbel (AI)
description: ""
triggers:
  - type: turned_on
    device_id: *camera*
    entity_id: *camera person detection*
    domain: binary_sensor
    trigger: device
conditions:
  - condition: and
    conditions:
      - condition: time
        after: "04:30:00"
        before: "23:00:00"
actions:
  - alias: Camera - Deurbel - Snapshot, AI & Notification
    sequence:
      - action: llmvision.stream_analyzer
        metadata: {}
        data:
          remember: true
          use_memory: false
          max_frames: 3
          include_filename: true
          target_width: 1280
          max_tokens: 100
          generate_title: true
          expose_images: true
          provider: *AI provider*
          model: gemini-2.0-flash
          message: >-
            De deurbel camera heeft beweging gedetecteerd in de voortuin.
            Beschrijf in het Nederlands op een grappige manier aan de hand van
            de beelden wat er gebeurt. 

            Beschrijf geen stilstaande objecten of gebouwen of struiken. Je
            bericht moet kort genoeg zijn om in een telefoonmelding te passen.
          image_entity:
            - camera.
          duration: 3
        response_variable: output
      - alias: Stuur via Telegram naar George
        action: telegram_bot.send_photo
        data:
          authentication: digest
          config_entry_id: *Telegram bot*
          caption: "{{ output['response_text'] }}"
          file: "{{ output.key_frame }}"
      - action: *notify.mobile_app_*
        metadata: {}
        data:
          message: "{{ output['response_text'] }}"
          data:
            image: "{{output.key_frame.replace('/media', '/media/local')}}"
            url: homeassistant://navigate/dashboard-deurbel/0
        enabled: true
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
mode: single

1 Like