alias: Generate AI Description of Driveway Camera sequence: - variables: todays_date: "{{ now().strftime('%Y-%m-%d') }}" timestamp: "{{ now().strftime('%H:%M:%S') }}" - data: folder: /config/www/{{ todays_date }} action: shell_command.create_folder - data: entity_id: camera.driveway filename: /config/www/{{ todays_date }}/driveway_snapshot1_{{ timestamp }}.jpg action: camera.snapshot - delay: hours: 0 minutes: 0 seconds: 0 milliseconds: 500 - data: entity_id: camera.driveway filename: /config/www/{{ todays_date }}/driveway_snapshot2_{{ timestamp }}.jpg action: camera.snapshot - delay: hours: 0 minutes: 0 seconds: 0 milliseconds: 500 - data: entity_id: camera.driveway filename: /config/www/{{ todays_date }}/driveway_snapshot3_{{ timestamp }}.jpg action: camera.snapshot - data: prompt: >- Motion has been detected, compare and very briefly describe what you see in the following sequence of images from my driveway camera. What do you think caused the motion alarm? If an animal, a person, or car is present, describe them in detail. Do not describe the gray f-150 unless it is moving. Do not describe stationary objects, or buildings. If you see no obvious signs of motion, reply with just "No Obvious Motion Detected". Make your description a bit cheeky. Your message should be less than 250 characters. image_filename: - /config/www/{{ todays_date }}/driveway_snapshot1_{{ timestamp }}.jpg - /config/www/{{ todays_date }}/driveway_snapshot2_{{ timestamp }}.jpg - /config/www/{{ todays_date }}/driveway_snapshot3_{{ timestamp }}.jpg response_variable: generated_content action: google_generative_ai_conversation.generate_content - condition: template value_template: "{{ 'No Obvious Motion Detected' not in generated_content.text }}" - data: dismissable: true timeout: 30000 title: Driveway Motion content: type: vertical-stack style: margin: 0 auto cards: - type: horizontal-stack cards: - type: picture image: >- /local/{{ todays_date }}/driveway_snapshot1_{{ timestamp }}.jpg style: width: 400px height: auto border-radius: 10px - type: markdown content: | {{ generated_content.text }} card_mod: style: | ha-card { background-color: #650000 !important; color: white !important; padding: 10px; border-radius: 5px; max-width: 780px; margin: 0 auto; word-wrap: break-word; } ha-markdown.no-header { padding-top: 16px; text-align: center; } action: browser_mod.popup - data: message: "{{ timestamp }}: {{ generated_content.text }}" title: Driveway Motion data: url: /lovelace/dwcamera actions: - action: open_cameras title: Live Camera Feed icon: sfsymbols:video uri: /lovelace/dwcamera attachment: content-type: jpeg url: /local/{{ todays_date }}/driveway_snapshot1_{{ timestamp }}.jpg push: sound: name: default critical: > {% set hour = now().hour %} {% if 'person' in generated_content.text | lower and (hour >= 22 or hour < 5) %} 1 {% else %} 0 {% endif %} volume: 1 action: notify.mobile_app_erics_iphone mode: single description: ""